[Fontconfig] Re: fontconfig support to exclude glyphs from fonts

Jay Hobson Jay.Hobson at Sun.COM
Wed Jun 28 16:15:52 PDT 2006


Keith,

    I have been working with Nicolas Mailhot to provide a solution to 
allow DejaVu to be added to fontconfig enabling support for some 
languages while excluding support for others. I have attached a patch 
which works with fontconfig-2.3.95.

    The patch adds two new tags to supported XML tag list. The tags work 
in conjuction with other tags already present in the library. The tags 
require fonts.conf or its included counterparts to be amended, detailing 
languages to restrict in specified families. The first added tag "hide" 
documents which languages are restricted from use for the family. The 
second tag "only" documents which languages the family is allowed to 
support.

    The patch works by copying the pattern out of the cache, then 
modifying the local copy of the pattern to remove either a list of 
languages to be hidden, or deleting the language set, creating a new one 
and adding only the supported languages. This new pattern is then used 
for comparison for a match, after which point it is deleted. This patch 
only affects the comparison for families within an alias. If the user 
requests a specific family by name, no modification of the language set 
will occur. Additionally, as some families may be used in more than one 
alias and need differing support for each, the alias name is required, 
and modifications to the language set needs to be dynamic.

    The key benefits for this patch are the ability to use fonts that 
are works in progress, broken, or have poor quality glyphs for 
particular languages. This patch can also be used to allow fonts to be 
placed higher in the alias list with support for only targeted languages 
without interfering with fonts intended for other language support.


    Syntax for the new commands is shown in the following example:

<alias>
    <family>Sans-serif</family>
    <only>
          <family>Arial</family>
          <lang>en</lang>
          <lang>de</lang>
    </only>
    <hide>
          <family>DejaVuSans</family>
          <lang>ar</lang>
     </hide>
</alias>
<alias>
    <family>Serif</family>
    <hide>
          <family>Times</family>
          <lang>en</lang>
          <lang>de</lang>
          <lang>es</lang>
    </hide>
</alias>

    The above XML would only allow Arial to be used for English and 
German, disallow DejaVu for Arabic, and disallow Times with English, 
German and Spanish.

    I am interested in your comments/questions and willing to work with 
you to make this a part of the fontconfig library.

Thanks,

Jay
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fontconfig-2.3.95.hide.patch
Type: text/x-patch
Size: 22916 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20060628/05724042/fontconfig-2.3.95.hide.bin


More information about the Fontconfig mailing list