different font sets for nearly identical code paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear fontconfig devs,

I have encountered an issue that results in me getting two different
font sets for two only slightly different code paths, please see the
attached example.

In the first code path, I first create an unsorted font set by
FcFontList() and sort it in the second step by FcFontSetSort(). In the
second code path, I create a somehow sorted font set by FcFontSort()
and sort it in the second step by FcFontSetSort(), too. The results of
the re-ordering of the font sets by FcFontSetSort() are different in
both cases, though:

$ gcc fc-wtf.c `pkg-config --cflags fontconfig` `pkg-config --libs fontconfig` -o fc-wtf
$ ./fc-wtf 
0: p052003l.pfb	p052003l.pfb
1: uplr8a.pfb	uplr8a.pfb
2: p052004l.pfb	p052004l.pfb
3: uplb8a.pfb	uplb8a.pfb
4: uplri8a.pfb	p052023l.pfb
5: p052023l.pfb	uplri8a.pfb
6: p052024l.pfb	p052024l.pfb
7: uplbi8a.pfb	uplbi8a.pfb
8: qplr.pfb	qplr.pfb
9: qplb.pfb	qplb.pfb

Please note how the fonts in the font set differ in the 4th position.
Could you please explain this difference to me?

Thank you very much,

Fabian
#include <stdio.h>
#include <fontconfig/fontconfig.h>

int main (void)
{
    FcFontSet *fontset1, *fontset1s, *fontset2, *fontset2s;
    FcPattern *pattern;
    FcResult result;
    int i;

    pattern = FcNameParse((const FcChar8*)":outline=true");
    // unsorted set of outline fonts
    fontset1 = FcFontList(NULL, pattern, NULL);
    // sorted (by what?) set of outline fonts
    FcConfigSubstitute(NULL, pattern, FcMatchPattern);
    FcDefaultSubstitute(pattern);
    fontset2 = FcFontSort(NULL, pattern, FcFalse, NULL, &result);
    FcPatternDestroy(pattern);

    pattern = FcNameParse((const FcChar8*)"URW Palladio L");
    FcConfigSubstitute(NULL, pattern, FcMatchPattern);
    FcDefaultSubstitute(pattern);
    // sort unsorted set of outline fonts matching "URW Palladio L"
    fontset1s = FcFontSetSort(NULL, &fontset1, 1, pattern, FcFalse, NULL, &result);
    // sort already sorted set of outline fonts matching "URW Palladio L"
    fontset2s = FcFontSetSort(NULL, &fontset2, 1, pattern, FcFalse, NULL, &result);
    FcPatternDestroy(pattern);

    for (i = 0; i < fontset1s->nfont && i < fontset2s->nfont && i < 10; i++)
    {
        FcPattern *f1, *f2;

        f1 = fontset1s->fonts[i];
        f2 = fontset2s->fonts[i];

        printf("%d: %s\t%s\n", i, 
          FcStrBasename(FcPatternFormat(f1, (const FcChar8 *)"%{file}")),
          FcStrBasename(FcPatternFormat(f2, (const FcChar8 *)"%{file}")));

        FcPatternDestroy(f1);
        FcPatternDestroy(f2);
    }

    return 0;
}

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux