We make software for humans. Custom Mac, Windows, iOS and Android solutions in HyperCard, MetaCard, and RunRev LiveCode
Much of the following information was gathered from the LiveCode mailing list, and is offered as a reference for cross-platform font issues.
The font issue
None of the major operating systems that LiveCode supports handle fonts in exactly the same way. Even though there are a few fonts that some systems have in common, the font metrics vary even between fonts of the same name. They will look and print differently on different platforms. Arial on Windows is not the same as Arial on Macintosh.
Windows by default displays fonts at 96 dots per inch resolution, and Macintosh displays them at 72 dots per inch. However, these default resolutions can (and usually do) change if the user has set their monitor to display at a different resolution. You cannot predict what the font metics will be on any given machine at any given time.
There is no easy way to resolve these conflicts that will enable your stacks to display identically on all platforms. The best solution is the simplest: allow the default system font to display in field text, or if you prefer more consistency, use a font common to all platforms. In all cases, leave some extra space in the field to allow for different word widths and line wrapping.
To set a field to always use the system default, set its textfont property to a font name that does not exist, such as 0:
set the textfont of fld 1 to 0
Fonts common to all platforms
There arent many. Only Courier is supported across Linux, MacOS, Mac OS X, and Windows. Because it is a monospaced font, Courier isnt very useful much of the time.
Below is a partial comparison table of some fonts shared across various operating systems. Users may install their own fonts at any time; this table lists only those fonts that are shipped with the operating system. If a font is not listed here, it is not relevant to cross-platform use. This table is not all-inclusive.
Mac OS | Mac OS X | Windows | Linux | |
---|---|---|---|---|
Courier | X | X | X | X |
Helvetica | X | X | X | |
Lucida | X | X | ||
LucidaTypewriter | X | |||
Times | X | X | X | |
Arial | X | X | ||
Arial Black | X | X | ||
Times New Roman | X | X | X | |
Verdana | (often*) | X | X | |
Comic Sans | (often*) | X | X | |
Century Gothic | X | X | ||
Copperplate Gothic | X | X | ||
Impact | X | X | ||
Lucida Handwriting | X | X | ||
Tahoma | X | X | ||
Times New Roman | (often*) | X | X | |
Trebuchet | X | X | ||
Verdana | (often*) | X | X |
* Not native to the OS but often auto-installed by web browsers or other software
User Recommendations
According to the mailing list, the most-recommended font for Mac/Windows deployment is Arial. Tahoma is also popular. For stacks that must display on Linux/Unix platforms as well, you will probably have to change the field text dynamically to a different font, or maintain separate versions of your stack.
Font metric comparisons
If you are determined to try for the closest appearance in cross-platform stacks, you can set the textfont and textsize of fields or stacks dynamically with scripts depending on the platform the stack is running on. Note that Windows fonts are not scalable, where Mac OS and Mac OS X fonts are. If you set a font size on Windows that does not exist natively, it will look bad. Macintosh fonts look good at any size, so it may be preferable to set your field text to a size supported by the Windows font, or else dynamically change the field fonts by script when the card opens. (LiveCode profiles can do this.)
Dar Scott posted the following helpful comparison table to the mailing list, This chart shows the formattedHeight and formattedWidth of the word "Washington" in different fonts and sizes on two platforms.
textSize | textHeight | Arial | Helvetica | Courier | Courier New |
---|---|---|---|---|---|
8 | 10 | 10x40 | 9x40 | 9x50 | 10x50 |
9 | 12 | 12x48 | 12x48 | 12x50 | 12x50 |
10 | 13 | 13x55 | 13x54 | 13x60 | 13x60 |
11 | 14 | 14x57 | 13x57 | 13x70 | 14x70 |
12 | 16 | 16x65 | 14x65 | 14x70 | 16x70 |
13 | 17 | 17x68 | 16x68 | 16x80 | 17x80 |
14 | 18 | 18x75 | 17x75 | 17x80 | 18x80 |
15 | 20 | 20x77 | 18x77 | 18x90 | 20x90 |
16 | 21 | 21x85 | 20x85 | 20x100 | 21x100 |
17 | 22 | 22x88 | 21x88 | 21x100 | 22x100 |
18 | 24 | 24x95 | 22x95 | 22x110 | 24x110 |
19 | 25 | 25x103 | 24x103 | 24x110 | 25x110 |
20 | 26 | 26x105 | 25x105 | 25x120 | 26x120 |
textSize | textHeight | Arial | Helvetica | Courier | Courier New |
---|---|---|---|---|---|
8 | 10 | 9x39 | ---- | 13x80 | 8x50 |
9 | 12 | 10x40 | ----- | 13x80 | 8x50 |
10 | 13 | 10x49 | ----- | 13x80 | 10x50 |
11 | 14 | 12x55 | ----- | 13x80 | 10x60 |
12 | 16 | 14x66 | ----- | 13x80 | 14x70 |
13 | 17 | 14x66 | ----- | 13x80 | 14x70 |
14 | 18 | 16x69 | ----- | 16x90 | 14x80 |
15 | 20 | 17x78 | ----- | 16x90 | 16x80 |
16 | 21 | 18x87 | ----- | 16x90 | 17x100 |
17 | 22 | 18x87 | ----- | 20x120 | 18x100 |
18 | 24 | 21x95 | ----- | 20x120 | 20x110 |
19 | 25 | 24x102 | ------ | 20x120 | 21x130 |
20 | 26 | 24x111 | ------ | 20x120 | 22x130 |
OSX | Windows XP |
8 | 9 |
10 | 11 (except for height) |
12 | 14 (except for width) |
Shipping fonts with your standalones
Some companies ship fonts with their applications so that they will more closely match across platforms. Bitstream makes a font called Vera that is specifically designed to display the same font metrics on both Windows and Macintosh. However, installing fonts into a users system is not always practical, and some users may not like it.
A last resort images
An image of a block of text is always an option for static text such as labels. However, some people have resorted to using images of text characters, which are assigned to fields dynamically by script using the imagesource property. This requires careful preparation and meticulous scripting and unless an absolute match is strictly required, probably isnt worth the trouble. Text editing such fields becomes almost impossible and scripts will no longer be able to use most of LiveCodes built-in text chunking.
In conclusion
Our recommendation is: in most cases, pretty close is good enough.