org.foray.font
Class Font4a

java.lang.Object
  extended by org.foray.font.Font4a
All Implemented Interfaces:
org.axsl.font.Font
Direct Known Subclasses:
FreeStandingFont, SystemFont

public abstract class Font4a
extends Object
implements org.axsl.font.Font

An implementation of the aXSL Font4a interface.


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
 
Fields inherited from interface org.axsl.font.Font
INVALID_STRING, NORMAL_STRING
 
Constructor Summary
protected Font4a(RegisteredFont rf)
          Constructor.
 
Method Summary
 org.axsl.font.Font.Baseline baseline(String script)
           
 int baselineOffset(org.axsl.font.Font.WritingMode writingMode, org.axsl.font.Font.Baseline baselineType, int fontSize)
           
 int estimateBaseline(org.axsl.font.Font.WritingMode writingMode, org.axsl.font.Font.Baseline baselineType, int fontSize)
          Provides reasonable estimates of the various baseline values for the font, based on other font metrics.
abstract  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.
abstract  int getAscender(int fontSize)
           
abstract  Font getAwtFont(int fontSize)
           
abstract  int getCapHeight(int fontSize)
           
abstract  org.axsl.ps.CharSet getCharSet()
          Returns the character set used by this font.
abstract  int getDefaultWidth()
           
abstract  int getDescender(int fontSize)
           
 int getEstimatedOverlinePosition(int fontSize)
          Returns the estimate of the appropriate overline position, in millipoints.
 int getEstimatedOverlineSize(int fontSize)
          Returns the estimate of the appropriate overline thickness, in millipoints.
protected  int getEstimatedStrikeoutPosition(int fontSize)
          Returns the estimate of the appropriate strikeout position, in millipoints.
protected  int getEstimatedStrikeoutSize(int fontSize)
          Returns the estimate of the appropriate strikeout size, in millipoints.
 int getEstimatedUnderlinePosition(int fontSize)
          Returns the estimate of the appropriate underline position, in millipoints.
 int getEstimatedUnderlineSize(int fontSize)
          Returns the estimate of the appropriate underline size, in millipoints.
abstract  org.axsl.font.Font.Format getFontFormat()
           
abstract  org.axsl.ps.Encoding getInternalEncoding()
           
abstract  float getItalicAngle()
           
protected abstract  Kerning getKerning()
          Returns the kerning for this font.
 org.apache.commons.logging.Log getLogger()
          Return the logger.
abstract  int getNumGlyphs()
          Returns the number of glyphs in this font.
 RegisteredFont getRegisteredFont()
          Return the parent registered font.
abstract  int getStemV()
           
abstract  int getUnitsPerTextSpaceUnit()
          Returns the units per text-space unit that is used in this font for internal font measurements.
abstract  int getXHeight(int fontSize)
           
abstract  boolean glyphAvailable(int c)
          Reports on the availability of a glyph in this font, without regard to encoding issues.
abstract  boolean isEmbeddable()
           
abstract  boolean isPdfStandardFont()
           
abstract  boolean isSubsettable()
           
 int kern(int glyphIndex1, int glyphIndex2)
           
abstract  boolean kerningActive()
          Reports whether kerning information should be used for this font.
 boolean kerningAvailable()
          Reports whether the font actually contains any kerning information.
abstract  int metricIndex(int codePoint)
          For a given Unicode code point index, returns the metric index.
 float normalLineHeightFactor(org.axsl.font.Font.LineHeightAlgorithm algorithm)
           
 int subscriptShift(int fontSize)
           
 int superscriptShift(int fontSize)
           
abstract  boolean supportsUnicode()
          Indicates whether this font has the ability to map Unicode characters to font glyphs.
abstract  boolean usableInPostScriptOutput()
           
 int width(org.axsl.common.IntSequence word, int offset, int length, int fontSize, int letterSpacing, int wordSpacing, org.axsl.font.FontOptions requestedFontOptions, org.axsl.common.i18n.Orthography orthography)
           
 int widthEstimate(int c, int fontSize)
           
abstract  int widthUndefinedGlyph(int fontSize)
          Returns the width of the undefined or missing glyph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.axsl.font.Font
getFamilyName, getFontComplexity, getFontName, getPanose, getPostscriptName, overlinePosition, overlineSize, strikeoutPosition, strikeoutSize, underlinePosition, underlineSize, width
 

Constructor Detail

Font4a

protected Font4a(RegisteredFont rf)
Constructor.

Parameters:
rf - The parent registered font.
Method Detail

getAscender

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

getDescender

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

getCapHeight

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

getXHeight

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

widthEstimate

public int widthEstimate(int c,
                         int fontSize)
Specified by:
widthEstimate in interface org.axsl.font.Font

width

public int width(org.axsl.common.IntSequence word,
                 int offset,
                 int length,
                 int fontSize,
                 int letterSpacing,
                 int wordSpacing,
                 org.axsl.font.FontOptions requestedFontOptions,
                 org.axsl.common.i18n.Orthography orthography)
Specified by:
width in interface org.axsl.font.Font

isEmbeddable

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

isSubsettable

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

getAwtFont

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

usableInPostScriptOutput

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

getInternalEncoding

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

getFontFormat

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

getKerning

protected abstract Kerning getKerning()
Returns the kerning for this font.

Returns:
The kerning for this font.

kerningAvailable

public boolean kerningAvailable()
Reports whether the font actually contains any kerning information.

Returns:
True if the font has kerning information, false otherwise.

kerningActive

public abstract boolean kerningActive()
Reports whether kerning information should be used for this font.

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

kern

public int kern(int glyphIndex1,
                int glyphIndex2)
Specified by:
kern in interface org.axsl.font.Font

widthUndefinedGlyph

public abstract int widthUndefinedGlyph(int fontSize)
Returns the width of the undefined or missing glyph.

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 abstract boolean glyphAvailable(int c)
Reports on the availability of a glyph in this font, without regard to encoding issues.

Parameters:
c - The Unicode code point to be tested.
Returns:
True iff this font can paint a glyph for c.

getItalicAngle

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

getStemV

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

getDefaultWidth

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

isPdfStandardFont

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

getRegisteredFont

public RegisteredFont getRegisteredFont()
Return the parent registered font.

Returns:
The registered font.

getLogger

public org.apache.commons.logging.Log getLogger()
Return the logger.

Returns:
The logger.

getNumGlyphs

public abstract int getNumGlyphs()
Returns the number of glyphs in this font.

Returns:
The number of glyphs in this font.

getCharSet

public abstract org.axsl.ps.CharSet getCharSet()
Returns the character set used by this font.

Returns:
The character set for this font.

normalLineHeightFactor

public float normalLineHeightFactor(org.axsl.font.Font.LineHeightAlgorithm algorithm)
Specified by:
normalLineHeightFactor in interface org.axsl.font.Font

baselineOffset

public int baselineOffset(org.axsl.font.Font.WritingMode writingMode,
                          org.axsl.font.Font.Baseline baselineType,
                          int fontSize)
Specified by:
baselineOffset in interface org.axsl.font.Font

extractBaseline

public abstract 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.

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.

estimateBaseline

public int estimateBaseline(org.axsl.font.Font.WritingMode writingMode,
                            org.axsl.font.Font.Baseline baselineType,
                            int fontSize)
Provides reasonable estimates of the various baseline values for the font, based on other font metrics.

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 estimated value of the baseline.

baseline

public org.axsl.font.Font.Baseline baseline(String script)
Specified by:
baseline in interface org.axsl.font.Font

getEstimatedUnderlineSize

public int getEstimatedUnderlineSize(int fontSize)
Returns the estimate of the appropriate underline size, in millipoints.

Parameters:
fontSize - The font size for which the underline size should be computed.
Returns:
The estimated underline size.

getEstimatedUnderlinePosition

public int getEstimatedUnderlinePosition(int fontSize)
Returns the estimate of the appropriate underline position, in millipoints.

Parameters:
fontSize - The font size for which the underline position should be computed.
Returns:
The estimated underline position.

getEstimatedOverlineSize

public int getEstimatedOverlineSize(int fontSize)
Returns the estimate of the appropriate overline thickness, in millipoints.

Parameters:
fontSize - The font size for which the overline thickness should be computed.
Returns:
The estimated overline thickness.

getEstimatedOverlinePosition

public int getEstimatedOverlinePosition(int fontSize)
Returns the estimate of the appropriate overline position, in millipoints.

Parameters:
fontSize - The font size for which the overline position should be computed.
Returns:
The estimated overline position.

getEstimatedStrikeoutSize

protected int getEstimatedStrikeoutSize(int fontSize)
Returns the estimate of the appropriate strikeout size, in millipoints.

Parameters:
fontSize - The font size for which the strikeout size should be computed.
Returns:
The estimated strikeout size.

getEstimatedStrikeoutPosition

protected int getEstimatedStrikeoutPosition(int fontSize)
Returns the estimate of the appropriate strikeout position, in millipoints.

Parameters:
fontSize - The font size for which the strikeout position should be computed.
Returns:
The estimated strikeout position.

subscriptShift

public int subscriptShift(int fontSize)
Specified by:
subscriptShift in interface org.axsl.font.Font

superscriptShift

public int superscriptShift(int fontSize)
Specified by:
superscriptShift in interface org.axsl.font.Font

getUnitsPerTextSpaceUnit

public abstract int getUnitsPerTextSpaceUnit()
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.

Returns:
The units per text-space unit used by this font.

supportsUnicode

public abstract boolean supportsUnicode()
Indicates whether this font has the ability to map Unicode characters to font glyphs.

Returns:
True iff this font can map Unicode characters to font glyphs.

metricIndex

public abstract int metricIndex(int codePoint)
For a given Unicode code point index, returns the metric index.

Parameters:
codePoint - The Unicode code point to be converted.
Returns:
The metric index.


Copyright © 2017. All rights reserved.