Cross-platform font handling, and why you don't want to do it

Tom Glod tom at
Mon Sep 5 12:06:07 EDT 2022

It seems like you have an approach that can work well, despite being more
Mainly shipping the fonts, which cancels out most of the issues, but
requires handling each case.

I don't know if any multi-platform dev tool deals with fonts without any
extra hoops.
If I recall correctly, flutter did  OK, but not perfectly on the 2 mobile
platforms, but I've not tested the desktops, which I am guessing will be

Hopefully your wrap up can help people to avoid trying to stick ..... the
thing in the thing.
Good luck to us all.

On Mon, Sep 5, 2022 at 3:03 AM Quentin Long via use-livecode <
use-livecode at> wrote:

> Cross-platform font compatibility is a hellacious rat's nest of
> mismatches. It may or may not be worse than handling time (Daylight Savings
> Time? leap years? leap *seconds*? etc, ad nauseum), but it's plenty bad
> enough on its own merits, or lack thereof.
> * You can't be 100% confident that your user will have the same font(s)
> you do installed on their system.
> * If your user has a font *of the same name* as your font installed on
> their system, you can't be 100% confident that *their* font came from the
> same font foundry as *your* font. Yes, font names are legally protected,
> but... Helvetica, anyone?
> * If your user has a font *of the same name* as your font installed on
> their system, you can't be 100% confident that it's the *same* font you
> have. Again: Font names are legally protected. But what if you
> have version 15.0 of RandomFontFoundry's WhateverFont on your system, but
> your user only has version 1.0 of RandomFontFoundry's WhateverFont? Who
> *knows* what tweaks RandomFontFoundry may have made to WhateverFont in
> between those two version numbers?
> * Can you be 100% confident that version 15.0
> of RandomFontFoundry's WhateverFont *for Mac* is going to render *exactly
> the same* as version 15.0 of RandomFontFoundry's WhateverFont *for Windows*
> or *for Linux*? No. You cannot. Different type rendering engines on
> different OSes *ensure* that rendering compatibility will be problematic at
> best.
> * Assuming your user has exactly the same version of exactly the same font
> on exactly the same OS you do, you can't be 100% confident that your user
> has installed the font metrics data (kerning, sidebearings, etc)—which
> means you have no idea if the damn thing will look the same on your user's
> system as on your system.
> If you want to *ensure* that some piece of text looks *exactly the same*
> cross-platform, the only way to get there is to format the text the way you
> want it on one platform, take a screenshot, and use that graphic. But even
> then, can you be 100% confident that your user *hasn't* tweaked some
> setting on their system which messes with graphics..?
> The "take a screenshot" solution is not well-suited for any use-case
> involving text which varies from time to time, and largely impractical for
> any use-case involving text which is input by the user. In principle, it
> should be possible to create a library of glyph-images of all glyphs in a
> font, and import those glyph-images as necessary—no, mass quantities of
> "set the imageSource of char X to $GlyphImage" commands ain't gonna fly,
> cuz letterspacing will look crappy—but that "solution" is tantamount to
> building your own, redundant, set of text-handling routines. Yuck!
> If "take a screenshot" doesn't work for you, I suspect the next-best route
> to achieving Absolute Cross-Platform Font Fidelity may be this:
>  1) Open up your font in your font-editing utility of choice
> (Fontographer, Glyphs, FontLab, whatever)
> 2) Export your font N times, once for each of the *other* OSes you need
> font compatibility with—WhateverFontMac, WhateverFontWindows,
> WhateverFontLinux, etc
> 3) Open up your stack within each of the OSes you're working with, always
> using the appropriate OS-specific version of your font, and see how
> different your stack looks on the other OSes
> 4) Tweak the font metrics on the other-OS versions of your font until your
> stack looks the same on all OSes
> 5) When it's time to distribute your stack, be sure to bundle *all* the
> hand-tuned OS-versions of your font with your stack
> This procedure is, of course, a royal pain in the arse. Hellacious rat's
> nest of mismatches, yada yada yada. But regardless of how painful it is? If
> you need absolute visual fidelity cross-platform, *and* total flexibility
> in the *content* of text, this procedure may be your least-bad option.
> As a perhaps-preferable option:
> 1) Open up your stack on each of the OSes you're striving for font
> compatibility on
> 2) Tweak the appearance-relevant text properties (textFont, textHeight,
> textShift, etc) on each OS until you get an acceptable approximation of
> identical appearance
> 3) Make note of the values of all these text properties for each OS
> 4) Assuming you have however-many fonts specified by fontName, be sure you
> bundle all those fonts with your stack when you distribute it
> 5) Include in your stack's preOpenStack handler a switch which
> includes "case = WhateverOS" for each OS you want font compatibility for
> 6) Within each OS's "case", set all the appearance-relevant text
> properties for that OS
> This procedure is not going to achieve anywhere near the degree of
> cross-platform font fidelity as the "roll your own" solution above. On the
> plus side, it's *significantly* less nitpicky/picayune/painful. You puts in
> your money, and you takes your chances...
> "Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length" Read the
> webcomic at [ ]! If you like "At Arm's
> Length", support it at [ ].
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:

More information about the use-livecode mailing list