KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > render > afp > AFPFontAttributes


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 /* $Id: AFPFontAttributes.java 426576 2006-07-28 15:44:37Z jeremias $ */
19
20 package org.apache.fop.render.afp;
21
22 import org.apache.fop.render.afp.fonts.AFPFont;
23 import org.apache.fop.render.afp.tools.BinaryUtils;
24
25 /**
26  * This class encapsulates the font atributes that need to be included
27  * in the AFP data stream. This class does not assist in converting the
28  * font attributes to AFP code pages and character set values.
29  *
30  */

31 public class AFPFontAttributes {
32
33     /**
34      * The font reference byte
35      */

36     private byte _fontReference;
37
38     /**
39      * The font key
40      */

41     private String JavaDoc _fontKey;
42
43     /**
44      * The font
45      */

46     private AFPFont _font;
47
48     /**
49      * The point size
50      */

51     private int _pointSize;
52
53     /**
54      * Constructor for the AFPFontAttributes
55      * @param fontKey the font key
56      * @param font the font
57      * @param pointSize the point size
58      */

59     public AFPFontAttributes(
60
61         String JavaDoc fontKey,
62         AFPFont font,
63         int pointSize) {
64
65         _fontKey = fontKey;
66         _font = font;
67         _pointSize = pointSize;
68
69     }
70     /**
71      * @return the font
72      */

73     public AFPFont getFont() {
74         return _font;
75     }
76
77     /**
78      * @return the FontKey attribute
79      */

80     public String JavaDoc getFontKey() {
81
82         return _fontKey + _pointSize;
83
84     }
85
86     /**
87      * @return the point size attribute
88      */

89     public int getPointSize() {
90         return _pointSize;
91     }
92
93     /**
94      * @return the FontReference attribute
95      */

96     public byte getFontReference() {
97         return _fontReference;
98     }
99
100     /**
101      * Sets the FontReference attribute
102      * @param fontReference the FontReference to set
103      */

104     public void setFontReference(int fontReference) {
105
106         String JavaDoc id = String.valueOf(fontReference);
107         _fontReference = BinaryUtils.convert(id)[0];
108
109     }
110
111 }
112
Popular Tags