[Fontconfig-bugs] [Bug 107242] New: Postscript name matching issues

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jul 16 10:21:00 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=107242

            Bug ID: 107242
           Summary: Postscript name matching issues
           Product: fontconfig
           Version: unspecified
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: library
          Assignee: fontconfig-bugs at lists.freedesktop.org
          Reporter: freedesktop at behdad.org
        QA Contact: freedesktop at behdad.org

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...

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fontconfig-bugs/attachments/20180716/0411c35a/attachment.html>


More information about the Fontconfig-bugs mailing list