Cyker Way
2011-Sep-04 08:16 UTC
[Fontconfig] What metric does fontconfig use to select a font
I just got messed up with so many <prefer>s and <accept>s. And it seems the first font in the list after all <prefer>/<accept>/<default> have been applied needn''t have to be the finally selected one. If the order in the list doesn''t count, why make that list? And how does the strong/weak binding affects the selection? What''s the logic of this font-choosing algorithm? And what should I do to make sure one specific font will certainly be chosen when executing, say, ''fc-match sans''? I''ve read the man page but still didn''t quite understand it. Thanks. -- Cyker Way E-mail: cykerway at gmail.com http://www.cykerway.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20110904/c0d28a3d/attachment.html>
Raimund Steger
2011-Sep-05 09:47 UTC
[Fontconfig] What metric does fontconfig use to select a font
Hi,> And what should I do to make sure one specific font will certainly be > chosen > when executing, say, ''fc-match sans''?maybe something like the following example in ~/.fonts.conf could work: <match target="pattern"> <test name="family" qual="all"><string>sans-serif</string></test> <edit mode="assign_replace" name="family"> <string>Helvetica</string> </edit> <edit mode="assign_replace" name="foundry"> <string>Adobe</string> </edit> </match> But I''m not sure if this is a good idea, since the font you choose might only be suitable for a limited range of character sets. Maybe that could be sorted out by adding additional "lang" tests... Raimund -- R.Steger Tel. +49-179-2981632 icq 16845346
Cyker Way
2011-Sep-05 10:29 UTC
[Fontconfig] What metric does fontconfig use to select a font
Hmm, it seems ~/.fonts.conf will be the first processed configurations. So this solution should work. Thanks. BTW, how does fontconfig sort the precedence of fonts according to the application request? If this question is not fully answered, maybe other problems will arise in the future. Do you have any idea on that? 2011/9/5 Raimund Steger <rs at mytum.de>> Hi, > > > And what should I do to make sure one specific font will certainly be > > chosen > > when executing, say, ''fc-match sans''? > > maybe something like the following example in ~/.fonts.conf could work: > > <match target="pattern"> > <test name="family" qual="all"><string>sans-serif</string></test> > <edit mode="assign_replace" name="family"> > <string>Helvetica</string> > </edit> > <edit mode="assign_replace" name="foundry"> > <string>Adobe</string> > </edit> > </match> > > But I''m not sure if this is a good idea, since the font you choose might > only be suitable for a limited range of character sets. Maybe that could > be sorted out by adding additional "lang" tests... > > Raimund > > > > -- > R.Steger Tel. +49-179-2981632 icq 16845346 > >-- Cyker Way E-mail: cykerway at gmail.com http://www.cykerway.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20110905/a31e2527/attachment.htm>
Akira TAGOH
2011-Sep-05 10:58 UTC
[Fontconfig] What metric does fontconfig use to select a font
That depends on what kind of the fontconfig configuration files you have. you may get more information from the debugging log by setting the env var like FC_DEBUG=4. On Mon, Sep 5, 2011 at 7:29 PM, Cyker Way <cykerway at gmail.com> wrote:> Hmm, it seems ~/.fonts.conf will be the first processed configurations. So > this solution should work. Thanks. > > BTW, how does fontconfig sort the precedence of fonts according to the > application request? If this question is not fully answered, maybe other > problems will arise in the future. Do you have any idea on that? > > > 2011/9/5 Raimund Steger <rs at mytum.de> > >> Hi, >> >> > And what should I do to make sure one specific font will certainly be >> > chosen >> > when executing, say, ''fc-match sans''? >> >> maybe something like the following example in ~/.fonts.conf could work: >> >> <match target="pattern"> >> <test name="family" qual="all"><string>sans-serif</string></test> >> <edit mode="assign_replace" name="family"> >> <string>Helvetica</string> >> </edit> >> <edit mode="assign_replace" name="foundry"> >> <string>Adobe</string> >> </edit> >> </match> >> >> But I''m not sure if this is a good idea, since the font you choose might >> only be suitable for a limited range of character sets. Maybe that could >> be sorted out by adding additional "lang" tests... >> >> Raimund >> >> >> >> -- >> R.Steger Tel. +49-179-2981632 icq 16845346 >> >> > > > -- > > > > Cyker Way > E-mail: cykerway at gmail.com > http://www.cykerway.com > > _______________________________________________ > Fontconfig mailing list > Fontconfig at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/fontconfig > >-- Akira TAGOH -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20110905/24c1ac7f/attachment.htm>
Raimund Steger
2011-Sep-05 18:24 UTC
[Fontconfig] What metric does fontconfig use to select a font
Hi,> On Mon, Sep 5, 2011 at 7:29 PM, Cyker Way <cykerway at gmail.com> wrote: > [...] >> BTW, how does fontconfig sort the precedence of fonts according to the >> application request? If this question is not fully answered, maybe other >> problems will arise in the future. Do you have any idea on that?You could say that the "order" of the fonts is that of their distance from the application-provided pattern. It is detailed on http://www.freedesktop.org/software/fontconfig/fontconfig-user.html#AEN25 In short: Your application specifies a pattern with a number of properties, like family, pixelsize, etc. (Example: "Bitstream Vera Sans:pixelsize=13") This pattern is modified through the <match target="pattern"> rules in your config files. (Every element in the pattern can in fact be a list ordered from good candidate to not-so-good candidate.) The modified pattern is then compared to all fonts that have been scanned, using a predefined order of properties -- see the above link. Properties like foundry and family weigh more than say, outline. Others like file or fontformat are not used at all, so you cannot select a font based on its filename. It should also be noted that some applications have their own fallback scheme on top of what fontconfig provides, e. g. based on CSS.> [...] > you may get more information from the debugging log by setting the env var > like FC_DEBUG=4.This is also a very good idea (be prepared for some output). Raimund -- R.Steger Tel. +49-179-2981632 icq 16845346
Suresh P
2011-Sep-06 13:58 UTC
[Fontconfig] What metric does fontconfig use to select a font
"Raimund Steger" <rs at mytum.de> writes:> Hi, > >> And what should I do to make sure one specific font will certainly be >> chosen >> when executing, say, ''fc-match sans''? > > maybe something like the following example in ~/.fonts.conf could work: > > <match target="pattern"> > <test name="family" qual="all"><string>sans-serif</string></test> > <edit mode="assign_replace" name="family"> > <string>Helvetica</string> > </edit> > <edit mode="assign_replace" name="foundry"> > <string>Adobe</string> > </edit> > </match> > > But I''m not sure if this is a good idea, since the font you choose might > only be suitable for a limited range of character sets. Maybe that could > be sorted out by adding additional "lang" tests...I have made a GUI Fontik(https://gitorious.org/fontik) which can perform some of these tasks.Have a try. thanks -suresh> > Raimund