Re: Pattern Matching Issues

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

 



On 30/01/14 19:27, Behdad Esfahbod wrote:
On 14-01-30 10:14 AM, Tom Hacohen wrote:
Hey,

I have two issues with matching patterns with fontconfig.
1. Something seems wrong with FcFontSort in some cases. I've tried it both
with fc-match and with code.
If I run "fc-match :spacing=100" it finds the default font (doesn't have
spacing=100), however if I run fc-list with the same parameter, I get a
filtered result that doesn't include the default system font.
It seems that fc-match is misbehaving, or am I missing something?

The problem is that in fcfreetype.c, we only set FC_SPACING on the font if
it's not FC_PROPORTIONAL.  Then when matching, if the font pattern doesn't
have FC_SPACING, it is an implicit match.  Ouch!  I think we should fix the
first part.  I'm sure there was a reason for it (broken fonts, etc?).  But I
think we should fix it now.  Here's the relevant part of fcfreetype.c:

     if (spacing != FC_PROPORTIONAL)
         if (!FcPatternAddInteger (pat, FC_SPACING, spacing))
             goto bail2;


Thanks, so for now I'll also check font is not proportional in my matching, I guess that will help.

2. Both FcFontSort and FcFontList don't work for me with "ftface" as a
filtering parameter.
Testing:
Use either of the attached c programs (modified versions of fc-match and
fc-list) and try running them. I hard-coded a font path there (which correctly
loads, I verified that), you might need to change that to a different path
depending on your system (Arch here).
compile with:
gcc fc-list.c `pkg-config --cflags --libs fontconfig freetype2` list

I would expect it to filter according to the FT_Face, but it doesn't, any ideas?

If that's not what it's meant to do, what's the best way to load a list of
"most similar to ftface" fonts available on the system? Do I have no analyse
the face and create the pattern on my own?

Nah, that's not how it works.  As Raimund suggested, try querying the font and
using that for matching.  Curious why you need this though.


I will do that, thanks.

As you may remember, I work on the efl (enlightenment.org). We have support for using fonts straight off the filesystem (i.e a filename), or a font in memory, embedded in our theme files. I'd like to be able to query the system for similar fonts in order to find the most suitable fonts for font fallback in case those font files are missing characters.

I would be happy to know if you have any better idea for implementing that.

Thanks,
Tom.

_______________________________________________
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