Class StandardCJKFont

  • All Implemented Interfaces:
    java.lang.Cloneable

    public final class StandardCJKFont
    extends PDFFont

    A subclass of PDFFont representing the "standard" Chinese, Japanese and Korean fonts which are supplied by default with Acrobat 5.0 or later, or with a supplementary "language pack" for earlier releases. It's safe to assume that some version of these characters will be available for most PDF viewing applications (although see below for details). The following fonts are available:

    • STSong-Ling: Simplified Chinese font with variable-width strokes
    • MHei-Medium: Traditional Chinese font with fixed-width strokes
    • MSung-Light: Traditional Chinese font with variable-width strokes
    • Heisei Kaku Gothic W5: Japanese font with fixed-width strokes
    • Heisei Mincho W3: Japanese font with variable-width strokes
    • HYS Myeongjo Medium: Korean font with variable-width strokes
    • HY Gothic Medium: Korean font with fixed-width strokes
    Each of these fonts may be used as is, or in italic or bold. More detail for each script is provided below.

    Simplified Chinese

    Simplified Chinese is used on mainland China and in Singapore, and the only font to choose from is STSONG. Support for the range of glyphs covered in Unicode 3.0/ISO 10646-1:2000 requires at least Java 1.5, PDF Library 2.2.6 and Acrobat 6.0. Support for the Yi character set requires at least the PDF library 2.10.4 and Acrobat 8.0.

    Traditional Chinese

    Traditional Chinese is used in Hong Kong and Taiwan, and the fonts to choose from are MHEI and MSUNG. Support for HKSCS:2001 requires at least Java 1.5, the PDF Library 2.2.6 and Acrobat 6.0. Support for HKSCS:2004 requires the PDF Library 2.10.4 and Acrobat 8.0.

    Japanese

    The two Japanese fonts are HEISEIMIN and HEISEIKAKUGO. We'd recommend at least Acrobat 5.0 for display of Japanese text. To support JIS X 0213:2004 you'll need Acrobat 7.0 or later and the PDF Library 2.2.6.

    Korean

    The two Korean fonts are HYGOTHIC and HYSMYEONGJO. Korean support has been largely static in Acrobat, and any reasonably recent version of the PDF library and Acrobat should support the full range of characters.
    Since:
    1.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BOLD
      A "style" parameter to the constructor requesting a bold font
      static int HEISEIKAKUGO
      Represents the Heisei Kaku Gothic W5 font, a Japanese font with fixed width strokes
      static int HEISEIMIN
      Represents the Heisei Mincho W3 font, a Japanese font with variable width strokes
      static int HYGOTHIC
      Represents the HY Gothic Medium font, a Korean font with fixed width strokes
      static int HYSMYEONGJO
      Represents the HYS Myeongjo Medium font, a Korean font with variable width strokes
      static int ITALIC
      A "style" parameter to the constructor requesting an italic font
      static int MHEI
      Represents the MHei Medium font, a Traditional Chinese font with fixed width strokes
      static int MSUNG
      Represents the MSung Light font, a Traditional Chinese font with variable width strokes
      static int REGULAR
      A "style" parameter to the constructor requesting a regular font - ie. not bold or italic.
      static int STSONG
      Represents the ST Song Light font, a Simplified Chinese font with variable width strokes
    • Constructor Summary

      Constructors 
      Constructor Description
      StandardCJKFont​(int font, int style)
      Create a new CJK Font.
    • Field Detail

      • STSONG

        public static final int STSONG
        Represents the ST Song Light font, a Simplified Chinese font with variable width strokes
        See Also:
        Constant Field Values
      • MSUNG

        public static final int MSUNG
        Represents the MSung Light font, a Traditional Chinese font with variable width strokes
        See Also:
        Constant Field Values
      • MHEI

        public static final int MHEI
        Represents the MHei Medium font, a Traditional Chinese font with fixed width strokes
        See Also:
        Constant Field Values
      • HEISEIMIN

        public static final int HEISEIMIN
        Represents the Heisei Mincho W3 font, a Japanese font with variable width strokes
        See Also:
        Constant Field Values
      • HEISEIKAKUGO

        public static final int HEISEIKAKUGO
        Represents the Heisei Kaku Gothic W5 font, a Japanese font with fixed width strokes
        See Also:
        Constant Field Values
      • HYGOTHIC

        public static final int HYGOTHIC
        Represents the HY Gothic Medium font, a Korean font with fixed width strokes
        See Also:
        Constant Field Values
      • HYSMYEONGJO

        public static final int HYSMYEONGJO
        Represents the HYS Myeongjo Medium font, a Korean font with variable width strokes
        See Also:
        Constant Field Values
      • REGULAR

        public static final int REGULAR
        A "style" parameter to the constructor requesting a regular font - ie. not bold or italic.
        See Also:
        Constant Field Values
      • BOLD

        public static final int BOLD
        A "style" parameter to the constructor requesting a bold font
        See Also:
        Constant Field Values
      • ITALIC

        public static final int ITALIC
        A "style" parameter to the constructor requesting an italic font
        See Also:
        Constant Field Values
    • Method Detail

      • getType

        public int getType()
        Return the type of the font, as supplied to the constructor
        Since:
        2.20.3
      • getDefaultLeading

        public float getDefaultLeading()
        Description copied from class: PDFFont

        Get the default leading for this font - the preferred distance between two successive baselines of text. Values are a ratio of the font size, and are typically between 1 and 1.3

        Note that the values of the different spacing-between-lines methods have changed - in versions 1.0.4 and earlier this routine normally returned 1 and the spacing was set by the PDFStyle.setTextLineSpacing(float) method. Since 1.1, the values for these two methods are effectively reversed. See the relevant method comments in the PDFStyle class for more information.

        Specified by:
        getDefaultLeading in class PDFFont
      • getDescender

        public float getDescender()
        Description copied from class: PDFFont
        Get the Descender for the font (the maximum height below the baseline the font extends), as a proportion of the point size. The returned value is usually negative. The exact source of this value is undefined except for OpenTypeFonts, where it comes from the "hhea.descender" value normally, or the from "OS2.sTypoDescender" flag if the USE_TYPO_METRICS flag is set.
        Specified by:
        getDescender in class PDFFont
      • getAscender

        public float getAscender()
        Description copied from class: PDFFont
        Get the Ascender for the font (the maximum height above the baseline the font extends), as a proportion of the point size. The exact source of of this value is undefined except for OpenTypeFonts, where it comes from the "hhea.ascender" value normally, or the from "OS2.sTypoAscender" flag if the USE_TYPO_METRICS flag is set.
        Specified by:
        getAscender in class PDFFont
      • getXHeight

        public float getXHeight()
        Description copied from class: PDFFont
        Get the X-Height of the font - normally the height of a lower-case 'x' character.
        Specified by:
        getXHeight in class PDFFont
      • getCapHeight

        public float getCapHeight()
        Description copied from class: PDFFont
        Get the Cap-Height of the font - normally the height of an upper-case 'O' character
        Specified by:
        getCapHeight in class PDFFont
      • getUnderlinePosition

        public float getUnderlinePosition()
        Description copied from class: PDFFont
        Get the underline position, as a proportion of the font size. Like the getDescender() method, the returned value is almost always negative, indicating below the baseline. The distance is from the baseline to the center of the underline.
        Specified by:
        getUnderlinePosition in class PDFFont
      • getUnderlineThickness

        public float getUnderlineThickness()
        Description copied from class: PDFFont
        Get the underline thickness, as a proportion of the font size.
        Specified by:
        getUnderlineThickness in class PDFFont
      • getStrikeoutPosition

        public float getStrikeoutPosition()
        Description copied from class: PDFFont
        Get the strikeout position, as a proportion of the font size. The value is the distance from the baseline to the center of the strikeout, and shuold be positive.
        Specified by:
        getStrikeoutPosition in class PDFFont
      • getStrikeoutThickness

        public float getStrikeoutThickness()
        Description copied from class: PDFFont
        Get the strikeout thickness, as a proportion of the font size.
        Specified by:
        getStrikeoutThickness in class PDFFont
      • getSuperscriptPosition

        public float getSuperscriptPosition()
        Description copied from class: PDFFont

        Get the recommended position of a super-script version of this font, as a proportion of the sub-scripted font size. Value is always positive.

        For some fonts (like CJK or barcode fonts) where there is no concept of super or subscript, this value is entirely arbitrary.

        Specified by:
        getSuperscriptPosition in class PDFFont
      • getSubscriptPosition

        public float getSubscriptPosition()
        Description copied from class: PDFFont

        Get the recommended position of a sub-script version of this font, as a proportion of the sub-scripted font size. Value is almost always zero or negative.

        For some fonts (like CJK or barcode fonts) where there is no concept of super or subscript, this value is entirely arbitrary.

        Specified by:
        getSubscriptPosition in class PDFFont
      • getSubscriptSize

        public float getSubscriptSize()
        Description copied from class: PDFFont

        Get the recommended size of a super/sub script version of this font, as a proportion of the normal font size. Typical value is around 0.6.

        For some fonts (like CJK or barcode fonts) where there is no concept of super or subscript, this value is entirely arbitrary.

        Specified by:
        getSubscriptSize in class PDFFont
      • isMonospace

        public boolean isMonospace()
        Description copied from class: PDFFont
        Return true if every character has the same width (like Courier), false if every character is potentially a different width (like Times-Roman)
        Specified by:
        isMonospace in class PDFFont
      • getDefinedCodepoints

        public java.util.BitSet getDefinedCodepoints()
        Description copied from class: PDFFont
        Return read-only BitSet containing all the Unicode codepoints defined in this font
        Specified by:
        getDefinedCodepoints in class PDFFont
      • isItalic

        public boolean isItalic()
        Description copied from class: PDFFont
        Return true if the font is italic
        Specified by:
        isItalic in class PDFFont
      • isBold

        public boolean isBold()
        Description copied from class: PDFFont
        Return true if the font is bold
        Specified by:
        isBold in class PDFFont
      • isSerif

        public boolean isSerif()
        Description copied from class: PDFFont
        Return true if the font is serif
        Specified by:
        isSerif in class PDFFont
      • versionBold

        public PDFFont versionBold()
        Description copied from class: PDFFont
        Return a bold version of the current font, if available. By default this just returns this font.
        Overrides:
        versionBold in class PDFFont
      • versionItalic

        public PDFFont versionItalic()
        Description copied from class: PDFFont
        Return an italic version of the current font, if available. By default this just returns this font.
        Overrides:
        versionItalic in class PDFFont
      • versionNonItalic

        public PDFFont versionNonItalic()
        Description copied from class: PDFFont
        Return a non-italic version of the current font, if available. By default this just returns this font.
        Overrides:
        versionNonItalic in class PDFFont
      • versionNonBold

        public PDFFont versionNonBold()
        Description copied from class: PDFFont
        Return a non-bold version of the current font, if available. By default this just returns this font.
        Overrides:
        versionNonBold in class PDFFont
      • versionRegular

        public PDFFont versionRegular()
        Description copied from class: PDFFont
        Return a non-bold, non-italic version of the current font, if available. By default this just returns this font.
        Overrides:
        versionRegular in class PDFFont
      • toString

        public java.lang.String toString()
      • putLiteral

        public void putLiteral​(java.lang.String key,
                               java.lang.String tokens)
        Put a literal token sequnce. For debugging
        Parameters:
        key - the key
        tokens - the token sequence, eg "true" or "/foo" or "[/Foo/Bar]". No refs, just direct objects.