Re: How to identify all the fonts an application specifies?

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

 



On Sun, 27 Mar 2016 19:18:56 -0400
Kynn Jones <kynnjo@xxxxxxxxx> wrote:
> [...]
> I imagine that, given some hypothetical application `Foo`, for each
> font that `Foo` wants to use, there is some interaction with
> `fontconfig` in which `Foo`'s original specification for a font gets
> resolved into a concrete font that is actually available in the
> current system.

Yes, the application constructs a pattern (FcPattern) but before it's compared to the fonts in the cache it's modified with FcConfigSubstitute and FcDefaultSubstitute.

* FcConfigSubstitute(3) goes through all config files and evaluates all target=pattern rules for the pattern.

* FcDefaultSubstitute(3) sets default values for some properties that are empty after config substitution.

The moment your user config steps in, all rules in config files earlier than 50* will already have been evaluated; so what you're getting at that point is not entirely the same that the application put in the pattern.

> 
> Assuming this picture is more or less correct, I'm looking for a
> convenient way to get a listing of all the font specifications that
> `Foo` "submits" to `fontconfig` for resolution.

Use FC_DEBUG=4 and an awk start/stop pattern:

E. g. with Firefox:

FC_DEBUG=4 firefox -no-remote | \                                               
awk '/^FcConfigSubstitute Pattern/,/^$/{pat=pat "\n" $0}
     /^FcConfigSubstitute test pattern/{if(pat) print pat}
     /^FcConfigSubstitute test/{pat=""}'


The reason why this awk drops all patterns unless /^FcConfigSubstitute test pattern/ is that FcConfigSubstitute is called twice: Once by the application (as mentioned above) and once by FcFontMatch to apply all target=font patterns to the best match. This assumes that your config has at least one test.

If you want to debug the patterns *and* the best matches, the awk becomes easier for that reason:

FC_DEBUG=4 firefox -no-remote | awk '/^FcConfigSubstitute Pattern/,/^$/{print $0}'


Raimund


-- 
Worringer Str 31 Duesseldorf 40211 DE  home: rs@xxxxxxxx
+49-179-2981632 icq 16845346           work: rs@xxxxxxxxxxxxxxx
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
https://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