Hi list, only as example to figure out how fontconfig''s <alias><family>...</family><default>...</default></alias> works, I put myself into following situation: I have installed (on changeroot) Droid fonts, Liberation fonts and STIXGeneral fonts, no other fonts. I emptyed all configuration, but I added: <alias binding="same"> <family>myserif</family> <accept> <family>DejaVu Serif</family> <family>STIXGeneral</family> <family>Droid Serif</family> <family>Liberation Serif</family> </accept> </alias> <alias binding="same"> <family>Droid Serif</family> <default><family>myserif</family></default> </alias> <alias binding="same"> <family>DejaVu Serif</family> <default><family>myserif</family></default> </alias> <alias binding="same"> <family>Liberation Serif</family> <default><family>myserif</family></default> </alias> <alias binding="same"> <family>STIXGeneral</family> <default><family>myserif</family></default> </alias> I wanted to have all Serif fonts grouped together in myserif and whenever any of them that is not installed (DejaVu Serif in this case) is requested, fc-match would return first available from <accept></accept> block of myserif alias. (I wanted to somewhat simplify the situation in 30-metric-aliases.conf.) But it seems that I either misunderstand <default></default> purpose or I do other thing wrong: fc-match "myserif" returns STIXGeneral as expected, but fc-match "DejaVu Serif" returns LiberationMono-Regular.ttf: "Liberation Mono" "Regular" What I am missing? What''s the exact meaning of <default> alias? Any help is appreciated! Petr -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20120222/b3875f2f/attachment.pgp>
# I forgot to Cc''ing the list. resending.... Hi, Once building the pattern list for lookup, it won''t be re-evaluated for matching. thus, what you need to do for what you want to do is to add the fallback fonts as you did for "myserif". it''s the same logic to how fontconfig deals with the virtual family names like sans-serif, serif, monospace and so on. On Wed, Feb 22, 2012 at 11:46 PM, Petr Gajdos <pgajdos at suse.cz> wrote:> Hi list, > > only as example to figure out how fontconfig''s > <alias><family>...</family><default>...</default></alias> > works, I put myself into following situation: > > I have installed (on changeroot) Droid fonts, Liberation > fonts and STIXGeneral fonts, no other fonts. > > I emptyed all configuration, but I added: > ? ? ? <alias binding="same"> > ? ? ? ? ? ? ? ?<family>myserif</family> > ? ? ? ? ? ? ? ?<accept> > ? ? ? ? ? ? ? ? ? ? ? ?<family>DejaVu Serif</family> > ? ? ? ? ? ? ? ? ? ? ? ?<family>STIXGeneral</family> > ? ? ? ? ? ? ? ? ? ? ? ?<family>Droid Serif</family> > ? ? ? ? ? ? ? ? ? ? ? ?<family>Liberation Serif</family> > ? ? ? ? ? ? ? ?</accept> > ? ? ? ?</alias> > > ? ? ? ?<alias binding="same"> > ? ? ? ? ? ? ? ?<family>Droid Serif</family> > ? ? ? ? ? ? ? ?<default><family>myserif</family></default> > ? ? ? ?</alias> > > ? ? ? ?<alias binding="same"> > ? ? ? ? ? ? ? ?<family>DejaVu Serif</family> > ? ? ? ? ? ? ? ?<default><family>myserif</family></default> > ? ? ? ?</alias> > > ? ? ? ?<alias binding="same"> > ? ? ? ? ? ? ? ?<family>Liberation Serif</family> > ? ? ? ? ? ? ? ?<default><family>myserif</family></default> > ? ? ? ?</alias> > > ? ? ? ?<alias binding="same"> > ? ? ? ? ? ? ? ?<family>STIXGeneral</family> > ? ? ? ? ? ? ? ?<default><family>myserif</family></default> > ? ? ? ?</alias> > > I wanted to have all Serif fonts grouped together in myserif and > whenever any of them that is not installed (DejaVu Serif in this case) > is requested, fc-match would return first available from > <accept></accept> block of myserif alias. (I wanted to somewhat > simplify the situation in 30-metric-aliases.conf.) > > But it seems that I either misunderstand <default></default> purpose > or I do other thing wrong: fc-match "myserif" returns STIXGeneral as > expected, but ?fc-match "DejaVu Serif" returns > > LiberationMono-Regular.ttf: "Liberation Mono" "Regular" > > > What I am missing? What''s the exact meaning of <default> alias? > > Any help is appreciated! > Petr > > > _______________________________________________ > Fontconfig mailing list > Fontconfig at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/fontconfig >-- Akira TAGOH
On Thu, Feb 23, 2012 at 01:13:42PM +0900, Akira TAGOH wrote:> # I forgot to Cc''ing the list. resending.... > > Hi, > > Once building the pattern list for lookup, it won''t be re-evaluated > for matching. thus, what you need to do for what you want to do is to > add the fallback fonts as you did for "myserif". it''s the same logicYou mean <accept></accept> block for every font in the group? I am searching for more scalable solution and, mainly, for <default></default> usage :-) (is there any other?). Nevertheless, I have probably found it: I didn''t preserve sequence of <alias><family></family><accept></accept></alias> and <alias><family></family><default></default></alias> from 30-metric-aliases.conf -- I haven''t consider it important until now (I have no idea why it matters, I don''t know internals of fontconfig). <alias binding="same"> <family>Droid Serif</family> <family>DejaVu Serif</family> <family>Liberation Serif</family> <family>STIXGeneral</family> <default><family>myserif</family></default> </alias> <alias binding="same"> <family>myserif</family> <accept> <family>DejaVu Serif</family> <family>STIXGeneral</family> <family>Droid Serif</family> <family>Liberation Serif</family> </accept> </alias> works as I expect. I. e. laura:/> fc-list | grep "DejaVu Serif" laura:/> fc-match "DejaVu Serif" STIXGeneral.otf: "STIXGeneral" "Regular" Note that, for <default> alias, it make sense to have more <family> tags in. Petr> > ? ? ? <alias binding="same"> > > ? ? ? ? ? ? ? ?<family>myserif</family> > > ? ? ? ? ? ? ? ?<accept> > > ? ? ? ? ? ? ? ? ? ? ? ?<family>DejaVu Serif</family> > > ? ? ? ? ? ? ? ? ? ? ? ?<family>STIXGeneral</family> > > ? ? ? ? ? ? ? ? ? ? ? ?<family>Droid Serif</family> > > ? ? ? ? ? ? ? ? ? ? ? ?<family>Liberation Serif</family> > > ? ? ? ? ? ? ? ?</accept> > > ? ? ? ?</alias> > > > > ? ? ? ?<alias binding="same"> > > ? ? ? ? ? ? ? ?<family>Droid Serif</family> > > ? ? ? ? ? ? ? ?<default><family>myserif</family></default> > > ? ? ? ?</alias> > > > > ? ? ? ?<alias binding="same"> > > ? ? ? ? ? ? ? ?<family>DejaVu Serif</family> > > ? ? ? ? ? ? ? ?<default><family>myserif</family></default> > > ? ? ? ?</alias> > > > > ? ? ? ?<alias binding="same"> > > ? ? ? ? ? ? ? ?<family>Liberation Serif</family> > > ? ? ? ? ? ? ? ?<default><family>myserif</family></default> > > ? ? ? ?</alias> > > > > ? ? ? ?<alias binding="same"> > > ? ? ? ? ? ? ? ?<family>STIXGeneral</family> > > ? ? ? ? ? ? ? ?<default><family>myserif</family></default> > > ? ? ? ?</alias>-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20120223/34a330b8/attachment.pgp>
Hi, On Thu, Feb 23, 2012 at 11:15:01AM +0100, Petr Gajdos wrote:> have no idea why it matters, I don''t know internals of fontconfig).I have it now ;-).> Note that, for <default> alias, it make sense to have more > <family> tags in.ok, I have read bug 44826 and 33644; result of ---------------8<------------------ <alias binding="same"> <family>Droid Sans</family> <family>DejaVu Sans</family> <family>Liberation Sans</family> <default><family>mysans</family></default> </alias> --------------->8------------------ is (FC_DEBUG=4) ---------------8<------------------ Add Subst match pattern any family Equal "Droid Sans" Comma "DejaVu Sans" Comma "Liberation Sans" edit Edit family AppendLast "mysans"; --------------->8------------------ How can I achieve it by <match><test><edit> (Comma operator)? Thanks for your help, Petr -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20120224/1d2c26b0/attachment.pgp>
On Fri, Feb 24, 2012 at 7:42 PM, Petr Gajdos <pgajdos at suse.cz> wrote:> How can I achieve it by <match><test><edit> (Comma operator)?How the syntactic sugar behaves is documented. read fonts.dtd or the mail archives in this list. it''s the topic sometimes brought up by someone. -- Akira TAGOH