Class RtfDestinationFontTable
- java.lang.Object
-
- com.lowagie.text.rtf.parser.destinations.RtfDestination
-
- com.lowagie.text.rtf.parser.destinations.RtfDestinationFontTable
-
public final class RtfDestinationFontTable extends RtfDestination
RtfDestinationFontTablehandles data destined for the font table destination- Since:
- 2.0.8
- Author:
- Howard Shank (hgshank@yahoo.com)
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringcharsetThe \charset valueprivate static java.lang.StringCHARSET_DEFAULTprivate java.lang.StringcpgThe \cpg valueprivate java.lang.StringfaltThe \falt alternate font if primary font is not available.private intfbiasThe \fbias valueprivate java.lang.StringfontembThe \falt alternate font if primary font is not available.private java.lang.StringfontFamilyThe family of the font being parsed.private java.lang.StringfontFileThe \falt alternate font if primary font is not available.private java.lang.StringfontFileCpgThe \falt alternate font if primary font is not available.private java.util.HashMapfontMapConvert font mapping toFontFactoryfont objects.private java.lang.StringfontNameThe name of the font being parsed.private java.lang.StringfontNrThe number of the font being parsed.private java.lang.StringfontTypeThe \falt alternate font if primary font is not available.private intfprqThe \fprqprivate RtfImportMgrimportHeaderThe RtfImportHeader to add font mappings to.private java.lang.StringnontaggednameThe \*\fnameprivate java.lang.StringpanoseThe \*\panose font matching value if primary font is not available.private static intSETTING_ALTERNATE\faltprivate static intSETTING_FONT_EMBED\fontembprivate static intSETTING_FONT_FILE\ffileprivate static intSETTING_FONTNAME\fnameprivate static intSETTING_NORMALNormalprivate static intSETTING_PANOSE\panoseprivate intstatestate flag to handle different parsing of a font elementprivate java.lang.StringthemeFontThe theme (Office 2007)private java.lang.StringtrueTypeThe \fnil, \fttruetype value-
Fields inherited from class com.lowagie.text.rtf.parser.destinations.RtfDestination
lastCtrlWord, modified, rtfParser
-
-
Constructor Summary
Constructors Constructor Description RtfDestinationFontTable()ConstructorRtfDestinationFontTable(RtfParser parser)Constructs a new RtfFontTableParser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancloseDestination()Clean up when destination is closed.private Fontcreatefont(java.lang.String fontName)Create a font via theFontFactoryprivate java.util.PropertiesgetEnvironmentVariables()Utility method to load the environment variables.FontgetFont(java.lang.String key)Get aFontobject from the font map objectbooleanhandleCharacter(int ch)Handle text for this destinationbooleanhandleCloseGroup()Clean up when group is closed.booleanhandleControlWord(RtfCtrlWordData ctrlWordData)Handle control word for this destinationbooleanhandleOpenGroup()Setup when group is opened.booleanhandleOpeningSubGroup()Handle a new subgroup contained within this groupprivate voidimportSystemFonts()Load system fonts into the staticFontFactoryobjectprivate voidinit(boolean importFonts)Initialize the object.private voidprocessFont()Process the font information that was parsed from the input.voidsetBias(java.lang.String value)Set the font biasvoidsetCharset(java.lang.String charset)Set the character-set to the parsed value.voidsetCodePage(java.lang.String value)Set the code pagevoidsetFontAlternate(java.lang.String fontAlternate)Set the alternate font name.voidsetFontFamily(java.lang.String fontFamily)Set the font family to the parsed value.voidsetFontName(java.lang.String fontName)Set the font name to the parsed value.voidsetFontNumber(java.lang.String fontNr)Set the font number to the parsed value.voidsetParser(RtfParser parser)Set the parser to use with the RtfDestination object.voidsetPitch(java.lang.String value)Set the font pitchvoidsetThemeFont(java.lang.String themeFont)Set the font themevoidsetToDefaults()Method to set this object to the default values.voidsetTrueType(java.lang.String value)Set the TrueTtype type-
Methods inherited from class com.lowagie.text.rtf.parser.destinations.RtfDestination
addListener, afterCharacter, afterCtrlWord, beforeCharacter, beforeCtrlWord, getNewTokeniserState, isModified, onCharacter, onCloseGroup, onCtrlWord, onOpenGroup, removeListener
-
-
-
-
Field Detail
-
importHeader
private RtfImportMgr importHeader
The RtfImportHeader to add font mappings to.
-
themeFont
private java.lang.String themeFont
The theme (Office 2007)
-
fontNr
private java.lang.String fontNr
The number of the font being parsed.
-
fontFamily
private java.lang.String fontFamily
The family of the font being parsed.
-
charset
private java.lang.String charset
The \charset value
-
CHARSET_DEFAULT
private static final java.lang.String CHARSET_DEFAULT
- See Also:
- Constant Field Values
-
fprq
private int fprq
The \fprq
-
panose
private java.lang.String panose
The \*\panose font matching value if primary font is not available.
-
nontaggedname
private java.lang.String nontaggedname
The \*\fname
-
fontName
private java.lang.String fontName
The name of the font being parsed.
-
falt
private java.lang.String falt
The \falt alternate font if primary font is not available.
-
fontemb
private java.lang.String fontemb
The \falt alternate font if primary font is not available.
-
fontType
private java.lang.String fontType
The \falt alternate font if primary font is not available.
-
fontFile
private java.lang.String fontFile
The \falt alternate font if primary font is not available.
-
fontFileCpg
private java.lang.String fontFileCpg
The \falt alternate font if primary font is not available.
-
fbias
private int fbias
The \fbias value
-
cpg
private java.lang.String cpg
The \cpg value
-
trueType
private java.lang.String trueType
The \fnil, \fttruetype value
-
state
private int state
state flag to handle different parsing of a font element
-
SETTING_NORMAL
private static final int SETTING_NORMAL
Normal- See Also:
- Constant Field Values
-
SETTING_ALTERNATE
private static final int SETTING_ALTERNATE
\falt- See Also:
- Constant Field Values
-
SETTING_FONTNAME
private static final int SETTING_FONTNAME
\fname- See Also:
- Constant Field Values
-
SETTING_PANOSE
private static final int SETTING_PANOSE
\panose- See Also:
- Constant Field Values
-
SETTING_FONT_EMBED
private static final int SETTING_FONT_EMBED
\fontemb- See Also:
- Constant Field Values
-
SETTING_FONT_FILE
private static final int SETTING_FONT_FILE
\ffile- See Also:
- Constant Field Values
-
fontMap
private java.util.HashMap fontMap
Convert font mapping toFontFactoryfont objects.
-
-
Constructor Detail
-
RtfDestinationFontTable
public RtfDestinationFontTable()
Constructor
-
RtfDestinationFontTable
public RtfDestinationFontTable(RtfParser parser)
Constructs a new RtfFontTableParser.- Parameters:
parser- an RtfParser.- Since:
- 2.0.8
-
-
Method Detail
-
setParser
public void setParser(RtfParser parser)
Description copied from class:RtfDestinationSet the parser to use with the RtfDestination object.- Overrides:
setParserin classRtfDestination- Parameters:
parser- The RtfParser object.
-
init
private void init(boolean importFonts)
Initialize the object.- Parameters:
importFonts- true to import the fonts into the FontFactory, false do not load fonts- Since:
- 2.0.8
-
handleOpeningSubGroup
public boolean handleOpeningSubGroup()
Description copied from class:RtfDestinationHandle a new subgroup contained within this group- Specified by:
handleOpeningSubGroupin classRtfDestination- Returns:
- true if handled, false if not handled
-
closeDestination
public boolean closeDestination()
Description copied from class:RtfDestinationClean up when destination is closed.- Specified by:
closeDestinationin classRtfDestination- Returns:
- true if handled, false if not handled
-
handleCloseGroup
public boolean handleCloseGroup()
Description copied from class:RtfDestinationClean up when group is closed.- Specified by:
handleCloseGroupin classRtfDestination- Returns:
- true if handled, false if not handled
-
handleOpenGroup
public boolean handleOpenGroup()
Description copied from class:RtfDestinationSetup when group is opened.- Specified by:
handleOpenGroupin classRtfDestination- Returns:
- true if handled, false if not handled
-
handleCharacter
public boolean handleCharacter(int ch)
Description copied from class:RtfDestinationHandle text for this destination- Specified by:
handleCharacterin classRtfDestination- Returns:
- true if handled, false if not handled
-
handleControlWord
public boolean handleControlWord(RtfCtrlWordData ctrlWordData)
Description copied from class:RtfDestinationHandle control word for this destination- Specified by:
handleControlWordin classRtfDestination- Parameters:
ctrlWordData- The control word and parameter information object- Returns:
- true if handled, false if not handled
-
setCodePage
public void setCodePage(java.lang.String value)
Set the code page- Parameters:
value- The code page value- Since:
- 2.0.8
-
setTrueType
public void setTrueType(java.lang.String value)
Set the TrueTtype type- Parameters:
value- The type- Since:
- 2.0.8
-
setPitch
public void setPitch(java.lang.String value)
Set the font pitch- Parameters:
value- Pitch value- Since:
- 2.0.8
-
setBias
public void setBias(java.lang.String value)
Set the font bias- Parameters:
value- Bias value- Since:
- 2.0.8
-
setThemeFont
public void setThemeFont(java.lang.String themeFont)
Set the font theme- Parameters:
themeFont- Theme value- Since:
- 2.0.8
-
setFontName
public void setFontName(java.lang.String fontName)
Set the font name to the parsed value.- Parameters:
fontName- The font name.- Since:
- 2.0.8
-
setFontFamily
public void setFontFamily(java.lang.String fontFamily)
Set the font family to the parsed value.- Parameters:
fontFamily- The font family.- Since:
- 2.0.8
-
setFontNumber
public void setFontNumber(java.lang.String fontNr)
Set the font number to the parsed value. This is used for mapping fonts to the new font numbers- Parameters:
fontNr- The font number.- Since:
- 2.0.8
-
setFontAlternate
public void setFontAlternate(java.lang.String fontAlternate)
Set the alternate font name.- Parameters:
fontAlternate- The falt font value- Since:
- 2.0.8
-
setCharset
public void setCharset(java.lang.String charset)
Set the character-set to the parsed value.- Parameters:
charset- The charset value- Since:
- 2.0.8
-
setToDefaults
public void setToDefaults()
Description copied from class:RtfDestinationMethod to set this object to the default values. Must be implemented in child class.- Specified by:
setToDefaultsin classRtfDestination
-
processFont
private void processFont()
Process the font information that was parsed from the input.- Since:
- 2.0.8
-
createfont
private Font createfont(java.lang.String fontName)
Create a font via theFontFactory- Parameters:
fontName- The font name to create- Returns:
- The created
Fontobject - Since:
- 2.0.8
-
getFont
public Font getFont(java.lang.String key)
Get aFontobject from the font map object- Parameters:
key- The font number to get- Returns:
- The mapped
Fontobject. - Since:
- 2.0.8
-
importSystemFonts
private void importSystemFonts()
Load system fonts into the staticFontFactoryobject- Since:
- 2.0.8
-
getEnvironmentVariables
private java.util.Properties getEnvironmentVariables() throws java.lang.ThrowableUtility method to load the environment variables.- Returns:
- Properties object with environment variable information
- Throws:
java.lang.Throwable- Since:
- 2.0.8
-
-