Standardize Font Appearance

Neville Smythe neville.smythe at
Fri Sep 2 02:18:13 EDT 2022

Standardising fonts, so that one would no longer have to check that every label and field carefully crafted on the Mac to fit text precisely would not have missing pixels or whole words wrapped out of sight on Windows because of different font metrics, sounds like a great idea. But the reality of the way systems render fonts seems to complicate things:

I set up a test standalone with the Google fonts NotoSans-regular.ttf and NotoSerif-regular.ttf installed. A label and and single line text field were set up to be exactly the right size to fit some text using Arial font on a Mac (Monterey). Then the labels and field were set to use NotoSans or NotoSerif fonts.

There does still appear to be a small difference in the baselines for the two fonts between Mac and Windows, possibly more than the difference between Arial on the two platforms, so that I think pixels could be cut off under some circumstances. Bizarrely there is a bigger difference between NotoSerif as rendered on Monterey and High Sierra — on High Sierra the space character seems to be more compressible when the system tries to fit a right-justified label into a given length - or possibly the 8pixel margins are honoured on High Sierra, whereas on Monterey the text just overwrote the left margin?

When it comes to Linux (Ubuntu) however everything came unstuck. The NotoSans text renders much wider, wrapping the final word of a piece of text to the next line. At least I think it is using NotoSans: LC lists the NotoSans and NotoSerif files as in use, but the Serif font just doesn’t render at all (that is, it does not change the displayed text)! It could be the system is substituting another font entirely for NotoSans, and not recognising NotoSerif [does the font have to be set to NotoSerif-regular on Linux rather than NotoSerif??]. 

I need to make a more detailed comparisons. I presume the LC text measurement functions return the exact pixel height and width that the text will use when rendered by the iterating system, but can I get the bottom-right of its rect? And the actual font the system will employ?


More information about the use-livecode mailing list