TrueTypeFont

Overview

TrueTypeFont is a class in Aspose.PDF FOSS for Java. Inherits from: PdfFont.

TrueType font (/Subtype /TrueType) - ISO 32000-1:2008, 9.6.3.

This class provides 15 methods for working with TrueTypeFont objects in Java programs. Available methods include: TrueTypeFont, decode, fromDictionary, getBaseFont, getEncoding, getFontDescriptor, getFontDictionary, getFontMetrics, getToUnicode, getTrueTypeReader, getWidth, glyphOutlineForCode, and 3 additional methods. All public members are accessible to any Java application after installing the Aspose.PDF FOSS for Java package. Properties: baseFont, composite, encoding, fontDescriptor, fontDictionary, fontMetrics, and 2 more.

Properties

NameTypeAccessDescription
trueTypeReaderTrueTypeReaderReadReturns the TrueTypeReader if the font program was loaded.
baseFontStringReadReturns the base font name (/BaseFont).
encodingFontEncodingReadReturns the font encoding.
toUnicodeToUnicodeCMapReadReturns the ToUnicode CMap.
fontDescriptorFontDescriptorReadReturns the font descriptor.
compositebooleanReadReturns {@code true} when this is a Type0 composite font whose
content-stream encoding uses multi-byte character codes (e.g.
fontMetricsFontMetricsReadReturns the font metrics.
fontDictionaryPdfDictionaryReadReturns the underlying font dictionary.

Methods

SignatureDescription
TrueTypeFont(fontDict: PdfDictionary, parser: PDFParser)Creates a TrueTypeFont from a font dictionary.
decode(charCodes: byte[])String
getWidth(charCode: int)double
getTrueTypeReader()TrueTypeReaderReturns the TrueTypeReader if the font program was loaded.
resolveGlyphId(code: int)intMaps a character code to a glyph id in the embedded program, following the
TrueType glyph-selection rules of ISO 32000-1:2008 §9.6.6.4:
  1. symbolic font with no explicit /Encoding → embedde | | `glyphOutlineForCode(code: int)` → `java.awt.geom.GeneralPath` | Returns the em-normalised, Y-up outline of the glyph selected by {@link #resolveGlyphId(int)} for the given character code, or {@code null} when no embedded program is present or the glyph cannot be resolved. | | `hasExplicitEncoding()` → `boolean` | Returns true if the font dictionary carries an explicit /Encoding (a base-encoding name or an encoding dictionary). | | `getBaseFont()` → `String` | Returns the base font name (/BaseFont). | | `getEncoding()` → `FontEncoding` | Returns the font encoding. | | `getToUnicode()` → `ToUnicodeCMap` | Returns the ToUnicode CMap. | | `getFontDescriptor()` → `FontDescriptor` | Returns the font descriptor. | | `isComposite()` → `boolean` | Returns {@code true} when this is a Type0 composite font whose content-stream encoding uses multi-byte character codes (e.g. | | `getFontMetrics()` → `FontMetrics` | Returns the font metrics. | | `getFontDictionary()` → `PdfDictionary` | Returns the underlying font dictionary. | | `fromDictionary(fontDict: PdfDictionary, parser: PDFParser)` → `PdfFont` | Creates the appropriate PdfFont subclass from a font dictionary. |

    See Also

 English