1:
37:
38: package ;
39:
40: import ;
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49:
50: import ;
51:
52: public class QtFontPeer extends ClasspathFontPeer
53: {
54:
55: private long nativeObject;
56: private QtFontMetrics metrics;
57:
58:
59: public QtFontPeer (String name, int style)
60: {
61: this(name, style, 12);
62: }
63:
64: public QtFontPeer (String name, int style, int size)
65: {
66: super(name, style, size);
67: init();
68: }
69:
70: public QtFontPeer (String name, Map attributes)
71: {
72: super(name, attributes);
73: init();
74: }
75:
76: public void init()
77: {
78: if(this.familyName == null)
79: throw new IllegalArgumentException("null family name");
80: if(this.familyName.equals("Helvetica"))
81: this.familyName = "sans serif";
82: if(this.familyName.equals("Dialog"))
83: this.familyName = "sans serif";
84: create(this.familyName, this.style, (int)this.size);
85: metrics = new QtFontMetrics(this);
86: }
87:
88:
91: private native void create(String name, int style, int size);
92:
93:
96: public native void dispose();
97:
98:
99:
100:
101: public boolean canDisplay (Font font, int c)
102: {
103: return metrics.canDisplay( c );
104: }
105:
106: public int canDisplayUpTo (Font font, CharacterIterator i,
107: int start, int limit)
108: {
109: int index = start;
110: char c = i.setIndex( index );
111: while( index <= limit )
112: {
113: if(!canDisplay(font, c))
114: return index;
115: index++;
116: c = i.next();
117: }
118: return -1;
119: }
120:
121: public String getSubFamilyName (Font font, Locale locale)
122: {
123: throw new UnsupportedOperationException();
124: }
125:
126: public String getPostScriptName (Font font)
127: {
128: throw new UnsupportedOperationException();
129: }
130:
131: public int getNumGlyphs (Font font)
132: {
133: throw new UnsupportedOperationException();
134: }
135:
136: public int getMissingGlyphCode (Font font)
137: {
138: throw new UnsupportedOperationException();
139: }
140:
141: public byte getBaselineFor (Font font, char c)
142: {
143: throw new UnsupportedOperationException();
144: }
145:
146: public String getGlyphName (Font font, int glyphIndex)
147: {
148: throw new UnsupportedOperationException();
149: }
150:
151: public GlyphVector createGlyphVector (Font font,
152: FontRenderContext frc,
153: CharacterIterator ci)
154: {
155: throw new UnsupportedOperationException();
156: }
157:
158: public GlyphVector createGlyphVector (Font font,
159: FontRenderContext ctx,
160: int[] glyphCodes)
161: {
162: throw new UnsupportedOperationException();
163: }
164:
165: public GlyphVector layoutGlyphVector (Font font,
166: FontRenderContext frc,
167: char[] chars, int start,
168: int limit, int flags)
169: {
170: throw new UnsupportedOperationException();
171: }
172:
173: public FontMetrics getFontMetrics (Font font)
174: {
175: return new QtFontMetrics( this );
176: }
177:
178: public boolean hasUniformLineMetrics (Font font)
179: {
180: throw new UnsupportedOperationException();
181: }
182:
183: public LineMetrics getLineMetrics (Font font,
184: CharacterIterator ci,
185: int begin, int limit,
186: FontRenderContext rc)
187: {
188: throw new UnsupportedOperationException();
189: }
190:
191: public Rectangle2D getMaxCharBounds (Font font,
192: FontRenderContext rc)
193: {
194: throw new UnsupportedOperationException();
195: }
196:
197: }