org.apache.fop.render.ps

## Class NativeTextHandler

- java.lang.Object
- - org.apache.fop.render.ps.NativeTextHandler

- All Implemented Interfaces:
    org.apache.xmlgraphics.java2d.ps.PSTextHandler, org.apache.xmlgraphics.java2d.TextHandler

      public class NativeTextHandler
      extends Object
      implements org.apache.xmlgraphics.java2d.ps.PSTextHandler

  Specialized TextHandler implementation that the PSGraphics2D class delegates to to paint text using PostScript text operations.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `currentFontName` the current (internal) font name
    `protected int` | `currentFontSize` the current font size in millipoints
    `protected Font` | `font` Currently valid Font
    `protected FontInfo` | `fontInfo` FontInfo containing all available fonts
    `protected Font` | `overrideFont` Overriding FontState

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NativeTextHandler(org.apache.xmlgraphics.java2d.ps.PSGraphics2D g2d, FontInfo fontInfo)` Main constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `drawString(Graphics2D g, String s, float x, float y)` Draw a string to the PostScript document.
    `FontInfo` | `getFontInfo()` Return the font information associated with this object
    `void` | `setOverrideFont(Font override)` Sets the overriding font.
    `void` | `writePageSetup()`
    `void` | `writeSetup()`

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

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

- - ### Field Detail

    - #### fontInfo

          protected FontInfo fontInfo

      FontInfo containing all available fonts

    - #### font

          protected Font font

      Currently valid Font

    - #### overrideFont

          protected Font overrideFont

      Overriding FontState

    - #### currentFontName

          protected String currentFontName

      the current (internal) font name

    - #### currentFontSize

          protected int currentFontSize

      the current font size in millipoints

  - ### Constructor Detail

    - #### NativeTextHandler

          public NativeTextHandler(org.apache.xmlgraphics.java2d.ps.PSGraphics2D g2d,
                                   FontInfo fontInfo)

      Main constructor.
      Parameters:
        `g2d` - the PSGraphics2D instance this instances is used by
        `fontInfo` - the FontInfo object with all available fonts

  - ### Method Detail

    - #### getFontInfo

          public FontInfo getFontInfo()

      Return the font information associated with this object
      Returns:
        the FontInfo object

    - #### writeSetup

          public void writeSetup()
                          throws IOException

      Specified by:
        `writeSetup` in interface `org.apache.xmlgraphics.java2d.ps.PSTextHandler`
      Throws:
        `IOException`

    - #### writePageSetup

          public void writePageSetup()
                              throws IOException

      Specified by:
        `writePageSetup` in interface `org.apache.xmlgraphics.java2d.ps.PSTextHandler`
      Throws:
        `IOException`

    - #### drawString

          public void drawString(Graphics2D g,
                                 String s,
                                 float x,
                                 float y)
                          throws IOException

      Draw a string to the PostScript document. The text is painted using text operations.
      Specified by:
        `drawString` in interface `org.apache.xmlgraphics.java2d.TextHandler`
      Throws:
        `IOException`

    - #### setOverrideFont

          public void setOverrideFont(Font override)

      Sets the overriding font.
      Parameters:
        `override` - Overriding Font to set

Copyright © 2023 Apache Software Foundation. All rights reserved.