Prior to 4D v17 R5, you may have discovered upon opening your 4D Write Pro document that the displayed font is not what it is supposed to be! If the document contains fonts which are not on your computer, 4D automatically replaced them with Times New Roman. However, since font preference is a matter of individual choice, this R-release gives you the ability to choose the replacement fonts!
Thanks to this feature, you can define which font will be used if the original one is missing. This can be done on both macOS and Windows operating systems.
A new attribute is added for this purpose: wk font default. It’s an object defining the default substitution font(s) for a document. It contains three properties:
- default: The font to use by default as a substitute if a font is not supported by the OS, regardless of the platform.
- Windows: The font to use by default on Windows (priority over “default”, if defined).
- mac: The font to use by default on macOS (priority over “default”, if defined).
Example
In the example below, we want to define a collection of fonts to be used hierarchically in case the main font doesn’t exist. In other words, if the Roboto Condensed Bold Italic font doesn’t exist on my macOS, the fonts in the collection will be used, in the order of their definition:
$o:=New object
$o.mac:=New collection("Helvetica";"Morocco Regular";"Arial Black")
WP SET ATTRIBUTES(wpDOC;wk font;"Roboto Condensed Bold Italic")
WP SET ATTRIBUTES(wpDOC;wk font default;$o)
What about converted 4D Write documents?
The substitution font in converted 4D Write documents is “Times New Roman”, regardless of the platform. If an imported font is not supported on the platform, it’s replaced by “Times New Roman” when rendering the document at runtime.