Package org.apache.fop.render.rtf
Class FoUnitsConverter
- java.lang.Object
-
- org.apache.fop.render.rtf.FoUnitsConverter
-
final class FoUnitsConverter extends java.lang.ObjectConverts XSL-FO units to RTF units.
This work was originally developed by Bertrand Delacretaz (bdelacretaz@codeconsult.ch).
-
-
Field Summary
Fields Modifier and Type Field Description static floatCM_TO_TWIPSstatic floatIN_TO_TWIPSmillimeters and centimeters to twips: , one point is 1/72 of an inch, one inch is 25.4 mmprivate static FoUnitsConverterINSTANCEstatic floatMM_TO_TWIPSstatic floatPOINT_TO_TWIPSpoints to twips: 1 twip is 1/20 of a pointprivate static java.util.MapTWIP_FACTORSconversion factors keyed by xsl:fo units names
-
Constructor Summary
Constructors Modifier Constructor Description privateFoUnitsConverter()singleton pattern
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intconvertFontSize(java.lang.String size)convert a font size given in points like "12pt"floatconvertMptToTwips(int width)(package private) floatconvertToTwips(java.lang.String foValue)convert given value to RTF units(package private) static FoUnitsConvertergetInstance()singleton patternprivate floatnumberToTwips(java.lang.String number, java.lang.String units)convert given value to twips according to given units
-
-
-
Field Detail
-
INSTANCE
private static final FoUnitsConverter INSTANCE
-
POINT_TO_TWIPS
public static final float POINT_TO_TWIPS
points to twips: 1 twip is 1/20 of a point- See Also:
- Constant Field Values
-
IN_TO_TWIPS
public static final float IN_TO_TWIPS
millimeters and centimeters to twips: , one point is 1/72 of an inch, one inch is 25.4 mm- See Also:
- Constant Field Values
-
MM_TO_TWIPS
public static final float MM_TO_TWIPS
- See Also:
- Constant Field Values
-
CM_TO_TWIPS
public static final float CM_TO_TWIPS
- See Also:
- Constant Field Values
-
TWIP_FACTORS
private static final java.util.Map TWIP_FACTORS
conversion factors keyed by xsl:fo units names
-
-
Method Detail
-
getInstance
static FoUnitsConverter getInstance()
singleton pattern
-
convertToTwips
float convertToTwips(java.lang.String foValue) throws FOPExceptionconvert 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
private float numberToTwips(java.lang.String number, java.lang.String units) throws FOPExceptionconvert given value to twips according to given units- Throws:
FOPException
-
convertFontSize
int convertFontSize(java.lang.String size) throws FOPExceptionconvert a font size given in points like "12pt"- Throws:
FOPException
-
convertMptToTwips
public float convertMptToTwips(int width)
-
-