Re: Determining the presence of a font / font fallback

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

 



On Wed, April 29, 2015 15:03, Urs Liska wrote:
> [...]
>
> So this function returns true if the family name in the matched font
> file is the same as the family name used for starting the match.
> This works most of the time (apart from the fact that it's now case
> sensitive, but we'd look into that separately). But there are reports of

You can use FcStrCmpIgnoreCase(3) for case insensitive comparison.
Actually FC_FAMILY and FC_POSTSCRIPT_NAME are internally compared with
FcStrCmpIgnoreCaseAndDelims, but unfortunately that API is not public.

> *some* fonts where the returned family is different from the actual one.
> http://lists.gnu.org/archive/html/lilypond-user/2015-04/msg01300.html
> reports that the file name returned for fonts Umpush and Kedage are
> wrong. I verified this in my own installation: The family name returned
> by the above function for Umpush is "Tlwg Typo", although FontViewer and
> FontForge both confirm that the family name is "Umpush".

According to "fc-list '' file family|egrep Tlwg\|Umpush" on my box, Tlwg
Typo is a different font, so this result just means that your FcFontMatch
call was running with a configuration that mapped your particular request
to it as fallback (which, if unexpected, would need to be examined
separately). If you want to exclude fallbacks from your result, you would
be right to not return it.

> Or otherwise I'd like to know about a way to have fontconfig return some
> "failure condition" instead of a replacement if a font isn't matched.

The problem with this is that fontconfig has only a fuzzy concept of
equality. Most people would think of font equality as "family name
equality". If that's what you want, just compare FC_FAMILY and/or
FC_POSTSCRIPT_NAME. If your requirement is different, then it starts
getting complicated, i. e. what threshold for fontconfig's match vector
should be chosen? A workable solution to keep aliased matches could be
Behdad's suggestion from the above thread (match "SomeFamilyName,sans" and
"SomeFamilyName,serif" and check those for equality, which should work
because even the most restrictive fontconfig setups should return
different fallbacks for sans and serif).


Raimund

-- 
Worringer Str 31 Duesseldorf 40211 DE  home: <rs@xxxxxxxx>
+49-179-2981632 icq 16845346           work: <rs@xxxxxxxxxxxxxxx>

_______________________________________________
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