|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.font.config.RegisteredFont
public class RegisteredFont
Class representing a font that has been registered for use with FOray. RegisteredFont is not really a Font, as it is not part of the Font hierarcy (i.e. it does not subclass Font). It is really the bridge between the font configuration and the actual Font classes. It first encapsulates the information from the "font" element in the font-configuration. During font resolution, a RegisteredFontDesc element (representing a "font-description" element in font-configuration) is selected, which in turn points to RegisteredFont instance. It then, as requested, converts that information into actual Font instances that can be used by the client application.
It is tempting to question why this separate class is needed. Because fonts can be registered from several sources (hard-coded, font configuration, operating system registration, and directly by the client application), a separate registry concept ensures that all of the registered fonts can be managed, even though they may not have been parsed yet. It is good to not parse the font until it is known to be necessary. Note that the data stored in RegisteredFont corresponds to the data passed in the <font> element of the font configuration file. Data from the actual font file itself tends to be stored in FreeStandingFont or one of its subclasses.
Field Summary | |
---|---|
static String[] |
STANDARD_PDF_FONT_NAMES
Array of the base-14 font names. |
Constructor Summary | |
---|---|
RegisteredFont(FontServer4a server,
String fontName,
DataSource fontFileSource,
DataSource metricsFileSource,
String ttcName,
org.axsl.font.Font.Embedding embedding,
String systemName)
Constructor useful for registering a Font that has not yet been read. |
|
RegisteredFont(FontServer4a server,
String fontID,
String fontFileDescription,
byte[] fontFileContents,
String metricsFileDescription,
byte[] metricsFileContents,
String collectionID,
org.axsl.font.Font.Embedding embedding,
String systemName)
Constructor useful for registering a font whose contents have been extracted from a document. |
Method Summary | |
---|---|
FontParser |
createFontFileReader()
Creates a font file reader for this registered font. |
Type1MetricsParser |
createMetricsFileReader()
Creates a metrics file reader for this registered font. |
Font4a |
getBestFont()
Returns the FreeStandingFont linked to this registered font, if it exists, or the
System font if no FreeStandingFont exists. |
String |
getConfiguredFontName()
Returns the configured font name. |
FontServer4a |
getFontServer()
Returns the parent font server. |
FreeStandingFont |
getFreeStandingFont()
Returns the FreeStandingFont manifestation of this font. |
org.apache.commons.logging.Log |
getLogger()
Returns the logger. |
Panose |
getPanose()
Returns the Panose instance, if any, that should be used to evaluate this font description. |
org.axsl.ps.PsServer |
getPsServer()
Returns the PostScript server, which is used to make instances of certain classes needed for parsing. |
URL |
getSerializedMetricsFile()
Returns the serialized metrics file. |
SystemFont |
getSystemFont()
Returns the SystemFont manifestation of this font. |
String |
getSystemName()
Returns the system name for this registerered font. |
String |
getTTCName()
Return the registered TrueType collection name that should be used to access this font within a TTC file. |
boolean |
hasFontContent()
Indicates whether this can return the content of the font. |
boolean |
hasFreeStandingFont()
Indicates whether a FreeStandingFont manifestation of this registered font exists. |
boolean |
hasSystemFont()
Indicates whether a SystemFont manifestation of this registered font exists. |
boolean |
isEmbedding()
Indicates whether this font should be embedded. |
boolean |
isSubsetting()
Indicates whether this font should be subsetted. |
protected void |
setSerializedMetricsFile(URL serializedMetricsFile)
Sets the serialized metrics file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String[] STANDARD_PDF_FONT_NAMES
Constructor Detail |
---|
public RegisteredFont(FontServer4a server, String fontName, DataSource fontFileSource, DataSource metricsFileSource, String ttcName, org.axsl.font.Font.Embedding embedding, String systemName) throws org.axsl.font.FontException
server
- The parent font server.fontName
- The name of the font.fontFileSource
- The source of the font file, if any.metricsFileSource
- The source of the metrics file, if any.ttcName
- The font name to be used within a TrueType Collection file
to select the proper font.embedding
- Indicates whether and how much of the font should be
embedded.systemName
- A non-null value indicates that this font can manifest
itself as a SystemFont.
org.axsl.font.FontException
- For an error during font registration.public RegisteredFont(FontServer4a server, String fontID, String fontFileDescription, byte[] fontFileContents, String metricsFileDescription, byte[] metricsFileContents, String collectionID, org.axsl.font.Font.Embedding embedding, String systemName) throws org.axsl.font.FontException
server
- The parent font server.fontID
- A unique ID for this font (e.g. "Courier-Bold").fontFileDescription
- A description of the font file. This is used primarily in user messages.fontFileContents
- Byte array containing the font file contents.metricsFileDescription
- A description of the metrics file. This is used primarily in user messages.metricsFileContents
- Byte array containing the metrics contents.
This is always null for TrueType and OpenType fonts.collectionID
- For TrueType collections, indicates which font in the collection corresponds to this font.embedding
- One of "none", "all", or "subset", indicating whether this font should be embedded in output
documents.systemName
- For system fonts only, this is the name that should be supplied to the operating system font
registry to obtain the font from it. For other fonts, set this to null.
org.axsl.font.FontException
- If a font with this fontID
is already registered.Method Detail |
---|
public FontParser createFontFileReader() throws org.axsl.font.FontException
org.axsl.font.FontException
- For errors opening the font file reader.public Type1MetricsParser createMetricsFileReader() throws org.axsl.font.FontException
org.axsl.font.FontException
- For errors opening the metrics file reader.public FreeStandingFont getFreeStandingFont()
FreeStandingFont
manifestation of this font.
FreeStandingFont
manifestation, if any, of this
RegisteredFont.public SystemFont getSystemFont()
SystemFont
manifestation of this font.
public String getSystemName()
public String getTTCName()
public FontServer4a getFontServer()
public org.apache.commons.logging.Log getLogger()
getLogger
in interface FontParserClient
public String getConfiguredFontName()
public boolean isEmbedding()
public boolean isSubsetting()
public boolean hasFontContent()
public boolean hasFreeStandingFont()
public boolean hasSystemFont()
public Panose getPanose()
public URL getSerializedMetricsFile()
protected void setSerializedMetricsFile(URL serializedMetricsFile)
serializedMetricsFile
- The new serialized metrics file.public Font4a getBestFont()
FreeStandingFont
linked to this registered font, if it exists, or the
System font if no FreeStandingFont exists.
public org.axsl.ps.PsServer getPsServer()
FontParserClient
getPsServer
in interface FontParserClient
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |