Class FontNames

java.lang.Object
com.itextpdf.io.font.FontNames

public class FontNames extends Object
Stores naming and style information read from a font program.
  • Field Details

    • allNames

      protected Map<Integer,List<String[]>> allNames
      Name records grouped by OpenType name ID.
  • Constructor Details

    • FontNames

      public FontNames()
  • Method Details

    • getNames

      public String[][] getNames (int id)
      Extracts the names of the font in all the languages available.
      Parameters:
      id - the name id to retrieve in OpenType notation
      Returns:
      not empty String[][] if any names exists, otherwise null.
    • getFullName

      public String[][] getFullName()
      Gets the full font names.
      Returns:
      name records for OpenType name ID 4, or null when unavailable
    • getFontName

      public String getFontName()
      Gets the PostScript font name.
      Returns:
      PostScript name, or null when unavailable
    • getCidFontName

      public String getCidFontName()
      Gets the CID font name.
      Returns:
      OpenType name ID 20 value, or null when unavailable
    • getFamilyName

      public String[][] getFamilyName()
      Gets the font family names.
      Returns:
      name records for OpenType name ID 16 or 1, or null when unavailable
    • getFamilyName2

      public String[][] getFamilyName2()
      Get extra family names.
      Returns:
      name records for OpenType name ID 1, or null when unavailable
    • getStyle

      public String getStyle()
      Gets the font style name.
      Returns:
      style string
    • getSubfamily

      public String getSubfamily()
      Gets the first available subfamily name.
      Returns:
      name ID 2 or 17 value, or an empty string when unavailable
    • getFontWeight

      public int getFontWeight()
      Gets the normalized font weight.
      Returns:
      weight in the range represented by FontWeights
    • setFontWeight

      protected void setFontWeight (int weight)
      Sets font weight.
      Parameters:
      weight - integer form 100 to 900. See FontWeights.
    • getFontStretch

      public String getFontStretch()
      Gets font stretch in css notation (font-stretch property).
      Returns:
      One of FontStretches values.
    • setFontStretch

      protected void setFontStretch (String fontStretch)
      Sets font stretch in css notation (font-stretch property).
      Parameters:
      fontStretch - FontStretches.
    • allowEmbedding

      public boolean allowEmbedding()
      Checks whether the font's embedding permissions allow embedding.
      Returns:
      true when embedding is permitted
    • isBold

      public boolean isBold()
      Checks the bold bit in the Macintosh style flags.
      Returns:
      true when bold is declared
    • isItalic

      public boolean isItalic()
      Checks the italic bit in the Macintosh style flags.
      Returns:
      true when italic is declared
    • isUnderline

      public boolean isUnderline()
      Checks the underline bit in the Macintosh style flags.
      Returns:
      true when underline is declared
    • isOutline

      public boolean isOutline()
      Checks the outline bit in the Macintosh style flags.
      Returns:
      true when outline is declared
    • isShadow

      public boolean isShadow()
      Checks the shadow bit in the Macintosh style flags.
      Returns:
      true when shadow is declared
    • isCondensed

      public boolean isCondensed()
      Checks the condensed bit in the Macintosh style flags.
      Returns:
      true when condensed is declared
    • isExtended

      public boolean isExtended()
      Checks the extended bit in the Macintosh style flags.
      Returns:
      true when extended is declared
    • setAllNames

      protected void setAllNames (Map<Integer,List<String[]>> allNames)
      Sets the names grouped by OpenType name ID.
      Parameters:
      allNames - names grouped by OpenType name ID
    • setFullName

      protected void setFullName (String[][] fullName)
      Sets the full-name records.
      Parameters:
      fullName - records in platform, encoding, language, name order
    • setFullName

      protected void setFullName (String fullName)
      Sets a single full name.
      Parameters:
      fullName - font full name
    • setFontName

      protected void setFontName (String psFontName)
      Sets the PostScript font name.
      Parameters:
      psFontName - PostScript name
    • setCidFontName

      protected void setCidFontName (String cidFontName)
      Sets the CID font name.
      Parameters:
      cidFontName - OpenType name ID 20 value
    • setFamilyName

      protected void setFamilyName (String[][] familyName)
      Sets the font family-name records.
      Parameters:
      familyName - records in platform, encoding, language, name order
    • setFamilyName2

      protected void setFamilyName2 (String[][] familyName2)
      Set extra family name used for better fonts match.
      Parameters:
      familyName2 - family name to set.
    • setFamilyName

      protected void setFamilyName (String familyName)
      Sets a single font family name.
      Parameters:
      familyName - preferred family name
    • setStyle

      protected void setStyle (String style)
      Sets the font style string.
      Parameters:
      style - style name
    • setSubfamily

      protected void setSubfamily (String subfamily)
      Sets a single subfamily name.
      Parameters:
      subfamily - style subfamily name
    • setSubfamily

      protected void setSubfamily (String[][] subfamily)
      Sets the subfamily name records.
      Parameters:
      subfamily - records in platform, encoding, language, name order
    • setMacStyle

      protected void setMacStyle (int macStyle)
      Sets Open Type head.macStyle.

      FontMacStyleFlags

      Parameters:
      macStyle - macStyle flag
    • getMacStyle

      protected int getMacStyle()
      Gets the raw head.macStyle bit field.
      Returns:
      Macintosh style flags
    • setAllowEmbedding

      protected void setAllowEmbedding (boolean allowEmbedding)
      Sets the embedding permission.
      Parameters:
      allowEmbedding - true when embedding is permitted
    • toString

      public String toString()
      Overrides:
      toString in class Object