Re: Matching font by unicode coverage

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

 



Thanks David,

Comments below.

On 15-01-19 12:36 PM, David Lattimore wrote:
> Matching with an FC_CHARSET works for me. No idea if what I'm doing is right,
> but roughly what I do is:
> - Identify script for each character
> (using http://unicode.org/Public/UNIDATA/Scripts.txt)
> - Split runs based on script (so that no run has two different scripts)
> - Build an FC_CHARSET for the run.
> - Match and use the resulting font.

While this works, it will be extremely slow, and results in ransom-note
effects whereas eg adding a diacritic mark to a run will change the font for
the entire run.

What most clients of Fontconfig do instead is to call FcFontSort() for all
desired properties but NOT FC_CHARSET, and then walk down the returned list of
font and pick the first font that supports each desired character.

Does that make sense?

behdad

> So if a font didn't define all the characters in a script, I might still get
> some missing glyphs. But it seems to work reasonably well. If I wanted to make
> sure all characters had glyphs, I could probably so a second round of
> splitting where adjacent characters for which no glyphs was found were broken
> off into a separate text run and rematched. So far I haven't bothered.
> 
> Hope that helps.
> 
> On 19 January 2015 at 22:51, Sam Varshavchik <mrsam@xxxxxxxxxxxxxxx
> <mailto:mrsam@xxxxxxxxxxxxxxx>> wrote:
> 
>     Akira TAGOH writes:
> 
>         That way is what Pango do to figure out the glyph coverage in fonts.
>         they convert the result into their own structure so that it's not that
>         easy to find out a font that have the certain coverage in fontconfig only.
> 
> 
>     You mean match by FC_CHARSET? That was the first part of what I'm trying
>     to figure out, whether creating an FcCharset containing the unicode
>     characters in the text, and then trying to match a font using it, will work.
> 
> 
>         On Mon, Jan 19, 2015 at 12:51 PM, Sam Varshavchik
>         <<URL:mailto:mrsam@courier-__mta.com
>         <mailto:mrsam@xxxxxxxxxxxxxxx>>mrsam@xxxxxxxxxxxxxxx
>         <mailto:mrsam@xxxxxxxxxxxxxxx>> wrote:
> 
>            I'm learning the fontconfig API, and I'm trying to figure out how to do
>            the following.
> 
>            I have arbitrary Unicode text, and I would like to match a
>         reasonable font
>            to use for displaying it. It's possible that I might need more than one
>            font if, say, the text is a mixture of Latin characters and Asian
>            ideographs.
> 
>            I see that FC_CHARSET is an option to FcPattern. Does this sound
>         like I'm
>            on the right track:
> 
>            A) Construct an FcCharset and add all unicode characters in the text to
>            display
> 
>            B) Add it as a FC_CHARSET value to an FcPattern.
> 
>            C) Use FcFontList() to search for the matching font.
> 
>            The developer reference contains the following statement:
>         "Fontconfig uses
>            some of these properties for font matching and font completion.
>         Others are
>            provided as a convenience for the application's rendering mechanism."
> 
>            So, I guess I'm trying to clarify whether I can use the FC_CHARSET
>            property to search for fonts that have coverage for my unicode
>         text, or if
>            this a non-searchable property, only.
> 
> 
> 
>     _______________________________________________
>     Fontconfig mailing list
>     Fontconfig@xxxxxxxxxxxxxxxxxxxxx <mailto:Fontconfig@xxxxxxxxxxxxxxxxxxxxx>
>     http://lists.freedesktop.org/mailman/listinfo/fontconfig
> 
> 
> 
> 
> _______________________________________________
> Fontconfig mailing list
> Fontconfig@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/fontconfig
> 

-- 
behdad
http://behdad.org/
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://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