[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to determine if a font is a fallback font?
From: |
Thomas Morley |
Subject: |
Re: How to determine if a font is a fallback font? |
Date: |
Tue, 28 Apr 2015 10:28:31 +0200 |
2015-04-28 10:16 GMT+02:00 Urs Liska <address@hidden>:
>
>
> Am 28.04.2015 um 10:12 schrieb Thomas Morley:
>>
>> 2015-04-28 9:48 GMT+02:00 Urs Liska <address@hidden>:
>>>
>>>
>>> Am 28.04.2015 um 09:38 schrieb Werner LEMBERG:
>>>
>>> Is there a function to retrieve the "font name" from a given file
>>> name? It would be a viable approach if I could compare the result
>>> of that request with the original font name.
>>>
>>> For TTFs and TTCs (either with TrueType outlines or embedded CFFs) you
>>> can use `ly:ttf-ps-name'.
>>>
>>>
>>> Thanks that seems to work perfectly. Try
>>>
>>> \version "2.19.19"
>>>
>>> fontExists =
>>> #(define-void-function (parser location font-name)(string?)
>>> (let* ((font-file (ly:font-config-get-font-file font-name))
>>> (reverse-font-name (ly:ttf-ps-name font-file))
>>> (font-exists (string=? font-name reverse-font-name)))
>>> (ly:message (format "\nGiven font name: ~a" font-name))
>>> (ly:message (format "Determined font file: ~a" font-file))
>>> (ly:message (format "Actual font in that file: ~a"
>>> reverse-font-name))
>>> (ly:message (format "Given font is present: ~a" font-exists))))
>>>
>>> \fontExists "Emmentaler-13"
>>> \fontExists "Fancy-Font"
>>>
>> For me this returns:
>>
>> Given font name: Emmentaler-13
>> Determined font file: /home/harm/.fonts/wds052801.ttf
>> Actual font in that file: WaltDisneyScript
>> Given font is present: #f
>>
>> Given font name: Fancy-Font
>> Determined font file: /home/harm/.fonts/wds052801.ttf
>> Actual font in that file: WaltDisneyScript
>> Given font is present: #f
>
>
> OMG!
>
>>
>> Again, on an outdated Ubuntu.
>
>
> But that shouldn't make a difference. At least we can't accept that it makes
> a difference.
>
> What is the result of ly:ttf-ps-name when you pass it the full path to a
> real emmentaler file (I can't see where they are on your system of course)?
#(display
(ly:font-config-get-font-file
"/home/harm/lilydevel/usr/share/lilypond/current/fonts/otf/emmentaler-13.otf"))
->/home/harm/.fonts/wds052801.ttf
#(display
(ly:ttf-ps-name
(ly:font-config-get-font-file
"/home/harm/lilydevel/usr/share/lilypond/current/fonts/otf/emmentaler-13.otf")))
->WaltDisneyScript
...
- How to determine if a font is a fallback font?, Urs Liska, 2015/04/28
- Re: How to determine if a font is a fallback font?, Werner LEMBERG, 2015/04/28
- Re: How to determine if a font is a fallback font?, Urs Liska, 2015/04/28
- Re: How to determine if a font is a fallback font?, Thomas Morley, 2015/04/28
- Re: How to determine if a font is a fallback font?, Urs Liska, 2015/04/28
- Re: How to determine if a font is a fallback font?,
Thomas Morley <=
- Re: How to determine if a font is a fallback font?, Urs Liska, 2015/04/28
- Re: How to determine if a font is a fallback font?, Werner LEMBERG, 2015/04/28
- Re: How to determine if a font is a fallback font?, Alexander Kobel, 2015/04/28
- Re: How to determine if a font is a fallback font?, Werner LEMBERG, 2015/04/28
- Re: How to determine if a font is a fallback font?, Urs Liska, 2015/04/28
- Re: How to determine if a font is a fallback font?, Alexander Kobel, 2015/04/28
- Re: How to determine if a font is a fallback font?, Alexander Kobel, 2015/04/28
- Re: How to determine if a font is a fallback font?, Urs Liska, 2015/04/28
- Re: How to determine if a font is a fallback font?, Werner LEMBERG, 2015/04/28
- Re: How to determine if a font is a fallback font?, Alexander Kobel, 2015/04/28