DynaPDF Manual - Page 715
Previous Page 714 Index Next Page 716
Page 715 of 821
The postscript name should be a unique name that identifies a font exactly. However, it is known
that certain font vendors deliver fonts with incorrectly named style variants, i.e. the same postscript
name can be assigned to condensed and expanded versions. In such a case the postscript name is
not unique and avoids correct font selection.
It is usually better to select fonts via the full name since this name seems to be unique in most fonts.
The parameter Style specifies the font style variant that should be loaded from a given font family. A
font style is a 32 bit unsigned integer that is encoded as follows:
// Style bits fsItalic, fsUnderlined, fsStriked
9..19 // Width class (1..9) -> Defined for future use
• Bits 20..31 // Font Weight (100..1000)
The width class and font weight can be converted to a style constant with the macros
WidthToStyle() and WeightToStyle():
((w) << 8)
((w) << 20)
// Corresponding macros to extract the values
#define WidthFromStyle(s) (((s) & 0x00000F00) >> 8)
#define WeightFromStyle(s)(((s) & 0xFFF00000) >> 20)
// Width class 5 (Normal), font weight 700 (bold), italic
TFStyle style = WidthToStyle(5) | WeightToStyle(700) | fsItalic;
// or use the defined constants instead
TFStyle style = fsNormal | fsBold | fsItalic;
A valid font weight is a multiple of 100 or 100. Values like 450 or 770 are not meaningful.
Supported font formats
The following font formats are supported by DynaPDF (on Mac OS X the same formats are also
supported if they are stored in resource or data forks, as well as in .dfont or .suit files):
• TrueType fonts (*.ttf). MAC Standard, Unicode or CJK encoded fonts.
• TrueType Collection (*.ttc). These fonts contain multiple fonts into one.
• OpenType fonts (*.otf) with TrueType or PostScript outlines.
• PostScript Type 1 fonts (*.pfb or *.pfa). No metric files are required.
When a TrueType, OpenType or a font of a TrueType Collection will be embedded, DynaPDF
creates a subset of this font which contains the used characters only. The function constructs a
completely new font file that contains no unnecessary information.
Previous topic: Font Search Order, Font names, Family name, Full name
Next topic: Font Embedding, The 14 Standard Fonts