Package org.apache.fop.render.rtf
Class FoUnitsConverter
java.lang.Object
org.apache.fop.render.rtf.FoUnitsConverter
Converts XSL-FO units to RTF units.
This work was originally developed by Bertrand Delacretaz (bdelacretaz@codeconsult.ch).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
static final float
millimeters and centimeters to twips: , one point is 1/72 of an inch, one inch is 25.4 mmprivate static final FoUnitsConverter
static final float
static final float
points to twips: 1 twip is 1/20 of a pointprivate static final Map
conversion factors keyed by xsl:fo units names -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) int
convertFontSize
(String size) convert a font size given in points like "12pt"float
convertMptToTwips
(int width) (package private) float
convertToTwips
(String foValue) convert given value to RTF units(package private) static FoUnitsConverter
singleton patternprivate float
numberToTwips
(String number, String units) convert given value to twips according to given units
-
Field Details
-
INSTANCE
-
POINT_TO_TWIPS
public static final float POINT_TO_TWIPSpoints to twips: 1 twip is 1/20 of a point- See Also:
-
IN_TO_TWIPS
public static final float IN_TO_TWIPSmillimeters and centimeters to twips: , one point is 1/72 of an inch, one inch is 25.4 mm- See Also:
-
MM_TO_TWIPS
public static final float MM_TO_TWIPS- See Also:
-
CM_TO_TWIPS
public static final float CM_TO_TWIPS- See Also:
-
TWIP_FACTORS
conversion factors keyed by xsl:fo units names
-
-
Constructor Details
-
FoUnitsConverter
private FoUnitsConverter()singleton pattern
-
-
Method Details
-
getInstance
singleton pattern -
convertToTwips
convert given value to RTF units- Parameters:
foValue
- a value like "12mm" TODO: tested with "mm" units only, needs work to comply with FO spec Why does it search for period instead of simply breaking last two Characters into another units string? - Chris- Throws:
FOPException
-
numberToTwips
convert given value to twips according to given units- Throws:
FOPException
-
convertFontSize
convert a font size given in points like "12pt"- Throws:
FOPException
-
convertMptToTwips
public float convertMptToTwips(int width)
-