DL Logo

PDEFont Definitions

kPDEFontNoEditableEmbedding

Header: PEExpT.h:2028

Description

Flags for protection of PDEFontAttrs: editable embedding is not allowed.

Syntax

#define kPDEFontNoEditableEmbedding 0x00000002

kPDEFontNoEmbedding

Header: PEExpT.h:2025

Description

Flags for protection of PDEFontAttrs: embedding is not allowed.

Syntax

#define kPDEFontNoEmbedding 0x00000001

PDEFont Enumerations

PDEFontCreateFlags

Header: PEExpT.h:1950

Description

Flags for PDEFontCreateFromSysFont(). If you want to subset a font, set both the kPDEFontCreateEmbedded and kPDEFontWillSubset flags.

Enum Constants

kPDEFontCreateEmbedded=0x0001
Embed the font. Create an embedded font. By itself, this will not subset the font.
kPDEFontWillSubset=0x0002
Subset the font. If you want to subset a font, set both the kPDEFontCreateEmbedded and kPDEFontWillSubset flags. You must call PDEFontSubsetNow() to actually subset the font. Both embedding and subsetting a font creates a CFF font.
kPDEFontDoNotEmbed=0x0004
Do not embed the font. You cannot set both this and the kPDEFontWillSubset flags. Nor can you set kPDEFontCreateEmbedded.
kPDEFontEncodeByGID=0x0008
Create a CIDFont with identity (GID) encoding.
kPDEFontDeferWidths=0x0010
Wait to get the widths until later (this affects Type0 fonts only).
kPDEFontCreateSubset=kPDEFontWillSubset
kPDEFontCreateGIDOverride=0x0020
PDFLib will convert cp to gid with identity embedded.
kPDEFontCreateToUnicode=0x0040
Create a ToUnicode CMap.
kPDEFontCreateAllWidths=0x0080
Supply the entire widths table (this affects Type0 fonts only).
kPDEFontCreateEmbedOpenType=0x0100
Embed an OpenType style font subset, if appropriate.
kPDEFontCreateReserved1=0x0200
Reserved for internal usage
kPDEFontCreateFullCIDSet=0x0400
Create CIDSet entry from all CIDs present in subsetted Type0 CID Fonts containing glyph descriptions based on identity encoded TrueType fonts (subtype CIDFontType2). Subsetted identity encoded Type0 fonts can have more glyphs than asked for to avoid glyph renumbering. Default behavior is to only include CIDs used in PDF page content stream in CIDset
kPDEFontThrowIfToUnicodeUsesPUA=0x0800
If kPDEFontThrowIfToUnicodeUsesPUA flag is passed along with kPDEFontCreateToUnicode and kPDEFontCreateSubset, throw error in PDEFont embedding APIs if the created ToUnicode table contains Private Use Area (Range: E000-F8FF in plane 0 and Supplemental Private Use Area A & B) Unicode values
kPDEFontInvisibleRenderingMode=0x1000
Reserved for internal usage- This flag is passed if PDEFont is used with Text rendering mode 3(Invisible)- While converting to PDFXxx and PDFAxx if fetched fontfile stream data from Cooltype is empty (NULL), then with this flag enabled entire fontfile stream data from input file is copied to embedded font in output file

PDEFontCreateNeedFlags

Header: PEExpT.h:2012

Description

Flags for PDEFontGetCreateNeedFlags().

Enum Constants

kPDEFontCreateNeedWidths=0x00010000
It is necessary to to create the width.
kPDEFontCreateNeedToUnicode=0x00020000
It is necessary to to create the ToUnicode stream.
kPDEFontCreateNeedEmbed=0x00040000
It is necessary to to embed it.

PDEFont Typedefs

PDEFont

Header: PEExpT.h:312

Description

A reference to a font used on a page in a PDF file. It may be equated with a font in the system. A PDEFont is not the same as a PDFont; a PDFont is associated with a particular document.

Related Methods

Syntax

typedef struct _t_PDEFont *PDEFont;

Returned From

Used By

Used In

PDEFont Structures

_t_PDEFontAttrs

Header: PEExpT.h:1031

Description

Attributes of a PDEFont and of a PDSysFont. This structure is also referenced in PDEFontCreateParams().

To learn more about the BaseFont key, see the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, page 269. You can find this document on the web store of the International Standards Organization (ISO).

To learn more about Base Encoding, see the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, page 262. You can find this document on the web store of the International Standards Organization (ISO).

Syntax

struct _t_PDEFontAttrs {
ASAtom name;
An ASAtom for font name (for example, "Times-Roman"). It corresponds to the BaseFont key in the font dictionary of a PDF file. See the description of the BaseFont key in the CIDFont dictionary in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.7.4, page 269.
ASAtom type;
    An ASAtom for the font type corresponding to the Subtype key in a a font dictionary. It may be:
  • "Type1"
  • "TrueType"
  • "MMType1"
  • "Type0"
ASAtom charSet;
An ASAtom for "Roman", or ASAtomNull. If it is "Roman", the characters must be a subset of the Adobe Standard Roman Character Set.
ASAtom encoding;
An ASAtom for font encoding. It may be MacRomanEncoding, WinAnsiEncoding, or ASAtomNull. In the case of ASAtomNull, call PDSysFontGetEncoding() to get more information about the encoding.
ASUns32 flags;
The desired font flags; one or more of the Font Flags.
ASFixedRect fontBBox;
The font bounding box in 1000 EM units.
ASInt16 missingWidth;
The width of the missing character (.notdef).
ASInt16 stemV;
The vertical stem width.
ASInt16 stemH;
The horizontal stem width.
ASInt16 capHeight;
The capital height.
ASInt16 xHeight;
The x height.
ASInt16 ascent;
The maximum ascender height.
ASInt16 descent;
The maximum descender depth.
ASInt16 leading;
The additional leading between lines.
ASInt16 maxWidth;
The maximum character width.
ASInt16 avgWidth;
The average character width.
ASInt16 italicAngle;
The italic angle in degrees, if any.
ASAtom cidFontType;
CIDFontType0 or CIDFontType2.
ASInt16 wMode;
The writing mode. It must be one of:
Value
Description
0
For horizontal writing.
1
For vertical writing.
ASAtom psName;
An ASAtom representing the PostScript name of a TrueType font.
ASAtom platformName;
The platform name.
ASAtom lang;
An ASAtom representing the ISO 639 language code. These are available from http://www.iso.ch.
ASAtom registry;
An ASAtom representing the CIDFont's Registry information (for example, "gAdobe-Japan".
ASAtom ordering;
An ASAtom representing the CIDFont's Ordering information (for example, "g1").
ASInt32 supplement;
The SystemSupplement field from the CIDFont.
ASInt32 cantEmbed;
A non-zero value means the font can't be embedded.
ASAtom deltaEncoding;
The name of the base encoding; that is, the BaseEncoding entry in an encoding dictionary. See the description of Base Encoding in the Character Encoding section of the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.6.6, page 262. The Differences entry of the encoding dictionary describes differences (deltas) from the base encoding.
ASUns32 protection;
Allows one of the following bits to be set in order to disable font embedding:
Bit
Description
The font should not be embedded.
The font should not be embedded for editing purposes.
ASInt32 packageType;
ASUns32 weight;
Font weight, An unsigned integer representing the thinness or thickness of * a font
} PDEFontAttrs, *PDEFontAttrsP;

Used By

Used In

_t_PDEFontCreateFromSysFontParams

Header: PEExpT.h:1363

Description

A data structure used with PDEFont creation. To learn more about Multiple Master Fonts, see the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, page 256. You can find this document on the web store of the International Standards Organization (ISO).

Syntax

struct _t_PDEFontCreateFromSysFontParams {
ASUns32 structSize;
The size of the data structure. It must be set to sizeof(PDEFontCreateFromSysFontParamsRec).
ASUns32 flags;
A bit mask of the PDEFontCreateFlags.
ASAtom snapshotName;
The name of a Multiple Master snapshot. See "Multiple Master Fonts" in section 9.6.2.3, under Type 1 Fonts, in ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, page 256.
ASFixed *mmDesignVec;
A pointer to the Multiple Master font design vector.
long ctCodePage;
Used to select a specific code page supported by the font. When a non-zero code page is supplied, embedding must be turned on and the kPDEFontEncodeByGID flag must be set.
ASAtom encoding;
Used to specify which encoding to use with a CID font. Pass ASAtomNull to use the platform default.
CosDoc cosDoc;
Used to specify the CosDoc in which to create the font. Pass NULL to use the scratch doc.
} PDEFontCreateFromSysFontParamsRec, *PDEFontCreateFromSysFontParams;

Used By

_t_PDEFontCreateParams

Header: PEExpT.h:1181

Description

Parameters used for PDEFontCreateWithParams() to describe a font.

To learn more about CIDFonts, see the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, page 269. You can find this document on the web store of the International Standards Organization (ISO).

To learn more about Composite Fonts, see the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, page 267. You can find this document on the web store of the International Standards Organization (ISO).

Syntax

struct _t_PDEFontCreateParams {
PDEFontAttrsP attrsP;
A pointer to a PDEFontAttrs for the font attributes.
ASUns32 attrsSize;
The size of the data structure. It must be set to sizeof(PDEFontAttrs).
ASInt32 firstChar;
The first character index for the widths array, widthsP.
ASInt32 lastChar;
The last character index for the widths array, widthsP.
ASInt16 *widthsP;
A pointer to the widths array.
char **encoding;
An array of 256 pointers to glyph names specifying the custom encoding. If any pointer is NULL, no encoding information is written for that entry.
ASAtom encodingBaseName;
An ASAtom representing the encoding base name if the encoding is a custom encoding. If the encoding is NULL, encodingBaseName is used as the value of the encoding and must be one of "WinAnsiEncoding", "MacRomanEncoding", or "MacExpertEncoding". If no encoding value is desired, use ASAtomNull. However, for Type 0 fonts, this field must be a valid CMap name, or PDEFontCreateWithParams() will fail.
ASStm fontStm;
A stream with font information.
ASInt32 len1;
The length in bytes of the ASCII portion of the Type 1 font file after it has been decoded. For other font formats, such as TrueType or CFF, only len1 is used, and it is the size of the font.
ASInt32 len2;
The length in bytes of the encrypted portion of the Type 1 font file after it has been decoded.
ASInt32 len3;
The length in bytes of the portion of the Type 1 font file that contains the 512 zeros, plus the cleartomark operator, plus any following data.
ASBool hasDW;
If true, the dw and w fields are used; if false, they are not used.
ASInt32 dw;
(Optional) The default width for glyphs in a CIDFont. See the description of the BaseFont key in the CIDFont dictionary in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.7.4, page 269.
CosObj w;
A Cos array of a set of lists that define the widths for the glyphs in the CIDFont. Each list can specify individual widths for consecutive CIDs, or one width for a range of CIDs. See the description of character widths in CIDFonts in the CIDFont dictionary in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.7.4, page 269.
ASBool hasDW2;
If true, the dw2 and w2 fields are used; if false, they are not used.
ASInt32 dw2 [2];

(Optional: this applies only to CIDFonts that are used for vertical writing).

The default metric for writing mode 1. This entry is an array of two numbers: the y-component of the position vector and the y component of the displacement vector for writing mode 1. The x-component of the position vector is always half the width of the character. The x-component of the displacement vector is always 0. The default value is [880-1000]. For information on writing mode 1, see the description of vertical writing in "CIDFonts" in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.7.4, page 269.

CosObj w2;

(Optional: this applies only to CIDFonts that are used for vertical writing)

A Cos array defining the metrics for vertical writing. Its format is similar to the format of the array in w. It defines the x and y components of the position vector, and the y-component of the displacement vector. The x-component of the displacement vector is always 0. See the description of character widths in CIDFonts in the CIDFont dictionary in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.7.4, page 269.

ASInt32 toUnicodeLen;
(Optional) The length of toUnicodeStm.
ASStm toUnicodeStm;
(Optional) A stream containing a CMap that defines the mapping from character codes to Unicode values. This entry is recommended for fonts that do not use one of the predefined CMaps. If present, this allows strings in the encoding to convert to Unicode values for export to other applications or plug-ins. For more information on type 0 fonts, see the description of Composite Fonts in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.7, page 267.
ASStm cidToGidMapStm;
A stream contain the mapping from a CID to glyphindex ( "GID"). The glyphindex for a particular CID value c is a 2-byte value stored in bytes 2 *c and 2 *c+1; the first byte is the high-order byte.
char *panoseNo;
A 12-byte string containing the Family Class ID, Family SubClass ID, and 10 bytes for the PANOSE classification number for the font. For additional details on the PANOSE number, see the Japanese TrueType Font Property Selection Guidelines by the TrueType Conference Technical Committee.
CosObj fd;
A Cos dictionary identifying a subset of characters in a CIDFont. The values are dictionaries with entries that override the values in the FontDescriptor dictionary for the subset of characters. See the description of Composite Fonts in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.7, page 267.
ASStm cidSetStm;
A stream identifying which CIDs are present in the CIDFont file. It is required if the CIDFont file is embedded and only contains a subset of the glyphs in the character collection defined by the CIDSystemInfo. If this entry is missing, then it is assumed that the CIDFont file contains all the glyphs for the character collection. The stream's length should be rounded up to the nearest multiple of 8. The bits should be stored in bytes with the high-order bit first. Each bit corresponds to a CID. The first bit of the first byte corresponds to CID 0, the next bit corresponds to CID 1, and so on. If the subset contains a CID, the bit for that CID should be set. For compactness, the stream may use one of the compression filters to encode the data. See the description of Composite Fonts in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.7, page 267.
ASUns32 flags;
ASFixed *mmDesignVec;
A pointer to the Multiple Master font design vector.
ASAtom sourceFontType;
    An ASAtom that indicates the font type of the provided font program when creating a font. Required in Type0 fonts.
  • "Type1"
  • "TrueType"
  • "MMType1"
  • "Type0"
} PDEFontCreateParamsRec, *PDEFontCreateParams;

Used By

_t_PDEFontInfo

Header: PDSysFontExpT.h:91

Description

PDEFont information.

Syntax

struct _t_PDEFontInfo {
ASAtom name;
An ASAtom for the font name (for example, "Times-Roman").
ASAtom type;
ASAtom charSet;
An ASAtom for "Roman", or ASAtomNull. If it is "Roman", the characters must be a subset of the Adobe Standard Roman Character Set.
ASAtom encoding;
An ASAtom for font encoding, such as WinAnsiEncoding.
The writing mode: 0 means horizontal and 1 means vertical.
} PDEFontInfoRec, *PDEFontInfoP;

Used By

_t_PDESpanItem

Header: PEExpT.h:1444

Syntax

struct _t_PDESpanItem {
ASInt32 firstGlyph;
The index into the glyphs array in a PDEGlyphRun object.
ASInt32 nGlyphs;
The number of glyphs in the span starting from firstGlyph. This can be zero, indicating there are no glyphs for this Unicode string. The firstGlyph indicates the glyph that precedes the Unicode string.
ASInt32 firstUniChar;
The index into the uniText array in a PDEGlyphRun object.
ASInt32 nUniChars;
The number of Unicode characters in the span starting from firstUniChar. This count can be zero, indicating there are no Unicode values for the range of glyphs.
} PDESpanItem, *PDESpanItemP;

Used In

_t_PDESpanSet

Header: PEExpT.h:1466

Syntax

struct _t_PDESpanSet {
PDESpanItemP spans;
A pointer to array of spans corresponding to the PDEGlyphRun object.
ASInt32 spanCount;
The count of spans in the spans array.
} PDESpanSet, *PDESpanSetP;

Returned From

Used By

PDEFont Functions

PDEFontAddGlyphs

Header: PEWProcs.h:2693

Description

Adds glyphs to a PDEFont object for embedding a PDEFont.

This is used by clients that use PDEFEdit calls to embed the font but create their own content stream. The glyphs added by this routine will be included in the font when PDEFontSubsetNow() is called. It is up to the client to ensure that the encoding used by the PDEFont matches the character codes used in the string arguments to the text operators in the content stream.

This routine is used to specify which glyphs should be included in the font when embedded. Additionally, it specifies the mapping from the GlyphIDs to Unicode values. This mapping will be used to create the ToUnicode entry in the embedded font object. In the cases where the ToUnicode table cannot accurately reproduce the Unicode string in the PDEGlyphRun structure, this routine will return an array of spans that describe the contents of the ActualText spans that must be included in the content stream. Each span indicates a contiguous range of glyphs and a corresponding contiguous range of Unicode values that correspond to the glyphs. For example, the following ActualText span replace two glyphs with three Unicode values.

/Span < /ActualText(U+vvvvU+xxxU+yyyy)>>

BDC [Giii Gjjj] TJ EMC

Note that the routine must be called with the PDEGlyphRuns in display order.

Syntax

PDESpanSetP PDEFontAddGlyphs(IN PDEFont pdeFont, IN PDEGlyphRunP glyphRun, IN ASUns32 flags);

Parameters

pdeFont
The font for the element.
glyphRun
A pointer to a PDEGlyphRun structure with Unicode data, GlyphIDs and their correspondence. Note that the xPosition and yPosition fields in the PDEGlyphDescription structure are ignored.
flags
Unused, reserved for later use.

Returns

A pointer to a PDESpanSet. The span can be released with PDEReleaseSpan().

Exceptions

PDEFontCreate

Header: PEWProcs.h:850

Description

Creates a new PDEFont from the specified parameters.

The PDEFont may be represented as an embedded font (a FontFile entry in the font descriptor of the PDF file). To create a PDEFont that is stored as an embedded font, the FontFile stream may be passed in fontStm, and the len1, len2, and len3 parameters contain the Length1, Length2, and Length3 values of the FontFile stream attributes dictionary. See the description of Embedded Font Programs in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.9, page 288. You can find this document on the web store of the International Standards Organization (ISO).

The caller must close fontStm with ASStmClose() after invoking PDEFontCreate().

Call PDERelease() to dispose of the returned font object when finished with it.

Syntax

PDEFont PDEFontCreate(IN PDEFontAttrsP attrsP, IN ASUns32 attrsSize, IN ASInt32 firstChar, IN ASInt32 lastChar, IN ASInt16 *widthsP, IN char **encoding, IN ASAtom encodingBaseName, IN ASStm fontStm, IN ASInt32 len1, IN ASInt32 len2, IN ASInt32 len3);

Parameters

attrsP
A pointer to a PDEFontAttrs structure for the font attributes.
attrsSize
The size of the attrsP buffer in bytes.
firstChar
The first character index for the widths array, widthsP.
lastChar
The last character index for the widths array, widthsP.
widthsP
A pointer to the widths array.
encoding
An array of 256 pointers to glyph names specifying the custom encoding. If any pointer is NULL, no encoding information is written for that entry.
encodingBaseName
The encoding base name if the encoding is a custom encoding. If the encoding is NULL, encodingBaseName is used as the value of the encoding, and must be one of WinAnsiEncoding, MacRomanEncoding, or MacExpertEncoding. If no encoding value is desired, use ASAtomNull.
fontStm
The stream with font information.
len1
The length in bytes of the ASCII portion of the Type 1 font file after it has been decoded. For other font formats, such as TrueType or CFF, only len1 is used, and it is the size of the font.
len2
The length in bytes of the encrypted portion of the Type 1 font file after it has been decoded.
len3
The length in bytes of the portion of the Type 1 font file that contains the 512 zeros, plus the cleartomark operator, plus any following data.

Returns

The specified PDEFont.

Exceptions

PDEFontCreateFromCosObj

Header: PEWProcs.h:879

Description

Creates a PDEFont corresponding to a Cos object of type Font.

Call PDERelease() to dispose of the returned font object when finished with it.

Syntax

PDEFont PDEFontCreateFromCosObj(const CosObj *cosObjP);

Parameters

cosObjP
IN/OUT The Cos object for which a PDEFont is created.

Returns

The PDEFont created from cosObjP.

Exceptions

PDEFontCreateFromSysFont

Header: PEWProcs.h:917

Description

Gets a PDEFont corresponding to a font in the system.

Call PDERelease() to dispose of the returned font object when finished with it.

The PDEFontCreateFlags flags kPDEFontCreateEmbedded and kPDEFontWillSubset must both be set in order to subset a font.

If you create a PDEFont that is a subset, call PDEFontSubsetNow() on this font afterwards.

Note: If you want to use WinAnsiEncoding on UNIX, do not use this method. Use PDEFontCreateFromSysFontWithParams() or PDEFontCreateFromSysFontAndEncoding() instead.

Syntax

PDEFont PDEFontCreateFromSysFont(IN PDSysFont sysFont, IN ASUns32 flags);

Parameters

sysFont
A PDSysFont object referencing a system font.
flags
Indicates whether to embed the font and whether to subset the font. It must be one of PDEFontCreateFlags. If you want to subset a font, set both the kPDEFontCreateEmbedded and kPDEFontWillSubset flags.

Returns

The PDEFont corresponding to sysFont.

Exceptions

PDEFontCreateFromSysFontAndEncoding

Header: PEWProcs.h:2165

Description

Create a PDEFont from sysFont and sysEnc. If it fails, it raises an exception. User can call PDSysFontGetCreateFlags() to see if the combination of sysFont and sysEnc makes sense.

Call PDERelease() to dispose of the returned PDEFont object when finished with it.

Note: If you want to use WinAnsiEncoding on UNIX, use this method or PDEFontCreateFromSysFontWithParams().

Syntax

PDEFont PDEFontCreateFromSysFontAndEncoding(IN PDSysFont sysFont, IN PDSysEncoding sysEnc, IN ASAtom useThisBaseFont, IN ASUns32 createFlags);

Parameters

sysFont
A PDSysFont object referencing a system font.
sysEnc
A PDSysEncoding object.
useThisBaseFont
The base font. An exception will be raised if the base font name passed is a subset name (XXXXXX+FontName) or an empty string.
createFlags
One of the PDEFontCreateFlags.

Returns

The newly created PDEFont object.

PDEFontCreateFromSysFontAndEncodingInCosDoc

Header: PEWProcs.h:3073

Description

Creates a font object like PDEFontCreateFromSysFontAndEncoding(), except that the client can specify the CosDoc in which the font is created. Create a PDEFont from sysFont and sysEnc. If it fails, it raises an exception. User can call PDSysFontGetCreateFlags() to see if the combination of sysFont and sysEnc makes sense.

Call PDERelease() to dispose of the returned PDEFont object when finished with it.

Note: If you want to use WinAnsiEncoding on UNIX, use this method or PDEFontCreateFromSysFontWithParams().

Syntax

PDEFont PDEFontCreateFromSysFontAndEncodingInCosDoc(IN PDSysFont sysFont, IN PDSysEncoding sysEnc, IN ASAtom useThisBaseFont, IN ASUns32 createFlags, IN CosDoc cosDoc);

Parameters

sysFont
A PDSysFont object referencing a system font.
sysEnc
A PDSysEncoding object.
useThisBaseFont
The base font. An exception will be raised if the base font name passed is a subset name (XXXXXX+FontName) or an empty string.
createFlags
One of the PDEFontCreateFlags.
cosDoc
IN/OUT The document in which to put the Cos representation of resource. It may be NULL.

Returns

The newly created PDEFont object.

Exceptions

PDEFontCreateFromSysFontEx

Header: PEWProcs.h:1555

Description

Creates a PDEFont corresponding to a font in the system.

If the font is a Multiple Master font, mmDesignVector points to the design vector, whose length must equal the number of design axes of the font.

Call PDERelease() to dispose of the returned font object when finished with it.

The PDEFontCreateFlags flags kPDEFontCreateEmbedded and kPDEFontWillSubset must both be set in order to subset a font.

If you create a PDEFont that is subsetted, call PDEFontSubsetNow() on this font afterwards.

Syntax

PDEFont PDEFontCreateFromSysFontEx(IN PDSysFont sysFont, IN ASUns32 flags, IN ASAtom snapshotName, IN ASFixed *mmDesignVec);

Parameters

sysFont
IN/OUT A PDSysFont object referencing a system font.
flags
IN/OUT Indicates whether to embed the font and whether to subset the font. It must be one of PDEFontCreateFlags. If you want to subset a font, set both the kPDEFontCreateEmbedded and kPDEFontWillSubset flags.
snapshotName
IN/OUT The name to be associated with this particular instantiation of the PDEFont.
mmDesignVec
IN/OUT A pointer to the Multiple Master font design vector.

Returns

The PDEFont corresponding to sysFont.

Exceptions

PDEFontCreateFromSysFontExInCosDoc

Header: PEWProcs.h:3008

Description

Creates a font object like PDEFontCreateFromSysFontEx(), except that the client can specify the CosDoc in which the font is created.

If the font is a Multiple Master font, mmDesignVector points to the design vector, whose length must equal the number of design axes of the font.

Call PDERelease() to dispose of the returned font object when finished with it.

The PDEFontCreateFlags flags kPDEFontCreateEmbedded and kPDEFontWillSubset must both be set in order to subset a font.

If you create a PDEFont that is subsetted, call PDEFontSubsetNow() on this font afterwards.

Syntax

PDEFont PDEFontCreateFromSysFontExInCosDoc(IN PDSysFont sysFont, IN ASUns32 flags, IN ASAtom snapshotName, IN ASFixed *mmDesignVec, IN CosDoc cosDoc);

Parameters

sysFont
IN/OUT A PDSysFont object referencing a system font.
flags
IN/OUT Indicates whether to embed the font and whether to subset the font. It must be one of PDEFontCreateFlags. If you want to subset a font, set both the kPDEFontCreateEmbedded and kPDEFontWillSubset flags.
snapshotName
IN/OUT The name to be associated with this particular instantiation of the PDEFont.
mmDesignVec
IN/OUT A pointer to the Multiple Master font design vector.
cosDoc
IN/OUT The document in which to put the Cos representation of resource. It may be NULL.

Returns

The PDEFont corresponding to sysFont.

Exceptions

PDEFontCreateFromSysFontInCosDoc

Header: PEWProcs.h:2961

Description

Creates a font object like PDEFontCreateFromSysFont(), except that the client can specify the CosDoc in which the font is created.

Call PDERelease() to dispose of the returned font object when finished with it.

The PDEFontCreateFlags flags kPDEFontCreateEmbedded and kPDEFontWillSubset must both be set in order to subset a font.

If you create a PDEFont that is a subset, call PDEFontSubsetNow() on this font afterwards.

Note: If you want to use WinAnsiEncoding on UNIX, do not use this method. Use PDEFontCreateFromSysFontWithParams() or PDEFontCreateFromSysFontAndEncoding() instead.

Syntax

PDEFont PDEFontCreateFromSysFontInCosDoc(IN PDSysFont sysFont, IN ASUns32 flags, IN CosDoc cosDoc);

Parameters

sysFont
A PDSysFont object referencing a system font.
flags
Indicates whether to embed the font and whether to subset the font. It must be one of PDEFontCreateFlags. If you want to subset a font, set both the kPDEFontCreateEmbedded and kPDEFontWillSubset flags.
cosDoc
IN/OUT The document in which to put the Cos representation of resource. It may be NULL.

Returns

The PDEFont corresponding to sysFont.

Exceptions

PDEFontCreateFromSysFontWithParams

Header: PEWProcs.h:2040

Description

Used to obtain a PDEFont corresponding to a font in the system.

Call PDERelease() to dispose of the returned PDEFont object when finished with it.

Note: If you want to use WinAnsiEncoding on UNIX, use this method or PDEFontCreateFromSysFontAndEncoding() instead.

Syntax

PDEFont PDEFontCreateFromSysFontWithParams(IN PDSysFont sysFont, IN PDEFontCreateFromSysFontParams params);

Parameters

sysFont
The system font.
params
The parameters structure.

Returns

The newly created PDEFont object.

Exceptions

PDEFontCreateInCosDoc

Header: PEWProcs.h:2918

Description

Creates a font object like PDEFontCreate(), except that the client can specify the CosDoc in which the font is created.

The PDEFont may be represented as an embedded font (a FontFile entry in the font descriptor of the PDF file). To create a PDEFont that is stored as an embedded font, the FontFile stream may be passed in fontStm, and the len1, len2, and len3 parameters contain the Length1, Length2, and Length3 values of the FontFile stream attributes dictionary.

See the description of Embedded Font Programs in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 9.9, page 288. You can find this document on the web store of the International Standards Organization (ISO).

The caller must close fontStm with ASStmClose() after invoking PDEFontCreate().

Call PDERelease() to dispose of the returned font object when finished with it.

Syntax

PDEFont PDEFontCreateInCosDoc(IN PDEFontAttrsP attrsP, IN ASUns32 attrsSize, IN ASInt32 firstChar, IN ASInt32 lastChar, IN ASInt16 *widthsP, IN char **encoding, IN ASAtom encodingBaseName, IN ASStm fontStm, IN ASInt32 len1, IN ASInt32 len2, IN ASInt32 len3, IN CosDoc cosDoc);

Parameters

attrsP
A pointer to a PDEFontAttrs structure for the font attributes.
attrsSize
The size of the attrsP buffer in bytes.
firstChar
The first character index for the widths array, widthsP.
lastChar
The last character index for the widths array, widthsP.
widthsP
A pointer to the widths array.
encoding
An array of 256 pointers to glyph names specifying the custom encoding. If any pointer is NULL, no encoding information is written for that entry.
encodingBaseName
The encoding base name if the encoding is a custom encoding. If the encoding is NULL, encodingBaseName is used as the value of the encoding, and must be one of WinAnsiEncoding, MacRomanEncoding, or MacExpertEncoding. If no encoding value is desired, use ASAtomNull.
fontStm
The stream with font information.
len1
The length in bytes of the ASCII portion of the Type 1 font file after it has been decoded. For other font formats, such as TrueType or CFF, only len1 is used, and it is the size of the font.
len2
The length in bytes of the encrypted portion of the Type 1 font file after it has been decoded.
len3
The length in bytes of the portion of the Type 1 font file that contains the 512 zeros, plus the cleartomark operator, plus any following data.
cosDoc
IN/OUT The document in which to put the Cos representation of resource. It may be NULL.

Returns

The specified PDEFont.

Exceptions

PDEFontCreateToUnicodeNow

Header: PEWProcs.h:2220

Description

This function creates the / ToUnicode table. The user can check the return value of PDEFontGetCreateNeedFlags() to see if calling PDEFontCreateToUnicodeNow() is needed.

Syntax

void PDEFontCreateToUnicodeNow(IN PDEFont font, IN CosDoc cosDoc);

Parameters

font
IN/OUT An object of type PDEFont.
cosDoc
IN/OUT The container document.

Exceptions

PDEFontCreateWidthsNow

Header: PEWProcs.h:2207

Description

This function creates width entries for font. User can check the return value of PDEFontGetCreateNeedFlags() to see if calling PDEFontCreateWidthsNow() is needed.

Syntax

void PDEFontCreateWidthsNow(IN PDEFont font, IN CosDoc cosDoc);

Parameters

font
IN/OUT The font for which to create width entries.
cosDoc
IN/OUT The container document.

Exceptions

PDEFontCreateWithParams

Header: PEWProcs.h:1421

Description

Creates a new PDEFont from params.

The PDEFont may be represented as an embedded font (a FontFile value in PDF). To create a PDEFont that will be stored as an embedded font, the FontFile stream may be passed as fontStm, and the len1, len2, and len3 parameters contain the Length1, Length2, and Length3 values of the FontFile. The caller must close the fontStm after calling this method. This method supports multi-byte fonts.

This method extends PDEFontCreate() to support multi-byte fonts.

Call PDERelease() to dispose of the returned font object when finished with it.

Syntax

PDEFont PDEFontCreateWithParams(IN PDEFontCreateParams params);

Parameters

params
IN/OUT A pointer to a structure containing all font parameters necessary to fully define a font.

Returns

A PDEFont object of the font described by the parameters.

Exceptions

PDEFontCreateWithParamsInCosDoc

Header: PEWProcs.h:3048

Description

Creates a font object like PDEFontCreateWithParams(), except that the client can specify the CosDoc in which the font is created. Creates a new PDEFont from params.

The PDEFont may be represented as an embedded font (a FontFile value in PDF). To create a PDEFont that will be stored as an embedded font, the FontFile stream may be passed as fontStm, and the len1, len2, and len3 parameters contain the Length1, Length2, and Length3 values of the FontFile. The caller must close the fontStm after calling this method. This method supports multi-byte fonts.

This method extends PDEFontCreate() to support multi-byte fonts.

Call PDERelease() to dispose of the returned font object when finished with it.

Syntax

PDEFont PDEFontCreateWithParamsInCosDoc(IN PDEFontCreateParams params, IN CosDoc cosDoc);

Parameters

params
IN/OUT A pointer to a structure containing all font parameters necessary to fully define a font.
cosDoc
IN/OUT The document in which to put the Cos representation of resource. It may be NULL.

Returns

A PDEFont object of the font described by the parameters.

Exceptions

PDEFontEmbedNow

Header: PEWProcs.h:2194

Description

This function embeds a font stream. User can check the return value of PDEFontGetCreateNeedFlags() to see if calling PDEFontEmbedNow() is needed.

Syntax

void PDEFontEmbedNow(IN PDEFont font, IN CosDoc cosDoc);

Parameters

font
The font to embed.
cosDoc
The container document.

Exceptions

PDEFontEmbedNowDontSubset

Header: PEWProcs.h:1635

Description

Embeds the given PDEFont inside doc without creating a subset. Use this method instead of PDEFontSubsetNow() if you created the font with the willSubset flag but changed your mind.

Syntax

void PDEFontEmbedNowDontSubset(IN PDEFont font, IN CosDoc cosDoc);

Parameters

font
The font to embed.
cosDoc
The container document.

PDEFontGetAttrs

Header: PERProcs.h:1047

Description

Gets the attributes for a font object.

Note: PDEFontGetAttrs() cannot fill in the cantEmbed and protection fields. PDSysFontAttrs() can return this information to you for system fonts.

Note: PDEFontGetAttrs() fills in the fontBBox portion of the PDEFontAttrs as ASInt16 objects, even though the member says it is an ASFixedRect. Make sure to properly convert those values using ASInt16ToFixed() so that you get the proper ASFixedRect associated with that font.

Related Methods

Syntax

void PDEFontGetAttrs(IN PDEFont font, OUT PDEFontAttrsP attrsP, IN ASUns32 attrsSize);

Parameters

font
IN/OUT A PDEFont whose attributes are found.
attrsP
IN/OUT (Filled by the method) A pointer to a PDEFontAttrs structure for the font attributes.
attrsSize
IN/OUT The size of the attrsP buffer in bytes.

Exceptions

PDEFontGetCosObj

Header: PERProcs.h:1079

Description

Gets a Cos object for a PDEFont.

Related Methods

Syntax

void PDEFontGetCosObj(IN PDEFont font, OUT CosObj *cosObjP);

Parameters

font
IN/OUT A PDEFont whose Cos object is obtained.
cosObjP
IN/OUT (Filled by the method) The Cos object corresponding to font.

Exceptions

PDEFontGetCreateNeedFlags

Header: PEWProcs.h:2178

Description

This function returns flags indicating what needs to be done to make PDEFont complete. kPDEFontCreateNeedWidths can be cleared by PDEFontCreateWidthsNow(). kPDEFontCreateNeedToUnicode can be cleared by PDEFontCreateToUnicodeNow(). kPDEFontCreateNeedEmbed can be cleared by PDEFontEmbedNow().

Syntax

ASUns32 PDEFontGetCreateNeedFlags(IN PDEFont font);

Parameters

font
The font object.

Returns

A value corresponding to PDEFontCreateNeedFlags().

PDEFontGetNumCodeBytes

Header: PERProcs.h:1573

Description

Gets the number of bytes comprising the next code in a string of single or multi-byte character codes.

Syntax

ASInt16 PDEFontGetNumCodeBytes(IN PDEFont font, IN ASUns8 *text, IN ASInt32 len);

Parameters

font
IN/OUT A PDEFont object returned from one of the PDEFontCreate methods.
text
IN/OUT A pointer to a string of characters.
len
IN/OUT The length, in bytes, of the string of characters, starting with the character pointed to by text.

Returns

The number of bytes in the next character code pointed to by text.

Exceptions

PDEFontGetOneByteEncoding

Header: PERProcs.h:1801

Description

Gets an array of delta encodings for the given one byte PDEFont. For encodingDelta, see the description of encoding in the ISO 32000 document, 1.7 or 2.0. You can find this document on the web store of the International Standards Organization.

Syntax

ASBool PDEFontGetOneByteEncoding(IN PDEFont font, OUT ASAtom *encodingDelta);

Parameters

font
IN/OUT A PDEFont object returned from one of the PDEFontCreate methods.
encodingDelta
IN/OUT (Filled by the method) A pointer to an ASAtom array that is filled with the delta encodings for font. Each entry is the ASAtom for a glyph name that differs from the base encoding. For more information about font encodings see the description of Base Encoding in the Character Encoding section of the ISO 32000-1:2008, Document Management- Portable Document Format-Part 1: PDF 1.7, section 9.6.6, page 262. The array must be allocated to hold 256 entries.

Returns

true if encodingDelta is filled, false otherwise.

Exceptions

PDEFontGetSysEncoding

Header: PERProcs.h:2500

Description

Gets the system encoding object associated with a font object.

Related Methods

Syntax

PDSysEncoding PDEFontGetSysEncoding(IN PDEFont pdeFont);

Parameters

pdeFont
A PDEFont whose system encoding is found.

Returns

The system encoding object.

Exceptions

PDEFontGetSysFont

Header: PERProcs.h:2488

Description

Gets the system font object associated with a font object.

Syntax

PDSysFont PDEFontGetSysFont(IN PDEFont pdeFont);

Parameters

pdeFont
A PDEFont whose system font is found.

Returns

The system font object.

Exceptions

PDEFontGetWidths

Header: PERProcs.h:1066

Description

Gets the widths for a font object.

Related Methods

Syntax

void PDEFontGetWidths(IN PDEFont font, OUT ASInt16 *widthsP);

Parameters

font
IN/OUT A PDEFont whose widths are found.
widthsP
IN/OUT (Filled by the method) A pointer to the widths array. widthsP must have room for 256 values. The widths are returned in character space (1000 EM units). An EM is a typographic unit of measurement equal to the size of a font. To convert to text space, divide the value returned by 1000. To convert to user space, multiply the text space value by the font size.

Exceptions

PDEFontGetWidthsNow

Header: PEWProcs.h:1647

Description

Gets a Type0 font's width information for only those characters used in the file. Call this routine when the font was created with the kPDEFontDeferWidths flag but without the kPDEFontCreateEmbedded flag (if the font is to be embedded, call PDEFontSubsetNow(), which also gets the width info).

Syntax

void PDEFontGetWidthsNow(IN PDEFont font, IN CosDoc cosDoc);

Parameters

font
The font whose widths are found.
cosDoc
The container document.

PDEFontIsEmbedded

Header: PERProcs.h:2475

Description

Tests whether a font is an embedded font in the document in which it was created.

Syntax

ASBool PDEFontIsEmbedded(IN PDEFont pdeFont);

Parameters

pdeFont
A PDEFont object to test.

Returns

true if the font is embedded, false if it is not, or if it was created in one document and embedded in a different document.

PDEFontIsMultiByte

Header: PERProcs.h:1602

Description

Tests whether a font contains any multi-byte characters.

Syntax

ASBool PDEFontIsMultiByte(IN PDEFont font);

Parameters

font
IN/OUT A PDEFont object returned from one of the PDEFontCreate methods to test.

Returns

true if the font contains any multi-byte characters, false otherwise.

PDEFontSetSysEncoding

Header: PEWProcs.h:2383

Description

Sets the system encoding object associated with a font object.

Note: Changing the system encoding may produce unexpected results.

Related Methods

Syntax

void PDEFontSetSysEncoding(IN PDEFont pdeFont, IN PDSysEncoding sysEnc);

Parameters

pdeFont
A PDEFont whose system encoding is set.
sysEnc
The new system encoding object.

Exceptions

PDEFontSetSysFont

Header: PEWProcs.h:2368

Description

Sets the system font object to be used with a font object that does not currently have a system font associated with it.

Related Methods

Syntax

void PDEFontSetSysFont(IN PDEFont pdeFont, IN PDSysFont sysFont);

Parameters

pdeFont
A PDEFont whose system font is set.
sysFont
The new system font object.

Exceptions

PDEFontSubsetNow

Header: PEWProcs.h:1349

Description

Subsets a given PDEFont in a CosDoc.

If you created font with PDEFontCreateFromSysFont(), you must have set both the kPDEFontCreateEmbedded and kPDEFontWillSubset set in the flags parameter, to be able to subset the font.

Note: This method does not change the reference count.

Related Methods

Syntax

void PDEFontSubsetNow(IN PDEFont font, IN CosDoc cosDoc);

Parameters

font
IN/OUT The PDEFont to subset.
cosDoc
IN/OUT The CosDoc whose font is subsetted.

Exceptions

PDEFontSumWidths

Header: PERProcs.h:1554

Description

Gets the sum of the widths of len characters from a string of single or multi-byte characters.

Syntax

ASInt32 PDEFontSumWidths(IN PDEFont font, IN ASUns8 *text, IN ASInt32 len);

Parameters

font
A PDEFont object returned from one of the PDEFontCreate methods.
text
A pointer to a string of characters.
len
The length of string in bytes.

Returns

The width of the text string in EM space. (In EM space, the width of 'M' is about 1000 EM units).

Exceptions

PDEFontTranslateGlyphIdsToUnicode

Header: PEWProcs.h:2058

Description

Translates a string to Unicode values. The PDEFont must have a / ToUnicode table.

Syntax

ASUns32 PDEFontTranslateGlyphIdsToUnicode(IN PDEFont font, IN ASUns8 *text, IN ASUns32 textLen, OUT ASUns8 *unicodeStr, IN ASUns32 size);

Parameters

font
IN/OUT The font.
text
IN/OUT The string to convert.
textLen
IN/OUT The length of text in bytes.
unicodeStr
IN/OUT (Filled by the method) A buffer to hold the translated string.
size
IN/OUT The size of the unicodeStr buffer.

Returns

0 if the string was successfully translated. If unicodeStr is too small for the translated string, it returns the number of bytes required.

Exceptions

PDEReleaseSpan

Header: PEWProcs.h:2702

Description

Releases a PDESpan object that is returned by PDEFontAddGlyphs().

Related Methods

Syntax

void PDEReleaseSpan(IN PDESpanSetP pdeSpan);

Exceptions