[Fontconfig] Difficulty finding a font file through the libraries
Michael Brennen
michael at fishnet.us
Sun Nov 7 22:46:42 UTC 2021
> On Nov 7, 2021, at 01:22, Lawrence D'Oliveiro <ldo at geek-central.gen.nz> wrote:
>
> On Sun, 7 Nov 2021 01:41:16 -0500, Michael Brennen wrote:
>
>> The FC routine called from gs to get the weight is this:
>>
>> result = FcPatternGetInteger (font, FC_WEIGHT, 0, &weight_fc);
>>
>> My debug messages, slightly modified from the gs debug messages:
>>
>> FC_WEIGHT failed to match on Bahnschrift (and Skia)
>> FC_WEIGHT failed to match on 32764
>>
>> weight_fc is an int where the result is stored; that is what is
>> showing 32764 upon return.
>
> That is probably just a rubbish uninitialized value. The function is
> probably returning FcResultNoMatch because there is no such entry in
> the pattern.
>
> Which is odd, because looking further back at the
> gp_enumerate_fonts_init() routine in base/gp_unix.c, it is specifically
> asking for a set of info that includes the weight, from the fonts
> matching a specified pattern.
>
> Maybe worth trying to dump out the full set of patterns returned, to
> see what is in there?
I have not done that yet, only set up a debug loop in gp_enumerate_fonts_init.c to print the names of the fonts to see what was included.
BTW to do printf() I had to comment this in base/gsio.h:
/*
#undef printf
#define printf Function._printf_.unavailable
*/
>> I quickly become tangled in FC’s fc_pat.c, which is where most of
>> this seems to happen. I am not sure what an ELT is (element?) is; I
>> found where it is retrieved by indexing into some data structure, but
>> I don’t know what that is.
>
> Seems properties can be multivalued, so you also pass an “id” (actually
> an index) to indicate which value element you want. I normally pass 0.
> ;)
It looks like the FcPatternGetInteger() does pass a 0, or perhaps I am misreading it. Without really understanding what I was seeing in the FC routines, because I have not studied the FC data structures, it seemed odd that such an anomalous value was returned.
>> variable: False(s)
>
> Is this the same Bahnschrift that I found here
> <https://freefontsfamily.com/bahnschrift-font-free-download/>? That
> archive has 15 different TTF files in it, and some of them report True
> for this property.
I don’t know what the variable false or true means in a font. I’ve never had occasion to look into font internals.
The file BAHNSCHRIFT.TTF in that archive has the same md5 sum as the bahnschrift.ttf file on the server I am working on. Within some miniscule margin of error, they are the same. :)
More information about the Fontconfig
mailing list