2
* =========================================================================
3
* This file is part of the JMathTeX Library - http://jmathtex.sourceforge.net
5
* Copyright (C) 2004-2007 Universiteit Gent
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or (at
10
* your option) any later version.
12
* This program is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* General Public License for more details.
17
* A copy of the GNU General Public License can be found in the file
18
* LICENSE.txt provided with the source distribution of this program (see
19
* the META-INF directory in the source jar). This license can also be
20
* found on the GNU website at http://www.gnu.org/licenses/gpl.html.
22
* If you did not receive a copy of the GNU General Public License along
23
* with this program, contact the lead developer, or write to the Free
24
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29
package be.ugent.caagt.jmathtex;
32
* Used by RowAtom. The "textSymbol"-property and the type of an atom can change
33
* (according to the TeX-algorithms used). Or this atom can be replaced by a ligature,
34
* (if it was a CharAtom). But atoms cannot be changed, otherwise
35
* different boxes could be made from the same TeXFormula, and that is not desired!
36
* This "dummy atom" makes sure that changes to an atom (during the createBox-method of
37
* a RowAtom) will be reset.
43
private boolean textSymbol = false;
45
private int type = -1;
48
* Creates a new Dummy for the given atom.
52
public Dummy(Atom a) {
57
* Changes the type of the atom
59
* @param t the new type
61
public void setType(int t) {
67
* @return the changed type, or the old left type if it hasn't been changed
69
public int getLeftType() {
70
return (type >= 0 ? type : el.getLeftType());
75
* @return the changed type, or the old right type if it hasn't been changed
77
public int getRightType() {
78
return (type >= 0 ? type : el.getRightType());
81
public boolean isCharSymbol() {
82
return el instanceof CharSymbol;
86
* This method will only be called if isCharSymbol returns true.
88
public CharFont getCharFont(TeXFont tf) {
89
return ((CharSymbol) el).getCharFont(tf);
93
* Changes this atom into the given "ligature atom".
95
* @param a the ligature atom
97
public void changeAtom(FixedCharAtom a) {
103
public Box createBox(TeXEnvironment rs) {
105
((CharSymbol) el).markAsTextSymbol();
106
Box b = el.createBox(rs);
108
((CharSymbol) el).removeMark(); // atom remains unchanged!
112
public void markAsTextSymbol() {
116
public boolean isKern() {
117
return el instanceof SpaceAtom;
120
// only for Row-elements
121
public void setPreviousAtom(Dummy prev) {
122
if (el instanceof Row)
123
((Row) el).setPreviousAtom(prev);