<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Postscript name matching issues"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107242">107242</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Postscript name matching issues
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>fontconfig
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>fontconfig-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>freedesktop@behdad.org
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>freedesktop@behdad.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Dominik and I are looking at postscriptname matching in Chrome, and I found a
couple issues with it.

1. The code seems to want to ignore space and dash as delimiters:

""static double 
FcComparePostScript (const FcValue *v1, const FcValue *v2, FcValue *bestValue) 

    const FcChar8 *v1_string = FcValueString (v1); 
    const FcChar8 *v2_string = FcValueString (v2); 
    int n; 
    size_t len; 

    *bestValue = FcValueCanonicalize (v2); 

    if (FcToLower (*v1_string) != FcToLower (*v2_string) && 
↦       *v1_string != ' ' && *v2_string != ' ') 
↦       return 1.0; 

    n = FcStrMatchIgnoreCaseAndDelims (v1_string, v2_string, (const FcChar8 *)"
-"); 
    len = strlen ((const char *)v1_string); 

    return (double)(len - n) / (double)len; 

""

But in actual testing I don't see dash ignored.  NOT ignoring dash is actually
correct and desired behavior.  I just don't understand why it's not ignored by
the code currently.

Inside FcStrCaseWalkerNext(), delims are not checked when fulfilling request
from w->read:

""
static FcChar8 
FcStrCaseWalkerNext (FcCaseWalker *w, const char *delims) 

    FcChar8↦    r; 

    if (w->read) 
    { 
↦       if ((r = *w->read++)) 
↦           return r; 
↦       w->read = 0; 
    } 
    do 
    { 
↦       r = *w->src++; 
    } while (r != 0 && delims && strchr (delims, r)); 

    if ((r & 0xc0) == 0xc0) 
↦       return FcStrCaseWalkerLong (w, r); 
    if ('A' <= r && r <= 'Z') 
        r = r - 'A' + 'a'; 
    return r; 

""

Ie, "if ((r = *w->read++))" needs to also check delims...</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>