Class IFUtil
java.lang.Object
org.apache.fop.render.intermediate.IFUtil
Utility functions for the intermediate format.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
adjustPA
(int[] paDst, int[] paSrc) Adjust a position adjustments array.static int[]
convertDPToDX
(int[][] dp) Convert the general gpos 'dp' adjustments to the older 'dx' adjustments.static int[]
convertDPToDX
(int[][] dp, int count) Convert the general gpos 'dp' adjustments to the older 'dx' adjustments.static int[][]
convertDXToDP
(int[] dx) Convert the general gpos 'dp' adjustments to the older 'dx' adjustments.static int[][]
convertDXToDP
(int[] dx, int count) Convert the general gpos 'dp' adjustments to the older 'dx' adjustments.static int[][]
copyDP
(int[][] dp, int offset, int count) Copy entries from position adjustments.static String
getEffectiveMIMEType
(IFDocumentHandler documentHandler) Returns the MIME type of the output format that the given document handler is supposed to handle.static boolean
isDPIdentity
(int[][] dp) Determine if position adjustments is the identity adjustment, i.e., no non-zero adjustment.static boolean
isDPOnlyDX
(int[][] dp) Determine if position adjustments comprises only DX adjustments as encoded byconvertDPToDX(int[][], int)
.static boolean
isPAIdentity
(int[] pa) Determine if position adjustment is the identity adjustment, i.e., no non-zero adjustment.static void
setupFonts
(IFDocumentHandler documentHandler) Sets up the fonts on a document handler.static void
setupFonts
(IFDocumentHandler documentHandler, FontInfo fontInfo) Sets up the fonts on a document handler.static String
toString
(int[] coordinates) Converts an array of integer coordinates into a space-separated string.static String
toString
(AffineTransform transform) Converts anAffineTransform
instance to an SVG style transform method.static String
toString
(AffineTransform[] transforms) Converts anAffineTransform
array to an SVG style transform method sequence.static StringBuffer
toString
(AffineTransform[] transforms, StringBuffer sb) Converts anAffineTransform
array to an SVG style transform method sequence.static StringBuffer
toString
(AffineTransform transform, StringBuffer sb) Converts anAffineTransform
instance to an SVG style transform method.static String
Converts a rectangle into a space-separated string.
-
Method Details
-
toString
Converts anAffineTransform
instance to an SVG style transform method.- Parameters:
transform
- the transformation matrixsb
- the StringBuffer to write the transform method to- Returns:
- the StringBuffer passed to this method
-
toString
Converts anAffineTransform
array to an SVG style transform method sequence.- Parameters:
transforms
- the transformation matrix arraysb
- the StringBuffer to write the transform method sequence to- Returns:
- the StringBuffer passed to this method
-
toString
Converts anAffineTransform
array to an SVG style transform method sequence.- Parameters:
transforms
- the transformation matrix array- Returns:
- the formatted array
-
toString
Converts anAffineTransform
instance to an SVG style transform method.- Parameters:
transform
- the transformation matrix- Returns:
- the formatted array
-
toString
Converts an array of integer coordinates into a space-separated string.- Parameters:
coordinates
- the coordinates- Returns:
- the space-separated array of coordinates
-
toString
Converts a rectangle into a space-separated string.- Parameters:
rect
- the rectangle- Returns:
- the space-separated array of coordinates
-
setupFonts
public static void setupFonts(IFDocumentHandler documentHandler, FontInfo fontInfo) throws FOPException Sets up the fonts on a document handler. If the document handler provides a configurator object the configuration from theFopFactory
will be used. Otherwise, a default font configuration will be set up.- Parameters:
documentHandler
- the document handlerfontInfo
- the font info object (may be null)- Throws:
FOPException
- if an error occurs while setting up the fonts
-
setupFonts
Sets up the fonts on a document handler. If the document handler provides a configurator object the configuration from theFopFactory
will be used. Otherwise, a default font configuration will be set up.- Parameters:
documentHandler
- the document handler- Throws:
FOPException
- if an error occurs while setting up the fonts
-
getEffectiveMIMEType
Returns the MIME type of the output format that the given document handler is supposed to handle. If the document handler is anIFSerializer
it returns the MIME type of the document handler it is mimicking.- Parameters:
documentHandler
- the document handler- Returns:
- the effective MIME type
-
convertDPToDX
public static int[] convertDPToDX(int[][] dp, int count) Convert the general gpos 'dp' adjustments to the older 'dx' adjustments. This utility method is used to provide backward compatibility in implementations of IFPainter that have not yet been upgraded to the general position adjustments format.- Parameters:
dp
- an array of 4-tuples, expressing [X,Y] placment adjustments and [X,Y] advancement adjustments, in that order (may be null)count
- ifdp
is not null, then a count of dp values to convert- Returns:
- if
dp
is not null, then an array of adjustments to the current x position prior to rendering individual glyphs; otherwise, null
-
convertDPToDX
public static int[] convertDPToDX(int[][] dp) Convert the general gpos 'dp' adjustments to the older 'dx' adjustments. This utility method is used to provide backward compatibility in implementations of IFPainter that have not yet been upgraded to the general position adjustments format.- Parameters:
dp
- an array of 4-tuples, expressing [X,Y] placment adjustments and [X,Y] advancement adjustments, in that order (may be null)- Returns:
- if
dp
is not null, then an array of adjustments to the current x position prior to rendering individual glyphs; otherwise, null
-
convertDXToDP
public static int[][] convertDXToDP(int[] dx, int count) Convert the general gpos 'dp' adjustments to the older 'dx' adjustments. This utility method is used to provide backward compatibility in implementations of IFPainter that have not yet been upgraded to the general position adjustments format.- Parameters:
dx
- an array of adjustments to the current x position prior to rendering individual glyphs or nullcount
- ifdx
is not null, then a count of dx values to convert- Returns:
- if
dx
is not null, then an array of 4-tuples, expressing [X,Y] placment adjustments and [X,Y] advancement adjustments, in that order; otherwise, null
-
convertDXToDP
public static int[][] convertDXToDP(int[] dx) Convert the general gpos 'dp' adjustments to the older 'dx' adjustments. This utility method is used to provide backward compatibility in implementations of IFPainter that have not yet been upgraded to the general position adjustments format.- Parameters:
dx
- an array of adjustments to the current x position prior to rendering individual glyphs or null- Returns:
- if
dx
is not null, then an array of 4-tuples, expressing [X,Y] placment adjustments and [X,Y] advancement adjustments, in that order; otherwise, null
-
isPAIdentity
public static boolean isPAIdentity(int[] pa) Determine if position adjustment is the identity adjustment, i.e., no non-zero adjustment.- Parameters:
pa
- a 4-tuple, expressing [X,Y] placment and [X,Y] advance adjuustments (may be null)- Returns:
- true if
dp
is null or contains no non-zero adjustment
-
isDPIdentity
public static boolean isDPIdentity(int[][] dp) Determine if position adjustments is the identity adjustment, i.e., no non-zero adjustment.- Parameters:
dp
- an array of 4-tuples, expressing [X,Y] placment adjustments and [X,Y] advancement adjustments, in that order (may be null)- Returns:
- true if
dp
is null or contains no non-zero adjustment
-
isDPOnlyDX
public static boolean isDPOnlyDX(int[][] dp) Determine if position adjustments comprises only DX adjustments as encoded byconvertDPToDX(int[][], int)
. Note that if given a set of all all zero position adjustments, both this method andisDPIdentity(int[][])
will return true; however, this method may return true whenisDPIdentity(int[][])
returns false.- Parameters:
dp
- an array of 4-tuples, expressing [X,Y] placment adjustments and [X,Y] advancement adjustments, in that order (may be null)- Returns:
- true if
dp
is not null and contains only xPlaAdjust and xAdvAdjust values consistent with the output ofconvertDPToDX(int[][], int)
.
-
adjustPA
public static void adjustPA(int[] paDst, int[] paSrc) Adjust a position adjustments array. If bothpaDst
andpaSrc
are non-null, thenpaSrc[i]
is added topaDst[i]
.- Parameters:
paDst
- a 4-tuple, expressing [X,Y] placment and [X,Y] advance adjuustments (may be null)paSrc
- a 4-tuple, expressing [X,Y] placment and [X,Y] advance adjuustments (may be null)
-
copyDP
public static int[][] copyDP(int[][] dp, int offset, int count) Copy entries from position adjustments.- Parameters:
dp
- an array of 4-tuples, expressing [X,Y] placment adjustments and [X,Y] advancement adjustments, in that orderoffset
- starting offset from which to copycount
- number of entries to copy- Returns:
- a deep copy of the count position adjustment entries start at offset
-