org.foray.font
Class SystemFont

java.lang.Object
  extended by org.foray.font.Font4a
      extended by org.foray.font.SystemFont
All Implemented Interfaces:
org.axsl.font.Font

public final class SystemFont
extends Font4a

Handles interface of system (AWT) fonts to the client application.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.axsl.font.Font
org.axsl.font.Font.Baseline, org.axsl.font.Font.Complexity, org.axsl.font.Font.Embedding, org.axsl.font.Font.Format, org.axsl.font.Font.LineHeightAlgorithm, org.axsl.font.Font.SelectionStrategy, org.axsl.font.Font.Stretch, org.axsl.font.Font.Style, org.axsl.font.Font.Variant, org.axsl.font.Font.Weight, org.axsl.font.Font.WritingMode
 
Field Summary
static int INITIAL_FONT_SIZE
          Standard initial font size used for metric measurements, until the font size is adjusted.
static String[] LOGICAL_FONT_FAMILIES
          The logical font families used by AWT Fonts.
 
Fields inherited from interface org.axsl.font.Font
INVALID_STRING, NORMAL_STRING
 
Method Summary
 Font createFont()
          Attempts to create a java.awt.Font from this SystemFont.
 int extractBaseline(org.axsl.font.Font.WritingMode writingMode, org.axsl.font.Font.Baseline baselineType, int fontSize)
          Returns the font's explicit definition of the baseline, if possible.
 FreeStandingFont freeStandingFontManifestation()
          Returns the free-standing manifestation of this font.
 int getAscender(int fontSize)
           
 Font getAwtFont(int fontSize)
           
 int getCapHeight(int fontSize)
           
 org.axsl.ps.CharSet getCharSet()
          Returns the character set used by this font.
 int getDefaultWidth()
           
 int getDescender(int fontSize)
           
 String getFamilyName()
           
 org.axsl.font.Font.Complexity getFontComplexity()
           
 org.axsl.font.Font.Format getFontFormat()
           
 String getFontName()
           
 FontServer4a getFontServer()
          Convenience method returning the font server.
 Graphics2D getGraphics()
          Convenience method returning the server's graphical environment.
 org.axsl.ps.Encoding getInternalEncoding()
           
 float getItalicAngle()
           
 Kerning getKerning()
          Returns the kerning for this font.
 Font getLastAWTFont()
          Returns the last AWT font for this System Font.
 int getNumGlyphs()
          Returns the number of glyphs in this font.
 byte[] getPanose()
           
 String getPostscriptName()
           
protected  FontMetrics getSizedFont(int fontSize)
          Get the FontMetrics instance for this font, scaled to a specific point size.
 int getStemV()
           
 int getUnitsPerTextSpaceUnit()
          Returns the units per text-space unit that is used in this font for internal font measurements.
 int getXHeight(int fontSize)
           
 boolean glyphAvailable(int c)
          Reports on the availability of a glyph in this font, without regard to encoding issues.
 boolean isEmbeddable()
           
 boolean isPdfStandardFont()
           
 boolean isSubsettable()
           
 boolean kerningActive()
          Reports whether kerning information should be used for this font.
static SystemFont makeSystemFont(RegisteredFont rf)
          Factory method that creates a new SystemFont instance.
 int metricIndex(int glyphIndex)
          For a given Unicode code point index, returns the metric index.
 int overlinePosition(int fontSize)
           
 int overlineSize(int fontSize)
           
 int strikeoutPosition(int fontSize)
           
 int strikeoutSize(int fontSize)
           
 boolean supportsUnicode()
          Indicates whether this font has the ability to map Unicode characters to font glyphs.
 int underlinePosition(int fontSize)
           
 int underlineSize(int fontSize)
           
 boolean usableInPostScriptOutput()
           
 int width(int c, int size)
           
 int widthUndefinedGlyph(int fontSize)
          Returns the width of the undefined or missing glyph.
 
Methods inherited from class org.foray.font.Font4a
baseline, baselineOffset, estimateBaseline, getEstimatedOverlinePosition, getEstimatedOverlineSize, getEstimatedStrikeoutPosition, getEstimatedStrikeoutSize, getEstimatedUnderlinePosition, getEstimatedUnderlineSize, getLogger, getRegisteredFont, kern, kerningAvailable, normalLineHeightFactor, subscriptShift, superscriptShift, width, widthEstimate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGICAL_FONT_FAMILIES

public static final String[] LOGICAL_FONT_FAMILIES
The logical font families used by AWT Fonts.


INITIAL_FONT_SIZE

public static final int INITIAL_FONT_SIZE
Standard initial font size used for metric measurements, until the font size is adjusted.

See Also:
Constant Field Values
Method Detail

makeSystemFont

public static SystemFont makeSystemFont(RegisteredFont rf)
Factory method that creates a new SystemFont instance.

Parameters:
rf - The parent RegisteredFont instance.
Returns:
The new SystemFont instance.

getAscender

public int getAscender(int fontSize)
Specified by:
getAscender in interface org.axsl.font.Font
Specified by:
getAscender in class Font4a

getDescender

public int getDescender(int fontSize)
Specified by:
getDescender in interface org.axsl.font.Font
Specified by:
getDescender in class Font4a

getCapHeight

public int getCapHeight(int fontSize)
Specified by:
getCapHeight in interface org.axsl.font.Font
Specified by:
getCapHeight in class Font4a

getXHeight

public int getXHeight(int fontSize)
Specified by:
getXHeight in interface org.axsl.font.Font
Specified by:
getXHeight in class Font4a

width

public int width(int c,
                 int size)

getAwtFont

public Font getAwtFont(int fontSize)
Specified by:
getAwtFont in interface org.axsl.font.Font
Specified by:
getAwtFont in class Font4a

isEmbeddable

public boolean isEmbeddable()
Specified by:
isEmbeddable in interface org.axsl.font.Font
Specified by:
isEmbeddable in class Font4a

isSubsettable

public boolean isSubsettable()
Specified by:
isSubsettable in interface org.axsl.font.Font
Specified by:
isSubsettable in class Font4a

usableInPostScriptOutput

public boolean usableInPostScriptOutput()
Specified by:
usableInPostScriptOutput in interface org.axsl.font.Font
Specified by:
usableInPostScriptOutput in class Font4a

getFontName

public String getFontName()

getPostscriptName

public String getPostscriptName()

getInternalEncoding

public org.axsl.ps.Encoding getInternalEncoding()
Specified by:
getInternalEncoding in interface org.axsl.font.Font
Specified by:
getInternalEncoding in class Font4a

getKerning

public Kerning getKerning()
Description copied from class: Font4a
Returns the kerning for this font.

Specified by:
getKerning in class Font4a
Returns:
The kerning for this font.

getFontFormat

public org.axsl.font.Font.Format getFontFormat()
Specified by:
getFontFormat in interface org.axsl.font.Font
Specified by:
getFontFormat in class Font4a

getFamilyName

public String getFamilyName()

getFontServer

public FontServer4a getFontServer()
Convenience method returning the font server.

Returns:
The font server.

getGraphics

public Graphics2D getGraphics()
Convenience method returning the server's graphical environment.

Returns:
The graphical environment.

getItalicAngle

public float getItalicAngle()
Specified by:
getItalicAngle in interface org.axsl.font.Font
Specified by:
getItalicAngle in class Font4a

getStemV

public int getStemV()
Specified by:
getStemV in interface org.axsl.font.Font
Specified by:
getStemV in class Font4a

getDefaultWidth

public int getDefaultWidth()
Specified by:
getDefaultWidth in interface org.axsl.font.Font
Specified by:
getDefaultWidth in class Font4a

isPdfStandardFont

public boolean isPdfStandardFont()
Specified by:
isPdfStandardFont in interface org.axsl.font.Font
Specified by:
isPdfStandardFont in class Font4a

kerningActive

public boolean kerningActive()
Description copied from class: Font4a
Reports whether kerning information should be used for this font.

Specified by:
kerningActive in class Font4a
Returns:
True if both 1) kerning is available for this font, and 2) the font configuration has kerning="yes" for this font; false otherwise.

getSizedFont

protected FontMetrics getSizedFont(int fontSize)
Get the FontMetrics instance for this font, scaled to a specific point size.

Parameters:
fontSize - The size, in millipoints, of the font.
Returns:
A properly-scaled FontMetrics instance.

createFont

public Font createFont()
                throws org.axsl.font.FontException
Attempts to create a java.awt.Font from this SystemFont.

Returns:
The AWT font instance.
Throws:
org.axsl.font.FontException - If an AWT font cannot be created for this system font. This usually indicated a font registration error.

getLastAWTFont

public Font getLastAWTFont()
Returns the last AWT font for this System Font.

Returns:
The current AWT font.

widthUndefinedGlyph

public int widthUndefinedGlyph(int fontSize)
Description copied from class: Font4a
Returns the width of the undefined or missing glyph.

Specified by:
widthUndefinedGlyph in class Font4a
Parameters:
fontSize - The font size at which the width should be computed.
Returns:
The width, in millipoints, of the undefined glyph at the specified point size.

glyphAvailable

public boolean glyphAvailable(int c)
Description copied from class: Font4a
Reports on the availability of a glyph in this font, without regard to encoding issues.

Specified by:
glyphAvailable in class Font4a
Parameters:
c - The Unicode code point to be tested.
Returns:
True iff this font can paint a glyph for c.

freeStandingFontManifestation

public FreeStandingFont freeStandingFontManifestation()
Returns the free-standing manifestation of this font.

Returns:
The FreeStandingFont manifestation of this SystemFont. If there is none, return null.

getNumGlyphs

public int getNumGlyphs()
Description copied from class: Font4a
Returns the number of glyphs in this font.

Specified by:
getNumGlyphs in class Font4a
Returns:
The number of glyphs in this font.

getCharSet

public org.axsl.ps.CharSet getCharSet()
Description copied from class: Font4a
Returns the character set used by this font.

Specified by:
getCharSet in class Font4a
Returns:
The character set for this font.

extractBaseline

public int extractBaseline(org.axsl.font.Font.WritingMode writingMode,
                           org.axsl.font.Font.Baseline baselineType,
                           int fontSize)
Description copied from class: Font4a
Returns the font's explicit definition of the baseline, if possible.

Specified by:
extractBaseline in class Font4a
Parameters:
writingMode - Same as for Font.baselineOffset(Font.WritingMode, Baseline, int).
baselineType - Same as for Font.baselineOffset(Font.WritingMode, Baseline, int).
fontSize - Same as for Font.baselineOffset(Font.WritingMode, Baseline, int).
Returns:
The extracted Baseline, as described for Font.baselineOffset(Font.WritingMode, Baseline, int), if it exists. Otherwise, returns Integer.MIN_VALUE.

strikeoutSize

public int strikeoutSize(int fontSize)

strikeoutPosition

public int strikeoutPosition(int fontSize)

underlineSize

public int underlineSize(int fontSize)

underlinePosition

public int underlinePosition(int fontSize)

overlineSize

public int overlineSize(int fontSize)

overlinePosition

public int overlinePosition(int fontSize)

getPanose

public byte[] getPanose()

getFontComplexity

public org.axsl.font.Font.Complexity getFontComplexity()

getUnitsPerTextSpaceUnit

public int getUnitsPerTextSpaceUnit()
Description copied from class: Font4a
Returns the units per text-space unit that is used in this font for internal font measurements. For PostScript Type 1 fonts, this is 1000. For TrueType fonts, it is usually 2048, but can be specified in the font itself.

Specified by:
getUnitsPerTextSpaceUnit in class Font4a
Returns:
The units per text-space unit used by this font.

supportsUnicode

public boolean supportsUnicode()
Description copied from class: Font4a
Indicates whether this font has the ability to map Unicode characters to font glyphs.

Specified by:
supportsUnicode in class Font4a
Returns:
True iff this font can map Unicode characters to font glyphs.

metricIndex

public int metricIndex(int glyphIndex)
Description copied from class: Font4a
For a given Unicode code point index, returns the metric index.

Specified by:
metricIndex in class Font4a
Parameters:
glyphIndex - The Unicode code point to be converted.
Returns:
The metric index.


Copyright © 2017. All rights reserved.