File: TeXFont.java

package info (click to toggle)
libjmathtex-java 0.7~pre-4
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 952 kB
  • ctags: 1,112
  • sloc: java: 5,129; xml: 2,151; makefile: 24
file content (219 lines) | stat: -rw-r--r-- 7,436 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/* TeXFont.java
 * =========================================================================
 * This file is part of the JMathTeX Library - http://jmathtex.sourceforge.net
 * 
 * Copyright (C) 2004-2007 Universiteit Gent
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * A copy of the GNU General Public License can be found in the file
 * LICENSE.txt provided with the source distribution of this program (see
 * the META-INF directory in the source jar). This license can also be
 * found on the GNU website at http://www.gnu.org/licenses/gpl.html.
 * 
 * If you did not receive a copy of the GNU General Public License along
 * with this program, contact the lead developer, or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 * 
 */

package be.ugent.caagt.jmathtex;

/**
 * An interface representing a "TeXFont", which is responsible for all the necessary
 * fonts and font information. 
 * 
 * @author Kurt Vermeulen
 */
interface TeXFont {

   // point-to-pixel conversion
   public static final float PIXELS_PER_POINT = 1f;

   public static final int NO_FONT = -1;

   /**
    * Derives a new {@link TeXFont} object with the given point size
    *  
    * @param pointSize the new size (in points) of the derived {@link TeXFont}
    * @return a <b>copy</b> of this {@link TeXFont} with the new size
    */
   public TeXFont deriveFont(float pointSize);

   public float getAxisHeight(int style);

   public float getBigOpSpacing1(int style);

   public float getBigOpSpacing2(int style);

   public float getBigOpSpacing3(int style);

   public float getBigOpSpacing4(int style);

   public float getBigOpSpacing5(int style);

   /**
    * Get a Char-object specifying the given character in the given text style with
    * metric information depending on the given "style".
    *  
    * @param c alphanumeric character
    * @param textStyle the text style in which the character should be drawn
    * @param style the style in which the atom should be drawn
    * @return the Char-object specifying the given character in the given text style 
    * @throws TextStyleMappingNotFoundException if there's no text style defined with
    * 		the given name
    */
   public Char getChar(char c, String textStyle, int style)
         throws TextStyleMappingNotFoundException;

   /**
    * Get a Char-object for this specific character containing the metric information
    * 
    * @param cf CharFont-object determining a specific character of a specific font
    * @param style the style in which the atom should be drawn
    * @return the Char-object for this character containing metric information
    */
   public Char getChar(CharFont cf, int style);

   /**
    * Get a Char-object for the given symbol with metric information depending on
    * "style".
    * 
    * @param name the symbol name
    * @param style the style in which the atom should be drawn
    * @return a Char-object for this symbol with metric information
    * @throws SymbolMappingNotFoundException if there's no symbol defined with the given
    * 			name
    */
   public Char getChar(String name, int style)
         throws SymbolMappingNotFoundException;

   /**
    * Get a Char-object specifying the given character in the default text style with
    * metric information depending on the given "style".
    * 
    * @param c alphanumeric character
    * @param style the style in which the atom should be drawn
    * @return the Char-object specifying the given character in the default text style 
    */
   public Char getDefaultChar(char c, int style);

   public float getDefaultRuleThickness(int style);

   public float getDenom1(int style);

   public float getDenom2(int style);

   /**
    * Get an Extension-object for the given Char containing the 4 possible parts to
    * build an arbitrary large variant. This will only be called if isExtensionChar(Char)
    * returns true.
    * 
    * @param c a Char-object for a specific character
    * @param style the style in which the atom should be drawn
    * @return an Extension object containing the 4 possible parts
    */
   public Extension getExtension(Char c, int style);

   /**
    * Get the kern value to be inserted between the given characters in the given style.
    * 
    * @param left left character
    * @param right right character
    * @param style the style in which the atom should be drawn
    * @return the kern value between both characters (default 0)
    */
   public float getKern(CharFont left, CharFont right, int style);

   /**
    * Get the ligature that replaces both characters (if any).
    * 
    * @param left left character
    * @param right right character
    * @return a ligature replacing both characters (or null: no ligature)
    */
   public CharFont getLigature(CharFont left, CharFont right);

   public int getMuFontId();

   /**
    * Get the next larger version of the given character. This is only called if
    * hasNextLarger(Char) returns true.
    * 
    * @param c character
    * @param style the style in which the atom should be drawn
    * @return the next larger version of this character
    */
   public Char getNextLarger(Char c, int style);

   public float getNum1(int style);

   public float getNum2(int style);

   public float getNum3(int style);

   public float getQuad(int style, int fontCode);

   /**
    * 
    * @return the point size of this TeXFont
    */
   public float getSize();

   /**
    * Get the kern amount of the character defined by the given CharFont followed by the
    * "skewchar" of it's font. This is used in the algorithm for placing an accent above
    * a single character.
    * 
    * @param cf the character and it's font above which an accent has to be placed
    * @param style the render style
    * @return the kern amount of the character defined by cf followed by the
    * "skewchar" of it's font.
    */
   public float getSkew(CharFont cf, int style);

   public float getSpace(int style);

   public float getSub1(int style);

   public float getSub2(int style);

   public float getSubDrop(int style);

   public float getSup1(int style);

   public float getSup2(int style);

   public float getSup3(int style);

   public float getSupDrop(int style);

   public float getXHeight(int style, int fontCode);

   /**
    * 
    * @param c a character
    * @return true if the given character has a larger version, false otherwise
    */
   public boolean hasNextLarger(Char c);

   public boolean hasSpace(int font);

   /**
    * 
    * @param c a character
    * @return true if the given character contains extension information to buid
    * 			an arbitrary large version of this character.
    */
   public boolean isExtensionChar(Char c);

}