47 * can get dingbats and symbols from them. This can be dispensed with when
48 * either AWT is based on 2D, or when the X font path is known to always
49 * contain a Type1 or TrueType font that can be used in font configuration
50 * files to replace the F3 fonts.
51 * 2. When location of font files by 2D fails, because of some system
52 * configuration problem, it is desirable to have a fall back to some
53 * functionality that lessens the immediate impact on users. Being able
54 * to perform limited operations by using bitmaps from X11 helps here.
55 */
56
57 public class NativeFont extends PhysicalFont {
58
59 String encoding;
60
61 private int numGlyphs = -1;
62 boolean isBitmapDelegate;
63 PhysicalFont delegateFont;
64
65 /**
66 * Verifies native font is accessible.
67 * @throws FontFormatException - if the font can't be located.
68 */
69 public NativeFont(String platName, boolean bitmapDelegate)
70 throws FontFormatException {
71 super(platName, null);
72
73 /* This is set true if this is an instance of a NativeFont
74 * created by some other font, to get native bitmaps.
75 * The delegating font will call this font only for "basic"
76 * cases - ie non-rotated, uniform scale, monochrome bitmaps.
77 * If this is false, then this instance may need to itself
78 * delegate to another font for non-basic cases. Since
79 * NativeFonts are used in that way only for symbol and dingbats
80 * we know its safe to delegate these to the JRE's default
81 * physical font (Lucida Sans Regular).
82 */
83 isBitmapDelegate = bitmapDelegate;
84
85 if (GraphicsEnvironment.isHeadless()) {
86 throw new FontFormatException("Native font in headless toolkit");
87 }
|
47 * can get dingbats and symbols from them. This can be dispensed with when
48 * either AWT is based on 2D, or when the X font path is known to always
49 * contain a Type1 or TrueType font that can be used in font configuration
50 * files to replace the F3 fonts.
51 * 2. When location of font files by 2D fails, because of some system
52 * configuration problem, it is desirable to have a fall back to some
53 * functionality that lessens the immediate impact on users. Being able
54 * to perform limited operations by using bitmaps from X11 helps here.
55 */
56
57 public class NativeFont extends PhysicalFont {
58
59 String encoding;
60
61 private int numGlyphs = -1;
62 boolean isBitmapDelegate;
63 PhysicalFont delegateFont;
64
65 /**
66 * Verifies native font is accessible.
67 * @throws FontFormatException if the font can't be located.
68 */
69 public NativeFont(String platName, boolean bitmapDelegate)
70 throws FontFormatException {
71 super(platName, null);
72
73 /* This is set true if this is an instance of a NativeFont
74 * created by some other font, to get native bitmaps.
75 * The delegating font will call this font only for "basic"
76 * cases - ie non-rotated, uniform scale, monochrome bitmaps.
77 * If this is false, then this instance may need to itself
78 * delegate to another font for non-basic cases. Since
79 * NativeFonts are used in that way only for symbol and dingbats
80 * we know its safe to delegate these to the JRE's default
81 * physical font (Lucida Sans Regular).
82 */
83 isBitmapDelegate = bitmapDelegate;
84
85 if (GraphicsEnvironment.isHeadless()) {
86 throw new FontFormatException("Native font in headless toolkit");
87 }
|