org.apache.fop.render.intermediate

## Class IFUtil

- java.lang.Object
- - org.apache.fop.render.intermediate.IFUtil

-     public final class IFUtil
      extends java.lang.Object

  Utility functions for the intermediate format.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static 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 java.lang.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 by `convertDPToDX(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 java.lang.String` | `toString(java.awt.geom.AffineTransform transform)` Converts an `AffineTransform` instance to an SVG style transform method.
    `static java.lang.String` | `toString(java.awt.geom.AffineTransform[] transforms)` Converts an `AffineTransform` array to an SVG style transform method sequence.
    `static java.lang.StringBuffer` | `toString(java.awt.geom.AffineTransform[] transforms, java.lang.StringBuffer sb)` Converts an `AffineTransform` array to an SVG style transform method sequence.
    `static java.lang.StringBuffer` | `toString(java.awt.geom.AffineTransform transform, java.lang.StringBuffer sb)` Converts an `AffineTransform` instance to an SVG style transform method.
    `static java.lang.String` | `toString(int[] coordinates)` Converts an array of integer coordinates into a space-separated string.
    `static java.lang.String` | `toString(java.awt.Rectangle rect)` Converts a rectangle into a space-separated string.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### toString

          public static java.lang.StringBuffer toString(java.awt.geom.AffineTransform transform,
                                                        java.lang.StringBuffer sb)

      Converts an `AffineTransform` instance to an SVG style transform method.
      Parameters:
        `transform` - the transformation matrix
        `sb` - the StringBuffer to write the transform method to
      Returns:
        the StringBuffer passed to this method

    - #### toString

          public static java.lang.StringBuffer toString(java.awt.geom.AffineTransform[] transforms,
                                                        java.lang.StringBuffer sb)

      Converts an `AffineTransform` array to an SVG style transform method sequence.
      Parameters:
        `transforms` - the transformation matrix array
        `sb` - the StringBuffer to write the transform method sequence to
      Returns:
        the StringBuffer passed to this method

    - #### toString

          public static java.lang.String toString(java.awt.geom.AffineTransform[] transforms)

      Converts an `AffineTransform` array to an SVG style transform method sequence.
      Parameters:
        `transforms` - the transformation matrix array
      Returns:
        the formatted array

    - #### toString

          public static java.lang.String toString(java.awt.geom.AffineTransform transform)

      Converts an `AffineTransform` instance to an SVG style transform method.
      Parameters:
        `transform` - the transformation matrix
      Returns:
        the formatted array

    - #### toString

          public static java.lang.String toString(int[] coordinates)

      Converts an array of integer coordinates into a space-separated string.
      Parameters:
        `coordinates` - the coordinates
      Returns:
        the space-separated array of coordinates

    - #### toString

          public static java.lang.String toString(java.awt.Rectangle rect)

      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 the `FopFactory` will be used. Otherwise, a default font configuration will be set up.
      Parameters:
        `documentHandler` - the document handler
        `fontInfo` - the font info object (may be null)
      Throws:
        `FOPException` - if an error occurs while setting up the fonts

    - #### setupFonts

          public static void setupFonts(IFDocumentHandler documentHandler)
                                 throws FOPException

      Sets up the fonts on a document handler. If the document handler provides a configurator object the configuration from the `FopFactory` 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

          public static java.lang.String getEffectiveMIMEType(IFDocumentHandler documentHandler)

      Returns the MIME type of the output format that the given document handler is supposed to handle. If the document handler is an `IFSerializer` 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` - if `dp` 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 null
        `count` - if `dx` 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 by `convertDPToDX(int[][], int)`. Note that if given a set of all all zero position adjustments, both this method and `isDPIdentity(int[][])` will return true; however, this method may return true when `isDPIdentity(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 of `convertDPToDX(int[][], int)`.

    - #### adjustPA

          public static void adjustPA(int[] paDst,
                                      int[] paSrc)

      Adjust a position adjustments array. If both `paDst` and `paSrc` are non-null, then `paSrc[i]` is added to `paDst[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 order
        `offset` - starting offset from which to copy
        `count` - number of entries to copy
      Returns:
        a deep copy of the count position adjustment entries start at offset

Copyright 1999-2015 The Apache Software Foundation. All Rights Reserved.