org.apache.poi.hwmf.record

## Class HwmfFont

- java.lang.Object
- - org.apache.poi.hwmf.record.HwmfFont

- All Implemented Interfaces:
    FontInfo, GenericRecord
  Direct Known Subclasses:
    HemfFont

      public class HwmfFont
      extends java.lang.Object
      implements FontInfo, GenericRecord

  The Font object specifies the attributes of a logical font

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `HwmfFont.WmfClipPrecision` ClipPrecision Flags specify clipping precision, which defines how to clip characters that are partially outside a clipping region.
    `static class` | `HwmfFont.WmfFontQuality` The output quality defines how carefully to attempt to match the logical font attributes to those of an actual physical font.
    `static class` | `HwmfFont.WmfOutPrecision` The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, pitch, and font type.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected FontCharset` | `charSet` An 8-bit unsigned integer that defines the character set.
    `protected HwmfFont.WmfClipPrecision` | `clipPrecision` An 8-bit unsigned integer that defines the clipping precision.
    `protected int` | `escapement` A 16-bit signed integer that defines the angle, in tenths of degrees, between the escapement vector and the x-axis of the device.
    `protected java.lang.String` | `facename` A null-terminated string of 8-bit Latin-1 [ISO/IEC-8859-1] ANSI characters that specifies the typeface name of the font.
    `protected FontFamily` | `family` Font families specify the look of fonts in a general way and are intended for specifying fonts when the exact typeface wanted is not available.
    `protected double` | `height` A 16-bit signed integer that specifies the height, in logical units, of the font's character cell.
    `protected boolean` | `italic` A 8-bit Boolean value that specifies the italic attribute of the font.
    `protected int` | `orientation` A 16-bit signed integer that defines the angle, in tenths of degrees, between each character's base line and the x-axis of the device.
    `protected HwmfFont.WmfOutPrecision` | `outPrecision` An 8-bit unsigned integer that defines the output precision.
    `protected FontPitch` | `pitch` A property of a font that describes the pitch (MSB 2 bits)
    `protected int` | `pitchAndFamily` A PitchAndFamily object that defines the pitch and the family of the font.
    `protected HwmfFont.WmfFontQuality` | `quality` An 8-bit unsigned integer that defines the output quality.
    `protected boolean` | `strikeOut` An 8-bit Boolean value that specifies the strike out attribute of the font.
    `protected boolean` | `underline` An 8-bit Boolean value that specifies the underline attribute of the font.
    `protected int` | `weight` A 16-bit signed integer that defines the weight of the font in the range 0 through 1000.
    `protected int` | `width` A 16-bit signed integer that defines the average width, in logical units, of characters in the font.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HwmfFont()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `FontCharset` | `getCharset()`
    `HwmfFont.WmfClipPrecision` | `getClipPrecision()`
    `int` | `getEscapement()`
    `FontFamily` | `getFamily()`
    `java.util.Map<java.lang.String,java.util.function.Supplier<?>>` | `getGenericProperties()`
    `double` | `getHeight()`
    `int` | `getOrientation()`
    `HwmfFont.WmfOutPrecision` | `getOutPrecision()`
    `FontPitch` | `getPitch()`
    `int` | `getPitchAndFamily()`
    `HwmfFont.WmfFontQuality` | `getQuality()`
    `java.lang.String` | `getTypeface()`
    `int` | `getWeight()`
    `int` | `getWidth()`
    `int` | `init(LittleEndianInputStream leis, long recordSize)`
    `void` | `initDefaults()`
    `boolean` | `isItalic()`
    `boolean` | `isStrikeOut()`
    `boolean` | `isUnderline()`
    `protected int` | `readString(LittleEndianInputStream leis, java.lang.StringBuilder sb, int limit)`
    `java.lang.String` | `toString()`

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

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

    - ### Methods inherited from interface org.apache.poi.common.usermodel.fonts.FontInfo

      `getFacets, getIndex, getPanose, setCharset, setFamily, setIndex, setPanose, setPitch, setTypeface`

    - ### Methods inherited from interface org.apache.poi.common.usermodel.GenericRecord

      `getGenericChildren, getGenericRecordType`

- - ### Field Detail

    - #### height

          protected double height

      A 16-bit signed integer that specifies the height, in logical units, of the font's character cell. The character height is computed as the character cell height minus the internal leading. The font mapper SHOULD interpret the height as follows. negative value: The font mapper SHOULD transform this value into device units and match its absolute value against the character height of available fonts. zero value: A default height value MUST be used when creating a physical font. positive value: The font mapper SHOULD transform this value into device units and match it against the cell height of available fonts. For all height comparisons, the font mapper SHOULD find the largest physical font that does not exceed the requested size.

    - #### width

          protected int width

      A 16-bit signed integer that defines the average width, in logical units, of characters in the font. If Width is 0x0000, the aspect ratio of the device SHOULD be matched against the digitization aspect ratio of the available fonts to find the closest match, determined by the absolute value of the difference.

    - #### escapement

          protected int escapement

      A 16-bit signed integer that defines the angle, in tenths of degrees, between the escapement vector and the x-axis of the device. The escapement vector is parallel to the base line of a row of text.

    - #### orientation

          protected int orientation

      A 16-bit signed integer that defines the angle, in tenths of degrees, between each character's base line and the x-axis of the device.

    - #### weight

          protected int weight

      A 16-bit signed integer that defines the weight of the font in the range 0 through 1000. For example, 400 is normal and 700 is bold. If this value is 0x0000, a default weight SHOULD be used.

    - #### italic

          protected boolean italic

      A 8-bit Boolean value that specifies the italic attribute of the font. 0 = not italic / 1 = italic.

    - #### underline

          protected boolean underline

      An 8-bit Boolean value that specifies the underline attribute of the font. 0 = not underlined / 1 = underlined

    - #### strikeOut

          protected boolean strikeOut

      An 8-bit Boolean value that specifies the strike out attribute of the font. 0 = not striked out / 1 = striked out

    - #### charSet

          protected FontCharset charSet

      An 8-bit unsigned integer that defines the character set. It SHOULD be set to a value in the `FontCharset` Enumeration. The DEFAULT_CHARSET value MAY be used to allow the name and size of a font to fully describe the logical font. If the specified font name does not exist, a font in another character set MAY be substituted. The DEFAULT_CHARSET value is set to a value based on the current system locale. For example, when the system locale is United States, it is set to ANSI_CHARSET. If a typeface name in the FaceName field is specified, the CharSet value MUST match the character set of that typeface.

    - #### outPrecision

          protected HwmfFont.WmfOutPrecision outPrecision

      An 8-bit unsigned integer that defines the output precision.

    - #### clipPrecision

          protected final HwmfFont.WmfClipPrecision clipPrecision

      An 8-bit unsigned integer that defines the clipping precision. These flags can be combined to specify multiple options.
      See Also:
        `HwmfFont.WmfClipPrecision`

    - #### quality

          protected HwmfFont.WmfFontQuality quality

      An 8-bit unsigned integer that defines the output quality.

    - #### pitchAndFamily

          protected int pitchAndFamily

      A PitchAndFamily object that defines the pitch and the family of the font. Font families specify the look of fonts in a general way and are intended for specifying fonts when the exact typeface wanted is not available.

    - #### family

          protected FontFamily family

      Font families specify the look of fonts in a general way and are intended for specifying fonts when the exact typeface wanted is not available. (LSB 4 bits)

    - #### pitch

          protected FontPitch pitch

      A property of a font that describes the pitch (MSB 2 bits)

    - #### facename

          protected java.lang.String facename

      A null-terminated string of 8-bit Latin-1 [ISO/IEC-8859-1] ANSI characters that specifies the typeface name of the font. The length of this string MUST NOT exceed 32 8-bit characters, including the terminating null.

  - ### Constructor Detail

    - #### HwmfFont

          public HwmfFont()

  - ### Method Detail

    - #### init

          public int init(LittleEndianInputStream leis,
                          long recordSize)
                   throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### initDefaults

          public void initDefaults()

    - #### getHeight

          public double getHeight()

    - #### getWidth

          public int getWidth()

    - #### getEscapement

          public int getEscapement()

    - #### getOrientation

          public int getOrientation()

    - #### getWeight

          public int getWeight()

    - #### isItalic

          public boolean isItalic()

    - #### isUnderline

          public boolean isUnderline()

    - #### isStrikeOut

          public boolean isStrikeOut()

    - #### getOutPrecision

          public HwmfFont.WmfOutPrecision getOutPrecision()

    - #### getClipPrecision

          public HwmfFont.WmfClipPrecision getClipPrecision()

    - #### getQuality

          public HwmfFont.WmfFontQuality getQuality()

    - #### getPitchAndFamily

          public int getPitchAndFamily()

    - #### getFamily

          public FontFamily getFamily()

      Specified by:
        `getFamily` in interface `FontInfo`
      Returns:
        the family class

    - #### getPitch

          public FontPitch getPitch()

      Specified by:
        `getPitch` in interface `FontInfo`
      Returns:
        the font pitch or `null` if unsupported

    - #### getTypeface

          public java.lang.String getTypeface()

      Specified by:
        `getTypeface` in interface `FontInfo`
      Returns:
        the full name of the font, i.e. font family + type face

    - #### getCharset

          public FontCharset getCharset()

      Specified by:
        `getCharset` in interface `FontInfo`
      Returns:
        the font charset

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### readString

          protected int readString(LittleEndianInputStream leis,
                                   java.lang.StringBuilder sb,
                                   int limit)
                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getGenericProperties

          public java.util.Map<java.lang.String,java.util.function.Supplier<?>> getGenericProperties()

      Specified by:
        `getGenericProperties` in interface `GenericRecord`

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.