Font flavours not rendering

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

Post Reply
golife
Posts: 115
Joined: Fri Apr 02, 2010 12:10 pm

Font flavours not rendering

Post by golife » Sat May 09, 2020 3:04 pm

LiveCode: LC 9.6 (dp4)
OS: Windows 2000

I do not fully understanding something about rendering fonts in LC.

I have installed the font "Roboto" from Google which comes in different flavors "Roboto-light", "Roboto-bold", etc. To install, I downloaded the font and used the command: start using font file <font name with full filepath>.

Each of the Roboto TFF files has been loaded into memory. The command fontFilesInUse verifies that the fonts are "in use".

Setting a field to such font name only works for "Roboto" as such, but not for any of the speical font flavours. For example, setting the textfont of field 1 to "Roboto-light" does not work. All these flavours of the font are also not listed in the standard font menu. I can change styles using the style menu, but not get the "light" or "extra light" versions of the Roboto font.

Question: Do we not have access to the special styles of fonts that ship with the font family? Or is there another way of "using" such fonts?

Thanks for answers. Golife

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Font flavours not rendering

Post by jacque » Sun May 10, 2020 5:25 pm

LC automatically translates bold and italic to use the correct font name but the others have to be managed by you. The name you see in the font menu usually isn't the actual name of the font. I don't recall the details exactly but I think if you look at the actual file names you can see what they're really called.

Edit: Try asking LC for the fontnames, that should show you what LC thinks they are.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

golife
Posts: 115
Joined: Fri Apr 02, 2010 12:10 pm

Re: Font flavours not rendering

Post by golife » Sun May 10, 2020 6:23 pm

Yes, actually that is what I did. The font names only list Roboto as the font family. The font file names "in use" are all more specific and are listed as being used since I loaded them. No error. But no field is rendering them. Choosing "italic" or "bold" works, but it is not what I desire. There is "semi bold", there is "light italic" etc. I want to see these special font subtypes. Maybe LC is not supporting this?

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Font flavours not rendering

Post by AxWald » Mon May 11, 2020 12:05 pm

Hi,

it seems that, over the years, something has changed with fonts that LC didn't kept up with - the fonts where not all font faces are combined in 1 file anymore. (Or is it only a change in Win10?)

"Roboto" is such a "new font" that behaves oddly (as do many from fonts.google.com, no matter if .ttf or .odf). It shows as "Roboto" in the font menu, but using this menu entry for "textFont" doesn't necessarily display it correctly. Sometimes it helps to set the textFont manually to "Roboto Regular" ...

Using the textStyles adds to the confusion - sometimes "[fontname]" & style "italic" works, sometimes it needs "[fontname]" & " Regular" & style "italic" ...

Seems dependent of the setting of the stacks textFont, too :/ And then, in Android, it's different again. Not to mention that LC9 behaves differently compared to LC6, as icing of the cake :)

I didn't yet find a recipe how to handle it - how to have it display correctly (reliably cross platform), and how to use for instance "Roboto-MediumItalic.ttf". Any insights welcome!

Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

golife
Posts: 115
Joined: Fri Apr 02, 2010 12:10 pm

Re: Font flavours not rendering

Post by golife » Mon May 11, 2020 4:44 pm

@AxWald

You are describing exactly what I am facing. To list the fontnames, they will show "Roboto", but none of the special faces even though present when executing the fontFilesInUse command. Setting the font to any of the font faces has no effect. It is possible to set it to bold or italic using the set textstyle of field "xyz" to "italic|bold|normal" or using the properties dialog.

That does not help in this case.

I need to use all the font faces of Roboto on Windows 10 OS and Android and they should also display on iOS and OSX.

Maybe it is worth filing a bug report? There are some such bug reports about fonts, but not exactly addressing this specific case as far as I could see with a quick search.

I consider that currently it is not possible to set a field to a specific font face. Roboto is certainly a widely used font especially on Android and whishing to adhere to material design principles using this font would practicially be impossible without a lot of compromise. I have zero problems with Roboto on webforms or in any other program I have used so far.

Any additional comment is highly welcome and thanks for all who replied and reply!!!

Golife

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm

Re: Font flavours not rendering

Post by Monox18 » Mon Dec 13, 2021 11:28 pm

golife wrote:
Sat May 09, 2020 3:04 pm
Or is there another way of "using" such fonts?
AxWald wrote:
Mon May 11, 2020 12:05 pm
Any insights welcome!
Yes, there's a workaround. Use a tool to edit the Metadata of the font files you want and change the name to something that suits your needs. Then Compile the font and it is ready to be used, realiably and cross platform. For instance I used: https://www.glyphrstudio.com/online/. It takes me less than 1 minute to edit each font I think (Importing, changing name, exporting back)

Tested on Both WIndows PC and Android phone.

For Android all you need is to have all font files in a folder named "fonts" and make sure it is copied when building a standalone. I configured it in the settings, you can build the .apk file.

For Windows it is tricky but aparently 100% realiable now. The "start/stop using font file" commands really suck and fail a lot. You gotta try it multiple times until it works. Don't trust the fontFilesInUse property. It might show a font file is loaded when in fact it isn't. The fontNames property does seem to be reliable. If something is there, it was properly loaded, if it isn't then it wasn't.
Screenshot_20211213-230844.png
Screenshot 2021-12-13 23.09.26.png
Edit:
I couldn't upload the stack here as its size is too big (way too many Roboto fonts). Instead I uploaded it to quality control. It contains all edited fonts.
Try getting it from: Bug #14436
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

Post Reply