[Gambas-user] Fonts: different answers from libraries

BB adamnt42 at gmail.com
Wed Oct 18 12:29:30 CEST 2023


On 18/10/23 7:45 pm, Gianluigi wrote:
> Il 18/10/23 06:50, BB ha scritto:
>>
>> On 18/10/23 1:51 pm, T Lee Davidson wrote:
>>> On 10/17/23 23:16, T Lee Davidson wrote:
>>>> On 10/17/23 16:27, Gianluigi wrote:
>>>>> The font is installed but I get information only with the GTK libraries. 
>>>>>
>>>>> Anyone know the reason?
>>>>> Code(*)
>>>>> System(**)
>>>>>
>>>>> Regards
>>>>> Gianluigi
>>>>>
>>>>> (*)
>>>>> Public Sub Form_Open()
>>>>>
>>>>>    If Fonts.Exist("D050000L") Then
>>>>>      Message.Info("The D050000L font is installed")
>>>>>    Else
>>>>>      Message.Warning("You have to install the D050000L font")
>>>>>    Endif
>>>>>    Me.Close
>>>>>
>>>>> End
>>>>>
>>>>> (**)
>>>>> [System]
>>>>> Gambas=3.18.90 d26f534 (master)
>>>>
>>>> I do not know the reason, but I can confirm that the list of fonts 
>>>> enumerated by Fonts is indeed different when using GTK3 versus Qt5; 
>>>> not only in number (141 versus 285, respectively) but also in name.
>>>
>>> I probably should have mentioned:
>>> 1) `fc-list : family` on the command-line yields 237, and
>>> 2) this is with v3.18.4 (stable)
>>>
>> In short, I believe the answer lies in how these three things "know" 
>> about fonts. QT5 has it's own internal list of what it thinks are 
>> names of installed fonts. fc (and fc-list) uses fontconfig files 
>> installed here there and everywhere by font packages and whatever GTK 
>> does it's probably a different way to the above. An important thing 
>> to know is that these three all have different ways of coming up with 
>> a font "name". I don't know for sure but Gialuigi's could be related 
>> to the fact that here D050000L is called "D050000L [URW]".
>>
>> b
>>
>> p.s. I guess that no matter how hard you try to be desktop agnostic, 
>> 4th parties (i.e. font providers) can stuff you up.
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
> Hi guys,
>
> thank you very much for your help.
> I found this page: https://www.kdab.com/the-qt-less-traveled/ it seems 
> like a qt bug.
> With this code I saw how QT (and GTK) call the font:
>
> Public Sub Form_Open()
>
>   Dim fontName As String
>
>   Print "QT"
>   Print "==================="
>   For Each fontName In Fonts
>     Print fontName
>   Next
>
> End
>
> And this code seems to solve:
>
> Public Sub Form_Open()
>
>   If Fonts.Exist("D050000L") Or If Fonts.Exist("D050000L [urw]") Or If 
> Fonts.Exist("D050000L [URW ]") Then
>     Message.Info("The D050000L font is installed")
>   Else
>     Message.Warning("You have to install the D050000L font")
>   Endif
>   Me.Close
>
> End
>
>
> Many thanks again, regards
> Gianluigi
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----


I guess the takeaway message here is that maybe Font.Exist() may need a 
bit of a relook. How does it look for a font name? Back to Benoit for an 
answer.



More information about the User mailing list