KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > faceless > pdf > StandardCJKFont


1 // $Id: StandardCJKFont.java,v 1.4 2003/11/04 17:16:01 mike Exp $
2

3 package org.faceless.pdf;
4
5 import java.util.*;
6 import java.io.*;
7
8 /**
9  * <p>
10  * A subclass of PDFFont representing the "standard" Chinese, Japanese and
11  * Korean fonts which are available as part of the Acrobat Reader for those
12  * countries, or as optional "language packs" for other locales. Without
13  * the language pack installed, Acrobat will throw an error message when
14  * trying to display a page containing one of these fonts. They can be
15  * can be downloaded from
16  * <a HREF="http://www.adobe.com/products/acrobat/acrrasianfontpack.html">http://www.adobe.com/products/acrobat/acrrasianfontpack.html</a>
17  * </p><p>
18  * The following fonts are available:
19  * <ul>
20  * <li><i>Simplified Chinese</i>: STSong-Light</li>
21  * <li><i>Traditional Chinese</i>: MSung-Light, MHei-Medium</li>
22  * <li><i>Japanese</i>: HeiseiMin-W3, HeiseiKakuGo-W5</li>
23  * <li><i>Korean</i>: HYGoThic-Medium, HYSMyeongJo-Medium</li>
24  * </ul>
25  * Each of these fonts may be used as is, or in <i>italic</i> or <b>bold</b>.
26  * </p><p>
27  * In the same way as the {@link PDFSimpleFont} class, all characters are
28  * represented by their Unicode codepoint. Since version 1.2.1, users from Hong Kong
29  * can use characters from the Hong Kong Supplementary Character Set (HKSCS), which
30  * are mapped to the "private character" range from U+E000 to U+F848
31  * in ISO10646-1:2000(E) - which is functionally equivalent to Unicode 3.0. Earlier
32  * versions of Unicode (as supported by Java prior to J2SE 1.4) can also use these
33  * characters. It's important to note that the viewing application (Acrobat) must have
34  * an up-to-date font and character map for these characters to appear. The Chinese
35  * language pack supplied with Acrobat 5.0 supports the HKSCS characters in the "MSung"
36  * font, but earlier viewers will need to be updated with the latest language pack to
37  * support these characters.
38  * </p><p>
39  * The current version of the library only handles horizontal text.
40  * </p>
41  *
42  * @version $Revision: 1.4 $
43  * @since 1.1
44  */

45 public class StandardCJKFont extends PDFFont implements Cloneable JavaDoc
46 {
47     /**
48      * Represents the STSong-Light font, a Simplified Chinese font
49      */

50     public static final int STSONG = 0;
51
52     /**
53      * Represents the MSung-Light font, a Traditional Chinese font with variable width strokes
54      */

55     public static final int MSUNG = 1;
56
57     /**
58      * Represents the MHei-Medium font, a Traditional Chinese font with fixed width strokes
59      */

60     public static final int MHEI = 2;
61
62     /**
63      * Represents the HeiseiMin-W3 font, a Japanese font with variable width strokes
64      */

65     public static final int HEISEIMIN = 3;
66
67     /**
68      * Represents the HeiseiKakuGo-W5 font, a Japanese font with fixed width strokes
69      */

70     public static final int HEISEIKAKUGO = 4;
71     
72     /**
73      * Represents the HYGoThic-Medium font, a Korean font with fixed width strokes
74      */

75     public static final int HYGOTHIC = 5;
76     
77     /**
78      * Represents the HYSMyeongJo-Medium font, a Korean font with variable with strokes
79      */

80     public static final int HYSMYEONGJO = 6;
81
82     /**
83      * A "style" parameter to the constructor requesting the text to
84      * regular - i.e. not bold or italic.
85      */

86     public static final int REGULAR = 0;
87
88     /**
89      * A "style" parameter to the constructor requesting a <b>bold</b> font
90      */

91     public static final int BOLD = 1;
92     
93     /**
94      * A "style" parameter to the constructor requesting an <i>italic</i> font
95      */

96     public static final int ITALIC = 2;
97
98     /**
99      * Create a new CJK Font.
100      * @param font The font to create. Can be one of {@link #STSONG}, {@link #MHEI},
101      * {@link #MSUNG}, {@link #HEISEIMIN}, {@link #HEISEIKAKUGO}, {@link #HYGOTHIC},
102      * or {@link #HYSMYEONGJO}.
103      * @param style a logical-OR of any of {@link #BOLD}, {@link #ITALIC} or {@link #REGULAR}
104      */

105     public StandardCJKFont(int font, int style)
106     {
107     super(new org.faceless.pdf2.StandardCJKFont(font,style));
108     }
109 }
110
Popular Tags