de.vc.jfo.tools

## Class FontMappingRule

- java.lang.Object
- - de.vc.jfo.tools.FontMappingRule

- All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable

      public class FontMappingRule
      extends java.lang.Object
      implements java.lang.Comparable, java.lang.Cloneable

  A font mapping rule provides information how a certain font is mapped to another target font including character transodings.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FontMappingRule(java.lang.String fontName, java.lang.String foName)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearTranscoding()` Clears all character transcoding rules.
    `java.lang.Object` | `clone()` Clones this rule.
    `int` | `compareTo(java.lang.Object o)`
    `java.lang.String` | `getInputFont()` Gets the input font/pattern.
    `int` | `getLineHeight()` Gets the default line height (percentage) applied to paragraphs (fo:block).
    `java.lang.String` | `getOutputFont()` Gets the output font.
    `boolean` | `hasTranscodings()` Returns true if this mapping rule contains character transcoding rules.
    `void` | `logMapping()` Writes out info about this rule through logger (INFO).
    `boolean` | `matches(java.lang.String fontName)` Tests if `fontName` matches the input font/pattern.
    `void` | `setInputFont(java.lang.String name)` Sets the input font/pattern.
    `void` | `setLineHeight(int lineHeight)` Sets the default line height (percentage) or disables line height.
    `void` | `setOutputFont(java.lang.String name)` Sets the output font.
    `void` | `setTranscoding(char in, char out)` Sets the transcoding for a single character
    `void` | `setTranscoding(int offset, java.lang.String hexTokens)` Sets the transcoding for a bunch of characters.
    `char` | `transcodeChar(char c)` Transcodes a single character.
    `java.lang.String` | `transcodeChars(java.lang.String s)` Transcodes characters of a complete String.

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

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

- - ### Constructor Detail

    - #### FontMappingRule

          public FontMappingRule(java.lang.String fontName,
                         java.lang.String foName)

  - ### Method Detail

    - #### matches

          public boolean matches(java.lang.String fontName)

      Tests if `fontName` matches the input font/pattern.
      Parameters:
        `fontName` - Input font (e.g. of RTF).
      Returns:
        true, if this rule applies to given font.

    - #### getInputFont

          public java.lang.String getInputFont()

      Gets the input font/pattern.
      Returns:
        String

    - #### setInputFont

          public void setInputFont(java.lang.String name)

      Sets the input font/pattern.
      Parameters:
        `name` - String

    - #### getOutputFont

          public java.lang.String getOutputFont()

      Gets the output font.
      Returns:
        Output font.

    - #### setOutputFont

          public void setOutputFont(java.lang.String name)

      Sets the output font.
      Parameters:
        `name` - Font name.

    - #### transcodeChar

          public char transcodeChar(char c)

      Transcodes a single character.
      Parameters:
        `c` - char
      Returns:
        char

    - #### transcodeChars

          public java.lang.String transcodeChars(java.lang.String s)

      Transcodes characters of a complete String.
      Parameters:
        `s` - String
      Returns:
        String with transcoded characters.

    - #### setTranscoding

          public void setTranscoding(char in,
                            char out)

      Sets the transcoding for a single character
      Parameters:
        `in` - Input character.
        `out` - Output character.

    - #### setTranscoding

          public void setTranscoding(int offset,
                            java.lang.String hexTokens)

      Sets the transcoding for a bunch of characters.
      For example setTranscoding(32,"AF, FFEF,BB") would add transcoding rules 32->0xAF, 33->0xFFEF and 34->0xBB.
      Parameters:
        `offset` - Unicode of first input character in hexTokens.
        `hexTokens` - List of output characters, encoded hexadecimal, separeted by a comma (,).

    - #### hasTranscodings

          public boolean hasTranscodings()

      Returns true if this mapping rule contains character transcoding rules.
      Returns:
        boolean

    - #### clearTranscoding

          public void clearTranscoding()

      Clears all character transcoding rules.

    - #### clone

          public java.lang.Object clone()
                                 throws java.lang.CloneNotSupportedException

      Clones this rule.
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        Object
      Throws:
        `java.lang.CloneNotSupportedException`

    - #### compareTo

          public int compareTo(java.lang.Object o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable`

    - #### logMapping

          public void logMapping()

      Writes out info about this rule through logger (INFO).

    - #### getLineHeight

          public int getLineHeight()

      Gets the default line height (percentage) applied to paragraphs (fo:block). A font mapping rule may contain another line height for a certain font.
      Returns:
        Line height (percentage) or LINE_HEIGHT_NONE or LINE_HEIGHT_DEFAULT.
      See Also:
        `FontMapper.LINE_HEIGHT_NONE`, `FontMapper.LINE_HEIGHT_DEFAULT`

    - #### setLineHeight

          public void setLineHeight(int lineHeight)

      Sets the default line height (percentage) or disables line height.
      Parameters:
        `lineHeight` - Line height (percentage) or LINE_HEIGHT_NONE or LINE_HEIGHT_DEFAULT
      See Also:
        `FontMapper.LINE_HEIGHT_NONE`, `FontMapper.LINE_HEIGHT_DEFAULT`

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.