happypdf / CustomFontSubsetEmbedder
Class: CustomFontSubsetEmbedder
Defined in: src/core/embedders/CustomFontSubsetEmbedder.ts:23
A note of thanks to the developers of https://github.com/foliojs/pdfkit, as this class borrows from: https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/jpeg.coffee
Extends
Properties
baseFontName
protected baseFontName: string;Defined in: src/core/embedders/CustomFontEmbedder.ts:65
Inherited from
CustomFontEmbedder.baseFontName
customName
readonly customName: string | undefined;Defined in: src/core/embedders/CustomFontEmbedder.ts:62
Inherited from
font
readonly font: Font;Defined in: src/core/embedders/CustomFontEmbedder.ts:58
Inherited from
fontData
readonly fontData: Uint8Array;Defined in: src/core/embedders/CustomFontEmbedder.ts:60
Inherited from
fontFeatures
readonly fontFeatures: TypeFeatures | undefined;Defined in: src/core/embedders/CustomFontEmbedder.ts:63
Inherited from
CustomFontEmbedder.fontFeatures
fontName
readonly fontName: string;Defined in: src/core/embedders/CustomFontEmbedder.ts:61
Inherited from
glyphCache
protected glyphCache: Cache<Glyph[]>;Defined in: src/core/embedders/CustomFontEmbedder.ts:66
Inherited from
scale
readonly scale: number;Defined in: src/core/embedders/CustomFontEmbedder.ts:59
Inherited from
Methods
computeWidths()
protected computeWidths(): (number | number[])[];Defined in: src/core/embedders/CustomFontEmbedder.ts:259
Returns
(number | number[])[]
Inherited from
CustomFontEmbedder.computeWidths
embedCIDFontDict()
protected embedCIDFontDict(context): Promise<PDFRef>;Defined in: src/core/embedders/CustomFontSubsetEmbedder.ts:112
Parameters
| Parameter | Type |
|---|---|
context | PDFContext |
Returns
Promise<PDFRef>
Overrides
CustomFontEmbedder.embedCIDFontDict
embedFontDescriptor()
protected embedFontDescriptor(context): Promise<PDFRef>;Defined in: src/core/embedders/CustomFontEmbedder.ts:205
Parameters
| Parameter | Type |
|---|---|
context | PDFContext |
Returns
Promise<PDFRef>
Inherited from
CustomFontEmbedder.embedFontDescriptor
embedFontDict()
protected embedFontDict(context, ref?): Promise<PDFRef>;Defined in: src/core/embedders/CustomFontEmbedder.ts:157
Parameters
| Parameter | Type |
|---|---|
context | PDFContext |
ref? | PDFRef |
Returns
Promise<PDFRef>
Inherited from
CustomFontEmbedder.embedFontDict
embedFontStream()
protected embedFontStream(context): Promise<PDFRef>;Defined in: src/core/embedders/CustomFontEmbedder.ts:237
Parameters
| Parameter | Type |
|---|---|
context | PDFContext |
Returns
Promise<PDFRef>
Inherited from
CustomFontEmbedder.embedFontStream
embedIntoContext()
embedIntoContext(context, ref?): Promise<PDFRef>;Defined in: src/core/embedders/CustomFontEmbedder.ts:151
Parameters
| Parameter | Type |
|---|---|
context | PDFContext |
ref? | PDFRef |
Returns
Promise<PDFRef>
Inherited from
CustomFontEmbedder.embedIntoContext
embedUnicodeCmap()
protected embedUnicodeCmap(context): PDFRef;Defined in: src/core/embedders/CustomFontEmbedder.ts:244
Parameters
| Parameter | Type |
|---|---|
context | PDFContext |
Returns
Inherited from
CustomFontEmbedder.embedUnicodeCmap
encodeText()
encodeText(text): PDFHexString;Defined in: src/core/embedders/CustomFontSubsetEmbedder.ts:76
Encode the JavaScript string into this font. (JavaScript encodes strings in Unicode, but embedded fonts use their own custom encodings)
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
Overrides
for()
static for(
fontDataOrFontkit,
fontDataOrCustomName?,
customNameOrFeatures?,
fontFeaturesOrVariations?,
fontVariations?): Promise<CustomFontSubsetEmbedder>;Defined in: src/core/embedders/CustomFontSubsetEmbedder.ts:24
Parameters
| Parameter | Type |
|---|---|
fontDataOrFontkit | unknown |
fontDataOrCustomName? | string | Uint8Array<ArrayBufferLike> |
customNameOrFeatures? | string | TypeFeatures |
fontFeaturesOrVariations? | TypeFeatures | FontVariations |
fontVariations? | FontVariations |
Returns
Promise<CustomFontSubsetEmbedder>
Overrides
glyphCountOfText()
glyphCountOfText(text): number;Defined in: src/core/embedders/CustomFontEmbedder.ts:115
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
number
Inherited from
CustomFontEmbedder.glyphCountOfText
glyphId()
protected glyphId(glyph?): number;Defined in: src/core/embedders/CustomFontSubsetEmbedder.ts:133
Parameters
| Parameter | Type |
|---|---|
glyph? | Glyph |
Returns
number
Overrides
heightOfFontAtSize()
heightOfFontAtSize(size, options?): number;Defined in: src/core/embedders/CustomFontEmbedder.ts:128
Parameters
| Parameter | Type |
|---|---|
size | number |
options | { descender?: boolean; } |
options.descender? | boolean |
Returns
number
Inherited from
CustomFontEmbedder.heightOfFontAtSize
isCFF()
protected isCFF(): boolean;Defined in: src/core/embedders/CustomFontSubsetEmbedder.ts:108
Returns
boolean
Overrides
layout()
protected layout(text): {
glyphs: Glyph[];
positions: GlyphPosition[];
};Defined in: src/core/embedders/CustomFontEmbedder.ts:254
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
{
glyphs: Glyph[];
positions: GlyphPosition[];
}glyphs
glyphs: Glyph[];positions
positions: GlyphPosition[];Inherited from
serializeFont()
protected serializeFont(): Promise<Uint8Array<ArrayBufferLike>>;Defined in: src/core/embedders/CustomFontSubsetEmbedder.ts:137
Returns
Promise<Uint8Array<ArrayBufferLike>>
Overrides
CustomFontEmbedder.serializeFont
sizeOfFontAtHeight()
sizeOfFontAtHeight(height): number;Defined in: src/core/embedders/CustomFontEmbedder.ts:144
Parameters
| Parameter | Type |
|---|---|
height | number |
Returns
number
Inherited from
CustomFontEmbedder.sizeOfFontAtHeight
widthOfTextAtSize()
widthOfTextAtSize(text, size): number;Defined in: src/core/embedders/CustomFontEmbedder.ts:122
Parameters
| Parameter | Type |
|---|---|
text | string |
size | number |
Returns
number