org.apache.fop.render.ps.fonts

## Class PSTTFGenerator

- java.lang.Object
- - org.apache.fop.render.ps.fonts.PSTTFGenerator

-     public class PSTTFGenerator
      extends java.lang.Object

  This is a wrapper for `PSGenerator` that contains some members specific for streaming TrueType fonts to a PostScript document.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `MAX_BUFFER_SIZE` The buffer is used to store the font file in an array of hex-encoded strings.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PSTTFGenerator(org.apache.xmlgraphics.ps.PSGenerator gen)` Creates a new instance wrapping the given generator.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `endString()` Finishes writing a string by appending '00' and '>' to the end.
    `void` | `startString()` Writes the '<' character that starts a string.
    `void` | `streamBytes(byte[] byteArray, int offset, int length)` Writes bytes from the given byte array to the output.
    `void` | `write(java.lang.String cmd)` Writes the given string to the output.
    `void` | `writeln(java.lang.String cmd)` Writes the given string to the output, followed by a newline.

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

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

- - ### Field Detail

    - #### MAX_BUFFER_SIZE

          public static final int MAX_BUFFER_SIZE

      The buffer is used to store the font file in an array of hex-encoded strings. Strings are limited to 65535 characters, string will start with a newline, 2 characters are needed to hex-encode each byte.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PSTTFGenerator

          public PSTTFGenerator(org.apache.xmlgraphics.ps.PSGenerator gen)

      Creates a new instance wrapping the given generator.
      Parameters:
        `gen` - the PSGenerator to wrap

  - ### Method Detail

    - #### startString

          public void startString()
                           throws java.io.IOException

      Writes the '<' character that starts a string.
      Throws:
        `java.io.IOException`

    - #### write

          public void write(java.lang.String cmd)
                     throws java.io.IOException

      Writes the given string to the output.
      Parameters:
        `cmd` - a string
      Throws:
        `java.io.IOException`

    - #### writeln

          public void writeln(java.lang.String cmd)
                       throws java.io.IOException

      Writes the given string to the output, followed by a newline.
      Parameters:
        `cmd` - a string
      Throws:
        `java.io.IOException`

    - #### streamBytes

          public void streamBytes(byte[] byteArray,
                                  int offset,
                                  int length)
                           throws java.io.IOException

      Writes bytes from the given byte array to the output.
      Parameters:
        `byteArray` - byte[] a byte array
        `offset` - the position in the byte array where the streaming must start
        `length` - the number of bytes to stream. This MUST be less than `MAX_BUFFER_SIZE` - 1 since strings are suffixed by '00' (see Section 4.2 of Adobe Technical Note #5012, The Type 42 Font Format Specification.).
      Throws:
        `java.io.IOException`

    - #### endString

          public void endString()
                         throws java.io.IOException

      Finishes writing a string by appending '00' and '>' to the end.
      Throws:
        `java.io.IOException`

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