Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
bn
- VIP Livecode Opensource Backer
- Posts: 4016
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Post
by bn » Wed Mar 13, 2024 10:40 pm
set the textfont of fld "fFont" to "Quicksand Light"
You can not just set the name of a font except if you are sure there is a font that is named like that. Only the pulldown menu of the Font section of a newly opened Properties Inspector would have the right name.
Sparkout posted a link to a Quality Control Center bug report that mentions that Font handling on Windows by Livecode seems severly limited/broken.
Unfortunately I am of no help here.
Kind regards
Bernd
-
Gary Rathbone
- Posts: 39
- Joined: Mon Apr 19, 2021 8:39 pm
Post
by Gary Rathbone » Thu Mar 14, 2024 3:30 pm
Big thanks to Sparkout for discovering the following...
https://quality.livecode.com/show_bug.cgi?id=21804
It's worth a read. This bug was first reported by Ken Ray in 2019 (only 5 years ago) and still hasn't been fixed.
"Bug 21804 - LC does not allow access to available font weights on Windows like Mac does
...
There is a HUGE problem that I was partially aware of years ago but that now has made me dive in and report on as fully as I can.
The problem stems from how Windows handles fonts and font weights and how that relates to Livecode.
Here's a simple example: I downloaded a licensed copy of Font Awesome 5 Pro to use its icons in LC. Font Awesome 5 Pro has three different "styles" or "weights": Solid, Regular, and Light.
On a Mac, these three are represented as three different font names, so I can assign the textFont of a field to "Font Awesome 5 Pro Solid" or "Font Awesome 5 Pro Light" and it works like one would expect.
On Windows, however, these are grouped together under a single font name "Font Awesome 5 Pro", so (a) trying to set the textFont of a field to "Font Awesome 5 Pro Solid" fails, and (b) you get the "Regular" version with "Font Awesome 5 Pro", and you can get at the "Solid" version by setting the textStyle of the field to "bold", but there's no way to get the "Light" version, meaning that interfaces that use the Light version cannot ever be run cross-platform, forcing a redesign (as it was in my case)." - Ken Ray (2019).
This is exactly the issue that I (and all other Livecode users) face. I'm really surprised this hasn't been raised by more Livecode Developers.
In 2021 Juan "found a workaround" by recompiling the font with a unique name.
I'll go through this process step by step (it may take few posts)...
Last edited by
Gary Rathbone on Thu Mar 14, 2024 4:26 pm, edited 5 times in total.
-
Gary Rathbone
- Posts: 39
- Joined: Mon Apr 19, 2021 8:39 pm
Post
by Gary Rathbone » Thu Mar 14, 2024 3:39 pm
Step 1 of 4
Download a copy of FontForge. It's open source.
https://fontforge.org/en-US/
Make a copy of the Typeface you wish to use, and open it in FontForge.
Select "Font Info" from the "Element Menu
Click on "PSNames" in the left hand panel (it may already be selected). The details about the font name will be displayed.
Last edited by
Gary Rathbone on Thu Mar 14, 2024 4:18 pm, edited 2 times in total.
-
Gary Rathbone
- Posts: 39
- Joined: Mon Apr 19, 2021 8:39 pm
Post
by Gary Rathbone » Thu Mar 14, 2024 3:47 pm
Step 2 of 4
Change the Fontname, Family Name and Name for Humans to a name of your choice.
Click on "TTF Names" in the left hand panel. Select the line containing the "Preferred Family" in the grid.
Click "Delete" and then "OK"
Last edited by
Gary Rathbone on Thu Mar 14, 2024 4:18 pm, edited 1 time in total.
-
Gary Rathbone
- Posts: 39
- Joined: Mon Apr 19, 2021 8:39 pm
Post
by Gary Rathbone » Thu Mar 14, 2024 3:56 pm
Step 3 of 4
Now to regenerate the Font. Select "Generate Fonts..." from the "File" menu
Select "TrueType" in the drop down menu.
... then click "Generate".
Last edited by
Gary Rathbone on Thu Mar 14, 2024 4:17 pm, edited 2 times in total.
-
Gary Rathbone
- Posts: 39
- Joined: Mon Apr 19, 2021 8:39 pm
Post
by Gary Rathbone » Thu Mar 14, 2024 4:01 pm
Step 4 of 4
Now when the "new" font is installed it has the name you provided and is no longer part of a family.
The font now appears in the property inspector and can be used to assign the typeface.
Sorted! It would be really nice though if the developers could provide a solution in Livecode.
Kind regards,
Gary
With big thanks to those who contributed, especially Bernd and Sparkout!
Last edited by
Gary Rathbone on Thu Mar 14, 2024 4:17 pm, edited 1 time in total.
-
stam
- Posts: 2736
- Joined: Sun Jun 04, 2006 9:39 pm
- Location: London, UK
Post
by stam » Thu Mar 14, 2024 4:10 pm
Well done on finding a workaround and sharing.
What LC really needs then is the option to choose any of the available weights. Seems like it should not only be feasible but also mandatory in this day and age….
-
bn
- VIP Livecode Opensource Backer
- Posts: 4016
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Post
by bn » Thu Mar 14, 2024 7:25 pm
Gary,
I am glad you found a solution. Very interesting story.
Kind regards
Bernd