001: /*
002: * Copyright (c) 2007, intarsys consulting GmbH
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * - Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * - Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * - Neither the name of intarsys nor the names of its contributors may be used
015: * to endorse or promote products derived from this software without specific
016: * prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
020: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
021: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
022: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
024: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
025: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
026: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
027: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
028: * POSSIBILITY OF SUCH DAMAGE.
029: */
030: package de.intarsys.pdf.font;
031:
032: import de.intarsys.pdf.cds.CDSRectangle;
033: import de.intarsys.pdf.cos.COSName;
034: import de.intarsys.pdf.cos.COSObject;
035: import de.intarsys.pdf.pd.PDObject;
036:
037: /**
038: * the detail information about a font.
039: */
040: abstract public class PDFontDescriptor extends PDObject {
041: /**
042: * The meta class implementation
043: */
044: static public class MetaClass extends PDObject.MetaClass {
045: protected MetaClass(Class instanceClass) {
046: super (instanceClass);
047: }
048:
049: public Class getRootClass() {
050: return PDFontDescriptor.class;
051: }
052: }
053:
054: /** The meta class instance */
055: static public final MetaClass META = new MetaClass(MetaClass.class
056: .getDeclaringClass());
057:
058: static public final COSName CN_Type_FontDescriptor = COSName
059: .constant("FontDescriptor");
060:
061: public boolean isAllCap() {
062: return flags.isAllCap();
063: }
064:
065: public boolean isFixedPitch() {
066: return flags.isFixedPitch();
067: }
068:
069: public boolean isForceBold() {
070: return flags.isForceBold();
071: }
072:
073: public boolean isItalic() {
074: return flags.isItalic();
075: }
076:
077: public boolean isNonsymbolic() {
078: return flags.isNonsymbolic();
079: }
080:
081: public boolean isScript() {
082: return flags.isScript();
083: }
084:
085: public boolean isSerif() {
086: return flags.isSerif();
087: }
088:
089: public boolean isSmallCap() {
090: return flags.isSmallCap();
091: }
092:
093: public boolean isSymbolic() {
094: return flags.isSymbolic();
095: }
096:
097: public void setAllCap(boolean flag) {
098: flags.setAllCap(flag);
099: }
100:
101: public void setFixedPitch(boolean flag) {
102: flags.setFixedPitch(flag);
103: }
104:
105: public void setForceBold(boolean flag) {
106: flags.setForceBold(flag);
107: }
108:
109: public void setItalic(boolean flag) {
110: flags.setItalic(flag);
111: }
112:
113: public void setNonsymbolic(boolean flag) {
114: flags.setNonsymbolic(flag);
115: }
116:
117: public void setScript(boolean flag) {
118: flags.setScript(flag);
119: }
120:
121: public void setSerif(boolean flag) {
122: flags.setSerif(flag);
123: }
124:
125: public void setSmallCap(boolean flag) {
126: flags.setSmallCap(flag);
127: }
128:
129: public void setSymbolic(boolean flag) {
130: flags.setSymbolic(flag);
131: }
132:
133: protected PDFontDescriptor(COSObject object) {
134: super (object);
135: }
136:
137: /**
138: * The font ascent.
139: *
140: * @return The font ascent.
141: */
142: abstract public float getAscent();
143:
144: /**
145: * The font average width.
146: *
147: * @return The font average width.
148: */
149: abstract public float getAvgWidth();
150:
151: /**
152: * The font capital height.
153: *
154: * @return The capital height.
155: */
156: abstract public float getCapHeight();
157:
158: /**
159: * The font descent.
160: *
161: * @return The font descent.
162: */
163: abstract public float getDescent();
164:
165: /**
166: * The font flags.
167: *
168: * @return The font flags.
169: */
170: abstract public int getFlagsValue();
171:
172: abstract public void setFlagsValue(int value);
173:
174: /**
175: * The character enclosing rectangle.
176: *
177: * @return The character enclosing rectangle.
178: */
179: abstract public CDSRectangle getFontBB();
180:
181: /**
182: * The font family name.
183: *
184: * @return The font name.
185: */
186: abstract public String getFontFamily();
187:
188: /**
189: * The font name.
190: *
191: * @return The font name.
192: */
193: abstract public String getFontName();
194:
195: /**
196: * The font italic angle.
197: *
198: * @return The font italic angle.
199: */
200: abstract public float getItalicAngle();
201:
202: /**
203: * The font leading.
204: *
205: * @return The font leading.
206: */
207: abstract public int getLeading();
208:
209: /**
210: * The font character maximal width.
211: *
212: * @return The font character maximal width.
213: */
214: abstract public int getMaxWidth();
215:
216: /**
217: * The width to use when definition is missing.
218: *
219: * @return The width to use when definition is missing.
220: */
221: abstract public int getMissingWidth();
222:
223: /**
224: * The font horizontal stem.
225: *
226: * @return The font horizontal stem.
227: */
228: abstract public int getStemH();
229:
230: /**
231: * The font vertical stem.
232: *
233: * @return The font vertical stem.
234: */
235: abstract public int getStemV();
236:
237: /**
238: * The height of "X".
239: *
240: * @return The height of "X".
241: */
242: abstract public float getXHeight();
243:
244: public byte[] getFontFile() {
245: return null;
246: }
247:
248: public byte[] getFontFile2() {
249: return null;
250: }
251:
252: public byte[] getFontFile3() {
253: return null;
254: }
255:
256: /*
257: * (non-Javadoc)
258: *
259: * @see de.intarsys.pdf.pd.PDObject#cosGetExpectedType()
260: */
261: protected COSName cosGetExpectedType() {
262: return CN_Type_FontDescriptor;
263: }
264:
265: private FontDescriptorFlags flags = new FontDescriptorFlags(this );
266:
267: public FontDescriptorFlags getFlags() {
268: return flags;
269: }
270: }
|