Cross Platform Font Layout - current workarounds
Mark Waddingham
mark at livecode.com
Tue Aug 25 14:51:41 EDT 2020
On 2020-08-24 21:49, Sean Cole (Pi) via use-livecode wrote:
> My client provided the font they needed in line with their tv show
> brand.
> They need the app to work both PC and Mac. It seems I have to manually
> go
> through each field, button and widget and make sure they are laid out
> properly. The left, right, center alignments don't always match and the
> vertical position certainly never matches.
> https://www.dropbox.com/s/v50aj7uv06bh4d9/MacText.png?dl=0
> https://www.dropbox.com/s/pry5teqp89xzbun/PCText.png?dl=0
I suspect the main issue with vertical alignment here is to do with the
font.
This very readable article contains the relevant information here as
well as how the problem can be resolved:
<https://www.williamrchase.com/post/font-height-differences-between-windows-and-mac/>
TL;DR; version - the custom font probably does not have the correct
settings/tables for use in programs which use the system text engines on
*both* Mac and Windows.
FWIW, LiveCode fields try to match the way the running platform displays
text in OS editable fields.
Specifically, text in a field on macOS will look almost the same as that
in TextEdit; and text in a field on Windows will look almost the same as
that in WordPad (DPI differences taken into account - LC assumes 72dpi,
Win assumes 96dpi).
Unfortunately this means you do need to do some work (i.e. scripting) if
you want to use LiveCode fields in more 'graphical' situations - e.g. as
the labels on custom buttons.
Warmest Regards,
Mark.
P.S. It is perfectly possible that fettling with the metrics detailed in
the article above would mean you could achieve identical vertical layout
on macOS and Windows but it isn't something I have actually tried.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create app
More information about the use-livecode
mailing list