public class

TrueTypeFont

extends FileFont
java.lang.Object
   ↳ sun.font.Font2D
     ↳ sun.font.PhysicalFont
       ↳ sun.font.FileFont
         ↳ sun.font.TrueTypeFont

Class Overview

TrueTypeFont is not called SFntFont because it is not expected to handle all types that may be housed in a such a font file. If additional types are supported later, it may make sense to create an SFnt superclass. Eg to handle sfnt-housed postscript fonts. OpenType fonts are handled by this class, and possibly should be represented by a subclass. An instance stores some information from the font file to faciliate faster access. File size, the table directory and the names of the font are the most important of these. It amounts to approx 400 bytes for a typical font. Systems with mutiple locales sometimes have up to 400 font files, and an app which loads all font files would need around 160Kbytes. So storing any more info than this would be expensive.

Summary

Constants
int EBLCTag
short ENGLISH_LOCALE_ID
int FAMILY_NAME_ID
int FULL_NAME_ID
int GDEFTag
int GPOSTag
int GSUBTag
int MS_PLATFORM_ID
int POSTSCRIPT_NAME_ID
int cmapTag
int fdscTag
int featTag
int fvarTag
int gaspTag
int glyfTag
int headTag
int hheaTag
int hmtxTag
int locaTag
int maxpTag
int mortTag
int nameTag
int os_2Tag
int ottoTag
int postTag
int reserved_bits1
int reserved_bits2
int trueTag
int ttcfTag
int v1ttTag
[Expand]
Inherited Constants
From class sun.font.Font2D
[Expand]
Inherited Fields
From class sun.font.FileFont
From class sun.font.PhysicalFont
From class sun.font.Font2D
Public Methods
String getFamilyName(Locale locale)
int getFontCount()
String getFontName(Locale locale)
String getFullName()
CharToGlyphMapper getMapper()
String getPostscriptName()
void getStyleMetrics(float pointSize, float[] metrics, int offset)
The length of the metrics array must be >= offset+4, and offset must be >= 0.
boolean hasSupplementaryChars()
String toString()
Returns a string representation of the object.
boolean useAAForPtSize(int ptsize)
Protected Methods
boolean checkUseNatives()
synchronized void close()
synchronized FontScaler getScaler()
void init(int fIndex)
void initAllNames(int requestedID, HashSet names)
void initNames()
String lookupName(short findLocaleID, int findNameID)
void setStyle()
[Expand]
Inherited Methods
From class sun.font.FileFont
From class sun.font.PhysicalFont
From class sun.font.Font2D
From class java.lang.Object

Constants

public static final int EBLCTag

Constant Value: 1161972803 (0x45424c43)

public static final short ENGLISH_LOCALE_ID

Constant Value: 1033 (0x00000409)

public static final int FAMILY_NAME_ID

Constant Value: 1 (0x00000001)

public static final int FULL_NAME_ID

Constant Value: 4 (0x00000004)

public static final int GDEFTag

Constant Value: 1195656518 (0x47444546)

public static final int GPOSTag

Constant Value: 1196445523 (0x47504f53)

public static final int GSUBTag

Constant Value: 1196643650 (0x47535542)

public static final int MS_PLATFORM_ID

Constant Value: 3 (0x00000003)

public static final int POSTSCRIPT_NAME_ID

Constant Value: 6 (0x00000006)

public static final int cmapTag

Constant Value: 1668112752 (0x636d6170)

public static final int fdscTag

Constant Value: 1717859171 (0x66647363)

public static final int featTag

Constant Value: 1717920116 (0x66656174)

public static final int fvarTag

Constant Value: 1719034226 (0x66766172)

public static final int gaspTag

Constant Value: 1734439792 (0x67617370)

public static final int glyfTag

Constant Value: 1735162214 (0x676c7966)

public static final int headTag

Constant Value: 1751474532 (0x68656164)

public static final int hheaTag

Constant Value: 1751672161 (0x68686561)

public static final int hmtxTag

Constant Value: 1752003704 (0x686d7478)

public static final int locaTag

Constant Value: 1819239265 (0x6c6f6361)

public static final int maxpTag

Constant Value: 1835104368 (0x6d617870)

public static final int mortTag

Constant Value: 1836020340 (0x6d6f7274)

public static final int nameTag

Constant Value: 1851878757 (0x6e616d65)

public static final int os_2Tag

Constant Value: 1330851634 (0x4f532f32)

public static final int ottoTag

Constant Value: 1330926671 (0x4f54544f)

public static final int postTag

Constant Value: 1886352244 (0x706f7374)

public static final int reserved_bits1

Constant Value: -2147483648 (0x80000000)

public static final int reserved_bits2

Constant Value: 65535 (0x0000ffff)

public static final int trueTag

Constant Value: 1953658213 (0x74727565)

public static final int ttcfTag

Constant Value: 1953784678 (0x74746366)

public static final int v1ttTag

Constant Value: 65536 (0x00010000)

Public Methods

public String getFamilyName (Locale locale)

public int getFontCount ()

Returns
  • number of logical fonts. Is "1" for all but TTC files

public String getFontName (Locale locale)

public String getFullName ()

public CharToGlyphMapper getMapper ()

public String getPostscriptName ()

public void getStyleMetrics (float pointSize, float[] metrics, int offset)

The length of the metrics array must be >= offset+4, and offset must be >= 0. Typically offset is 4. This method will store the following elements in that array before returning: metrics[off+0]: strikethrough offset metrics[off+1]: strikethrough thickness metrics[off+2]: underline offset metrics[off+3]: underline thickness Note that this implementation simply returns default values; subclasses can override this method to provide more accurate values.

public boolean hasSupplementaryChars ()

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
  • a string representation of the object.

public boolean useAAForPtSize (int ptsize)

Protected Methods

protected boolean checkUseNatives ()

protected synchronized void close ()

protected synchronized FontScaler getScaler ()

protected void init (int fIndex)

protected void initAllNames (int requestedID, HashSet names)

protected void initNames ()

protected String lookupName (short findLocaleID, int findNameID)

protected void setStyle ()