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 * @author Ilya S. Okomin
19 * @version $Revision$
20 *
21 */
22package org.apache.harmony.awt.gl.font;
23
24/**
25 * Extra font metrics: sub/superscripts sizes, offsets, average char width.
26 */
27public class FontExtraMetrics {
28
29    /* !! Subscript/superscript metrics are undefined for Type1. As a possible
30     * solution we can use values for Type1, that are proportionate to TrueType
31     * ones:
32     *  SubscriptSizeX == 0.7 * fontSize
33     *  SubscriptSizeY == 0.65 * fontSize
34     *  SubscriptOffsetX == 0;
35     *  SubscriptOffsetY == 0.15 * fontSize;
36     *  SuperscriptSizeX == 0.7 * fontSize
37     *  SuperscriptSizeY == 0.65 * fontSize
38     *  SuperscriptOffsetX == 0;
39     *  SuperscriptOffsetY == 0.45 * fontSize
40     *
41     */
42
43    /*
44     * The average width of characters in the font.
45     */
46    private float lAverageCharWidth;
47
48    /*
49     * Horizontal size for subscripts.
50     */
51    private float lSubscriptSizeX;
52
53    /*
54     * Vertical size for subscripts.
55     */
56    private float lSubscriptSizeY;
57
58    /*
59     * Horizontal offset for subscripts, the offset from the character origin
60     * to the origin of the subscript character.
61     */
62    private float lSubscriptOffsetX;
63
64    /*
65     * Vertical offset for subscripts, the offset from the character origin
66     * to the origin of the subscript character.
67     */
68    private float lSubscriptOffsetY;
69
70    /*
71     * Horizontal size for superscripts.
72     */
73    private float lSuperscriptSizeX;
74
75    /*
76     * Vertical size for superscripts.
77     */
78    private float lSuperscriptSizeY;
79
80    /*
81     * Horizontal offset for superscripts, the offset from the character
82     * base line to the base line of the superscript character.
83     */
84    private float lSuperscriptOffsetX;
85
86    /*
87     * Vertical offset for superscripts, the offset from the character
88     * base line to the base line of the superscript character.
89     */
90    private float lSuperscriptOffsetY;
91
92    public FontExtraMetrics(){
93        // default constructor
94    }
95
96    public FontExtraMetrics(float[] metrics){
97        lAverageCharWidth = metrics[0];
98        lSubscriptSizeX = metrics[1];
99        lSubscriptSizeY = metrics[2];
100        lSubscriptOffsetX = metrics[3];
101        lSubscriptOffsetY = metrics[4];
102        lSuperscriptSizeX = metrics[5];
103        lSuperscriptSizeY = metrics[6];
104        lSuperscriptOffsetX = metrics[7];
105        lSuperscriptOffsetY = metrics[8];
106    }
107
108    public float getAverageCharWidth(){
109        return lAverageCharWidth;
110    }
111
112    public float getSubscriptSizeX(){
113        return lSubscriptSizeX;
114    }
115
116    public float getSubscriptSizeY(){
117        return lSubscriptSizeY;
118    }
119
120    public float getSubscriptOffsetX(){
121        return lSubscriptOffsetX;
122    }
123
124    public float getSubscriptOffsetY(){
125        return lSubscriptOffsetY;
126    }
127
128    public float getSuperscriptSizeX(){
129        return lSuperscriptSizeX;
130    }
131
132    public float getSuperscriptSizeY(){
133        return lSuperscriptSizeY;
134    }
135
136    public float getSuperscriptOffsetX(){
137        return lSuperscriptOffsetX;
138    }
139
140    public float getSuperscriptOffsetY(){
141        return lSuperscriptOffsetY;
142    }
143
144
145}
146