Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/AccentedAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/AccentedAtom.java (.../AccentedAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/AccentedAtom.java (.../AccentedAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -50,35 +50,35 @@ * An atom representing another atom with an accent symbol above it. */ public class AccentedAtom extends Atom { - + // accent symbol private final SymbolAtom accent; private boolean acc = false; private boolean changeSize = true; - + // base atom protected Atom base = null; protected Atom underbase = null; - + public AccentedAtom(Atom base, Atom accent) throws InvalidSymbolTypeException { - this.base = base; - if (base instanceof AccentedAtom) - underbase = ((AccentedAtom)base).underbase; - else - underbase = base; + this.base = base; + if (base instanceof AccentedAtom) + underbase = ((AccentedAtom)base).underbase; + else + underbase = base; - if (!(accent instanceof SymbolAtom)) - throw new InvalidSymbolTypeException("Invalid accent"); - - this.accent = (SymbolAtom)accent; - this.acc = true; + if (!(accent instanceof SymbolAtom)) + throw new InvalidSymbolTypeException("Invalid accent"); + + this.accent = (SymbolAtom)accent; + this.acc = true; } public AccentedAtom(Atom base, Atom accent, boolean changeSize) throws InvalidSymbolTypeException { - this(base, accent); - this.changeSize = changeSize; + this(base, accent); + this.changeSize = changeSize; } - + /** * Creates an AccentedAtom from a base atom and an accent symbol defined by its name * @@ -92,18 +92,17 @@ accent = SymbolAtom.get(accentName); if (accent.type == TeXConstants.TYPE_ACCENT) { this.base = base; - if (base instanceof AccentedAtom) - underbase = ((AccentedAtom)base).underbase; - else - underbase = base; - } - else + if (base instanceof AccentedAtom) + underbase = ((AccentedAtom)base).underbase; + else + underbase = base; + } else throw new InvalidSymbolTypeException("The symbol with the name '" - + accentName + "' is not defined as an accent (" - + TeXSymbolParser.TYPE_ATTR + "='acc') in '" - + TeXSymbolParser.RESOURCE_NAME + "'!"); + + accentName + "' is not defined as an accent (" + + TeXSymbolParser.TYPE_ATTR + "='acc') in '" + + TeXSymbolParser.RESOURCE_NAME + "'!"); } - + /** * Creates an AccentedAtom from a base atom and an accent symbol defined as a TeXFormula. * This is used for parsing MathML. @@ -118,7 +117,7 @@ throws InvalidTeXFormulaException, InvalidSymbolTypeException { if (acc == null) throw new InvalidTeXFormulaException( - "The accent TeXFormula can't be null!"); + "The accent TeXFormula can't be null!"); else { Atom root = acc.root; if (root instanceof SymbolAtom) { @@ -127,30 +126,30 @@ this.base = base; else throw new InvalidSymbolTypeException( - "The accent TeXFormula represents a single symbol with the name '" - + accent.getName() - + "', but this symbol is not defined as an accent (" - + TeXSymbolParser.TYPE_ATTR + "='acc') in '" - + TeXSymbolParser.RESOURCE_NAME + "'!"); + "The accent TeXFormula represents a single symbol with the name '" + + accent.getName() + + "', but this symbol is not defined as an accent (" + + TeXSymbolParser.TYPE_ATTR + "='acc') in '" + + TeXSymbolParser.RESOURCE_NAME + "'!"); } else throw new InvalidTeXFormulaException( - "The accent TeXFormula does not represent a single symbol!"); + "The accent TeXFormula does not represent a single symbol!"); } } - + public Box createBox(TeXEnvironment env) { TeXFont tf = env.getTeXFont(); int style = env.getStyle(); - - // set base in cramped style + + // set base in cramped style Box b = (base == null ? new StrutBox(0, 0, 0, 0) : base.createBox(env.crampStyle())); - + float u = b.getWidth(); float s = 0; if (underbase instanceof CharSymbol) s = tf.getSkew(((CharSymbol) underbase).getCharFont(tf), style); - - // retrieve best Char from the accent symbol + + // retrieve best Char from the accent symbol Char ch = tf.getChar(accent.getName(), style); while (tf.hasNextLarger(ch)) { Char larger = tf.getNextLarger(ch, style); @@ -159,50 +158,50 @@ else break; } - + // calculate delta - float ec = -SpaceAtom.getFactor(TeXConstants.UNIT_MU, env); + float ec = -SpaceAtom.getFactor(TeXConstants.UNIT_MU, env); float delta = acc ? ec : Math.min(b.getHeight(), tf.getXHeight(style, ch.getFontCode())); - + // create vertical box VerticalBox vBox = new VerticalBox(); - + // accent Box y; float italic = ch.getItalic(); - Box cb = new CharBox(ch); - if (acc) - cb = accent.createBox(changeSize ? env.subStyle() : env); + Box cb = new CharBox(ch); + if (acc) + cb = accent.createBox(changeSize ? env.subStyle() : env); - if (Math.abs(italic) > TeXFormula.PREC) { + if (Math.abs(italic) > TeXFormula.PREC) { y = new HorizontalBox(new StrutBox(-italic, 0, 0, 0)); y.add(cb); } else y = cb; - + // if diff > 0, center accent, otherwise center base float diff = (u - y.getWidth()) / 2; y.setShift(s + (diff > 0 ? diff : 0)); if (diff < 0) b = new HorizontalBox(b, y.getWidth(), TeXConstants.ALIGN_CENTER); vBox.add(y); - + // kern - vBox.add(new StrutBox(0, changeSize ? -delta : -b.getHeight(), 0, 0)); + vBox.add(new StrutBox(0, changeSize ? -delta : -b.getHeight(), 0, 0)); // base vBox.add(b); - + // set height and depth vertical box float total = vBox.getHeight() + vBox.getDepth(), d = b.getDepth(); vBox.setDepth(d); vBox.setHeight(total - d); - if (diff < 0) { - HorizontalBox hb = new HorizontalBox(new StrutBox(diff, 0, 0, 0)); - hb.add(vBox); - hb.setWidth(u); - return hb; - } + if (diff < 0) { + HorizontalBox hb = new HorizontalBox(new StrutBox(diff, 0, 0, 0)); + hb.add(vBox); + hb.setWidth(u); + return hb; + } return vBox; } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/AlphabetRegistration.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/AlphabetRegistration.java (.../AlphabetRegistration.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/AlphabetRegistration.java (.../AlphabetRegistration.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,36 +24,34 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.lang.Character.UnicodeBlock; - public interface AlphabetRegistration { - - public static final Character.UnicodeBlock[] JLM_GREEK = new Character.UnicodeBlock[]{Character.UnicodeBlock.GREEK, Character.UnicodeBlock.GREEK_EXTENDED}; - public static final Character.UnicodeBlock[] JLM_CYRILLIC = new Character.UnicodeBlock[]{Character.UnicodeBlock.CYRILLIC}; - + + public static final Character.UnicodeBlock[] JLM_GREEK = new Character.UnicodeBlock[] {Character.UnicodeBlock.GREEK, Character.UnicodeBlock.GREEK_EXTENDED}; + public static final Character.UnicodeBlock[] JLM_CYRILLIC = new Character.UnicodeBlock[] {Character.UnicodeBlock.CYRILLIC}; + public Character.UnicodeBlock[] getUnicodeBlock(); - + public Object getPackage() throws AlphabetRegistrationException; public String getTeXFontFileName(); Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/AlphabetRegistrationException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/AlphabetRegistrationException.java (.../AlphabetRegistrationException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/AlphabetRegistrationException.java (.../AlphabetRegistrationException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,7 +49,9 @@ * Signals that an error occured while registering an alphabet */ public class AlphabetRegistrationException extends Exception { - + + private static final long serialVersionUID = 2024902825275906423L; + protected AlphabetRegistrationException(String str) { super(str); } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ArrayOfAtoms.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ArrayOfAtoms.java (.../ArrayOfAtoms.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ArrayOfAtoms.java (.../ArrayOfAtoms.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,107 +24,105 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.util.BitSet; -import java.util.Map; import java.util.LinkedList; public class ArrayOfAtoms extends TeXFormula { - + public LinkedList> array; public int col, row; public ArrayOfAtoms() { - super(); - array = new LinkedList>(); - array.add(new LinkedList()); - row = 0; + super(); + array = new LinkedList>(); + array.add(new LinkedList()); + row = 0; } - + public void addCol() { - array.get(row).add(root); - root = null; + array.get(row).add(root); + root = null; } public void addCol(int n) { - array.get(row).add(root); - for (int i = 1; i < n - 1; i++) { - array.get(row).add(null); - } - root = null; + array.get(row).add(root); + for (int i = 1; i < n - 1; i++) { + array.get(row).add(null); + } + root = null; } public void addRow() { - addCol(); - array.add(new LinkedList()); - row++; + addCol(); + array.add(new LinkedList()); + row++; } public int getRows() { - return row; + return row; } public int getCols() { - return col; + return col; } public VRowAtom getAsVRow() { - VRowAtom vr = new VRowAtom(); - vr.setAddInterline(true); - for (LinkedList r : array) { - for (Atom a : r) { - vr.append(a); - } - } + VRowAtom vr = new VRowAtom(); + vr.setAddInterline(true); + for (LinkedList r : array) { + for (Atom a : r) { + vr.append(a); + } + } - return vr; + return vr; } - + public void checkDimensions() { - if (array.getLast().size() != 0) - addRow(); - else if (root != null) - addRow(); - - row = array.size() - 1; - col = array.get(0).size(); + if (array.getLast().size() != 0) + addRow(); + else if (root != null) + addRow(); - for (int i = 1; i < row; i++) { - if (array.get(i).size() > col) { - col = array.get(i).size(); - } - } + row = array.size() - 1; + col = array.get(0).size(); - /* Thanks to Juan Enrique Escobar Robles for this patch - which let the user have empty columns */ - for (int i = 0; i < row; i++) { - int j = array.get(i).size(); - if (j != col && array.get(i).get(0) != null && array.get(i).get(0).type != TeXConstants.TYPE_INTERTEXT) { - LinkedList r = array.get(i); - for(; j < col; j++) { - r.add(null); - } - } - } + for (int i = 1; i < row; i++) { + if (array.get(i).size() > col) { + col = array.get(i).size(); + } + } + + /* Thanks to Juan Enrique Escobar Robles for this patch + which let the user have empty columns */ + for (int i = 0; i < row; i++) { + int j = array.get(i).size(); + if (j != col && array.get(i).get(0) != null && array.get(i).get(0).type != TeXConstants.TYPE_INTERTEXT) { + LinkedList r = array.get(i); + for(; j < col; j++) { + r.add(null); + } + } + } } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Atom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Atom.java (.../Atom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Atom.java (.../Atom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* Atom.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ @@ -50,7 +50,7 @@ /** * An abstract superclass for all logical mathematical constructions that can be - * a part of a TeXFormula. All subclasses must implement the abstract + * a part of a TeXFormula. All subclasses must implement the abstract * {@link #createBox(TeXEnvironment)} method that transforms this logical unit into * a concrete box (that can be painted). They also must define their type, used for * determining what glue to use between adjacent atoms in a "row construction". That can @@ -59,9 +59,9 @@ * This can be done by implementing the methods {@link #getLeftType()} and * {@link #getRightType()}. * The left type will then be used for determining the glue between this atom and the - * previous one (in a row, if any) and the right type for the glue between this atom and + * previous one (in a row, if any) and the right type for the glue between this atom and * the following one (in a row, if any). - * + * * @author Kurt Vermeulen */ public abstract class Atom implements Cloneable { @@ -70,51 +70,51 @@ * The type of the atom (default value: ordinary atom) */ public int type = TeXConstants.TYPE_ORDINARY; - + public int type_limits = TeXConstants.SCRIPT_NOLIMITS; public int alignment = -1; - + /** * Convert this atom into a {@link Box}, using properties set by "parent" * atoms, like the TeX style, the last used font, color settings, ... - * + * * @param env the current environment settings * @return the resulting box. */ public abstract Box createBox(TeXEnvironment env); - + /** * Get the type of the leftermost child atom. Most atoms have no child atoms, * so the "left type" and the "right type" are the same: the atom's type. This * also is the default implementation. - * But Some atoms are composed of child atoms put one after another in a + * But Some atoms are composed of child atoms put one after another in a * horizontal row. These atoms must override this method. - * + * * @return the type of the leftermost child atom */ public int getLeftType() { - return type; + return type; } - + /** * Get the type of the rightermost child atom. Most atoms have no child atoms, * so the "left type" and the "right type" are the same: the atom's type. This * also is the default implementation. - * But Some atoms are composed of child atoms put one after another in a + * But Some atoms are composed of child atoms put one after another in a * horizontal row. These atoms must override this method. - * + * * @return the type of the rightermost child atom */ public int getRightType() { - return type; + return type; } - + public Atom clone() { - try { - return (Atom)super.clone(); - } catch (Exception e) { - return null; - } + try { + return (Atom)super.clone(); + } catch (Exception e) { + return null; + } } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BigDelimiterAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BigDelimiterAtom.java (.../BigDelimiterAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BigDelimiterAtom.java (.../BigDelimiterAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -55,17 +55,17 @@ public BigDelimiterAtom(SymbolAtom delim, int size) { this.delim = delim; - this.size = size; + this.size = size; } - + public Box createBox(TeXEnvironment env) { Box b = DelimiterFactory.create(delim, env, size); - HorizontalBox hbox = new HorizontalBox(); - final float h = b.getHeight(); - final float total = h + b.getDepth(); - final float axis = env.getTeXFont().getAxisHeight(env.getStyle()); - b.setShift(-total / 2 + h - axis); - hbox.add(b); - return hbox; + HorizontalBox hbox = new HorizontalBox(); + final float h = b.getHeight(); + final float total = h + b.getDepth(); + final float axis = env.getTeXFont().getAxisHeight(env.getStyle()); + b.setShift(-total / 2 + h - axis); + hbox.add(b); + return hbox; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BigOperatorAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BigOperatorAtom.java (.../BigOperatorAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BigOperatorAtom.java (.../BigOperatorAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ @@ -53,20 +53,20 @@ * with its limits. */ public class BigOperatorAtom extends Atom { - + // limits private Atom under = null, over = null; - + // atom representing a big operator protected Atom base = null; - + // whether the "limits"-value should be taken into account // (otherwise the default rules will be applied) private boolean limitsSet = false; - + // whether limits should be drawn over and under the base (<-> as scripts) private boolean limits = false; - + /** * Creates a new BigOperatorAtom from the given atoms. * The default rules the positioning of the limits will be applied. @@ -81,140 +81,140 @@ this.over = over; type = TeXConstants.TYPE_BIG_OPERATOR; } - + /** * Creates a new BigOperatorAtom from the given atoms. * Limits will be drawn according to the "limits"-value * * @param base atom representing the big operator * @param under atom representing the under limit * @param over atom representing the over limit - * @param limits whether limits should be drawn over and under the base (<-> as scripts) + * @param limits whether limits should be drawn over and under the base (<-> as scripts) */ public BigOperatorAtom(Atom base, Atom under, Atom over, boolean limits) { this(base, under, over); this.limits = limits; limitsSet = true; } - + public Box createBox(TeXEnvironment env) { TeXFont tf = env.getTeXFont(); int style = env.getStyle(); - + Box y; float delta; - - RowAtom bbase = null; - Atom Base = base; - if (base instanceof TypedAtom) { - Atom at = ((TypedAtom)base).getBase(); - if (at instanceof RowAtom && ((RowAtom)at).lookAtLastAtom && base.type_limits != TeXConstants.SCRIPT_LIMITS) { - base = ((RowAtom)at).getLastAtom(); - bbase = (RowAtom)at; - } - else - base = at; - } + RowAtom bbase = null; + Atom Base = base; + if (base instanceof TypedAtom) { + Atom at = ((TypedAtom)base).getBase(); + if (at instanceof RowAtom && ((RowAtom)at).lookAtLastAtom && base.type_limits != TeXConstants.SCRIPT_LIMITS) { + base = ((RowAtom)at).getLastAtom(); + bbase = (RowAtom)at; + } else + base = at; + } + if ((limitsSet && !limits) - || (!limitsSet && style >= TeXConstants.STYLE_TEXT) - || (base.type_limits == TeXConstants.SCRIPT_NOLIMITS) - || (base.type_limits == TeXConstants.SCRIPT_NORMAL && style >= TeXConstants.STYLE_TEXT)) { + || (!limitsSet && style >= TeXConstants.STYLE_TEXT) + || (base.type_limits == TeXConstants.SCRIPT_NOLIMITS) + || (base.type_limits == TeXConstants.SCRIPT_NORMAL && style >= TeXConstants.STYLE_TEXT)) { // if explicitly set to not display as limits or if not set and style // is not display, then attach over and under as regular sub- en // superscript - if (bbase != null) { - bbase.add(new ScriptsAtom(base, under, over)); - Box b = bbase.createBox(env); - bbase.getLastAtom(); - bbase.add(base); - base = Base; - return b; - } + if (bbase != null) { + bbase.add(new ScriptsAtom(base, under, over)); + Box b = bbase.createBox(env); + bbase.getLastAtom(); + bbase.add(base); + base = Base; + return b; + } return new ScriptsAtom(base, under, over).createBox(env); - } else { + } else { if (base instanceof SymbolAtom - && base.type == TeXConstants.TYPE_BIG_OPERATOR) { // single + && base.type == TeXConstants.TYPE_BIG_OPERATOR) { // single // bigop // symbol Char c = tf.getChar(((SymbolAtom) base).getName(), style); y = base.createBox(env); - + // include delta in width delta = c.getItalic(); - } else { // formula + } else { // formula delta = 0; y = new HorizontalBox(base == null ? new StrutBox(0, 0, 0, 0) - : base.createBox(env)); + : base.createBox(env)); } - + // limits Box x = null, z = null; if (over != null) x = over.createBox(env.supStyle()); if (under != null) z = under.createBox(env.subStyle()); - + // make boxes equally wide float maxWidth = Math.max(Math.max(x == null ? 0 : x.getWidth(), y - .getWidth()), z == null ? 0 : z.getWidth()); + .getWidth()), z == null ? 0 : z.getWidth()); x = changeWidth(x, maxWidth); y = changeWidth(y, maxWidth); z = changeWidth(z, maxWidth); - + // build vertical box VerticalBox vBox = new VerticalBox(); - + float bigop5 = tf.getBigOpSpacing5(style), kern = 0; float xh = 0; // TODO: check why this is not used // NOPMD - + // over if (over != null) { vBox.add(new StrutBox(0, bigop5, 0, 0)); x.setShift(delta / 2); vBox.add(x); kern = Math.max(tf.getBigOpSpacing1(style), tf - .getBigOpSpacing3(style) - - x.getDepth()); + .getBigOpSpacing3(style) + - x.getDepth()); vBox.add(new StrutBox(0, kern, 0, 0)); xh = vBox.getHeight() + vBox.getDepth(); } - + // base vBox.add(y); - + // under if (under != null) { float k = Math.max(tf.getBigOpSpacing2(style), tf - .getBigOpSpacing4(style) - - z.getHeight()); + .getBigOpSpacing4(style) + - z.getHeight()); vBox.add(new StrutBox(0, k, 0, 0)); z.setShift(-delta / 2); vBox.add(z); vBox.add(new StrutBox(0, bigop5, 0, 0)); } - + // set height and depth vertical box and return it float h = y.getHeight(), total = vBox.getHeight() + vBox.getDepth(); if (x != null) h += bigop5 + kern + x.getHeight() + x.getDepth(); vBox.setHeight(h); vBox.setDepth(total - h); - - if (bbase != null) { - HorizontalBox hb = new HorizontalBox(bbase.createBox(env));bbase.add(base); - hb.add(vBox); - base = Base; - return hb; - } + if (bbase != null) { + HorizontalBox hb = new HorizontalBox(bbase.createBox(env)); + bbase.add(base); + hb.add(vBox); + base = Base; + return hb; + } + return vBox; } } - - /* - * Centers the given box in a new box that has the given width - */ + + /* + * Centers the given box in a new box that has the given width + */ private static Box changeWidth(Box b, float maxWidth) { if (b != null && Math.abs(maxWidth - b.getWidth()) > TeXFormula.PREC) return new HorizontalBox(b, maxWidth, TeXConstants.ALIGN_CENTER); Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BoldAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BoldAtom.java (.../BoldAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BoldAtom.java (.../BoldAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Box.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Box.java (.../Box.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Box.java (.../Box.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,36 +25,35 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ package org.scilab.forge.jlatexmath; +import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; -import java.awt.geom.Rectangle2D; import java.awt.Stroke; -import java.awt.BasicStroke; +import java.awt.geom.Rectangle2D; import java.util.LinkedList; -import java.util.List; /** * An abstract graphical representation of a formula, that can be painted. All characters, font @@ -317,17 +316,17 @@ if (showDepth) { Color c = g2.getColor(); g2.setColor(Color.RED); - if (depth > 0) { - g2.fill(new Rectangle2D.Float(x, y, width, depth)); - g2.setColor(c); - g2.draw(new Rectangle2D.Float(x, y, width, depth)); - } else if (depth < 0) { - g2.fill(new Rectangle2D.Float(x, y + depth, width, -depth)); - g2.setColor(c); - g2.draw(new Rectangle2D.Float(x, y + depth, width, -depth)); - } else { - g2.setColor(c); - } + if (depth > 0) { + g2.fill(new Rectangle2D.Float(x, y, width, depth)); + g2.setColor(c); + g2.draw(new Rectangle2D.Float(x, y, width, depth)); + } else if (depth < 0) { + g2.fill(new Rectangle2D.Float(x, y + depth, width, -depth)); + g2.setColor(c); + g2.draw(new Rectangle2D.Float(x, y + depth, width, -depth)); + } else { + g2.setColor(c); + } } g2.setStroke(st); } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BreakFormula.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BreakFormula.java (.../BreakFormula.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BreakFormula.java (.../BreakFormula.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BreakMarkAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BreakMarkAtom.java (.../BreakMarkAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/BreakMarkAtom.java (.../BreakMarkAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CedillaAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CedillaAtom.java (.../CedillaAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CedillaAtom.java (.../CedillaAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Char.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Char.java (.../Char.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Char.java (.../Char.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* Char.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -57,47 +57,47 @@ private final Font font; private final Metrics m; private final int fontCode; - + public Char(char c, Font f, int fc, Metrics m) { - font = f; - fontCode = fc; - this.c = c; - this.m = m; + font = f; + fontCode = fc; + this.c = c; + this.m = m; } - + public CharFont getCharFont() { - return new CharFont(c, fontCode); + return new CharFont(c, fontCode); } - + public char getChar() { - return c; + return c; } - + public Font getFont() { - return font; + return font; } - + public int getFontCode() { - return fontCode; + return fontCode; } - + public float getWidth() { - return m.getWidth(); + return m.getWidth(); } - + public float getItalic() { - return m.getItalic(); + return m.getItalic(); } - + public float getHeight() { - return m.getHeight(); + return m.getHeight(); } - + public float getDepth() { - return m.getDepth(); + return m.getDepth(); } - + public Metrics getMetrics() { - return m; + return m; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharAtom.java (.../CharAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharAtom.java (.../CharAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,68 +1,68 @@ /* CharAtom.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * An atom representing exactly one alphanumeric character and the text style in which - * it should be drawn. + * An atom representing exactly one alphanumeric character and the text style in which + * it should be drawn. */ public class CharAtom extends CharSymbol { // alphanumeric character private final char c; - + // text style (null means the default text style) private String textStyle; private boolean mathMode; /** * Creates a CharAtom that will represent the given character in the given text style. * Null for the text style means the default text style. - * + * * @param c the alphanumeric character * @param textStyle the text style in which the character should be drawn */ @@ -81,49 +81,49 @@ } public Box createBox(TeXEnvironment env) { - if (textStyle == null) { - String ts = env.getTextStyle(); - if (ts != null) { - textStyle = ts; - } - } - boolean smallCap = env.getSmallCap(); - Char ch = getChar(env.getTeXFont(), env.getStyle(), smallCap); - Box box = new CharBox(ch); - if (smallCap && Character.isLowerCase(c)) { - // We have a small capital - box = new ScaleBox(box, 0.8f, 0.8f); - } - - return box; + if (textStyle == null) { + String ts = env.getTextStyle(); + if (ts != null) { + textStyle = ts; + } + } + boolean smallCap = env.getSmallCap(); + Char ch = getChar(env.getTeXFont(), env.getStyle(), smallCap); + Box box = new CharBox(ch); + if (smallCap && Character.isLowerCase(c)) { + // We have a small capital + box = new ScaleBox(box, 0.8f, 0.8f); + } + + return box; } public char getCharacter() { - return c; + return c; } /* * Get the Char-object representing this character ("c") in the right text style */ private Char getChar(TeXFont tf, int style, boolean smallCap) { - char chr = c; - if (smallCap) { - if (Character.isLowerCase(c)) { - chr = Character.toUpperCase(c); - } - } - if (textStyle == null) { - return tf.getDefaultChar(chr, style); - } else { - return tf.getChar(chr, textStyle, style); - } + char chr = c; + if (smallCap) { + if (Character.isLowerCase(c)) { + chr = Character.toUpperCase(c); + } + } + if (textStyle == null) { + return tf.getDefaultChar(chr, style); + } else { + return tf.getChar(chr, textStyle, style); + } } public CharFont getCharFont(TeXFont tf) { - return getChar(tf, TeXConstants.STYLE_DISPLAY, false).getCharFont(); + return getChar(tf, TeXConstants.STYLE_DISPLAY, false).getCharFont(); } public String toString() { - return "CharAtom: \'" + c + "\'"; + return "CharAtom: \'" + c + "\'"; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharBox.java (.../CharBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharBox.java (.../CharBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,57 +1,54 @@ /* CharBox.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; import java.awt.Font; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; -import java.awt.geom.Rectangle2D; -import java.awt.Stroke; -import java.awt.BasicStroke; /** * A box representing a single character. @@ -60,51 +57,55 @@ private final CharFont cf; private final float size; - private float italic; - - private final char[] arr = new char[1]; + private float italic; + private final char[] arr = new char[1]; + /** * Create a new CharBox that will represent the character defined by the given * Char-object. - * + * * @param c a Char-object containing the character's font information. */ public CharBox(Char c) { - cf = c.getCharFont(); - size = c.getMetrics().getSize(); - width = c.getWidth(); - height = c.getHeight(); - depth = c.getDepth(); - italic = c.getItalic(); + cf = c.getCharFont(); + size = c.getMetrics().getSize(); + width = c.getWidth(); + height = c.getHeight(); + depth = c.getDepth(); + italic = c.getItalic(); } public void addItalicCorrectionToWidth() { width += italic; italic = 0; } - + public void draw(Graphics2D g2, float x, float y) { - drawDebug(g2, x, y); - AffineTransform at = g2.getTransform(); + drawDebug(g2, x, y); + AffineTransform at = g2.getTransform(); g2.translate(x, y); - Font font = FontInfo.getFont(cf.fontId); - if (size != 1) { - g2.scale(size, size); - } + Font font = FontInfo.getFont(cf.fontId); + + if (Math.abs(size - TeXFormula.FONT_SCALE_FACTOR) > TeXFormula.PREC) { + g2.scale(size / TeXFormula.FONT_SCALE_FACTOR, + size / TeXFormula.FONT_SCALE_FACTOR); + } + if (g2.getFont() != font) { - g2.setFont(font); - } - arr[0] = cf.c; - g2.drawChars(arr, 0, 1, 0, 0); - g2.setTransform(at); + g2.setFont(font); + } + + arr[0] = cf.c; + g2.drawChars(arr, 0, 1, 0, 0); + g2.setTransform(at); } - + public int getLastFontId() { - return cf.fontId; + return cf.fontId; } public String toString() { - return super.toString() + "=" + cf.c; + return super.toString() + "=" + cf.c; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharFont.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharFont.java (.../CharFont.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharFont.java (.../CharFont.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* CharFont.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -54,14 +54,14 @@ public char c; public int fontId; public int boldFontId; - + public CharFont(char ch, int f) { - this(ch, f, f); + this(ch, f, f); } - + public CharFont(char ch, int f, int bf) { - c = ch; - fontId = f; - boldFontId = bf; + c = ch; + fontId = f; + boldFontId = bf; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharSymbol.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharSymbol.java (.../CharSymbol.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CharSymbol.java (.../CharSymbol.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,54 +1,54 @@ /* CharSymbol.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * An common superclass for atoms that represent one single character - * and access the font information. + * and access the font information. */ public abstract class CharSymbol extends Atom { @@ -57,34 +57,34 @@ * Msubsup wil use this property for a certain spacing rule. */ private boolean textSymbol = false; - + /** * Mark as text symbol (used by Dummy) */ public void markAsTextSymbol() { - textSymbol = true; + textSymbol = true; } - + /** * Remove the mark so the atom remains unchanged (used by Dummy) */ public void removeMark() { - textSymbol = false; + textSymbol = false; } - + /** * Tests if this atom is marked as a text symbol (used by Msubsup) - * + * * @return whether this CharSymbol is marked as a text symbol */ public boolean isMarkedAsTextSymbol() { - return textSymbol; + return textSymbol; } - + /** * Get the CharFont-object that uniquely identifies the character that is represented * by this atom. - * + * * @param tf the TeXFont containing all font related information * @return a CharFont */ Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CumulativeScriptsAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CumulativeScriptsAtom.java (.../CumulativeScriptsAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/CumulativeScriptsAtom.java (.../CumulativeScriptsAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,32 +49,32 @@ * An atom representing a reflected Atom. */ public class CumulativeScriptsAtom extends Atom { - + private Atom base; private RowAtom sup; private RowAtom sub; public CumulativeScriptsAtom(Atom base, Atom sub, Atom sup) { - super(); - if (base instanceof CumulativeScriptsAtom) { - CumulativeScriptsAtom at = (CumulativeScriptsAtom) base; - this.base = at.base; - at.sup.add(sup); - at.sub.add(sub); - this.sup = at.sup; - this.sub = at.sub; - } else { - if (base == null) { - this.base = new PhantomAtom(new CharAtom('M', "mathnormal"), false, true, true); - } else { - this.base = base; - } - this.sup = new RowAtom(sup); - this.sub = new RowAtom(sub); - } + super(); + if (base instanceof CumulativeScriptsAtom) { + CumulativeScriptsAtom at = (CumulativeScriptsAtom) base; + this.base = at.base; + at.sup.add(sup); + at.sub.add(sub); + this.sup = at.sup; + this.sub = at.sub; + } else { + if (base == null) { + this.base = new PhantomAtom(new CharAtom('M', "mathnormal"), false, true, true); + } else { + this.base = base; + } + this.sup = new RowAtom(sup); + this.sub = new RowAtom(sub); + } } - + public Box createBox(TeXEnvironment env) { - return new ScriptsAtom(base, sub, sup).createBox(env); - } + return new ScriptsAtom(base, sub, sup).createBox(env); + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DdotsAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DdotsAtom.java (.../DdotsAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DdotsAtom.java (.../DdotsAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -52,26 +52,26 @@ public DdotsAtom() { } - + public Box createBox(TeXEnvironment env) { - Box ldots = TeXFormula.get("ldots").root.createBox(env); - float w = ldots.getWidth(); - Box dot = SymbolAtom.get("ldotp").createBox(env); - HorizontalBox hb1 = new HorizontalBox(dot, w, TeXConstants.ALIGN_LEFT); - HorizontalBox hb2 = new HorizontalBox(dot, w, TeXConstants.ALIGN_CENTER); - HorizontalBox hb3 = new HorizontalBox(dot, w, TeXConstants.ALIGN_RIGHT); - Box pt4 = new SpaceAtom(TeXConstants.UNIT_MU, 0, 4, 0).createBox(env); - VerticalBox vb = new VerticalBox(); - vb.add(hb1); - vb.add(pt4); - vb.add(hb2); - vb.add(pt4); - vb.add(hb3); - - float h = vb.getHeight() + vb.getDepth(); - vb.setHeight(h); - vb.setDepth(0); + Box ldots = TeXFormula.get("ldots").root.createBox(env); + float w = ldots.getWidth(); + Box dot = SymbolAtom.get("ldotp").createBox(env); + HorizontalBox hb1 = new HorizontalBox(dot, w, TeXConstants.ALIGN_LEFT); + HorizontalBox hb2 = new HorizontalBox(dot, w, TeXConstants.ALIGN_CENTER); + HorizontalBox hb3 = new HorizontalBox(dot, w, TeXConstants.ALIGN_RIGHT); + Box pt4 = new SpaceAtom(TeXConstants.UNIT_MU, 0, 4, 0).createBox(env); + VerticalBox vb = new VerticalBox(); + vb.add(hb1); + vb.add(pt4); + vb.add(hb2); + vb.add(pt4); + vb.add(hb3); - return vb; - } + float h = vb.getHeight() + vb.getDepth(); + vb.setHeight(h); + vb.setDepth(0); + + return vb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DefaultTeXFont.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DefaultTeXFont.java (.../DefaultTeXFont.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DefaultTeXFont.java (.../DefaultTeXFont.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,36 +25,35 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; import java.awt.Font; -import java.util.Map; -import java.util.HashMap; -import java.util.List; -import java.util.ArrayList; -import java.lang.Character.UnicodeBlock; import java.io.FileInputStream; -import java.io.InputStream; import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * The default implementation of the TeXFont-interface. All font information is read @@ -74,19 +73,14 @@ protected final static int SMALL = 2; protected final static int UNICODE = 3; - /** - * Number of font ids in a single font description file. - */ - private static final int NUMBER_OF_FONT_IDS = 256; - private static Map textStyleMappings; private static Map symbolMappings; private static FontInfo[] fontInfo = new FontInfo[0]; private static Map parameters; private static Map generalSettings; private static boolean magnificationEnable = true; - + protected static final int TOP = 0, MID = 1, REP = 2, BOT = 3; protected static final int WIDTH = 0, HEIGHT = 1, DEPTH = 2, IT = 3; @@ -385,7 +379,7 @@ } public float getKern(CharFont left, CharFont right, int style) { - if (left.fontId == right.fontId){ + if (left.fontId == right.fontId) { FontInfo info = fontInfo[left.fontId]; return info.getKern(left.c, right.c, getSizeFactor(style) * TeXFormula.PIXELS_PER_POINT); } else { Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DefaultTeXFontParser.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DefaultTeXFontParser.java (.../DefaultTeXFontParser.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DefaultTeXFontParser.java (.../DefaultTeXFontParser.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,307 +25,305 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ package org.scilab.forge.jlatexmath; -import java.lang.reflect.Method; - import java.awt.Font; +import java.awt.GraphicsEnvironment; import java.io.IOException; import java.io.InputStream; -import java.io.File; -import java.util.HashMap; -import java.util.Map; -import java.util.List; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; -import java.awt.GraphicsEnvironment; +import java.util.HashMap; +import java.util.Map; import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Attr; import org.w3c.dom.Element; -import org.w3c.dom.NodeList; import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Attr; import org.w3c.dom.Node; +import org.w3c.dom.NodeList; /** * Parses the font information from an XML-file. */ public class DefaultTeXFontParser { - /** + /** * if the register font cannot be found, we display an error message - * but we do it only once + * but we do it only once */ - private static boolean registerFontExceptionDisplayed = false; + private static boolean registerFontExceptionDisplayed = false; private static boolean shouldRegisterFonts = true; private static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); private static interface CharChildParser { // NOPMD public void parse(Element el, char ch, FontInfo info) throws XMLResourceParseException; } - + private static class ExtensionParser implements CharChildParser { - + ExtensionParser() { // avoid generation of access class } - + public void parse(Element el, char ch, FontInfo info) throws ResourceParseException { int[] extensionChars = new int[4]; // get required integer attributes extensionChars[DefaultTeXFont.REP] = DefaultTeXFontParser - .getIntAndCheck("rep", el); + .getIntAndCheck("rep", el); // get optional integer attributes extensionChars[DefaultTeXFont.TOP] = DefaultTeXFontParser - .getOptionalInt("top", el, DefaultTeXFont.NONE); + .getOptionalInt("top", el, DefaultTeXFont.NONE); extensionChars[DefaultTeXFont.MID] = DefaultTeXFontParser - .getOptionalInt("mid", el, DefaultTeXFont.NONE); + .getOptionalInt("mid", el, DefaultTeXFont.NONE); extensionChars[DefaultTeXFont.BOT] = DefaultTeXFontParser - .getOptionalInt("bot", el, DefaultTeXFont.NONE); - + .getOptionalInt("bot", el, DefaultTeXFont.NONE); + // parsing OK, add extension info info.setExtension(ch, extensionChars); } } - + private static class KernParser implements CharChildParser { - + KernParser() { // avoid generation of access class } - + public void parse(Element el, char ch, FontInfo info) throws ResourceParseException { // get required integer attribute int code = DefaultTeXFontParser.getIntAndCheck("code", el); // get required float attribute float kernAmount = DefaultTeXFontParser.getFloatAndCheck("val", el); - + // parsing OK, add kern info info.addKern(ch, (char) code, kernAmount); } } - + private static class LigParser implements CharChildParser { - + LigParser() { // avoid generation of access class } - + public void parse(Element el, char ch, FontInfo info) throws ResourceParseException { // get required integer attributes int code = DefaultTeXFontParser.getIntAndCheck("code", el); int ligCode = DefaultTeXFontParser.getIntAndCheck("ligCode", el); - + // parsing OK, add ligature info info.addLigature(ch, (char) code, (char) ligCode); } } - + private static class NextLargerParser implements CharChildParser { - + NextLargerParser() { // avoid generation of access class } - + public void parse(Element el, char ch, FontInfo info) throws ResourceParseException { // get required integer attributes String fontId = DefaultTeXFontParser.getAttrValueAndCheckIfNotNull("fontId", el); int code = DefaultTeXFontParser.getIntAndCheck("code", el); - + // parsing OK, add "next larger" info info.setNextLarger(ch, (char) code, Font_ID.indexOf(fontId)); } } - + public static final String RESOURCE_NAME = "DefaultTeXFont.xml"; - + public static final String STYLE_MAPPING_EL = "TextStyleMapping"; public static final String SYMBOL_MAPPING_EL = "SymbolMapping"; public static final String GEN_SET_EL = "GeneralSettings"; public static final String MUFONTID_ATTR = "mufontid"; public static final String SPACEFONTID_ATTR = "spacefontid"; - + protected static ArrayList Font_ID = new ArrayList(); private static Map rangeTypeMappings = new HashMap(); private static Map charChildParsers = new HashMap(); - + private Map parsedTextStyles; - + private Element root; private Object base = null; - + static { // string-to-constant mappings setRangeTypeMappings(); // parsers for the child elements of a "Char"-element setCharChildParsers(); } - + public DefaultTeXFontParser() throws ResourceParseException { - this(DefaultTeXFontParser.class.getResourceAsStream(RESOURCE_NAME), RESOURCE_NAME); + this(DefaultTeXFontParser.class.getResourceAsStream(RESOURCE_NAME), RESOURCE_NAME); } - + public DefaultTeXFontParser(InputStream file, String name) throws ResourceParseException { - factory.setIgnoringElementContentWhitespace(true); - factory.setIgnoringComments(true); - try { - root = factory.newDocumentBuilder().parse(file).getDocumentElement(); + factory.setIgnoringElementContentWhitespace(true); + factory.setIgnoringComments(true); + try { + root = factory.newDocumentBuilder().parse(file).getDocumentElement(); } catch (Exception e) { // JDOMException or IOException throw new XMLResourceParseException(name, e); } } - public DefaultTeXFontParser(Object base , InputStream file, String name) throws ResourceParseException { - this.base = base; - factory.setIgnoringElementContentWhitespace(true); - factory.setIgnoringComments(true); - try { - root = factory.newDocumentBuilder().parse(file).getDocumentElement(); + public DefaultTeXFontParser(Object base, InputStream file, String name) throws ResourceParseException { + this.base = base; + factory.setIgnoringElementContentWhitespace(true); + factory.setIgnoringComments(true); + try { + root = factory.newDocumentBuilder().parse(file).getDocumentElement(); } catch (Exception e) { // JDOMException or IOException - throw new XMLResourceParseException(name, e); + throw new XMLResourceParseException(name, e); } } - + private static void setCharChildParsers() { charChildParsers.put("Kern", new KernParser()); charChildParsers.put("Lig", new LigParser()); charChildParsers.put("NextLarger", new NextLargerParser()); charChildParsers.put("Extension", new ExtensionParser()); } - + public FontInfo[] parseFontDescriptions(FontInfo[] fi, InputStream file, String name) throws ResourceParseException { - if (file == null) { - return fi; - } + if (file == null) { + return fi; + } ArrayList res = new ArrayList(Arrays.asList(fi)); - Element font; - try { - font = factory.newDocumentBuilder().parse(file).getDocumentElement(); - } catch (Exception e) { - throw new XMLResourceParseException("Cannot find the file " + name + "!" + e.toString()); - } - - String fontName = getAttrValueAndCheckIfNotNull("name", font); - // get required integer attribute - String fontId = getAttrValueAndCheckIfNotNull("id", font); - if (Font_ID.indexOf(fontId) < 0) - Font_ID.add(fontId); - else throw new FontAlreadyLoadedException("Font " + fontId + " is already loaded !"); - // get required real attributes - float space = getFloatAndCheck("space", font); - float xHeight = getFloatAndCheck("xHeight", font); - float quad = getFloatAndCheck("quad", font); - - // get optional integer attribute - int skewChar = getOptionalInt("skewChar", font, -1); - - // get optional boolean for unicode - int unicode = getOptionalInt("unicode", font, 0); - - // get different versions of a font - String bold = null; - try { - bold = getAttrValueAndCheckIfNotNull("boldVersion", font); - } catch (ResourceParseException e) {} - String roman = null; - try { - roman = getAttrValueAndCheckIfNotNull("romanVersion", font); - } catch (ResourceParseException e) {} - String ss = null; - try { - ss = getAttrValueAndCheckIfNotNull("ssVersion", font); - } catch (ResourceParseException e) {} - String tt = null; - try { - tt = getAttrValueAndCheckIfNotNull("ttVersion", font); - } catch (ResourceParseException e) {} - String it = null; - try { - it = getAttrValueAndCheckIfNotNull("itVersion", font); - } catch (ResourceParseException e) {} - - String path = name.substring(0, name.lastIndexOf("/") + 1) + fontName; - - // create FontInfo-object - FontInfo info = new FontInfo(Font_ID.indexOf(fontId), base, path, fontName, unicode, xHeight, space, quad, bold, roman, ss, tt, it); - - if (skewChar != -1) // attribute set - info.setSkewChar((char) skewChar); - - // process all "Char"-elements - NodeList listF = font.getElementsByTagName("Char"); - for (int j = 0; j < listF.getLength(); j++) - processCharElement((Element) listF.item(j), info); - - // parsing OK, add to table - res.add(info); + Element font; + try { + font = factory.newDocumentBuilder().parse(file).getDocumentElement(); + } catch (Exception e) { + throw new XMLResourceParseException("Cannot find the file " + name + "!" + e.toString()); + } - for (int i = 0; i < res.size(); i++) { - FontInfo fin = res.get(i); - fin.setBoldId(Font_ID.indexOf(fin.boldVersion)); - fin.setRomanId(Font_ID.indexOf(fin.romanVersion)); - fin.setSsId(Font_ID.indexOf(fin.ssVersion)); - fin.setTtId(Font_ID.indexOf(fin.ttVersion)); - fin.setItId(Font_ID.indexOf(fin.itVersion)); - } - - parsedTextStyles = parseStyleMappings(); - return res.toArray(fi); + String fontName = getAttrValueAndCheckIfNotNull("name", font); + // get required integer attribute + String fontId = getAttrValueAndCheckIfNotNull("id", font); + if (Font_ID.indexOf(fontId) < 0) + Font_ID.add(fontId); + else throw new FontAlreadyLoadedException("Font " + fontId + " is already loaded !"); + // get required real attributes + float space = getFloatAndCheck("space", font); + float xHeight = getFloatAndCheck("xHeight", font); + float quad = getFloatAndCheck("quad", font); + + // get optional integer attribute + int skewChar = getOptionalInt("skewChar", font, -1); + + // get optional boolean for unicode + int unicode = getOptionalInt("unicode", font, 0); + + // get different versions of a font + String bold = null; + try { + bold = getAttrValueAndCheckIfNotNull("boldVersion", font); + } catch (ResourceParseException e) {} + String roman = null; + try { + roman = getAttrValueAndCheckIfNotNull("romanVersion", font); + } catch (ResourceParseException e) {} + String ss = null; + try { + ss = getAttrValueAndCheckIfNotNull("ssVersion", font); + } catch (ResourceParseException e) {} + String tt = null; + try { + tt = getAttrValueAndCheckIfNotNull("ttVersion", font); + } catch (ResourceParseException e) {} + String it = null; + try { + it = getAttrValueAndCheckIfNotNull("itVersion", font); + } catch (ResourceParseException e) {} + + String path = name.substring(0, name.lastIndexOf("/") + 1) + fontName; + + // create FontInfo-object + FontInfo info = new FontInfo(Font_ID.indexOf(fontId), base, path, fontName, unicode, xHeight, space, quad, bold, roman, ss, tt, it); + + if (skewChar != -1) // attribute set + info.setSkewChar((char) skewChar); + + // process all "Char"-elements + NodeList listF = font.getElementsByTagName("Char"); + for (int j = 0; j < listF.getLength(); j++) + processCharElement((Element) listF.item(j), info); + + // parsing OK, add to table + res.add(info); + + for (int i = 0; i < res.size(); i++) { + FontInfo fin = res.get(i); + fin.setBoldId(Font_ID.indexOf(fin.boldVersion)); + fin.setRomanId(Font_ID.indexOf(fin.romanVersion)); + fin.setSsId(Font_ID.indexOf(fin.ssVersion)); + fin.setTtId(Font_ID.indexOf(fin.ttVersion)); + fin.setItId(Font_ID.indexOf(fin.itVersion)); + } + + parsedTextStyles = parseStyleMappings(); + return res.toArray(fi); } - + public FontInfo[] parseFontDescriptions(FontInfo[] fi) throws ResourceParseException { - Element fontDescriptions = (Element)root.getElementsByTagName("FontDescriptions").item(0); + Element fontDescriptions = (Element)root.getElementsByTagName("FontDescriptions").item(0); if (fontDescriptions != null) { // element present - NodeList list = fontDescriptions.getElementsByTagName("Metrics"); + NodeList list = fontDescriptions.getElementsByTagName("Metrics"); for (int i = 0; i < list.getLength(); i++) { - // get required string attribute - String include = getAttrValueAndCheckIfNotNull("include", (Element)list.item(i)); - if (base == null) { - fi = parseFontDescriptions(fi, DefaultTeXFontParser.class.getResourceAsStream(include), include); - } else { - fi = parseFontDescriptions(fi, base.getClass().getResourceAsStream(include), include); - } - } - } - return fi; + // get required string attribute + String include = getAttrValueAndCheckIfNotNull("include", (Element)list.item(i)); + if (base == null) { + fi = parseFontDescriptions(fi, DefaultTeXFontParser.class.getResourceAsStream(include), include); + } else { + fi = parseFontDescriptions(fi, base.getClass().getResourceAsStream(include), include); + } + } + } + return fi; } protected void parseExtraPath() throws ResourceParseException { - Element syms = (Element)root.getElementsByTagName("TeXSymbols").item(0); + Element syms = (Element)root.getElementsByTagName("TeXSymbols").item(0); if (syms != null) { // element present - // get required string attribute - String include = getAttrValueAndCheckIfNotNull("include", syms); - SymbolAtom.addSymbolAtom(base.getClass().getResourceAsStream(include), include); - } - Element settings = (Element)root.getElementsByTagName("FormulaSettings").item(0); + // get required string attribute + String include = getAttrValueAndCheckIfNotNull("include", syms); + SymbolAtom.addSymbolAtom(base.getClass().getResourceAsStream(include), include); + } + Element settings = (Element)root.getElementsByTagName("FormulaSettings").item(0); if (settings != null) { // element present - // get required string attribute - String include = getAttrValueAndCheckIfNotNull("include", settings); - TeXFormula.addSymbolMappings(base.getClass().getResourceAsStream(include), include); - } + // get required string attribute + String include = getAttrValueAndCheckIfNotNull("include", settings); + TeXFormula.addSymbolMappings(base.getClass().getResourceAsStream(include), include); + } } - + private static void processCharElement(Element charElement, FontInfo info) throws ResourceParseException { // retrieve required integer attribute @@ -338,60 +336,61 @@ metrics[DefaultTeXFont.IT] = getOptionalFloat("italic", charElement, 0); // set metrics info.setMetrics(ch, metrics); - + // process children - NodeList list = charElement.getChildNodes(); + NodeList list = charElement.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { - Node node = list.item(i); - if (node.getNodeType() != Node.TEXT_NODE) { - Element el = (Element)node; - Object parser = charChildParsers.get(el.getTagName()); - if (parser == null) // unknown element - throw new XMLResourceParseException(RESOURCE_NAME - + ": a -element has an unknown child element '" - + el.getTagName() + "'!"); - else - // process the child element - ((CharChildParser) parser).parse(el, ch, info); - } - } + Node node = list.item(i); + if (node.getNodeType() != Node.TEXT_NODE) { + Element el = (Element)node; + Object parser = charChildParsers.get(el.getTagName()); + if (parser == null) // unknown element + throw new XMLResourceParseException(RESOURCE_NAME + + ": a -element has an unknown child element '" + + el.getTagName() + "'!"); + else + // process the child element + ((CharChildParser) parser).parse(el, ch, info); + } + } } public static void registerFonts(boolean b) { - shouldRegisterFonts = b; + shouldRegisterFonts = b; } - + public static Font createFont(String name) throws ResourceParseException { - return createFont(DefaultTeXFontParser.class.getResourceAsStream(name), name); + return createFont(DefaultTeXFontParser.class.getResourceAsStream(name), name); } public static Font createFont(InputStream fontIn, String name) throws ResourceParseException { try { - Font f = Font.createFont(Font.TRUETYPE_FONT, fontIn).deriveFont(TeXFormula.PIXELS_PER_POINT); - GraphicsEnvironment graphicEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); - /** - * The following fails under java 1.5 - * graphicEnv.registerFont(f); - * dynamic load then - */ - if (shouldRegisterFonts) { - try { - Method registerFontMethod = graphicEnv.getClass().getMethod("registerFont", new Class[] { Font.class }); - if ((Boolean) registerFontMethod.invoke(graphicEnv, new Object[] { f }) == Boolean.FALSE) { - System.err.println("Cannot register the font " + f.getFontName()); - } - } catch (Exception ex) { - if (!registerFontExceptionDisplayed) { - System.err.println("Warning: Jlatexmath: Could not access to registerFont. Please update to java 6"); - registerFontExceptionDisplayed = true; - } - } - } - return f; + Font f = Font.createFont(Font.TRUETYPE_FONT, fontIn) + .deriveFont(TeXFormula.PIXELS_PER_POINT * TeXFormula.FONT_SCALE_FACTOR); + GraphicsEnvironment graphicEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); + /** + * The following fails under java 1.5 + * graphicEnv.registerFont(f); + * dynamic load then + */ + if (shouldRegisterFonts) { + try { + Method registerFontMethod = graphicEnv.getClass().getMethod("registerFont", new Class[] { Font.class }); + if ((Boolean) registerFontMethod.invoke(graphicEnv, new Object[] { f }) == Boolean.FALSE) { + System.err.println("Cannot register the font " + f.getFontName()); + } + } catch (Exception ex) { + if (!registerFontExceptionDisplayed) { + System.err.println("Warning: Jlatexmath: Could not access to registerFont. Please update to java 6"); + registerFontExceptionDisplayed = true; + } + } + } + return f; } catch (Exception e) { throw new XMLResourceParseException(RESOURCE_NAME - + ": error reading font '" + name + "'. Error message: " - + e.getMessage()); + + ": error reading font '" + name + "'. Error message: " + + e.getMessage()); } finally { try { if (fontIn != null) @@ -401,7 +400,7 @@ } } } - + public Map parseSymbolMappings() throws ResourceParseException { Map res = new HashMap(); Element symbolMappings = (Element)root.getElementsByTagName("SymbolMappings").item(0); @@ -410,89 +409,88 @@ throw new XMLResourceParseException(RESOURCE_NAME, "SymbolMappings"); else { // element present // iterate all mappings - NodeList list = symbolMappings.getElementsByTagName("Mapping"); - for (int i = 0; i < list.getLength(); i++) { - String include = getAttrValueAndCheckIfNotNull("include", (Element)list.item(i)); - Element map; - try { - if (base == null) { - map = factory.newDocumentBuilder().parse(DefaultTeXFontParser.class.getResourceAsStream(include)).getDocumentElement(); - } else { - map = factory.newDocumentBuilder().parse(base.getClass().getResourceAsStream(include)).getDocumentElement(); - } - } catch (Exception e) { - throw new XMLResourceParseException("Cannot find the file " + include + "!"); - } - NodeList listM = map.getElementsByTagName(SYMBOL_MAPPING_EL); - for (int j = 0; j < listM.getLength(); j++) { - Element mapping = (Element)listM.item(j); - // get string attribute - String symbolName = getAttrValueAndCheckIfNotNull("name", mapping); - // get integer attributes - int ch = getIntAndCheck("ch", mapping); - String fontId = getAttrValueAndCheckIfNotNull("fontId", mapping); - // put mapping in table - String boldFontId = null; - try { - boldFontId = getAttrValueAndCheckIfNotNull("boldId", mapping); - } - catch (ResourceParseException e) {} + NodeList list = symbolMappings.getElementsByTagName("Mapping"); + for (int i = 0; i < list.getLength(); i++) { + String include = getAttrValueAndCheckIfNotNull("include", (Element)list.item(i)); + Element map; + try { + if (base == null) { + map = factory.newDocumentBuilder().parse(DefaultTeXFontParser.class.getResourceAsStream(include)).getDocumentElement(); + } else { + map = factory.newDocumentBuilder().parse(base.getClass().getResourceAsStream(include)).getDocumentElement(); + } + } catch (Exception e) { + throw new XMLResourceParseException("Cannot find the file " + include + "!"); + } + NodeList listM = map.getElementsByTagName(SYMBOL_MAPPING_EL); + for (int j = 0; j < listM.getLength(); j++) { + Element mapping = (Element)listM.item(j); + // get string attribute + String symbolName = getAttrValueAndCheckIfNotNull("name", mapping); + // get integer attributes + int ch = getIntAndCheck("ch", mapping); + String fontId = getAttrValueAndCheckIfNotNull("fontId", mapping); + // put mapping in table + String boldFontId = null; + try { + boldFontId = getAttrValueAndCheckIfNotNull("boldId", mapping); + } catch (ResourceParseException e) {} - if (boldFontId == null) { - res.put(symbolName, new CharFont((char) ch, Font_ID.indexOf(fontId))); - } else { - res.put(symbolName, new CharFont((char) ch, Font_ID.indexOf(fontId), Font_ID.indexOf(boldFontId))); - } - } - } - - return res; - } + if (boldFontId == null) { + res.put(symbolName, new CharFont((char) ch, Font_ID.indexOf(fontId))); + } else { + res.put(symbolName, new CharFont((char) ch, Font_ID.indexOf(fontId), Font_ID.indexOf(boldFontId))); + } + } + } + + return res; + } } - + public String[] parseDefaultTextStyleMappings() throws ResourceParseException { String[] res = new String[4]; Element defaultTextStyleMappings = (Element)root - .getElementsByTagName("DefaultTextStyleMapping").item(0); + .getElementsByTagName("DefaultTextStyleMapping").item(0); if (defaultTextStyleMappings == null) return res; else { // element present // iterate all mappings - NodeList list = defaultTextStyleMappings.getElementsByTagName("MapStyle"); + NodeList list = defaultTextStyleMappings.getElementsByTagName("MapStyle"); for (int i = 0; i < list.getLength(); i++) { - Element mapping = (Element)list.item(i); + Element mapping = (Element)list.item(i); // get range name and check if it's valid String code = getAttrValueAndCheckIfNotNull("code", mapping); Object codeMapping = rangeTypeMappings.get(code); if (codeMapping == null) // unknown range name throw new XMLResourceParseException(RESOURCE_NAME, "MapStyle", - "code", "contains an unknown \"range name\" '" + code - + "'!"); + "code", "contains an unknown \"range name\" '" + code + + "'!"); // get mapped style and check if it exists String textStyleName = getAttrValueAndCheckIfNotNull("textStyle", - mapping); + mapping); Object styleMapping = parsedTextStyles.get(textStyleName); if (styleMapping == null) // unknown text style throw new XMLResourceParseException(RESOURCE_NAME, "MapStyle", - "textStyle", "contains an unknown text style '" - + textStyleName + "'!"); + "textStyle", "contains an unknown text style '" + + textStyleName + "'!"); // now check if the range is defined within the mapped text style CharFont[] charFonts = parsedTextStyles.get(textStyleName); int index = ((Integer) codeMapping).intValue(); if (charFonts[index] == null) // range not defined throw new XMLResourceParseException(RESOURCE_NAME - + ": the default text style mapping '" + textStyleName - + "' for the range '" + code - + "' contains no mapping for that range!"); + + ": the default text style mapping '" + textStyleName + + "' for the range '" + code + + "' contains no mapping for that range!"); else // everything OK, put mapping in table res[index] = textStyleName; } } return res; } - + public Map parseParameters() throws ResourceParseException { Map res = new HashMap(); Element parameters = (Element)root.getElementsByTagName("Parameters").item(0); @@ -501,7 +499,7 @@ throw new XMLResourceParseException(RESOURCE_NAME, "Parameters"); else { // element present // iterate all attributes - NamedNodeMap list = parameters.getAttributes(); + NamedNodeMap list = parameters.getAttributes(); for (int i = 0; i < list.getLength(); i++) { String name = ((Attr)list.item(i)).getName(); // set float value (if valid) @@ -510,7 +508,7 @@ return res; } } - + public Map parseGeneralSettings() throws ResourceParseException { Map res = new HashMap(); // TODO: must this be 'Number' ? @@ -526,35 +524,34 @@ res.put("scriptfactor", getFloatAndCheck("scriptfactor", generalSettings)); // autoboxing res.put("scriptscriptfactor", getFloatAndCheck( - "scriptscriptfactor", generalSettings)); // autoboxing - + "scriptscriptfactor", generalSettings)); // autoboxing + } return res; } - + public Map parseTextStyleMappings() { return parsedTextStyles; } - + private Map parseStyleMappings() throws ResourceParseException { Map res = new HashMap(); Element textStyleMappings = (Element)root.getElementsByTagName("TextStyleMappings").item(0); if (textStyleMappings == null) - return res; + return res; else { // element present // iterate all mappings - NodeList list = textStyleMappings.getElementsByTagName(STYLE_MAPPING_EL); + NodeList list = textStyleMappings.getElementsByTagName(STYLE_MAPPING_EL); for (int i = 0; i < list.getLength(); i++) { Element mapping = (Element)list.item(i); // get required string attribute String textStyleName = getAttrValueAndCheckIfNotNull("name", - mapping); - String boldFontId = null; - try { - boldFontId = getAttrValueAndCheckIfNotNull("bold", mapping); - } - catch (ResourceParseException e) {} - + mapping); + String boldFontId = null; + try { + boldFontId = getAttrValueAndCheckIfNotNull("bold", mapping); + } catch (ResourceParseException e) {} + NodeList mapRangeList = mapping.getElementsByTagName("MapRange"); // iterate all mapping ranges CharFont[] charFonts = new CharFont[4]; @@ -568,70 +565,70 @@ Object codeMapping = rangeTypeMappings.get(code); if (codeMapping == null) throw new XMLResourceParseException(RESOURCE_NAME, - "MapRange", "code", - "contains an unknown \"range name\" '" + code + "'!"); + "MapRange", "code", + "contains an unknown \"range name\" '" + code + "'!"); else if (boldFontId == null) charFonts[((Integer) codeMapping).intValue()] = new CharFont((char) ch, Font_ID.indexOf(fontId)); - else charFonts[((Integer) codeMapping).intValue()] = new CharFont((char) ch, Font_ID.indexOf(fontId), Font_ID.indexOf(boldFontId)); + else charFonts[((Integer) codeMapping).intValue()] = new CharFont((char) ch, Font_ID.indexOf(fontId), Font_ID.indexOf(boldFontId)); } res.put(textStyleName, charFonts); } } return res; } - + private static void setRangeTypeMappings() { rangeTypeMappings.put("numbers", DefaultTeXFont.NUMBERS); // autoboxing rangeTypeMappings.put("capitals", DefaultTeXFont.CAPITALS); // autoboxing rangeTypeMappings.put("small", DefaultTeXFont.SMALL); // autoboxing rangeTypeMappings.put("unicode", DefaultTeXFont.UNICODE); // autoboxing } - + private static String getAttrValueAndCheckIfNotNull(String attrName, Element element) throws ResourceParseException { String attrValue = element.getAttribute(attrName); if (attrValue.equals("")) throw new XMLResourceParseException(RESOURCE_NAME, element.getTagName(), - attrName, null); + attrName, null); return attrValue; } - + public static float getFloatAndCheck(String attrName, Element element) throws ResourceParseException { String attrValue = getAttrValueAndCheckIfNotNull(attrName, element); - - // try parsing string to float value + + // try parsing string to float value float res = 0; try { res = (float) Double.parseDouble(attrValue); } catch (NumberFormatException e) { throw new XMLResourceParseException(RESOURCE_NAME, element.getTagName(), - attrName, "has an invalid real value!"); + attrName, "has an invalid real value!"); } // parsing OK return res; } - + public static int getIntAndCheck(String attrName, Element element) throws ResourceParseException { String attrValue = getAttrValueAndCheckIfNotNull(attrName, element); - + // try parsing string to integer value int res = 0; - try { - res = Integer.parseInt(attrValue); - } catch (NumberFormatException e) { - throw new XMLResourceParseException(RESOURCE_NAME, element.getTagName(), - attrName, "has an invalid integer value!"); - } - // parsing OK - return res; + try { + res = Integer.parseInt(attrValue); + } catch (NumberFormatException e) { + throw new XMLResourceParseException(RESOURCE_NAME, element.getTagName(), + attrName, "has an invalid integer value!"); + } + // parsing OK + return res; } - + public static int getOptionalInt(String attrName, Element element, - int defaultValue) throws ResourceParseException { + int defaultValue) throws ResourceParseException { String attrValue = element.getAttribute(attrName); - if (attrValue.equals("")) // attribute not present + if (attrValue.equals("")) // attribute not present return defaultValue; else { // try parsing string to integer value @@ -640,15 +637,15 @@ res = Integer.parseInt(attrValue); } catch (NumberFormatException e) { throw new XMLResourceParseException(RESOURCE_NAME, element - .getTagName(), attrName, "has an invalid integer value!"); + .getTagName(), attrName, "has an invalid integer value!"); } // parsing OK return res; } } - + public static float getOptionalFloat(String attrName, Element element, - float defaultValue) throws ResourceParseException { + float defaultValue) throws ResourceParseException { String attrValue = element.getAttribute(attrName); if (attrValue.equals("")) // attribute not present return defaultValue; @@ -659,7 +656,7 @@ res = (float) Double.parseDouble(attrValue); } catch (NumberFormatException e) { throw new XMLResourceParseException(RESOURCE_NAME, element - .getTagName(), attrName, "has an invalid float value!"); + .getTagName(), attrName, "has an invalid float value!"); } // parsing OK return res; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DelimiterFactory.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DelimiterFactory.java (.../DelimiterFactory.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DelimiterFactory.java (.../DelimiterFactory.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ @@ -53,26 +53,26 @@ * in different sizes. */ public class DelimiterFactory { - + public static Box create(SymbolAtom symbol, TeXEnvironment env, int size) { - if (size > 4) - return symbol.createBox(env); + if (size > 4) + return symbol.createBox(env); - TeXFont tf = env.getTeXFont(); + TeXFont tf = env.getTeXFont(); int style = env.getStyle(); - Char c = tf.getChar(symbol.getName(), style); + Char c = tf.getChar(symbol.getName(), style); int i; - - for (i = 1; i <= size && tf.hasNextLarger(c); i++) - c = tf.getNextLarger(c, style); - - if (i <= size && !tf.hasNextLarger(c)) { - CharBox A = new CharBox(tf.getChar('A', "mathnormal", style)); - Box b = create(symbol.getName(), env, size*(A.getHeight() + A.getDepth())); - return b; - } - return new CharBox(c); + for (i = 1; i <= size && tf.hasNextLarger(c); i++) + c = tf.getNextLarger(c, style); + + if (i <= size && !tf.hasNextLarger(c)) { + CharBox A = new CharBox(tf.getChar('A', "mathnormal", style)); + Box b = create(symbol.getName(), env, size*(A.getHeight() + A.getDepth())); + return b; + } + + return new CharBox(c); } /** @@ -86,12 +86,12 @@ public static Box create(String symbol, TeXEnvironment env, float minHeight) { TeXFont tf = env.getTeXFont(); int style = env.getStyle(); - Char c = tf.getChar(symbol, style); - + Char c = tf.getChar(symbol, style); + // start with smallest character Metrics m = c.getMetrics(); float total = m.getHeight() + m.getDepth(); - + // try larger versions of the same character until minHeight has been // reached while (total < minHeight && tf.hasNextLarger(c)) { @@ -105,23 +105,23 @@ // construct tall enough vertical box VerticalBox vBox = new VerticalBox(); Extension ext = tf.getExtension(c, style); // extension info - + if (ext.hasTop()) { // insert top part c = ext.getTop(); vBox.add(new CharBox(c)); } - + boolean middle = ext.hasMiddle(); if (middle) { // insert middle part c = ext.getMiddle(); vBox.add(new CharBox(c)); } - + if (ext.hasBottom()) { // insert bottom part c = ext.getBottom(); vBox.add(new CharBox(c)); } - + // insert repeatable part until tall enough c = ext.getRepeat(); CharBox rep = new CharBox(c); @@ -135,7 +135,7 @@ else vBox.add(rep); } - + return vBox; } else // no extensions, so return tallest possible character Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DelimiterMappingNotFoundException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DelimiterMappingNotFoundException.java (.../DelimiterMappingNotFoundException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DelimiterMappingNotFoundException.java (.../DelimiterMappingNotFoundException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,61 +1,63 @@ /* DelimiterMappingNotFoundException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals a missing character-to-delimiter mapping. - * + * * @author Kurt Vermeulen */ public class DelimiterMappingNotFoundException extends JMathTeXException { + private static final long serialVersionUID = 273456491396361682L; + protected DelimiterMappingNotFoundException(char delimiter) { - super("No mapping found for the character '" + delimiter + "'! " - + "Insert a <" + TeXFormulaSettingsParser.CHARTODEL_MAPPING_EL - + ">-element in '" + TeXFormulaSettingsParser.RESOURCE_NAME + "'."); + super("No mapping found for the character '" + delimiter + "'! " + + "Insert a <" + TeXFormulaSettingsParser.CHARTODEL_MAPPING_EL + + ">-element in '" + TeXFormulaSettingsParser.RESOURCE_NAME + "'."); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DoubleFramedAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DoubleFramedAtom.java (.../DoubleFramedAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/DoubleFramedAtom.java (.../DoubleFramedAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,66 +1,64 @@ /* FBoxAtom.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.awt.Color; - /** - * An atom representing a boxed base atom. + * An atom representing a boxed base atom. */ public class DoubleFramedAtom extends FBoxAtom { public DoubleFramedAtom(Atom base) { - super(base); + super(base); } - + public Box createBox(TeXEnvironment env) { - Box bbase = base.createBox(env); - float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); - float space = INTERSPACE * SpaceAtom.getFactor(TeXConstants.UNIT_EM, env); - float sspace = 1.5f * drt + 0.5f * SpaceAtom.getFactor(TeXConstants.UNIT_POINT, env); - return new FramedBox(new FramedBox(bbase, 0.75f * drt, space), 1.5f * drt, sspace); + Box bbase = base.createBox(env); + float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); + float space = INTERSPACE * SpaceAtom.getFactor(TeXConstants.UNIT_EM, env); + float sspace = 1.5f * drt + 0.5f * SpaceAtom.getFactor(TeXConstants.UNIT_POINT, env); + return new FramedBox(new FramedBox(bbase, 0.75f * drt, space), 1.5f * drt, sspace); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Dummy.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Dummy.java (.../Dummy.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Dummy.java (.../Dummy.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -81,16 +81,15 @@ } /** - * Changes the type of the atom - * - * @param t the new type + * Returns the type of the atom + * + * @return the type of the atom */ public int getType() { return type; } /** - * * @return the changed type, or the old left type if it hasn't been changed */ public int getLeftType() { Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/EmptyAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/EmptyAtom.java (.../EmptyAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/EmptyAtom.java (.../EmptyAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -51,8 +51,8 @@ public class EmptyAtom extends Atom { public EmptyAtom() { } - + public Box createBox(TeXEnvironment env) { - return new StrutBox(0, 0, 0, 0); - } + return new StrutBox(0, 0, 0, 0); + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/EmptyFormulaException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/EmptyFormulaException.java (.../EmptyFormulaException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/EmptyFormulaException.java (.../EmptyFormulaException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,54 +1,56 @@ /* EmptyFormulaException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; public class EmptyFormulaException extends Exception { + private static final long serialVersionUID = -8034123603703695067L; + public EmptyFormulaException() { - super("Illegal operation with an empty Formula!"); + super("Illegal operation with an empty Formula!"); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Extension.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Extension.java (.../Extension.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Extension.java (.../Extension.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* Extension.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -57,39 +57,39 @@ private final Char middle; private final Char bottom; private final Char repeat; - + public Extension(Char t, Char m, Char r, Char b) { - top = t; - middle = m; - repeat = r; - bottom = b; + top = t; + middle = m; + repeat = r; + bottom = b; } - + public boolean hasTop() { - return top != null; + return top != null; } - + public boolean hasMiddle() { - return middle != null; + return middle != null; } public boolean hasBottom() { - return bottom != null; + return bottom != null; } - + public Char getTop() { - return top; + return top; } - + public Char getMiddle() { - return middle; + return middle; } - + public Char getRepeat() { - return repeat; + return repeat; } - + public Char getBottom() { - return bottom; + return bottom; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FBoxAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FBoxAtom.java (.../FBoxAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FBoxAtom.java (.../FBoxAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,54 +1,54 @@ /* FBoxAtom.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; import java.awt.Color; /** - * An atom representing a boxed base atom. + * An atom representing a boxed base atom. */ public class FBoxAtom extends Atom { @@ -57,31 +57,31 @@ // base atom protected final Atom base; protected Color bg = null, line = null; - + public FBoxAtom(Atom base) { - if (base == null) - this.base = new RowAtom(); // empty base - else { - this.base = base; - this.type = base.type; - } + if (base == null) + this.base = new RowAtom(); // empty base + else { + this.base = base; + this.type = base.type; + } } - + public FBoxAtom(Atom base, Color bg, Color line) { - this(base); - this.bg = bg; - this.line = line; + this(base); + this.bg = bg; + this.line = line; } public Box createBox(TeXEnvironment env) { - Box bbase = base.createBox(env); - float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); - float space = INTERSPACE * SpaceAtom.getFactor(TeXConstants.UNIT_EM, env); - if (bg == null) { - return new FramedBox(bbase, drt, space); - } else { - env.isColored = true; - return new FramedBox(bbase, drt, space, line, bg); - } + Box bbase = base.createBox(env); + float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); + float space = INTERSPACE * SpaceAtom.getFactor(TeXConstants.UNIT_EM, env); + if (bg == null) { + return new FramedBox(bbase, drt, space); + } else { + env.isColored = true; + return new FramedBox(bbase, drt, space, line, bg); + } } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FcscoreBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FcscoreBox.java (.../FcscoreBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FcscoreBox.java (.../FcscoreBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,30 +24,30 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; +import java.awt.BasicStroke; import java.awt.Graphics2D; import java.awt.Stroke; -import java.awt.BasicStroke; import java.awt.geom.AffineTransform; import java.awt.geom.Line2D; @@ -60,55 +60,55 @@ private boolean strike; private float space; private float thickness; - + public FcscoreBox(int N, float h, float thickness, float space, boolean strike) { - this.N = N; - this.width = N * (thickness + space) + 2 * space; - this.height = h; - this.depth = 0; - this.strike = strike; - this.space = space; - this.thickness = thickness; + this.N = N; + this.width = N * (thickness + space) + 2 * space; + this.height = h; + this.depth = 0; + this.strike = strike; + this.space = space; + this.thickness = thickness; } public void draw(Graphics2D g2, float x, float y) { - AffineTransform transf = g2.getTransform(); - Stroke oldStroke = g2.getStroke(); + AffineTransform transf = g2.getTransform(); + Stroke oldStroke = g2.getStroke(); - final double sx = transf.getScaleX(); - final double sy = transf.getScaleY(); - double s = 1; - if (sx == sy) { - // There are rounding problems due to scale factor: lines could have different - // spacing... - // So the increment (space+thickness) is done in using integer. - s = sx; - AffineTransform t = (AffineTransform) transf.clone(); - t.scale(1 / sx, 1 / sy); - g2.setTransform(t); - } + final double sx = transf.getScaleX(); + final double sy = transf.getScaleY(); + double s = 1; + if (sx == sy) { + // There are rounding problems due to scale factor: lines could have different + // spacing... + // So the increment (space+thickness) is done in using integer. + s = sx; + AffineTransform t = (AffineTransform) transf.clone(); + t.scale(1 / sx, 1 / sy); + g2.setTransform(t); + } - g2.setStroke(new BasicStroke((float) (s * thickness), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); - float th = thickness / 2.f; - final Line2D.Float line = new Line2D.Float(); - float xx = x + space; - xx = (float) (xx * s + (space / 2.f) * s); - final int inc = (int) Math.round((space + thickness) * s); + g2.setStroke(new BasicStroke((float) (s * thickness), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); + float th = thickness / 2.f; + final Line2D.Float line = new Line2D.Float(); + float xx = x + space; + xx = (float) (xx * s + (space / 2.f) * s); + final int inc = (int) Math.round((space + thickness) * s); - for (int i = 0; i < N; i++) { - line.setLine(xx + th * s, (y - height) * s, xx + th * s, y * s); - g2.draw(line); - xx += inc; - } + for (int i = 0; i < N; i++) { + line.setLine(xx + th * s, (y - height) * s, xx + th * s, y * s); + g2.draw(line); + xx += inc; + } - if (strike) { - - line.setLine((x + space) * s, (y - height / 2.f) * s, xx - s * space / 2, (y - height / 2.f) * s); - g2.draw(line); - } - - g2.setTransform(transf); - g2.setStroke(oldStroke); + if (strike) { + + line.setLine((x + space) * s, (y - height / 2.f) * s, xx - s * space / 2, (y - height / 2.f) * s); + g2.draw(line); + } + + g2.setTransform(transf); + g2.setStroke(oldStroke); } public int getLastFontId() { Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FencedAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FencedAtom.java (.../FencedAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FencedAtom.java (.../FencedAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ @@ -80,7 +80,7 @@ this(base, l, null, r); } - public FencedAtom(Atom base, SymbolAtom l, List m, SymbolAtom r) { + public FencedAtom(Atom base, SymbolAtom l, List m, SymbolAtom r) { if (base == null) this.base = new RowAtom(); // empty base else Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FixedCharAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FixedCharAtom.java (.../FixedCharAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FixedCharAtom.java (.../FixedCharAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* FixedCharAtom.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -51,20 +51,20 @@ */ public class FixedCharAtom extends CharSymbol { - private final CharFont cf; + private final CharFont cf; - public FixedCharAtom(CharFont c) { - cf = c; - } + public FixedCharAtom(CharFont c) { + cf = c; + } - public CharFont getCharFont(TeXFont tf) { - return cf; - } + public CharFont getCharFont(TeXFont tf) { + return cf; + } - public Box createBox(TeXEnvironment env) { - TeXFont tf = env.getTeXFont(); - Char c = tf.getChar(cf, env.getStyle()); - return new CharBox(c); - } + public Box createBox(TeXEnvironment env) { + TeXFont tf = env.getTeXFont(); + Char c = tf.getChar(cf, env.getStyle()); + return new CharBox(c); + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FontAlreadyLoadedException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FontAlreadyLoadedException.java (.../FontAlreadyLoadedException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FontAlreadyLoadedException.java (.../FontAlreadyLoadedException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,53 +1,55 @@ /* FontAlreadyLoadedException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; public class FontAlreadyLoadedException extends XMLResourceParseException { + private static final long serialVersionUID = -6172324828113185078L; + public FontAlreadyLoadedException(String msg) { super(msg); } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FontInfo.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FontInfo.java (.../FontInfo.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FontInfo.java (.../FontInfo.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -54,36 +54,36 @@ * Contains all the font information for 1 font. */ public class FontInfo { - + /** * Maximum number of character codes in a TeX font. */ public static final int NUMBER_OF_CHAR_CODES = 256; private static Map fonts = new HashMap(); - + private class CharCouple { - + private final char left, right; - + CharCouple(char l, char r) { left = l; right = r; } - + public boolean equals(Object o) { CharCouple lig = (CharCouple) o; return left == lig.left && right == lig.right; } - + public int hashCode() { return (left + right) % 128; } } - + // ID private final int fontId; - + // font private Font font; private final Object base; @@ -96,12 +96,12 @@ private CharFont[] nextLarger; private int[][] extensions; private HashMap unicode = null; - + // skew character of the font (used for positioning accents) private char skewChar = (char) -1; - + // general parameters for this font - private final float xHeight; + private final float xHeight; private final float space; private final float quad; private int boldId; @@ -117,28 +117,28 @@ public FontInfo(int fontId, Object base, String path, String fontName, int unicode, float xHeight, float space, float quad, String boldVersion, String romanVersion, String ssVersion, String ttVersion, String itVersion) { this.fontId = fontId; - this.base = base; - this.path = path; - this.fontName = fontName; + this.base = base; + this.path = path; + this.fontName = fontName; this.xHeight = xHeight; this.space = space; this.quad = quad; - this.boldVersion = boldVersion; - this.romanVersion = romanVersion; - this.ssVersion = ssVersion; - this.ttVersion = ttVersion; - this.itVersion = itVersion; - int num = NUMBER_OF_CHAR_CODES; - if (unicode != 0) { - this.unicode = new HashMap(unicode); - num = unicode; - } - metrics = new float[num][]; - nextLarger = new CharFont[num]; - extensions = new int[num][]; - fonts.put(fontId, this); + this.boldVersion = boldVersion; + this.romanVersion = romanVersion; + this.ssVersion = ssVersion; + this.ttVersion = ttVersion; + this.itVersion = itVersion; + int num = NUMBER_OF_CHAR_CODES; + if (unicode != 0) { + this.unicode = new HashMap(unicode); + num = unicode; + } + metrics = new float[num][]; + nextLarger = new CharFont[num]; + extensions = new int[num][]; + fonts.put(fontId, this); } - + /** * * @param left @@ -151,7 +151,7 @@ public void addKern(char left, char right, float k) { kern.put(new CharCouple(left, right), new Float(k)); } - + /** * @param left * left character @@ -163,102 +163,102 @@ public void addLigature(char left, char right, char ligChar) { lig.put(new CharCouple(left, right), new Character(ligChar)); } - + public int[] getExtension(char ch) { - if (unicode == null) - return extensions[ch]; - return extensions[unicode.get(ch)]; + if (unicode == null) + return extensions[ch]; + return extensions[unicode.get(ch)]; } - + public float getKern(char left, char right, float factor) { Object obj = kern.get(new CharCouple(left, right)); if (obj == null) return 0; else return ((Float) obj).floatValue() * factor; } - + public CharFont getLigature(char left, char right) { Object obj = lig.get(new CharCouple(left, right)); if (obj == null) return null; else return new CharFont(((Character) obj).charValue(), fontId); } - + public float[] getMetrics(char c) { - if (unicode == null) - return metrics[c]; - return metrics[unicode.get(c)]; + if (unicode == null) + return metrics[c]; + return metrics[unicode.get(c)]; } - + public CharFont getNextLarger(char ch) { if (unicode == null) - return nextLarger[ch]; - return nextLarger[unicode.get(ch)]; + return nextLarger[ch]; + return nextLarger[unicode.get(ch)]; } - + public float getQuad(float factor) { return quad * factor; } - + /** * @return the skew character of the font (for the correct positioning of * accents) */ public char getSkewChar() { return skewChar; } - + public float getSpace(float factor) { return space * factor; } - + public float getXHeight(float factor) { return xHeight * factor; } - + public boolean hasSpace() { return space > TeXFormula.PREC; } - + public void setExtension(char ch, int[] ext) { if (unicode == null) - extensions[ch] = ext; - else if (!unicode.containsKey(ch)) { - char s = (char)unicode.size(); - unicode.put(ch, s); - extensions[s] = ext; - } else - extensions[unicode.get(ch)] = ext; + extensions[ch] = ext; + else if (!unicode.containsKey(ch)) { + char s = (char)unicode.size(); + unicode.put(ch, s); + extensions[s] = ext; + } else + extensions[unicode.get(ch)] = ext; } - + public void setMetrics(char c, float[] arr) { if (unicode == null) - metrics[c] = arr; - else if (!unicode.containsKey(c)) { - char s = (char)unicode.size(); - unicode.put(c, s); - metrics[s] = arr; - } else - metrics[unicode.get(c)] = arr; + metrics[c] = arr; + else if (!unicode.containsKey(c)) { + char s = (char)unicode.size(); + unicode.put(c, s); + metrics[s] = arr; + } else + metrics[unicode.get(c)] = arr; } - + public void setNextLarger(char ch, char larger, int fontLarger) { if (unicode == null) - nextLarger[ch] = new CharFont(larger, fontLarger); - else if (!unicode.containsKey(ch)) { - char s = (char)unicode.size(); - unicode.put(ch, s); - nextLarger[s] = new CharFont(larger, fontLarger); - } else - nextLarger[unicode.get(ch)] = new CharFont(larger, fontLarger); + nextLarger[ch] = new CharFont(larger, fontLarger); + else if (!unicode.containsKey(ch)) { + char s = (char)unicode.size(); + unicode.put(ch, s); + nextLarger[s] = new CharFont(larger, fontLarger); + } else + nextLarger[unicode.get(ch)] = new CharFont(larger, fontLarger); } - + public void setSkewChar(char c) { skewChar = c; } - + public int getId() { return fontId; } @@ -284,38 +284,38 @@ } public void setSsId(int id) { - ssId = id == -1 ? fontId : id; + ssId = id == -1 ? fontId : id; } public void setTtId(int id) { - ttId = id == -1 ? fontId : id; + ttId = id == -1 ? fontId : id; } public void setItId(int id) { - itId = id == -1 ? fontId : id; + itId = id == -1 ? fontId : id; } public void setRomanId(int id) { - romanId = id == -1 ? fontId : id; + romanId = id == -1 ? fontId : id; } public void setBoldId(int id) { - boldId = id == -1 ? fontId : id; + boldId = id == -1 ? fontId : id; } public Font getFont() { - if (font == null) { - if (base == null) { - font = DefaultTeXFontParser.createFont(path); - } else { - font = DefaultTeXFontParser.createFont(base.getClass().getResourceAsStream(path), fontName); - } - } + if (font == null) { + if (base == null) { + font = DefaultTeXFontParser.createFont(path); + } else { + font = DefaultTeXFontParser.createFont(base.getClass().getResourceAsStream(path), fontName); + } + } return font; } public static Font getFont(int id) { - return fonts.get(id).getFont(); + return fonts.get(id).getFont(); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FormulaNotFoundException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FormulaNotFoundException.java (.../FormulaNotFoundException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FormulaNotFoundException.java (.../FormulaNotFoundException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,61 +1,63 @@ /* FormulaNotFoundException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals that unknown predefined TeXFormula name was used. - * + * * @author Kurt Vermeulen */ public class FormulaNotFoundException extends JMathTeXException { + private static final long serialVersionUID = 7660105446051204466L; + protected FormulaNotFoundException(String name) { - super("There's no predefined TeXFormula with the name '" + name - + "' defined in '" + PredefinedTeXFormulaParser.RESOURCE_NAME - + "'!"); + super("There's no predefined TeXFormula with the name '" + name + + "' defined in '" + PredefinedTeXFormulaParser.RESOURCE_NAME + + "'!"); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FractionAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FractionAtom.java (.../FractionAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FractionAtom.java (.../FractionAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -59,7 +59,7 @@ // alignment settings for the numerator and denominator private int numAlign = TeXConstants.ALIGN_CENTER, - denomAlign = TeXConstants.ALIGN_CENTER; + denomAlign = TeXConstants.ALIGN_CENTER; // the atoms representing the numerator and denominator private Atom numerator, denominator; @@ -95,7 +95,7 @@ } /** - * Depending on noDef, the given thickness and unit will be used (<-> the default + * Depending on noDef, the given thickness and unit will be used (<-> the default * thickness). * * @param num the numerator @@ -106,7 +106,7 @@ * @throws InvalidUnitException if the given integer is not a valid unit constant */ public FractionAtom(Atom num, Atom den, boolean noDef, int unit, float t) - throws InvalidUnitException { + throws InvalidUnitException { // check unit SpaceAtom.checkUnit(unit); @@ -186,7 +186,7 @@ // If not, a default value will be used. private int checkAlignment(int align) { if (align == TeXConstants.ALIGN_LEFT || - align == TeXConstants.ALIGN_RIGHT) + align == TeXConstants.ALIGN_RIGHT) return align; else return TeXConstants.ALIGN_CENTER; @@ -244,7 +244,7 @@ // adjust shift amounts delta = thickness / 2; float kern1 = shiftUp - num.getDepth() - (axis + delta), kern2 = axis - - delta - (denom.getHeight() - shiftDown); + - delta - (denom.getHeight() - shiftDown); float delta1 = clr - kern1, delta2 = clr - kern2; if (delta1 > 0) { shiftUp += delta1; @@ -268,7 +268,7 @@ // adjust shift amounts float kern = shiftUp - num.getDepth() - - (denom.getHeight() - shiftDown); + - (denom.getHeight() - shiftDown); delta = (clr - kern) / 2; if (delta > 0) { shiftUp += delta; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FramedBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FramedBox.java (.../FramedBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/FramedBox.java (.../FramedBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,107 +1,107 @@ /* FramedBox.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; +import java.awt.BasicStroke; +import java.awt.Color; import java.awt.Graphics2D; import java.awt.Stroke; -import java.awt.BasicStroke; import java.awt.geom.Rectangle2D; -import java.awt.Color; /** * A box representing a rotated box. */ public class FramedBox extends Box { - + protected Box box; protected float thickness; protected float space; private Color line; private Color bg; public FramedBox(Box box, float thickness, float space) { - this.box = box; - this.width = box.width + 2 * thickness + 2 * space; - this.height = box.height + thickness + space; - this.depth = box.depth + thickness + space; - this.shift = box.shift; - this.thickness = thickness; - this.space = space; + this.box = box; + this.width = box.width + 2 * thickness + 2 * space; + this.height = box.height + thickness + space; + this.depth = box.depth + thickness + space; + this.shift = box.shift; + this.thickness = thickness; + this.space = space; } public FramedBox(Box box, float thickness, float space, Color line, Color bg) { - this(box, thickness, space); - this.line = line; - this.bg = bg; + this(box, thickness, space); + this.line = line; + this.bg = bg; } public void draw(Graphics2D g2, float x, float y) { - Stroke st = g2.getStroke(); - g2.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); - float th = thickness / 2; - if (bg != null) { - Color prev = g2.getColor(); - g2.setColor(bg); - g2.fill(new Rectangle2D.Float(x + th, y - height + th, width - thickness, height + depth - thickness)); - g2.setColor(prev); - } - if (line != null) { - Color prev = g2.getColor(); - g2.setColor(line); - g2.draw(new Rectangle2D.Float(x + th, y - height + th, width - thickness, height + depth - thickness)); - g2.setColor(prev); - } else { - g2.draw(new Rectangle2D.Float(x + th, y - height + th, width - thickness, height + depth - thickness)); - } - //drawDebug(g2, x, y); - g2.setStroke(st); - box.draw(g2, x + space + thickness, y); + Stroke st = g2.getStroke(); + g2.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); + float th = thickness / 2; + if (bg != null) { + Color prev = g2.getColor(); + g2.setColor(bg); + g2.fill(new Rectangle2D.Float(x + th, y - height + th, width - thickness, height + depth - thickness)); + g2.setColor(prev); + } + if (line != null) { + Color prev = g2.getColor(); + g2.setColor(line); + g2.draw(new Rectangle2D.Float(x + th, y - height + th, width - thickness, height + depth - thickness)); + g2.setColor(prev); + } else { + g2.draw(new Rectangle2D.Float(x + th, y - height + th, width - thickness, height + depth - thickness)); + } + //drawDebug(g2, x, y); + g2.setStroke(st); + box.draw(g2, x + space + thickness, y); } public int getLastFontId() { - return box.getLastFontId(); + return box.getLastFontId(); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GeoGebraLogoAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GeoGebraLogoAtom.java (.../GeoGebraLogoAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GeoGebraLogoAtom.java (.../GeoGebraLogoAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,17 +49,17 @@ public GeoGebraLogoAtom() { } - + public int getLeftType() { - return TeXConstants.TYPE_ORDINARY; + return TeXConstants.TYPE_ORDINARY; } - + public int getRightType() { - return TeXConstants.TYPE_ORDINARY; + return TeXConstants.TYPE_ORDINARY; } public Box createBox(TeXEnvironment env) { - CharBox o = new CharBox(env.getTeXFont().getDefaultChar('o', env.getStyle())); - return new GeoGebraLogoBox(o.width, o.height); - } + CharBox o = new CharBox(env.getTeXFont().getDefaultChar('o', env.getStyle())); + return new GeoGebraLogoBox(o.width, o.height); + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GeoGebraLogoBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GeoGebraLogoBox.java (.../GeoGebraLogoBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GeoGebraLogoBox.java (.../GeoGebraLogoBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,56 +1,55 @@ /* GraphicsBox.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.awt.Graphics2D; -import java.awt.Color; import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; import java.awt.Stroke; import java.awt.geom.AffineTransform; -import java.awt.image.BufferedImage; /** * A box representing a box containing a graphics. @@ -61,47 +60,46 @@ private static final Color blue = new Color(153, 153, 255); private static final BasicStroke st = new BasicStroke(3.79999995f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 4f); - private static final BasicStroke stC = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 4f); public GeoGebraLogoBox(float w, float h) { - this.depth = 0; - this.height = h; - this.width = w; - this.shift = 0; + this.depth = 0; + this.height = h; + this.width = w; + this.shift = 0; } - + public void draw(Graphics2D g2, float x, float y) { - AffineTransform oldAt = g2.getTransform(); - Color oldC = g2.getColor(); - Stroke oldS = g2.getStroke(); - g2.translate(x + 0.25f * height / 2.15f, y - 1.75f / 2.15f * height); - g2.setColor(gray); - g2.setStroke(st); - g2.scale(0.05f * height / 2.15f, 0.05f * height / 2.15f); - g2.rotate(-26 * Math.PI / 180, 20.5, 17.5); - g2.drawArc(0, 0, 43, 32, 0, 360); - g2.rotate(26 * Math.PI / 180, 20.5, 17.5); - g2.setStroke(oldS); - drawCircle(g2, 16f, -5f); - drawCircle(g2, -1f, 7f); - drawCircle(g2, 5f, 28f); - drawCircle(g2, 27f, 24f); - drawCircle(g2, 36f, 3f); - g2.setStroke(oldS); - g2.setTransform(oldAt); - g2.setColor(oldC); + AffineTransform oldAt = g2.getTransform(); + Color oldC = g2.getColor(); + Stroke oldS = g2.getStroke(); + g2.translate(x + 0.25f * height / 2.15f, y - 1.75f / 2.15f * height); + g2.setColor(gray); + g2.setStroke(st); + g2.scale(0.05f * height / 2.15f, 0.05f * height / 2.15f); + g2.rotate(-26 * Math.PI / 180, 20.5, 17.5); + g2.drawArc(0, 0, 43, 32, 0, 360); + g2.rotate(26 * Math.PI / 180, 20.5, 17.5); + g2.setStroke(oldS); + drawCircle(g2, 16f, -5f); + drawCircle(g2, -1f, 7f); + drawCircle(g2, 5f, 28f); + drawCircle(g2, 27f, 24f); + drawCircle(g2, 36f, 3f); + g2.setStroke(oldS); + g2.setTransform(oldAt); + g2.setColor(oldC); } - + private static void drawCircle(Graphics2D g2, float x, float y) { - g2.setColor(blue); - g2.translate(x, y); - g2.fillArc(0, 0, 8, 8, 0, 360); - g2.setColor(Color.BLACK); - g2.drawArc(0, 0, 8, 8, 0, 360); - g2.translate(-x, -y); + g2.setColor(blue); + g2.translate(x, y); + g2.fillArc(0, 0, 8, 8, 0, 360); + g2.setColor(Color.BLACK); + g2.drawArc(0, 0, 8, 8, 0, 360); + g2.translate(-x, -y); } - - public int getLastFontId() { - return 0; + + public int getLastFontId() { + return 0; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Glue.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Glue.java (.../Glue.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Glue.java (.../Glue.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GlueBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GlueBox.java (.../GlueBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GlueBox.java (.../GlueBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GlueSettingsParser.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GlueSettingsParser.java (.../GlueSettingsParser.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GlueSettingsParser.java (.../GlueSettingsParser.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,80 +25,80 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.parsers.DocumentBuilderFactory; + import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * Parses the glue settings (different types and rules) from an XML-file. */ public class GlueSettingsParser { - + private static final String RESOURCE_NAME = "GlueSettings.xml"; - + private final Map typeMappings = new HashMap(); private final Map glueTypeMappings = new HashMap(); private Glue[] glueTypes; - + private final Map styleMappings = new HashMap(); - + private Element root; - + public GlueSettingsParser() throws ResourceParseException { try { setTypeMappings(); setStyleMappings(); - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setIgnoringElementContentWhitespace(true); - factory.setIgnoringComments(true); - root = factory.newDocumentBuilder().parse(GlueSettingsParser.class.getResourceAsStream(RESOURCE_NAME)).getDocumentElement(); - parseGlueTypes(); - } catch (Exception e) { // JDOMException or IOException - throw new XMLResourceParseException(RESOURCE_NAME, e); - } + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setIgnoringElementContentWhitespace(true); + factory.setIgnoringComments(true); + root = factory.newDocumentBuilder().parse(GlueSettingsParser.class.getResourceAsStream(RESOURCE_NAME)).getDocumentElement(); + parseGlueTypes(); + } catch (Exception e) { // JDOMException or IOException + throw new XMLResourceParseException(RESOURCE_NAME, e); + } } - + private void setStyleMappings() { styleMappings.put("display", TeXConstants.STYLE_DISPLAY / 2); styleMappings.put("text", TeXConstants.STYLE_TEXT / 2); styleMappings.put("script", TeXConstants.STYLE_SCRIPT / 2); styleMappings.put("script_script", TeXConstants.STYLE_SCRIPT_SCRIPT / 2); // autoboxing } - + private void parseGlueTypes() throws ResourceParseException { List glueTypesList = new ArrayList (); Element types = (Element)root.getElementsByTagName("GlueTypes").item(0); int defaultIndex = -1; int index = 0; if (types != null) { // element present - NodeList list = types.getElementsByTagName("GlueType"); + NodeList list = types.getElementsByTagName("GlueType"); for (int i = 0; i < list.getLength(); i++) { Element type = (Element)list.item(i); // retrieve required attribute value, throw exception if not set @@ -115,22 +115,22 @@ defaultIndex = index; glueTypesList.add(new Glue(0,0,0,"default")); } - + glueTypes = glueTypesList.toArray(new Glue[glueTypesList.size()]); - + // make sure default glue is at the front if (defaultIndex > 0) { Glue tmp = glueTypes[defaultIndex]; glueTypes[defaultIndex] = glueTypes[0]; glueTypes[0] = tmp; } - + // make reverse map for (int i = 0; i < glueTypes.length; i++) { - glueTypeMappings.put(glueTypes[i].getName(), i); - } + glueTypeMappings.put(glueTypes[i].getName(), i); + } } - + private Glue createGlue(Element type, String name) throws ResourceParseException { final String[] names = { "space", "stretch", "shrink" }; float[] values = new float[names.length]; @@ -143,13 +143,13 @@ val = Double.parseDouble(attrVal); } catch (NumberFormatException e) { throw new XMLResourceParseException(RESOURCE_NAME, "GlueType", - names[i], "has an invalid real value '" + attrVal + "'!"); + names[i], "has an invalid real value '" + attrVal + "'!"); } values[i] = (float) val; } return new Glue(values[0], values[1], values[2], name); } - + private void setTypeMappings() { typeMappings.put("ord", TeXConstants.TYPE_ORDINARY); typeMappings.put("op", TeXConstants.TYPE_BIG_OPERATOR); @@ -160,34 +160,34 @@ typeMappings.put("punct", TeXConstants.TYPE_PUNCTUATION); typeMappings.put("inner", TeXConstants.TYPE_INNER); // autoboxing } - + public Glue[] getGlueTypes() { return glueTypes; } - + public int[][][] createGlueTable() throws ResourceParseException { int size = typeMappings.size(); int[][][] table = new int[size][size][styleMappings.size()]; Element glueTable = (Element)root.getElementsByTagName("GlueTable").item(0); if (glueTable != null) { // element present // iterate all the "Glue"-elements - NodeList list = glueTable.getElementsByTagName("Glue"); + NodeList list = glueTable.getElementsByTagName("Glue"); for (int i = 0; i < list.getLength(); i++) { Element glue = (Element)list.item(i); // retrieve required attribute values and throw exception if they're not set String left = getAttrValueAndCheckIfNotNull("lefttype", glue); - String right = getAttrValueAndCheckIfNotNull("righttype", glue); - String type = getAttrValueAndCheckIfNotNull("gluetype", glue); - // iterate all the "Style"-elements - NodeList listG = glue.getElementsByTagName("Style"); + String right = getAttrValueAndCheckIfNotNull("righttype", glue); + String type = getAttrValueAndCheckIfNotNull("gluetype", glue); + // iterate all the "Style"-elements + NodeList listG = glue.getElementsByTagName("Style"); for (int j = 0; j < listG.getLength(); j++) { Element style = (Element)listG.item(j); String styleName = getAttrValueAndCheckIfNotNull("name", style); // retrieve mappings Object l = typeMappings.get(left); - Object r = typeMappings.get(right); - Object st = styleMappings.get(styleName); - Object val = glueTypeMappings.get(type); + Object r = typeMappings.get(right); + Object st = styleMappings.get(styleName); + Object val = glueTypeMappings.get(type); // throw exception if unknown value set checkMapping(l, "Glue", "lefttype", left); checkMapping(r, "Glue", "righttype", right); @@ -200,20 +200,20 @@ } return table; } - + private static void checkMapping(Object val, String elementName, - String attrName, String attrValue) throws ResourceParseException { + String attrName, String attrValue) throws ResourceParseException { if (val == null) throw new XMLResourceParseException(RESOURCE_NAME, elementName, - attrName, "has an unknown value '" + attrValue + "'!"); + attrName, "has an unknown value '" + attrValue + "'!"); } - + private static String getAttrValueAndCheckIfNotNull(String attrName, Element element) throws ResourceParseException { String attrValue = element.getAttribute(attrName); if (attrValue.equals("")) throw new XMLResourceParseException(RESOURCE_NAME, element.getTagName(), - attrName, null); + attrName, null); return attrValue; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GraphicsAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GraphicsAtom.java (.../GraphicsAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GraphicsAtom.java (.../GraphicsAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,44 +24,43 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.awt.image.ImageObserver; +import java.awt.Graphics2D; import java.awt.Image; -import java.awt.image.BufferedImage; -import java.awt.MediaTracker; import java.awt.Label; -import java.awt.Graphics2D; +import java.awt.MediaTracker; import java.awt.Toolkit; +import java.awt.image.BufferedImage; import java.io.File; -import java.net.URL; import java.net.MalformedURLException; +import java.net.URL; import java.util.Map; /** * An atom representing an atom containing a graphic. */ public class GraphicsAtom extends Atom { - + private Image image = null; private BufferedImage bimage; private Label c; @@ -72,81 +71,81 @@ private int interp = -1; public GraphicsAtom(String path, String option) { - File f = new File(path); - if (!f.exists()) { - try { - URL url = new URL(path); - image = Toolkit.getDefaultToolkit().getImage(url); - } catch (MalformedURLException e) { - image = null; - } - } else { - image = Toolkit.getDefaultToolkit().getImage(path); - } - - if (image != null) { - c = new Label(); - MediaTracker tracker = new MediaTracker(c); - tracker.addImage(image, 0); - try { - tracker.waitForID(0); - } catch (InterruptedException e) { - image = null; - } - } - draw(); - buildAtom(option); + File f = new File(path); + if (!f.exists()) { + try { + URL url = new URL(path); + image = Toolkit.getDefaultToolkit().getImage(url); + } catch (MalformedURLException e) { + image = null; + } + } else { + image = Toolkit.getDefaultToolkit().getImage(path); + } + + if (image != null) { + c = new Label(); + MediaTracker tracker = new MediaTracker(c); + tracker.addImage(image, 0); + try { + tracker.waitForID(0); + } catch (InterruptedException e) { + image = null; + } + } + draw(); + buildAtom(option); } protected void buildAtom(String option) { - base = this; - Map options = ParseOption.parseMap(option); - if (options.containsKey("width") || options.containsKey("height")) { - base = new ResizeAtom(base, options.get("width"), options.get("height"), options.containsKey("keepaspectratio")); - } - if (options.containsKey("scale")) { - double scl = Double.parseDouble(options.get("scale")); - base = new ScaleAtom(base, scl, scl); - } - if (options.containsKey("angle") || options.containsKey("origin")) { - base = new RotateAtom(base, options.get("angle"), options.get("origin")); - } - if (options.containsKey("interpolation")) { - String meth = options.get("interpolation"); - if (meth.equalsIgnoreCase("bilinear")) { - interp = GraphicsBox.BILINEAR; - } else if (meth.equalsIgnoreCase("bicubic")) { - interp = GraphicsBox.BICUBIC; - } else if (meth.equalsIgnoreCase("nearest_neighbor")) { - interp = GraphicsBox.NEAREST_NEIGHBOR; - } - } + base = this; + Map options = ParseOption.parseMap(option); + if (options.containsKey("width") || options.containsKey("height")) { + base = new ResizeAtom(base, options.get("width"), options.get("height"), options.containsKey("keepaspectratio")); + } + if (options.containsKey("scale")) { + double scl = Double.parseDouble(options.get("scale")); + base = new ScaleAtom(base, scl, scl); + } + if (options.containsKey("angle") || options.containsKey("origin")) { + base = new RotateAtom(base, options.get("angle"), options.get("origin")); + } + if (options.containsKey("interpolation")) { + String meth = options.get("interpolation"); + if (meth.equalsIgnoreCase("bilinear")) { + interp = GraphicsBox.BILINEAR; + } else if (meth.equalsIgnoreCase("bicubic")) { + interp = GraphicsBox.BICUBIC; + } else if (meth.equalsIgnoreCase("nearest_neighbor")) { + interp = GraphicsBox.NEAREST_NEIGHBOR; + } + } } - + public void draw() { - if (image != null) { - w = image.getWidth(c); - h = image.getHeight(c); - bimage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); - Graphics2D g2d = bimage.createGraphics(); - g2d.drawImage(image, 0, 0, null); - g2d.dispose(); - } + if (image != null) { + w = image.getWidth(c); + h = image.getHeight(c); + bimage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = bimage.createGraphics(); + g2d.drawImage(image, 0, 0, null); + g2d.dispose(); + } } public Box createBox(TeXEnvironment env) { - if (image != null) { - if (first) { - first = false; - return base.createBox(env); - } else { - env.isColored = true; - float width = w * SpaceAtom.getFactor(TeXConstants.UNIT_PIXEL, env); - float height = h * SpaceAtom.getFactor(TeXConstants.UNIT_PIXEL, env); - return new GraphicsBox(bimage, width, height, env.getSize(), interp); - } - } + if (image != null) { + if (first) { + first = false; + return base.createBox(env); + } else { + env.isColored = true; + float width = w * SpaceAtom.getFactor(TeXConstants.UNIT_PIXEL, env); + float height = h * SpaceAtom.getFactor(TeXConstants.UNIT_PIXEL, env); + return new GraphicsBox(bimage, width, height, env.getSize(), interp); + } + } - return new TeXFormula("\\text{ No such image file ! }").root.createBox(env); + return new TeXFormula("\\text{ No such image file ! }").root.createBox(env); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GraphicsBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GraphicsBox.java (.../GraphicsBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/GraphicsBox.java (.../GraphicsBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,54 +1,54 @@ /* GraphicsBox.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; -import java.awt.RenderingHints; /** * A box representing a box containing a graphics. @@ -64,44 +64,44 @@ private Object interp; public GraphicsBox(BufferedImage image, float width, float height, float size, int interpolation) { - this.image = image; - this.width = width; - this.height = height; - this.scl = 1 / size; - depth = 0; - shift = 0; - switch (interpolation) { - case BILINEAR : - interp = RenderingHints.VALUE_INTERPOLATION_BILINEAR; - break; - case NEAREST_NEIGHBOR : - interp = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; - break; - case BICUBIC : - interp = RenderingHints.VALUE_INTERPOLATION_BICUBIC; - break; - default : - interp = null; - } + this.image = image; + this.width = width; + this.height = height; + this.scl = 1 / size; + depth = 0; + shift = 0; + switch (interpolation) { + case BILINEAR : + interp = RenderingHints.VALUE_INTERPOLATION_BILINEAR; + break; + case NEAREST_NEIGHBOR : + interp = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; + break; + case BICUBIC : + interp = RenderingHints.VALUE_INTERPOLATION_BICUBIC; + break; + default : + interp = null; + } } - + public void draw(Graphics2D g2, float x, float y) { - AffineTransform oldAt = g2.getTransform(); - Object oldKey = null; - if (interp != null) { - oldKey = g2.getRenderingHint(RenderingHints.KEY_INTERPOLATION); - g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, interp); - } - g2.translate(x, y - height); - g2.scale(scl, scl); - g2.drawImage(image, 0, 0, null); - g2.setTransform(oldAt); - if (oldKey != null) { - g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, oldKey); - } + AffineTransform oldAt = g2.getTransform(); + Object oldKey = null; + if (interp != null) { + oldKey = g2.getRenderingHint(RenderingHints.KEY_INTERPOLATION); + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, interp); + } + g2.translate(x, y - height); + g2.scale(scl, scl); + g2.drawImage(image, 0, 0, null); + g2.setTransform(oldAt); + if (oldKey != null) { + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, oldKey); + } } - + public int getLastFontId() { - return 0; + return 0; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HdotsforAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HdotsforAtom.java (.../HdotsforAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HdotsforAtom.java (.../HdotsforAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -55,28 +55,28 @@ private float coeff; public HdotsforAtom(int n, float coeff) { - super(n, "c", ldotp); - this.coeff = coeff; + super(n, "c", ldotp); + this.coeff = coeff; } public Box createBox(TeXEnvironment env) { - Box sp = new StrutBox(coeff * thin.createBox(env).getWidth(), 0, 0, 0); - HorizontalBox db = new HorizontalBox(sp); - db.add(ldotp.createBox(env)); - db.add(sp); - Box b; - if (w != 0) { - float dw = db.getWidth(); - b = new HorizontalBox(db); - while (b.getWidth() < w) { - b.add(db); - } - b = new HorizontalBox(b, w, TeXConstants.ALIGN_CENTER); - } else { - b = db; - } - - b.type = TeXConstants.TYPE_MULTICOLUMN; - return b; - } + Box sp = new StrutBox(coeff * thin.createBox(env).getWidth(), 0, 0, 0); + HorizontalBox db = new HorizontalBox(sp); + db.add(ldotp.createBox(env)); + db.add(sp); + Box b; + if (w != 0) { + float dw = db.getWidth(); + b = new HorizontalBox(db); + while (b.getWidth() < w) { + b.add(db); + } + b = new HorizontalBox(b, w, TeXConstants.ALIGN_CENTER); + } else { + b = db; + } + + b.type = TeXConstants.TYPE_MULTICOLUMN; + return b; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HlineAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HlineAtom.java (.../HlineAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HlineAtom.java (.../HlineAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,27 +49,27 @@ * An atom representing a hline in array environment */ public class HlineAtom extends Atom { - + private float width; private float shift; - + public HlineAtom() { } - + public void setWidth(float width) { - this.width = width; + this.width = width; } public void setShift(float shift) { - this.shift = shift; + this.shift = shift; } public Box createBox(TeXEnvironment env) { - float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); - Box b = new HorizontalRule(drt, width, shift, false); - VerticalBox vb = new VerticalBox(); - vb.add(b); - vb.type = TeXConstants.TYPE_HLINE; - return vb; - } + float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); + Box b = new HorizontalRule(drt, width, shift, false); + VerticalBox vb = new VerticalBox(); + vb.add(b); + vb.type = TeXConstants.TYPE_HLINE; + return vb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HorizontalBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HorizontalBox.java (.../HorizontalBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HorizontalBox.java (.../HorizontalBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,31 +25,30 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; import java.awt.Color; import java.awt.Graphics2D; import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; import java.util.ListIterator; @@ -64,24 +63,24 @@ public HorizontalBox(Box b, float w, int alignment) { if (w != Float.POSITIVE_INFINITY) { float rest = w - b.getWidth(); - if (rest > 0) { - if (alignment == TeXConstants.ALIGN_CENTER || alignment == TeXConstants.ALIGN_NONE) { - StrutBox s = new StrutBox(rest / 2, 0, 0, 0); - add(s); - add(b); - add(s); - } else if (alignment == TeXConstants.ALIGN_LEFT) { - add(b); - add(new StrutBox(rest, 0, 0, 0)); - } else if (alignment == TeXConstants.ALIGN_RIGHT) { - add(new StrutBox(rest, 0, 0, 0)); - add(b); - } else { - add(b); - } - } else { - add(b); - } + if (rest > 0) { + if (alignment == TeXConstants.ALIGN_CENTER || alignment == TeXConstants.ALIGN_NONE) { + StrutBox s = new StrutBox(rest / 2, 0, 0, 0); + add(s); + add(b); + add(s); + } else if (alignment == TeXConstants.ALIGN_LEFT) { + add(b); + add(new StrutBox(rest, 0, 0, 0)); + } else if (alignment == TeXConstants.ALIGN_RIGHT) { + add(new StrutBox(rest, 0, 0, 0)); + add(b); + } else { + add(b); + } + } else { + add(b); + } } else { add(b); } @@ -145,7 +144,7 @@ // iterate from the last child box to the first untill a font id is found // that's not equal to NO_FONT int fontId = TeXFont.NO_FONT; - for (ListIterator it = children.listIterator(children.size()); fontId == TeXFont.NO_FONT && it.hasPrevious();) + for (ListIterator it = children.listIterator(children.size()); fontId == TeXFont.NO_FONT && it.hasPrevious();) fontId = ((Box) it.previous()).getLastFontId(); return fontId; @@ -185,6 +184,6 @@ } } - return new HorizontalBox[]{hb1, hb2}; + return new HorizontalBox[] {hb1, hb2}; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HorizontalRule.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HorizontalRule.java (.../HorizontalRule.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/HorizontalRule.java (.../HorizontalRule.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,101 +1,101 @@ /* HorizontalRule.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; +import java.awt.Color; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; -import java.awt.Color; /** * A box representing a horizontal line. */ public class HorizontalRule extends Box { - + private Color color = null; private float speShift = 0;; - + public HorizontalRule(float thickness, float width, float s) { - height = thickness; - this.width = width; - shift = s; + height = thickness; + this.width = width; + shift = s; } public HorizontalRule(float thickness, float width, float s, boolean trueShift) { - height = thickness; - this.width = width; - if (trueShift) { - shift = s; - } else { - shift = 0; - speShift = s; - } + height = thickness; + this.width = width; + if (trueShift) { + shift = s; + } else { + shift = 0; + speShift = s; + } } public HorizontalRule(float thickness, float width, float s, Color c) { - height = thickness; - this.width = width; - color = c; - shift = s; + height = thickness; + this.width = width; + color = c; + shift = s; } public void draw(Graphics2D g2, float x, float y) { - Color old = g2.getColor(); - if (color != null) - g2.setColor(color); - - if (speShift == 0) { - g2.fill(new Rectangle2D.Float(x, y - height, width, height)); - } else { - g2.fill(new Rectangle2D.Float(x, y - height + speShift, width, height)); - } - g2.setColor(old); + Color old = g2.getColor(); + if (color != null) + g2.setColor(color); + + if (speShift == 0) { + g2.fill(new Rectangle2D.Float(x, y - height, width, height)); + } else { + g2.fill(new Rectangle2D.Float(x, y - height + speShift, width, height)); + } + g2.setColor(old); } - + public int getLastFontId() { - return TeXFont.NO_FONT; + return TeXFont.NO_FONT; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/IJAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/IJAtom.java (.../IJAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/IJAtom.java (.../IJAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -53,15 +53,15 @@ private boolean upper; public IJAtom(boolean upper) { - this.upper = upper; + this.upper = upper; } - + public Box createBox(TeXEnvironment env) { - CharBox I = new CharBox(env.getTeXFont().getChar(upper ? 'I' : 'i', "mathnormal", env.getStyle())); - CharBox J = new CharBox(env.getTeXFont().getChar(upper ? 'J' : 'j', "mathnormal", env.getStyle())); - HorizontalBox hb = new HorizontalBox(I); - hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.065f, 0, 0).createBox(env)); - hb.add(J); - return hb; - } + CharBox I = new CharBox(env.getTeXFont().getChar(upper ? 'I' : 'i', "mathnormal", env.getStyle())); + CharBox J = new CharBox(env.getTeXFont().getChar(upper ? 'J' : 'j', "mathnormal", env.getStyle())); + HorizontalBox hb = new HorizontalBox(I); + hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.065f, 0, 0).createBox(env)); + hb.add(J); + return hb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/IddotsAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/IddotsAtom.java (.../IddotsAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/IddotsAtom.java (.../IddotsAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -51,26 +51,26 @@ public class IddotsAtom extends Atom { public IddotsAtom() { } - + public Box createBox(TeXEnvironment env) { - Box ldots = TeXFormula.get("ldots").root.createBox(env); - float w = ldots.getWidth(); - Box dot = SymbolAtom.get("ldotp").createBox(env); - HorizontalBox hb1 = new HorizontalBox(dot, w, TeXConstants.ALIGN_RIGHT); - HorizontalBox hb2 = new HorizontalBox(dot, w, TeXConstants.ALIGN_CENTER); - HorizontalBox hb3 = new HorizontalBox(dot, w, TeXConstants.ALIGN_LEFT); - Box pt4 = new SpaceAtom(TeXConstants.UNIT_MU, 0, 4, 0).createBox(env); - VerticalBox vb = new VerticalBox(); - vb.add(hb1); - vb.add(pt4); - vb.add(hb2); - vb.add(pt4); - vb.add(hb3); - - float h = vb.getHeight() + vb.getDepth(); - vb.setHeight(h); - vb.setDepth(0); + Box ldots = TeXFormula.get("ldots").root.createBox(env); + float w = ldots.getWidth(); + Box dot = SymbolAtom.get("ldotp").createBox(env); + HorizontalBox hb1 = new HorizontalBox(dot, w, TeXConstants.ALIGN_RIGHT); + HorizontalBox hb2 = new HorizontalBox(dot, w, TeXConstants.ALIGN_CENTER); + HorizontalBox hb3 = new HorizontalBox(dot, w, TeXConstants.ALIGN_LEFT); + Box pt4 = new SpaceAtom(TeXConstants.UNIT_MU, 0, 4, 0).createBox(env); + VerticalBox vb = new VerticalBox(); + vb.add(hb1); + vb.add(pt4); + vb.add(hb2); + vb.add(pt4); + vb.add(hb3); - return vb; - } + float h = vb.getHeight() + vb.getDepth(); + vb.setHeight(h); + vb.setDepth(0); + + return vb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidAtomTypeException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidAtomTypeException.java (.../InvalidAtomTypeException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidAtomTypeException.java (.../InvalidAtomTypeException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,59 +1,61 @@ /* InvalidAtomTypeException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals that an unknown atom type constant was used. - * + * * @author Kurt Vermeulen */ public class InvalidAtomTypeException extends JMathTeXException { + private static final long serialVersionUID = -6558639348158242539L; + protected InvalidAtomTypeException(String msg) { - super(msg); + super(msg); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidDelimiterException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidDelimiterException.java (.../InvalidDelimiterException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidDelimiterException.java (.../InvalidDelimiterException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,70 +1,72 @@ /* InvalidDelimiterException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals that a symbol, that was not defined as a delimiter, was used * as a delimiter. - * + * * @author Kurt Vermeulen */ public class InvalidDelimiterException extends JMathTeXException { - protected InvalidDelimiterException(String symbolName) { - super("The symbol with the name '" + symbolName - + "' is not defined as a delimiter (" - + TeXSymbolParser.DELIMITER_ATTR + "='true') in '" - + TeXSymbolParser.RESOURCE_NAME + "'!"); - } + private static final long serialVersionUID = 212553180078002724L; - protected InvalidDelimiterException(char ch, String symbolName) { - super("The character '" + ch + "' is mapped to a symbol with the name '" - + symbolName + "', but that symbol is not defined as a delimiter (" - + TeXSymbolParser.DELIMITER_ATTR + "='true') in '" - + TeXSymbolParser.RESOURCE_NAME + "'!"); - } + protected InvalidDelimiterException(String symbolName) { + super("The symbol with the name '" + symbolName + + "' is not defined as a delimiter (" + + TeXSymbolParser.DELIMITER_ATTR + "='true') in '" + + TeXSymbolParser.RESOURCE_NAME + "'!"); + } + + protected InvalidDelimiterException(char ch, String symbolName) { + super("The character '" + ch + "' is mapped to a symbol with the name '" + + symbolName + "', but that symbol is not defined as a delimiter (" + + TeXSymbolParser.DELIMITER_ATTR + "='true') in '" + + TeXSymbolParser.RESOURCE_NAME + "'!"); + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidDelimiterTypeException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidDelimiterTypeException.java (.../InvalidDelimiterTypeException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidDelimiterTypeException.java (.../InvalidDelimiterTypeException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,61 +1,63 @@ /* InvalidDelimiterTypeException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals that an unknown delimiter type constant was used. - * + * * @author Kurt Vermeulen */ public class InvalidDelimiterTypeException extends JMathTeXException { + private static final long serialVersionUID = -7170484583239756156L; + protected InvalidDelimiterTypeException() { - super( - "The delimiter type was not valid! " - + "Use one of the delimiter type constants from the class 'TeXConstants'."); + super( + "The delimiter type was not valid! " + + "Use one of the delimiter type constants from the class 'TeXConstants'."); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidMatrixException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidMatrixException.java (.../InvalidMatrixException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidMatrixException.java (.../InvalidMatrixException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* InvalidMatrixException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -53,7 +53,9 @@ */ public class InvalidMatrixException extends JMathTeXException { - protected InvalidMatrixException(String msg) { - super(msg); - } + private static final long serialVersionUID = -6766435055092128073L; + + protected InvalidMatrixException(String msg) { + super(msg); + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidSymbolTypeException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidSymbolTypeException.java (.../InvalidSymbolTypeException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidSymbolTypeException.java (.../InvalidSymbolTypeException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,59 +1,61 @@ /* InvalidSymbolTypeException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals that an unknown symbol type constant or a symbol of the wrong type was used. - * + * * @author Kurt Vermeulen */ public class InvalidSymbolTypeException extends JMathTeXException { + private static final long serialVersionUID = 6679471054726869590L; + protected InvalidSymbolTypeException(String msg) { - super(msg); + super(msg); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidTeXFormulaException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidTeXFormulaException.java (.../InvalidTeXFormulaException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidTeXFormulaException.java (.../InvalidTeXFormulaException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,59 +1,61 @@ /* InvalidTeXFormulaException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals that an invalid TeXFormula was used. - * + * * @author Kurt Vermeulen */ public class InvalidTeXFormulaException extends JMathTeXException { + private static final long serialVersionUID = -1360488533073280569L; + protected InvalidTeXFormulaException(String msg) { - super(msg); + super(msg); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidUnitException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidUnitException.java (.../InvalidUnitException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/InvalidUnitException.java (.../InvalidUnitException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,60 +1,62 @@ /* InvalidUnitException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals that an unknown unit constant was used. - * + * * @author Kurt Vermeulen */ public class InvalidUnitException extends JMathTeXException { + private static final long serialVersionUID = 860909774647515072L; + protected InvalidUnitException() { - super("The delimiter type was not valid! " - + "Use one of the unit constants from the class 'TeXConstants'."); + super("The delimiter type was not valid! " + + "Use one of the unit constants from the class 'TeXConstants'."); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ItAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ItAtom.java (.../ItAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ItAtom.java (.../ItAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/JMathTeXException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/JMathTeXException.java (.../JMathTeXException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/JMathTeXException.java (.../JMathTeXException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,63 +1,65 @@ /* JMathTeXException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * Superclass of all the possible (public) exceptions that can be thrown in this package. - * + * Superclass of all the possible (public) exceptions that can be thrown in this package. + * * @author Kurt Vermeulen */ public class JMathTeXException extends RuntimeException { + private static final long serialVersionUID = 6788678896908035811L; + protected JMathTeXException(String msg) { - super(msg); + super(msg); } - + protected JMathTeXException(String msg, Throwable cause) { - super(msg, cause); + super(msg, cause); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/JavaFontRenderingAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/JavaFontRenderingAtom.java (.../JavaFontRenderingAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/JavaFontRenderingAtom.java (.../JavaFontRenderingAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -63,32 +63,32 @@ public JavaFontRenderingAtom(String str, TeXFormula.FontInfos fontInfos) { this(str, 0); - this.fontInfos = fontInfos; + this.fontInfos = fontInfos; } public Box createBox(TeXEnvironment env) { if (fontInfos == null) { - return new JavaFontRenderingBox(str, type, DefaultTeXFont.getSizeFactor(env.getStyle())); - } else { - DefaultTeXFont dtf = (DefaultTeXFont) env.getTeXFont(); - int type = dtf.isIt ? Font.ITALIC : Font.PLAIN; - type = type | (dtf.isBold ? Font.BOLD : 0); - boolean kerning = dtf.isRoman; - Font font; - if (dtf.isSs) { - if (fontInfos.sansserif == null) { - font = new Font(fontInfos.serif, Font.PLAIN, 10); - } else { - font = new Font(fontInfos.sansserif, Font.PLAIN, 10); - } - } else { - if (fontInfos.serif == null) { - font = new Font(fontInfos.sansserif, Font.PLAIN, 10); - } else { - font = new Font(fontInfos.serif, Font.PLAIN, 10); - } - } - return new JavaFontRenderingBox(str, type, DefaultTeXFont.getSizeFactor(env.getStyle()), font, kerning); - } + return new JavaFontRenderingBox(str, type, DefaultTeXFont.getSizeFactor(env.getStyle())); + } else { + DefaultTeXFont dtf = (DefaultTeXFont) env.getTeXFont(); + int type = dtf.isIt ? Font.ITALIC : Font.PLAIN; + type = type | (dtf.isBold ? Font.BOLD : 0); + boolean kerning = dtf.isRoman; + Font font; + if (dtf.isSs) { + if (fontInfos.sansserif == null) { + font = new Font(fontInfos.serif, Font.PLAIN, 10); + } else { + font = new Font(fontInfos.sansserif, Font.PLAIN, 10); + } + } else { + if (fontInfos.serif == null) { + font = new Font(fontInfos.sansserif, Font.PLAIN, 10); + } else { + font = new Font(fontInfos.serif, Font.PLAIN, 10); + } + } + return new JavaFontRenderingBox(str, type, DefaultTeXFont.getSizeFactor(env.getStyle()), font, kerning); + } } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/JavaFontRenderingBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/JavaFontRenderingBox.java (.../JavaFontRenderingBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/JavaFontRenderingBox.java (.../JavaFontRenderingBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -51,7 +51,6 @@ import java.awt.font.TextLayout; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; -import java.lang.reflect.Field; import java.util.Hashtable; import java.util.Map; @@ -64,7 +63,6 @@ private static Font font = new Font("Serif", Font.PLAIN, 10); - private String str; private TextLayout text; private float size; private static TextAttribute KERNING; @@ -82,7 +80,6 @@ } public JavaFontRenderingBox(String str, int type, float size, Font f, boolean kerning) { - this.str = str; this.size = size; if (kerning && KERNING != null) { Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/LCaronAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/LCaronAtom.java (.../LCaronAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/LCaronAtom.java (.../LCaronAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -53,18 +53,18 @@ private boolean upper; public LCaronAtom(boolean upper) { - this.upper = upper; + this.upper = upper; } - + public Box createBox(TeXEnvironment env) { - CharBox A = new CharBox(env.getTeXFont().getChar("textapos", env.getStyle())); - CharBox L = new CharBox(env.getTeXFont().getChar(upper ? 'L' : 'l', "mathnormal", env.getStyle())); - HorizontalBox hb = new HorizontalBox(L); - if (upper) - hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.3f, 0, 0).createBox(env)); - else - hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.13f, 0, 0).createBox(env)); - hb.add(A); - return hb; - } + CharBox A = new CharBox(env.getTeXFont().getChar("textapos", env.getStyle())); + CharBox L = new CharBox(env.getTeXFont().getChar(upper ? 'L' : 'l', "mathnormal", env.getStyle())); + HorizontalBox hb = new HorizontalBox(L); + if (upper) + hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.3f, 0, 0).createBox(env)); + else + hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.13f, 0, 0).createBox(env)); + hb.add(A); + return hb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/LaTeXAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/LaTeXAtom.java (.../LaTeXAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/LaTeXAtom.java (.../LaTeXAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -53,36 +53,36 @@ public LaTeXAtom() { } - + public Box createBox(TeXEnvironment env) { - env = env.copy(env.getTeXFont().copy()); - env.getTeXFont().setRoman(true); - float sc = env.getTeXFont().getScaleFactor(); + env = env.copy(env.getTeXFont().copy()); + env.getTeXFont().setRoman(true); + float sc = env.getTeXFont().getScaleFactor(); TeXFormula.FontInfos fontInfos = TeXFormula.externalFontMap.get(Character.UnicodeBlock.BASIC_LATIN); if (fontInfos != null) { TeXFormula.externalFontMap.put(Character.UnicodeBlock.BASIC_LATIN, null); } - RowAtom rat = (RowAtom)((RomanAtom)new TeXFormula("\\mathrm{XETL}").root).base; + RowAtom rat = (RowAtom)((RomanAtom)new TeXFormula("\\mathrm{XETL}").root).base; if (fontInfos != null) { TeXFormula.externalFontMap.put(Character.UnicodeBlock.BASIC_LATIN, fontInfos); } - HorizontalBox hb = new HorizontalBox(rat.getLastAtom().createBox(env)); - hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.35f * sc, 0, 0).createBox(env)); - float f = new SpaceAtom(TeXConstants.UNIT_EX, 0.45f * sc, 0, 0).createBox(env).getWidth(); - float f1 = new SpaceAtom(TeXConstants.UNIT_EX, 0.5f * sc, 0, 0).createBox(env).getWidth(); - CharBox A = new CharBox(env.getTeXFont().getChar('A', "mathnormal", env.supStyle().getStyle())); - A.setShift(-f); - hb.add(A); - hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.15f * sc, 0, 0).createBox(env)); - hb.add(rat.getLastAtom().createBox(env)); - hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.15f * sc, 0, 0).createBox(env)); - Box E = rat.getLastAtom().createBox(env); - E.setShift(f1); - hb.add(E); - hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.15f * sc, 0, 0).createBox(env)); - hb.add(rat.getLastAtom().createBox(env)); - return hb; - } + HorizontalBox hb = new HorizontalBox(rat.getLastAtom().createBox(env)); + hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.35f * sc, 0, 0).createBox(env)); + float f = new SpaceAtom(TeXConstants.UNIT_EX, 0.45f * sc, 0, 0).createBox(env).getWidth(); + float f1 = new SpaceAtom(TeXConstants.UNIT_EX, 0.5f * sc, 0, 0).createBox(env).getWidth(); + CharBox A = new CharBox(env.getTeXFont().getChar('A', "mathnormal", env.supStyle().getStyle())); + A.setShift(-f); + hb.add(A); + hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.15f * sc, 0, 0).createBox(env)); + hb.add(rat.getLastAtom().createBox(env)); + hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.15f * sc, 0, 0).createBox(env)); + Box E = rat.getLastAtom().createBox(env); + E.setShift(f1); + hb.add(E); + hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.15f * sc, 0, 0).createBox(env)); + hb.add(rat.getLastAtom().createBox(env)); + return hb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/LapedAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/LapedAtom.java (.../LapedAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/LapedAtom.java (.../LapedAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,56 +24,56 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * An atom representing a laped atom (i.e. with no width). + * An atom representing a laped atom (i.e. with no width). */ public class LapedAtom extends Atom { private Atom at; private char type; - + public LapedAtom(Atom at, char type) { this.at = at; - this.type = type; + this.type = type; } - + public Box createBox(TeXEnvironment env) { Box b = at.createBox(env); - VerticalBox vb = new VerticalBox(); - vb.add(b); - vb.setWidth(0); - switch (type) { - case 'l' : - b.setShift(- b.getWidth()); - break; - case 'r' : - b.setShift(0); - break; - default : - b.setShift(- b.getWidth() / 2); - } + VerticalBox vb = new VerticalBox(); + vb.add(b); + vb.setWidth(0); + switch (type) { + case 'l' : + b.setShift(- b.getWidth()); + break; + case 'r' : + b.setShift(0); + break; + default : + b.setShift(- b.getWidth() / 2); + } - return vb; + return vb; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MacroInfo.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MacroInfo.java (.../MacroInfo.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MacroInfo.java (.../MacroInfo.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,56 +1,56 @@ /* MacroInfo.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.HashMap; public class MacroInfo { - + public static HashMap Commands = new HashMap(300); public static HashMap Packages = new HashMap(); @@ -59,82 +59,82 @@ public int nbArgs; public boolean hasOptions = false; public int posOpts; - + public MacroInfo(Object pack, Method macro, int nbArgs) { - this.pack = pack; - this.macro = macro; - this.nbArgs = nbArgs; + this.pack = pack; + this.macro = macro; + this.nbArgs = nbArgs; } public MacroInfo(Object pack, Method macro, int nbArgs, int posOpts) { - this(pack, macro, nbArgs); - this.hasOptions = true; - this.posOpts = posOpts; + this(pack, macro, nbArgs); + this.hasOptions = true; + this.posOpts = posOpts; } public MacroInfo(int nbArgs, int posOpts) { - this(null, (Method) null, nbArgs); - this.hasOptions = true; - this.posOpts = posOpts; + this(null, (Method) null, nbArgs); + this.hasOptions = true; + this.posOpts = posOpts; } public MacroInfo(int nbArgs) { - this(null, (Method) null, nbArgs); + this(null, (Method) null, nbArgs); } - + public MacroInfo(String className, String methodName, float nbArgs) { - int nba = (int) nbArgs; - Class[] args = new Class[]{TeXParser.class, String[].class}; - - try { - Object pack = Packages.get(className); - if (pack == null) { - Class cl = Class.forName(className); - pack = cl.getConstructor(new Class[0]).newInstance(new Object[0]); - Packages.put(className, pack); - } - this.pack = pack; - this.macro = pack.getClass().getDeclaredMethod(methodName, args); - this.nbArgs = nba; - } catch (Exception e) { - System.err.println("Cannot load package " + className + ":"); - System.err.println(e.toString()); - } + int nba = (int) nbArgs; + Class[] args = new Class[] {TeXParser.class, String[].class}; + + try { + Object pack = Packages.get(className); + if (pack == null) { + Class cl = Class.forName(className); + pack = cl.getConstructor(new Class[0]).newInstance(new Object[0]); + Packages.put(className, pack); + } + this.pack = pack; + this.macro = pack.getClass().getDeclaredMethod(methodName, args); + this.nbArgs = nba; + } catch (Exception e) { + System.err.println("Cannot load package " + className + ":"); + System.err.println(e.toString()); + } } public MacroInfo(String className, String methodName, float nbArgs, float posOpts) { - int nba = (int) nbArgs; - Class[] args = new Class[]{TeXParser.class, String[].class}; + int nba = (int) nbArgs; + Class[] args = new Class[] {TeXParser.class, String[].class}; - try { - Object pack = Packages.get(className); - if (pack == null) { - Class cl = Class.forName(className); - pack = cl.getConstructor(new Class[0]).newInstance(new Object[0]); - Packages.put(className, pack); - } - this.pack = pack; - this.macro = pack.getClass().getDeclaredMethod(methodName, args); - this.nbArgs = nba; - this.hasOptions = true; - this.posOpts = (int) posOpts; - } catch (Exception e) { - System.err.println("Cannot load package " + className + ":"); - System.err.println(e.toString()); - } + try { + Object pack = Packages.get(className); + if (pack == null) { + Class cl = Class.forName(className); + pack = cl.getConstructor(new Class[0]).newInstance(new Object[0]); + Packages.put(className, pack); + } + this.pack = pack; + this.macro = pack.getClass().getDeclaredMethod(methodName, args); + this.nbArgs = nba; + this.hasOptions = true; + this.posOpts = (int) posOpts; + } catch (Exception e) { + System.err.println("Cannot load package " + className + ":"); + System.err.println(e.toString()); + } } public Object invoke(final TeXParser tp, final String[] args) throws ParseException { - Object[] argsMethod = {(Object) tp, (Object) args}; - try { - return macro.invoke(pack, argsMethod); - } catch (IllegalAccessException e) { - throw new ParseException("Problem with command " + args[0] + " at position " + tp.getLine() + ":" + tp.getCol() + "\n", e); - } catch (IllegalArgumentException e) { - throw new ParseException("Problem with command " + args[0] + " at position " + tp.getLine() + ":" + tp.getCol() + "\n", e); - } catch (InvocationTargetException e) { - Throwable th = e.getCause(); - throw new ParseException("Problem with command " + args[0] + " at position " + tp.getLine() + ":" + tp.getCol() + "\n" + th.getMessage()); - } + Object[] argsMethod = {(Object) tp, (Object) args}; + try { + return macro.invoke(pack, argsMethod); + } catch (IllegalAccessException e) { + throw new ParseException("Problem with command " + args[0] + " at position " + tp.getLine() + ":" + tp.getCol() + "\n", e); + } catch (IllegalArgumentException e) { + throw new ParseException("Problem with command " + args[0] + " at position " + tp.getLine() + ":" + tp.getCol() + "\n", e); + } catch (InvocationTargetException e) { + Throwable th = e.getCause(); + throw new ParseException("Problem with command " + args[0] + " at position " + tp.getLine() + ":" + tp.getCol() + "\n" + th.getMessage()); + } } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MathAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MathAtom.java (.../MathAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MathAtom.java (.../MathAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MatrixAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MatrixAtom.java (.../MatrixAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MatrixAtom.java (.../MatrixAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,32 +24,31 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.util.BitSet; -import java.util.Map; -import java.util.HashMap; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * A box representing a matrix. @@ -76,9 +75,6 @@ private ArrayOfAtoms matrix; private int[] position; private Map vlines = new HashMap(); - private boolean isAlign; - private boolean isAlignat; - private boolean isFl; private int type; private boolean isPartial; private boolean spaceAround; @@ -240,12 +236,11 @@ position[i] = tab[i]; } } else { - position = new int[]{TeXConstants.ALIGN_CENTER}; + position = new int[] {TeXConstants.ALIGN_CENTER}; } } public Box[] getColumnSep(TeXEnvironment env, float width) { - int row = matrix.row; int col = matrix.col; Box[] arr = new Box[col + 1]; Box Align, AlignSep, Hsep; @@ -445,7 +440,6 @@ VerticalBox vb = new VerticalBox(); Box Vsep = vsep_in.createBox(env); vb.add(vsep_ext_top.createBox(env)); - float vsepH = Vsep.getHeight(); float totalHeight = 0; for (int i = 0; i < row; i++) { Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Metrics.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Metrics.java (.../Metrics.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Metrics.java (.../Metrics.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* Metrics.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -56,32 +56,32 @@ private final float d; private final float i; private final float s; - + public Metrics(float w, float h, float d, float i, float factor, float size) { - this.w = w * factor; - this.h = h * factor; - this.d = d * factor; - this.i = i * factor; - this.s = size; + this.w = w * factor; + this.h = h * factor; + this.d = d * factor; + this.i = i * factor; + this.s = size; } public float getWidth() { - return w; + return w; } public float getHeight() { - return h; + return h; } public float getDepth() { - return d; + return d; } public float getItalic() { - return i; + return i; } - + public float getSize() { - return s; + return s; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MiddleAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MiddleAtom.java (.../MiddleAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MiddleAtom.java (.../MiddleAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,15 +49,15 @@ * An atom representing a middle atom which must be rounded by a left and right delimiter. */ public class MiddleAtom extends Atom { - + public Atom base; public Box box = new StrutBox(0, 0, 0, 0); - + public MiddleAtom(Atom at) { - base = at; + base = at; } - + public Box createBox(TeXEnvironment env) { - return box; - } + return box; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MonoScaleAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MonoScaleAtom.java (.../MonoScaleAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MonoScaleAtom.java (.../MonoScaleAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -53,14 +53,14 @@ private float factor; public MonoScaleAtom(Atom base, float factor) { - super(base, (double) factor, (double) factor); - this.factor = factor; + super(base, (double) factor, (double) factor); + this.factor = factor; } - + public Box createBox(TeXEnvironment env) { - env = env.copy(); - float f = env.getScaleFactor(); - env.setScaleFactor(factor); - return new ScaleBox(base.createBox(env), factor / f); - } + env = env.copy(); + float f = env.getScaleFactor(); + env.setScaleFactor(factor); + return new ScaleBox(base.createBox(env), factor / f); + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MulticolumnAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MulticolumnAtom.java (.../MulticolumnAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MulticolumnAtom.java (.../MulticolumnAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -59,90 +59,90 @@ protected int row, col; public MulticolumnAtom(int n, String align, Atom cols) { - this.n = n >= 1 ? n : 1; - this.cols = cols; - this.align = parseAlign(align); + this.n = n >= 1 ? n : 1; + this.cols = cols; + this.align = parseAlign(align); } public void setWidth(float w) { - this.w = w; + this.w = w; } public int getSkipped() { - return n; + return n; } public boolean hasRightVline() { - return afterVlines != 0; + return afterVlines != 0; } public void setRowColumn(int i, int j) { - this.row = i; - this.col = j; + this.row = i; + this.col = j; } - + public int getRow() { - return row; + return row; } public int getCol() { - return col; + return col; } private int parseAlign(String str) { - int pos = 0; - int len = str.length(); - int align = TeXConstants.ALIGN_CENTER; - boolean first = true; - while (pos < len) { - char c = str.charAt(pos); - switch (c) { - case 'l' : - align = TeXConstants.ALIGN_LEFT; - first = false; - break; - case 'r': - align = TeXConstants.ALIGN_RIGHT; - first = false; - break; - case 'c': - align = TeXConstants.ALIGN_CENTER; - first = false; - break; - case '|': - if (first) { - beforeVlines = 1; - } else { - afterVlines = 1; - } - while (++pos < len) { - c = str.charAt(pos); - if (c != '|') { - pos--; - break; - } else { - if (first) { - beforeVlines++; - } else { - afterVlines++; - } - } - } - } - pos++; - } - return align; + int pos = 0; + int len = str.length(); + int align = TeXConstants.ALIGN_CENTER; + boolean first = true; + while (pos < len) { + char c = str.charAt(pos); + switch (c) { + case 'l' : + align = TeXConstants.ALIGN_LEFT; + first = false; + break; + case 'r': + align = TeXConstants.ALIGN_RIGHT; + first = false; + break; + case 'c': + align = TeXConstants.ALIGN_CENTER; + first = false; + break; + case '|': + if (first) { + beforeVlines = 1; + } else { + afterVlines = 1; + } + while (++pos < len) { + c = str.charAt(pos); + if (c != '|') { + pos--; + break; + } else { + if (first) { + beforeVlines++; + } else { + afterVlines++; + } + } + } + } + pos++; + } + return align; } public Box createBox(TeXEnvironment env) { - Box b; - if (w == 0) { - b = cols.createBox(env); - } else { - b = new HorizontalBox(cols.createBox(env), w, align); - } - - b.type = TeXConstants.TYPE_MULTICOLUMN; - return b; - } + Box b; + if (w == 0) { + b = cols.createBox(env); + } else { + b = new HorizontalBox(cols.createBox(env), w, align); + } + + b.type = TeXConstants.TYPE_MULTICOLUMN; + return b; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MultlineAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MultlineAtom.java (.../MultlineAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/MultlineAtom.java (.../MultlineAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,64 +49,64 @@ * An atom representing a vertical row of other atoms. */ public class MultlineAtom extends Atom { - + public static SpaceAtom vsep_in = new SpaceAtom(TeXConstants.UNIT_EX, 0.0f, 1.0f, 0.0f); public static final int MULTLINE = 0; public static final int GATHER = 1; public static final int GATHERED = 2; - + private ArrayOfAtoms column; private int type; private boolean isPartial; public MultlineAtom(boolean isPartial, ArrayOfAtoms column, int type) { this.isPartial = isPartial; - this.column = column; - this.type = type; + this.column = column; + this.type = type; } public MultlineAtom(ArrayOfAtoms column, int type) { this(false, column, type); } - + public Box createBox(TeXEnvironment env) { - float tw = env.getTextwidth(); - if (tw == Float.POSITIVE_INFINITY || type == GATHERED) { - return new MatrixAtom(isPartial, column, "").createBox(env); - } + float tw = env.getTextwidth(); + if (tw == Float.POSITIVE_INFINITY || type == GATHERED) { + return new MatrixAtom(isPartial, column, "").createBox(env); + } - VerticalBox vb = new VerticalBox(); - Atom at = column.array.get(0).get(0); - int alignment = type == GATHER ? TeXConstants.ALIGN_CENTER : TeXConstants.ALIGN_LEFT; - if (at.alignment != -1) { - alignment = at.alignment; - } - vb.add(new HorizontalBox(at.createBox(env), tw, alignment)); - Box Vsep = vsep_in.createBox(env); - for (int i = 1; i < column.row - 1; i++) { - at = column.array.get(i).get(0); - alignment = TeXConstants.ALIGN_CENTER; - if (at.alignment != -1) { - alignment = at.alignment; - } - vb.add(Vsep); - vb.add(new HorizontalBox(at.createBox(env), tw, alignment)); - } - - if (column.row > 1) { - at = column.array.get(column.row - 1).get(0); - alignment = type == GATHER ? TeXConstants.ALIGN_CENTER : TeXConstants.ALIGN_RIGHT; - if (at.alignment != -1) { - alignment = at.alignment; - } - vb.add(Vsep); - vb.add(new HorizontalBox(at.createBox(env), tw, alignment)); - } - - float height = vb.getHeight() + vb.getDepth(); - vb.setHeight(height / 2); - vb.setDepth(height / 2); + VerticalBox vb = new VerticalBox(); + Atom at = column.array.get(0).get(0); + int alignment = type == GATHER ? TeXConstants.ALIGN_CENTER : TeXConstants.ALIGN_LEFT; + if (at.alignment != -1) { + alignment = at.alignment; + } + vb.add(new HorizontalBox(at.createBox(env), tw, alignment)); + Box Vsep = vsep_in.createBox(env); + for (int i = 1; i < column.row - 1; i++) { + at = column.array.get(i).get(0); + alignment = TeXConstants.ALIGN_CENTER; + if (at.alignment != -1) { + alignment = at.alignment; + } + vb.add(Vsep); + vb.add(new HorizontalBox(at.createBox(env), tw, alignment)); + } - return vb; + if (column.row > 1) { + at = column.array.get(column.row - 1).get(0); + alignment = type == GATHER ? TeXConstants.ALIGN_CENTER : TeXConstants.ALIGN_RIGHT; + if (at.alignment != -1) { + alignment = at.alignment; + } + vb.add(Vsep); + vb.add(new HorizontalBox(at.createBox(env), tw, alignment)); + } + + float height = vb.getHeight() + vb.getDepth(); + vb.setHeight(height / 2); + vb.setDepth(height / 2); + + return vb; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/NewCommandMacro.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/NewCommandMacro.java (.../NewCommandMacro.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/NewCommandMacro.java (.../NewCommandMacro.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,46 +1,46 @@ /* NewCommandMacro.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -55,55 +55,55 @@ public NewCommandMacro() { } - + public static void addNewCommand(String name, String code, int nbargs) throws ParseException { - //if (macrocode.get(name) != null) - //throw new ParseException("Command " + name + " already exists ! Use renewcommand instead ..."); - macrocode.put(name, code); - MacroInfo.Commands.put(name, new MacroInfo("org.scilab.forge.jlatexmath.NewCommandMacro", "executeMacro", nbargs)); + //if (macrocode.get(name) != null) + //throw new ParseException("Command " + name + " already exists ! Use renewcommand instead ..."); + macrocode.put(name, code); + MacroInfo.Commands.put(name, new MacroInfo("org.scilab.forge.jlatexmath.NewCommandMacro", "executeMacro", nbargs)); } - + public static void addNewCommand(String name, String code, int nbargs, String def) throws ParseException { - if (macrocode.get(name) != null) - throw new ParseException("Command " + name + " already exists ! Use renewcommand instead ..."); - macrocode.put(name, code); - macroreplacement.put(name, def); - MacroInfo.Commands.put(name, new MacroInfo("org.scilab.forge.jlatexmath.NewCommandMacro", "executeMacro", nbargs, 1)); + if (macrocode.get(name) != null) + throw new ParseException("Command " + name + " already exists ! Use renewcommand instead ..."); + macrocode.put(name, code); + macroreplacement.put(name, def); + MacroInfo.Commands.put(name, new MacroInfo("org.scilab.forge.jlatexmath.NewCommandMacro", "executeMacro", nbargs, 1)); } - + public static boolean isMacro(String name) { - return macrocode.containsKey(name); + return macrocode.containsKey(name); } - + public static void addReNewCommand(String name, String code, int nbargs) { - if (macrocode.get(name) == null) - throw new ParseException("Command " + name + " is not defined ! Use newcommand instead ..."); - macrocode.put(name, code); - MacroInfo.Commands.put(name, new MacroInfo("org.scilab.forge.jlatexmath.NewCommandMacro", "executeMacro", nbargs)); + if (macrocode.get(name) == null) + throw new ParseException("Command " + name + " is not defined ! Use newcommand instead ..."); + macrocode.put(name, code); + MacroInfo.Commands.put(name, new MacroInfo("org.scilab.forge.jlatexmath.NewCommandMacro", "executeMacro", nbargs)); } - + public String executeMacro(TeXParser tp, String[] args) { - String code = macrocode.get(args[0]); - String rep; - int nbargs = args.length - 11; - int dec = 0; - - - if (args[nbargs + 1] != null) { - dec = 1; - rep = Matcher.quoteReplacement(args[nbargs + 1]); - code = code.replaceAll("#1", rep); - } else if (macroreplacement.get(args[0]) != null) { - dec = 1; - rep = Matcher.quoteReplacement(macroreplacement.get(args[0])); - code = code.replaceAll("#1", rep); - } + String code = macrocode.get(args[0]); + String rep; + int nbargs = args.length - 11; + int dec = 0; - for (int i = 1; i <= nbargs; i++) { - rep = Matcher.quoteReplacement(args[i]); - code = code.replaceAll("#" + (i + dec), rep); - } - - return code; + + if (args[nbargs + 1] != null) { + dec = 1; + rep = Matcher.quoteReplacement(args[nbargs + 1]); + code = code.replaceAll("#1", rep); + } else if (macroreplacement.get(args[0]) != null) { + dec = 1; + rep = Matcher.quoteReplacement(macroreplacement.get(args[0])); + code = code.replaceAll("#1", rep); + } + + for (int i = 1; i <= nbargs; i++) { + rep = Matcher.quoteReplacement(args[i]); + code = code.replaceAll("#" + (i + dec), rep); + } + + return code; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/NewEnvironmentMacro.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/NewEnvironmentMacro.java (.../NewEnvironmentMacro.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/NewEnvironmentMacro.java (.../NewEnvironmentMacro.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,44 +24,41 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.util.HashMap; -import java.util.regex.Matcher; - public class NewEnvironmentMacro extends NewCommandMacro { - + public NewEnvironmentMacro() { } - + public static void addNewEnvironment(String name, String begdef, String enddef, int nbArgs) throws ParseException { - //if (macrocode.get(name + "@env") != null) - //throw new ParseException("Environment " + name + " already exists ! Use renewenvironment instead ..."); - addNewCommand(name + "@env", begdef + " #" + (nbArgs + 1) + " " + enddef, nbArgs + 1); + //if (macrocode.get(name + "@env") != null) + //throw new ParseException("Environment " + name + " already exists ! Use renewenvironment instead ..."); + addNewCommand(name + "@env", begdef + " #" + (nbArgs + 1) + " " + enddef, nbArgs + 1); } public static void addReNewEnvironment(String name, String begdef, String enddef, int nbArgs) throws ParseException { - if (macrocode.get(name + "@env") == null) - throw new ParseException("Environment " + name + "is not defined ! Use newenvironment instead ..."); - addReNewCommand(name + "@env", begdef + " #" + (nbArgs + 1) + " " + enddef, nbArgs + 1); + if (macrocode.get(name + "@env") == null) + throw new ParseException("Environment " + name + "is not defined ! Use newenvironment instead ..."); + addReNewCommand(name + "@env", begdef + " #" + (nbArgs + 1) + " " + enddef, nbArgs + 1); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/NthRoot.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/NthRoot.java (.../NthRoot.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/NthRoot.java (.../NthRoot.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* NthRoot.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -52,77 +52,77 @@ public class NthRoot extends Atom { private static final String sqrtSymbol = "sqrt"; - + private static final float FACTOR = 0.55f; - + // base atom to be put under the root sign private final Atom base; - + // root atom to be put in the upper left corner above the root sign private final Atom root; - + public NthRoot(Atom base, Atom root) { - this.base = base == null ? new EmptyAtom() : base; - this.root = root == null ? new EmptyAtom() : root; + this.base = base == null ? new EmptyAtom() : base; + this.root = root == null ? new EmptyAtom() : root; } - + public Box createBox(TeXEnvironment env) { - // first create a simple square root construction - - TeXFont tf = env.getTeXFont(); - int style = env.getStyle(); - // calculate minimum clearance clr - float clr, drt = tf.getDefaultRuleThickness(style); - if (style < TeXConstants.STYLE_TEXT) - clr = tf.getXHeight(style, tf.getChar(sqrtSymbol, style).getFontCode()); - else - clr = drt; - clr = drt + Math.abs(clr) / 4 ; - - // cramped style for the formula under the root sign - Box bs = base.createBox(env.crampStyle()); - HorizontalBox b = new HorizontalBox(bs); - b.add(new SpaceAtom(TeXConstants.UNIT_MU, 1, 0, 0).createBox(env.crampStyle())); - // create root sign - float totalH = b.getHeight() + b.getDepth(); - Box rootSign = DelimiterFactory.create(sqrtSymbol, env, totalH + clr + drt); - - // add half the excess to clr - float delta = rootSign.getDepth() - (totalH + clr); - clr += delta / 2; - - // create total box - rootSign.setShift(-(b.getHeight() + clr)); - OverBar ob = new OverBar(b, clr, rootSign.getHeight()); - ob.setShift(-(b.getHeight() + clr + drt)); - HorizontalBox squareRoot = new HorizontalBox(rootSign); - squareRoot.add(ob); - - if (root == null) - // simple square root - return squareRoot; - else { // nthRoot, not a simple square root - - // create box from root - Box r = root.createBox(env.rootStyle()); - - // shift root up - float bottomShift = FACTOR * (squareRoot.getHeight() + squareRoot.getDepth()); - r.setShift(squareRoot.getDepth() - r.getDepth() - bottomShift); - - // negative kern - Box negativeKern = new SpaceAtom(TeXConstants.UNIT_MU, -10f, 0, 0).createBox(env); - - // arrange both boxes together with the negative kern - Box res = new HorizontalBox(); - float pos = r.getWidth() + negativeKern.getWidth(); - if (pos < 0) - res.add(new StrutBox(-pos, 0, 0, 0)); - - res.add(r); - res.add(negativeKern); - res.add(squareRoot); - return res; - } + // first create a simple square root construction + + TeXFont tf = env.getTeXFont(); + int style = env.getStyle(); + // calculate minimum clearance clr + float clr, drt = tf.getDefaultRuleThickness(style); + if (style < TeXConstants.STYLE_TEXT) + clr = tf.getXHeight(style, tf.getChar(sqrtSymbol, style).getFontCode()); + else + clr = drt; + clr = drt + Math.abs(clr) / 4 ; + + // cramped style for the formula under the root sign + Box bs = base.createBox(env.crampStyle()); + HorizontalBox b = new HorizontalBox(bs); + b.add(new SpaceAtom(TeXConstants.UNIT_MU, 1, 0, 0).createBox(env.crampStyle())); + // create root sign + float totalH = b.getHeight() + b.getDepth(); + Box rootSign = DelimiterFactory.create(sqrtSymbol, env, totalH + clr + drt); + + // add half the excess to clr + float delta = rootSign.getDepth() - (totalH + clr); + clr += delta / 2; + + // create total box + rootSign.setShift(-(b.getHeight() + clr)); + OverBar ob = new OverBar(b, clr, rootSign.getHeight()); + ob.setShift(-(b.getHeight() + clr + drt)); + HorizontalBox squareRoot = new HorizontalBox(rootSign); + squareRoot.add(ob); + + if (root == null) + // simple square root + return squareRoot; + else { // nthRoot, not a simple square root + + // create box from root + Box r = root.createBox(env.rootStyle()); + + // shift root up + float bottomShift = FACTOR * (squareRoot.getHeight() + squareRoot.getDepth()); + r.setShift(squareRoot.getDepth() - r.getDepth() - bottomShift); + + // negative kern + Box negativeKern = new SpaceAtom(TeXConstants.UNIT_MU, -10f, 0, 0).createBox(env); + + // arrange both boxes together with the negative kern + Box res = new HorizontalBox(); + float pos = r.getWidth() + negativeKern.getWidth(); + if (pos < 0) + res.add(new StrutBox(-pos, 0, 0, 0)); + + res.add(r); + res.add(negativeKern); + res.add(squareRoot); + return res; + } } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OgonekAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OgonekAtom.java (.../OgonekAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OgonekAtom.java (.../OgonekAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,34 +49,33 @@ * An atom with an ogonek. */ public class OgonekAtom extends Atom { - - private static final SymbolAtom ogonek = SymbolAtom.get("ogonek"); + private Atom base; public OgonekAtom(Atom base) { - this.base = base; + this.base = base; } - + public Box createBox(TeXEnvironment env) { - Box b = base.createBox(env); - VerticalBox vb = new VerticalBox(); - vb.add(b); - Char ch = env.getTeXFont().getChar("ogonek", env.getStyle()); - float italic = ch.getItalic(); - Box ogonek = new CharBox(ch); - Box y; - if (Math.abs(italic) > TeXFormula.PREC) { + Box b = base.createBox(env); + VerticalBox vb = new VerticalBox(); + vb.add(b); + Char ch = env.getTeXFont().getChar("ogonek", env.getStyle()); + float italic = ch.getItalic(); + Box ogonek = new CharBox(ch); + Box y; + if (Math.abs(italic) > TeXFormula.PREC) { y = new HorizontalBox(new StrutBox(-italic, 0, 0, 0)); y.add(ogonek); } else y = ogonek; - Box og = new HorizontalBox(y, b.getWidth(), TeXConstants.ALIGN_RIGHT); - vb.add(new StrutBox(0, -ogonek.getHeight(), 0, 0)); - vb.add(og); - float f = vb.getHeight() + vb.getDepth(); - vb.setHeight(b.getHeight()); - vb.setDepth(f - b.getHeight()); - return vb; - } + Box og = new HorizontalBox(y, b.getWidth(), TeXConstants.ALIGN_RIGHT); + vb.add(new StrutBox(0, -ogonek.getHeight(), 0, 0)); + vb.add(og); + float f = vb.getHeight() + vb.getDepth(); + vb.setHeight(b.getHeight()); + vb.setDepth(f - b.getHeight()); + return vb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OvalAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OvalAtom.java (.../OvalAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OvalAtom.java (.../OvalAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,62 +1,60 @@ /* ShadowAtom.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.awt.Color; - /** - * An atom representing a boxed base atom. + * An atom representing a boxed base atom. */ public class OvalAtom extends FBoxAtom { public OvalAtom(Atom base) { - super(base); + super(base); } - + public Box createBox(TeXEnvironment env) { - return new OvalBox((FramedBox) super.createBox(env)); + return new OvalBox((FramedBox) super.createBox(env)); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OvalBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OvalBox.java (.../OvalBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OvalBox.java (.../OvalBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,78 +1,76 @@ /* OvalBox.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2011 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; +import java.awt.BasicStroke; import java.awt.Graphics2D; import java.awt.Stroke; -import java.awt.BasicStroke; import java.awt.geom.RoundRectangle2D; /** * A box representing a rotated box. */ public class OvalBox extends FramedBox { - - private float shadowRule; public OvalBox(FramedBox fbox) { - super(fbox.box, fbox.thickness, fbox.space); + super(fbox.box, fbox.thickness, fbox.space); } public void draw(Graphics2D g2, float x, float y) { - box.draw(g2, x + space + thickness, y); - Stroke st = g2.getStroke(); - g2.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); - float th = thickness / 2; - float r = 0.5f * Math.min(width - thickness, height + depth - thickness); - g2.draw(new RoundRectangle2D.Float(x + th, y - height + th, width - thickness, height + depth - thickness, r, r)); - //drawDebug(g2, x, y); - g2.setStroke(st); + box.draw(g2, x + space + thickness, y); + Stroke st = g2.getStroke(); + g2.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); + float th = thickness / 2; + float r = 0.5f * Math.min(width - thickness, height + depth - thickness); + g2.draw(new RoundRectangle2D.Float(x + th, y - height + th, width - thickness, height + depth - thickness, r, r)); + //drawDebug(g2, x, y); + g2.setStroke(st); } public int getLastFontId() { - return box.getLastFontId(); + return box.getLastFontId(); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverBar.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverBar.java (.../OverBar.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverBar.java (.../OverBar.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,62 +1,62 @@ /* OverBar.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * A box representing another box with a horizontal rule above it, with appropriate - * kerning. + * kerning. */ public class OverBar extends VerticalBox { public OverBar(Box b, float kern, float thickness) { - // construct vertical box - add(new StrutBox(0, thickness, 0, 0)); - add(new HorizontalRule(thickness, b.getWidth(), 0)); - add(new StrutBox(0, kern, 0, 0)); - add(b); + // construct vertical box + add(new StrutBox(0, thickness, 0, 0)); + add(new HorizontalRule(thickness, b.getWidth(), 0)); + add(new StrutBox(0, kern, 0, 0)); + add(b); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverUnderBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverUnderBox.java (.../OverUnderBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverUnderBox.java (.../OverUnderBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* OverUnderBox.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009-2010 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -50,7 +50,7 @@ import java.awt.geom.AffineTransform; /** - * A box representing another box with a delimiter box and a script box above or under it, + * A box representing another box with a delimiter box and a script box above or under it, * with script and delimiter seperated by a kern. */ public class OverUnderBox extends Box { @@ -63,12 +63,12 @@ // kern amount between the delimiter and the script private final float kern; - // whether the delimiter should be drawn over (<-> under) the base atom + // whether the delimiter should be drawn over (<-> under) the base atom private final boolean over; /** * the parameter boxes must have an equal width!! - * + * * @param b * base box to be drawn on the baseline * @param d @@ -80,61 +80,61 @@ * base box */ public OverUnderBox(Box b, Box d, Box script, float kern, boolean over) { - base = b; - del = d; - this.script = script; - this.kern = kern; - this.over = over; + base = b; + del = d; + this.script = script; + this.kern = kern; + this.over = over; - // calculate metrics of the box - width = b.getWidth(); - height = b.height - + (over ? d.getWidth() : 0) - + (over && script != null ? script.height + script.depth + kern : 0); - depth = b.depth - + (over ? 0 : d.getWidth()) - + (!over && script != null ? script.height + script.depth + kern : 0); + // calculate metrics of the box + width = b.getWidth(); + height = b.height + + (over ? d.getWidth() : 0) + + (over && script != null ? script.height + script.depth + kern : 0); + depth = b.depth + + (over ? 0 : d.getWidth()) + + (!over && script != null ? script.height + script.depth + kern : 0); } public void draw(Graphics2D g2, float x, float y) { - drawDebug(g2, x, y); - base.draw(g2, x, y); + drawDebug(g2, x, y); + base.draw(g2, x, y); - float yVar = y - base.height - del.getWidth(); - del.setDepth(del.getHeight() + del.getDepth()); - del.setHeight(0); - if (over) { // draw delimiter and script above base box - double transX = x + (del.height + del.depth) * 0.75, transY = yVar; - AffineTransform oldAt = g2.getTransform(); - g2.translate(transX, transY); - g2.rotate(Math.PI / 2); - del.draw(g2, 0, 0); - g2.setTransform(oldAt); - - // draw superscript - if (script != null) { - script.draw(g2, x, yVar - kern - script.depth); - } - } + float yVar = y - base.height - del.getWidth(); + del.setDepth(del.getHeight() + del.getDepth()); + del.setHeight(0); + if (over) { // draw delimiter and script above base box + double transX = x + (del.height + del.depth) * 0.75, transY = yVar; + AffineTransform oldAt = g2.getTransform(); + g2.translate(transX, transY); + g2.rotate(Math.PI / 2); + del.draw(g2, 0, 0); + g2.setTransform(oldAt); - yVar = y + base.depth; - if (!over) { // draw delimiter and script under base box - double transX = x + (del.getHeight() + del.depth) * 0.75, transY = yVar; - AffineTransform oldAt = g2.getTransform(); - g2.translate(transX, transY); - g2.rotate(Math.PI / 2); - del.draw(g2, 0, 0); - g2.setTransform(oldAt); - yVar += del.getWidth(); - - // draw subscript - if (script != null) { - script.draw(g2, x, yVar + kern + script.height); - } - } + // draw superscript + if (script != null) { + script.draw(g2, x, yVar - kern - script.depth); + } + } + + yVar = y + base.depth; + if (!over) { // draw delimiter and script under base box + double transX = x + (del.getHeight() + del.depth) * 0.75, transY = yVar; + AffineTransform oldAt = g2.getTransform(); + g2.translate(transX, transY); + g2.rotate(Math.PI / 2); + del.draw(g2, 0, 0); + g2.setTransform(oldAt); + yVar += del.getWidth(); + + // draw subscript + if (script != null) { + script.draw(g2, x, yVar + kern + script.height); + } + } } public int getLastFontId() { - return base.getLastFontId(); + return base.getLastFontId(); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverUnderDelimiter.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverUnderDelimiter.java (.../OverUnderDelimiter.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverUnderDelimiter.java (.../OverUnderDelimiter.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,117 +1,117 @@ /* OverUnderDelimiter.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009-2010 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * A box representing another atom with a delimiter and a script above or under it, + * A box representing another atom with a delimiter and a script above or under it, * with script and delimiter seperated by a kern. */ public class OverUnderDelimiter extends Atom { // base and script atom private final Atom base; private Atom script; - + // delimiter symbol private final SymbolAtom symbol; - + // kern between delimiter and script private final SpaceAtom kern; - + // whether the delimiter should be positioned above or under the base private final boolean over; public OverUnderDelimiter(Atom base, Atom script, SymbolAtom s, int kernUnit, - float kern, boolean over) throws InvalidUnitException { - type = TeXConstants.TYPE_INNER; - this.base = base; - this.script = script; - symbol = s; - this.kern = new SpaceAtom(kernUnit, 0, kern, 0); - this.over = over; + float kern, boolean over) throws InvalidUnitException { + type = TeXConstants.TYPE_INNER; + this.base = base; + this.script = script; + symbol = s; + this.kern = new SpaceAtom(kernUnit, 0, kern, 0); + this.over = over; } - + public void addScript(Atom script) { - this.script = script; + this.script = script; } public boolean isOver() { - return over; + return over; } - + public Box createBox(TeXEnvironment env) { - Box b = (base == null ? new StrutBox(0, 0, 0, 0) : base.createBox(env)); - Box del = DelimiterFactory.create(symbol.getName(), env, b.getWidth()); - - Box scriptBox = null; - if (script != null) { - scriptBox = script.createBox((over ? env.supStyle() : env.subStyle())); - } + Box b = (base == null ? new StrutBox(0, 0, 0, 0) : base.createBox(env)); + Box del = DelimiterFactory.create(symbol.getName(), env, b.getWidth()); - // create centered horizontal box if smaller than maximum width - float max = getMaxWidth(b, del, scriptBox); - if (max - b.getWidth() > TeXFormula.PREC) { - b = new HorizontalBox(b, max, TeXConstants.ALIGN_CENTER); - } + Box scriptBox = null; + if (script != null) { + scriptBox = script.createBox((over ? env.supStyle() : env.subStyle())); + } - del = new VerticalBox(del, max, TeXConstants.ALIGN_CENTER); - if (scriptBox != null && max - scriptBox.getWidth() > TeXFormula.PREC) { - scriptBox = new HorizontalBox(scriptBox, max, TeXConstants.ALIGN_CENTER); - } + // create centered horizontal box if smaller than maximum width + float max = getMaxWidth(b, del, scriptBox); + if (max - b.getWidth() > TeXFormula.PREC) { + b = new HorizontalBox(b, max, TeXConstants.ALIGN_CENTER); + } - return new OverUnderBox(b, del, scriptBox, kern.createBox(env).getHeight(), over); + del = new VerticalBox(del, max, TeXConstants.ALIGN_CENTER); + if (scriptBox != null && max - scriptBox.getWidth() > TeXFormula.PREC) { + scriptBox = new HorizontalBox(scriptBox, max, TeXConstants.ALIGN_CENTER); + } + + return new OverUnderBox(b, del, scriptBox, kern.createBox(env).getHeight(), over); } - + private static float getMaxWidth(Box b, Box del, Box script) { - float max = Math.max(b.getWidth(), del.getHeight() + del.getDepth()); - if (script != null) { - max = Math.max(max, script.getWidth()); - } + float max = Math.max(b.getWidth(), del.getHeight() + del.getDepth()); + if (script != null) { + max = Math.max(max, script.getWidth()); + } - return max; + return max; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverlinedAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverlinedAtom.java (.../OverlinedAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/OverlinedAtom.java (.../OverlinedAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* OverlinedAtom.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -51,26 +51,26 @@ */ public class OverlinedAtom extends Atom { - // base atom to be overlined - private final Atom base; + // base atom to be overlined + private final Atom base; - public OverlinedAtom(Atom f) { - base = f; - type = TeXConstants.TYPE_ORDINARY; - } + public OverlinedAtom(Atom f) { + base = f; + type = TeXConstants.TYPE_ORDINARY; + } - public Box createBox(TeXEnvironment env) { - float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); + public Box createBox(TeXEnvironment env) { + float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); - // cramp the style of the formula to be overlined and create vertical box - Box b = (base == null ? new StrutBox(0, 0, 0, 0) : base.createBox(env - .crampStyle())); - OverBar ob = new OverBar(b, 3 * drt, drt); + // cramp the style of the formula to be overlined and create vertical box + Box b = (base == null ? new StrutBox(0, 0, 0, 0) : base.createBox(env + .crampStyle())); + OverBar ob = new OverBar(b, 3 * drt, drt); - // baseline vertical box = baseline box b - ob.setDepth(b.getDepth()); - ob.setHeight(b.getHeight() + 5 * drt); + // baseline vertical box = baseline box b + ob.setDepth(b.getDepth()); + ob.setHeight(b.getHeight() + 5 * drt); - return ob; - } + return ob; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ParseException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ParseException.java (.../ParseException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ParseException.java (.../ParseException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -50,11 +50,13 @@ * Signals that an error occured while parsing a string to a formula. */ public class ParseException extends JMathTeXException { - + + private static final long serialVersionUID = -3498558910250213782L; + public ParseException(String str, Throwable cause) { super(str, cause); } - + public ParseException(String str) { super(str); } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ParseOption.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ParseOption.java (.../ParseOption.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ParseOption.java (.../ParseOption.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,46 +1,46 @@ /* ParseOption.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2011 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -55,24 +55,24 @@ public final class ParseOption { public final static Map parseMap(String options) { - Map map = new HashMap(); - if (options == null || options.length() == 0) { - return map; - } - StringTokenizer tokens = new StringTokenizer(options, ","); - while (tokens.hasMoreTokens()) { - String tok = tokens.nextToken().trim(); - String[] optarg = tok.split("="); - if (optarg != null){ - if (optarg.length == 2) { - map.put(optarg[0].trim(), optarg[1].trim()); - } else if (optarg.length == 1) { - map.put(optarg[0].trim(), null); - } - } - } - - return map; + Map map = new HashMap(); + if (options == null || options.length() == 0) { + return map; + } + StringTokenizer tokens = new StringTokenizer(options, ","); + while (tokens.hasMoreTokens()) { + String tok = tokens.nextToken().trim(); + String[] optarg = tok.split("="); + if (optarg != null) { + if (optarg.length == 2) { + map.put(optarg[0].trim(), optarg[1].trim()); + } else if (optarg.length == 1) { + map.put(optarg[0].trim(), null); + } + } + } + + return map; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PhantomAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PhantomAtom.java (.../PhantomAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PhantomAtom.java (.../PhantomAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* PhantomAtom.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -53,39 +53,39 @@ // RowAtom to be drawn invisibly private RowAtom elements; - + // dimensions to be taken into account private boolean w = true, h = true, d = true; - + public PhantomAtom(Atom el) { - if (el == null) - elements = new RowAtom(); - else - elements = new RowAtom(el); + if (el == null) + elements = new RowAtom(); + else + elements = new RowAtom(el); } - + public PhantomAtom(Atom el, boolean width, boolean height, boolean depth) { - this(el); - w = width; - h = height; - d = depth; + this(el); + w = width; + h = height; + d = depth; } - + public Box createBox(TeXEnvironment env) { - Box res = elements.createBox(env); - return new StrutBox((w ? res.getWidth() : 0), (h ? res.getHeight() : 0), - (d ? res.getDepth() : 0), res.getShift()); + Box res = elements.createBox(env); + return new StrutBox((w ? res.getWidth() : 0), (h ? res.getHeight() : 0), + (d ? res.getDepth() : 0), res.getShift()); } - + public int getLeftType() { - return elements.getLeftType(); + return elements.getLeftType(); } - + public int getRightType() { - return elements.getRightType(); + return elements.getRightType(); } - + public void setPreviousAtom(Dummy prev) { - elements.setPreviousAtom(prev); + elements.setPreviousAtom(prev); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefMacroInfo.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefMacroInfo.java (.../PredefMacroInfo.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefMacroInfo.java (.../PredefMacroInfo.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,31 +24,27 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; - /** * Class to load the predefined commands. Mainly wrote to avoid the use of the Java reflection. */ Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefMacros.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefMacros.java (.../PredefMacros.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefMacros.java (.../PredefMacros.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -140,13 +140,13 @@ public static final Atom longdiv_macro(final TeXParser tp, final String[] args) throws ParseException { try { long dividend = Long.valueOf(args[1]); - long divisor = Long.valueOf(args[2]); + long divisor = Long.valueOf(args[2]); return new LongdivAtom(divisor, dividend); } catch (NumberFormatException e) { throw new ParseException("Divisor and dividend must be integer numbers"); } } - + public static final Atom st_macro(final TeXParser tp, final String[] args) throws ParseException { return new StrikeThroughAtom(new TeXFormula(tp, args[1], false).root); } @@ -305,7 +305,7 @@ boolean rule = true; float[] ths = SpaceAtom.getLength(args[3]); if (args[3] == null || args[3].length() == 0 || ths.length == 1) { - ths = new float[]{0.0f, 0.0f}; + ths = new float[] {0.0f, 0.0f}; rule = false; } @@ -395,11 +395,11 @@ public static final Atom brack_macro(final TeXParser tp, final String[] args) throws ParseException { return choose_brackets("lsqbrack", "rsqbrack", tp, args); } - + public static final Atom bangle_macro(final TeXParser tp, final String[] args) throws ParseException { return choose_brackets("langle", "rangle", tp, args); } - + public static final Atom brace_macro(final TeXParser tp, final String[] args) throws ParseException { return choose_brackets("lbrace", "rbrace", tp, args); } @@ -1038,7 +1038,7 @@ Atom at = new UnderOverAtom(SymbolAtom.get(TeXFormula.symbolMappings['=']), new ScaleAtom(SymbolAtom.get(TeXFormula.symbolMappings['?']), 0.75f), TeXConstants.UNIT_MU, 2.5f, true, true); return new TypedAtom(TeXConstants.TYPE_RELATION, TeXConstants.TYPE_RELATION, at); } - + public static final Atom stackrel_macro(final TeXParser tp, final String[] args) throws ParseException { Atom at = new UnderOverAtom(new TeXFormula(tp, args[2], false).root, new TeXFormula(tp, args[3], false).root, TeXConstants.UNIT_MU, 0.5f, true, new TeXFormula(tp, args[1], false).root, TeXConstants.UNIT_MU, 2.5f, true); return new TypedAtom(TeXConstants.TYPE_RELATION, TeXConstants.TYPE_RELATION, at); @@ -1295,10 +1295,10 @@ float[] height = SpaceAtom.getLength(args[3]); float[] depth = SpaceAtom.getLength(args[4]); if (height.length == 1 || height[1] == 0) { - height = new float[]{-1, 0}; + height = new float[] {-1, 0}; } if (depth.length == 1 || depth[1] == 0) { - depth = new float[]{-1, 0}; + depth = new float[] {-1, 0}; } return new RaiseAtom(new TeXFormula(tp, args[2]).root, (int) raise[0], raise[1], (int) height[0], height[1], (int) depth[0], depth[1]); Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefinedCommands.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefinedCommands.java (.../PredefinedCommands.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefinedCommands.java (.../PredefinedCommands.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefinedTeXFormulaParser.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefinedTeXFormulaParser.java (.../PredefinedTeXFormulaParser.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefinedTeXFormulaParser.java (.../PredefinedTeXFormulaParser.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,58 +25,57 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.util.Map; import java.io.InputStream; +import java.util.Map; import javax.xml.parsers.DocumentBuilderFactory; + import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * Parses and creates predefined TeXFormula objects form an XML-file. */ public class PredefinedTeXFormulaParser { - - private static final String RESOURCE_DIR = ""; - + public static final String RESOURCE_NAME = "PredefinedTeXFormulas.xml"; - + private Element root; private String type; - + public PredefinedTeXFormulaParser(InputStream file, String type) throws ResourceParseException { try { - this.type = type; - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setIgnoringElementContentWhitespace(true); - factory.setIgnoringComments(true); - root = factory.newDocumentBuilder().parse(file).getDocumentElement(); - } catch (Exception e) { // JDOMException or IOException + this.type = type; + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setIgnoringElementContentWhitespace(true); + factory.setIgnoringComments(true); + root = factory.newDocumentBuilder().parse(file).getDocumentElement(); + } catch (Exception e) { // JDOMException or IOException throw new XMLResourceParseException("", e); } } - + public PredefinedTeXFormulaParser(String PredefFile, String type) throws ResourceParseException { this(PredefinedTeXFormulaParser.class.getResourceAsStream(PredefFile), type); } @@ -86,20 +85,20 @@ String enabledAll = getAttrValueAndCheckIfNotNull("enabled", root); if ("true".equals(enabledAll)) { // parse formula's // iterate all "Font"-elements - NodeList list = root.getElementsByTagName(this.type); + NodeList list = root.getElementsByTagName(this.type); for (int i = 0; i < list.getLength(); i++) { Element formula = (Element)list.item(i); // get required string attribute String enabled = getAttrValueAndCheckIfNotNull("enabled", formula); if ("true".equals (enabled)) { // parse this formula // get required string attribute String name = getAttrValueAndCheckIfNotNull("name", formula); - + // parse and build the formula and add it to the table if ("TeXFormula".equals(this.type)) - predefinedTeXFormulas.put(name, (TeXFormula) new TeXFormulaParser(name, formula, this.type).parse()); - else - predefinedTeXFormulas.put(name, (MacroInfo) new TeXFormulaParser(name, formula, this.type).parse()); + predefinedTeXFormulas.put(name, (TeXFormula) new TeXFormulaParser(name, formula, this.type).parse()); + else + predefinedTeXFormulas.put(name, (MacroInfo) new TeXFormulaParser(name, formula, this.type).parse()); } } } @@ -110,7 +109,7 @@ String attrValue = element.getAttribute(attrName); if (attrValue.equals("")) throw new XMLResourceParseException(RESOURCE_NAME, element.getTagName(), - attrName, null); + attrName, null); return attrValue; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefinedTeXFormulas.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefinedTeXFormulas.java (.../PredefinedTeXFormulas.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/PredefinedTeXFormulas.java (.../PredefinedTeXFormulas.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RaiseAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RaiseAtom.java (.../RaiseAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RaiseAtom.java (.../RaiseAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -55,13 +55,13 @@ private float r, h, d; public RaiseAtom(Atom base, int runit, float r, int hunit, float h, int dunit, float d) { - this.base = base; - this.runit = runit; - this.r = r; - this.hunit = hunit; - this.h = h; - this.dunit = dunit; - this.d = d; + this.base = base; + this.runit = runit; + this.r = r; + this.hunit = hunit; + this.h = h; + this.dunit = dunit; + this.d = d; } public int getLeftType() { @@ -74,24 +74,24 @@ public Box createBox(TeXEnvironment env) { Box bbox = base.createBox(env); - if (runit == -1) { - bbox.setShift(0); - } else { - bbox.setShift(-r * SpaceAtom.getFactor(runit, env)); - } + if (runit == -1) { + bbox.setShift(0); + } else { + bbox.setShift(-r * SpaceAtom.getFactor(runit, env)); + } - if (hunit == -1) { - return bbox; - } + if (hunit == -1) { + return bbox; + } - HorizontalBox hbox = new HorizontalBox(bbox); - hbox.setHeight(h * SpaceAtom.getFactor(hunit, env)); - if (dunit == -1) { - hbox.setDepth(0); - } else { - hbox.setDepth(d * SpaceAtom.getFactor(dunit, env)); - } + HorizontalBox hbox = new HorizontalBox(bbox); + hbox.setHeight(h * SpaceAtom.getFactor(hunit, env)); + if (dunit == -1) { + hbox.setDepth(0); + } else { + hbox.setDepth(d * SpaceAtom.getFactor(dunit, env)); + } - return hbox; + return hbox; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ReflectAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ReflectAtom.java (.../ReflectAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ReflectAtom.java (.../ReflectAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,15 +49,15 @@ * An atom representing a reflected Atom. */ public class ReflectAtom extends Atom { - + private Atom base; - + public ReflectAtom(Atom base) { - this.type = base.type; - this.base = base; + this.type = base.type; + this.base = base; } - + public Box createBox(TeXEnvironment env) { - return new ReflectBox(base.createBox(env)); - } + return new ReflectBox(base.createBox(env)); + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ReflectBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ReflectBox.java (.../ReflectBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ReflectBox.java (.../ReflectBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,46 +1,46 @@ /* ReflectBox.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -55,23 +55,23 @@ private Box box; public ReflectBox(Box b) { - this.box = b; - width = b.width; - height = b.height; - depth = b.depth; - shift = b.shift; + this.box = b; + width = b.width; + height = b.height; + depth = b.depth; + shift = b.shift; } - + public void draw(Graphics2D g2, float x, float y) { - drawDebug(g2, x, y); - g2.translate(x, y); - g2.scale(-1, 1); - box.draw(g2, -width, 0); - g2.scale(-1, 1); - g2.translate(-x, -y); + drawDebug(g2, x, y); + g2.translate(x, y); + g2.scale(-1, 1); + box.draw(g2, -width, 0); + g2.scale(-1, 1); + g2.translate(-x, -y); } public int getLastFontId() { - return box.getLastFontId(); + return box.getLastFontId(); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ResizeAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ResizeAtom.java (.../ResizeAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ResizeAtom.java (.../ResizeAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -58,23 +58,23 @@ public ResizeAtom(Atom base, String ws, String hs, boolean keepaspectratio) { this.type = base.type; this.base = base; - this.keepaspectratio = keepaspectratio; - float[] w = SpaceAtom.getLength(ws == null ? "" : ws); - float[] h = SpaceAtom.getLength(hs == null ? "" : hs); - if (w.length != 2) { - this.wunit = -1; - } else { - this.wunit = (int) w[0]; - this.w = w[1]; - } - if (h.length != 2) { - this.hunit = -1; - } else { - this.hunit = (int) h[0]; - this.h = h[1]; - } + this.keepaspectratio = keepaspectratio; + float[] w = SpaceAtom.getLength(ws == null ? "" : ws); + float[] h = SpaceAtom.getLength(hs == null ? "" : hs); + if (w.length != 2) { + this.wunit = -1; + } else { + this.wunit = (int) w[0]; + this.w = w[1]; + } + if (h.length != 2) { + this.hunit = -1; + } else { + this.hunit = (int) h[0]; + this.h = h[1]; + } } - + public int getLeftType() { return base.getLeftType(); } @@ -85,27 +85,27 @@ public Box createBox(TeXEnvironment env) { Box bbox = base.createBox(env); - if (wunit == -1 && hunit == -1) { - return bbox; - } else { - double xscl = 1; - double yscl = 1; - if (wunit != -1 && hunit != -1) { - xscl = w * SpaceAtom.getFactor(wunit, env) / bbox.width; - yscl = h * SpaceAtom.getFactor(hunit, env) / bbox.height; - if (keepaspectratio) { - xscl = Math.min(xscl, yscl); - yscl = xscl; - } - } else if (wunit != -1 && hunit == -1) { - xscl = w * SpaceAtom.getFactor(wunit, env) / bbox.width; - yscl = xscl; - } else { - yscl = h * SpaceAtom.getFactor(hunit, env) / bbox.height; - xscl = yscl; - } + if (wunit == -1 && hunit == -1) { + return bbox; + } else { + double xscl = 1; + double yscl = 1; + if (wunit != -1 && hunit != -1) { + xscl = w * SpaceAtom.getFactor(wunit, env) / bbox.width; + yscl = h * SpaceAtom.getFactor(hunit, env) / bbox.height; + if (keepaspectratio) { + xscl = Math.min(xscl, yscl); + yscl = xscl; + } + } else if (wunit != -1 && hunit == -1) { + xscl = w * SpaceAtom.getFactor(wunit, env) / bbox.width; + yscl = xscl; + } else { + yscl = h * SpaceAtom.getFactor(hunit, env) / bbox.height; + xscl = yscl; + } - return new ScaleBox(bbox, xscl, yscl); - } + return new ScaleBox(bbox, xscl, yscl); + } } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ResourceParseException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ResourceParseException.java (.../ResourceParseException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ResourceParseException.java (.../ResourceParseException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -50,11 +50,13 @@ * Signals that an error occurred while loading the necessary resources into memory. */ public class ResourceParseException extends JMathTeXException { - + + private static final long serialVersionUID = -7083164592631533649L; + protected ResourceParseException(String msg) { super(msg); } - + protected ResourceParseException(String msg, Throwable cause) { super(msg, cause); } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RomanAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RomanAtom.java (.../RomanAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RomanAtom.java (.../RomanAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RotateAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RotateAtom.java (.../RotateAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RotateAtom.java (.../RotateAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -51,52 +51,52 @@ * An atom representing a rotated Atom. */ public class RotateAtom extends Atom { - + private Atom base; private double angle; private int option = -1; private int xunit, yunit; private float x, y; - + public RotateAtom(Atom base, String angle, String option) { - this.type = base.type; - this.base = base; - this.angle = Double.parseDouble(angle); - this.option = RotateBox.getOrigin(option); + this.type = base.type; + this.base = base; + this.angle = Double.parseDouble(angle); + this.option = RotateBox.getOrigin(option); } public RotateAtom(Atom base, double angle, String option) { - this.type = base.type; - this.base = base; - this.angle = angle; - Map map = ParseOption.parseMap(option); - if (map.containsKey("origin")) { - this.option = RotateBox.getOrigin(map.get("origin")); - } else { - if (map.containsKey("x")) { - float[] xinfo = SpaceAtom.getLength(map.get("x")); - this.xunit = (int) xinfo[0]; - this.x = xinfo[1]; - } else { - this.xunit = TeXConstants.UNIT_POINT; - this.x = 0; - } - if (map.containsKey("y")) { - float[] yinfo = SpaceAtom.getLength(map.get("y")); - this.yunit = (int) yinfo[0]; - this.y = yinfo[1]; - } else { - this.yunit = TeXConstants.UNIT_POINT; - this.y = 0; - } - } + this.type = base.type; + this.base = base; + this.angle = angle; + Map map = ParseOption.parseMap(option); + if (map.containsKey("origin")) { + this.option = RotateBox.getOrigin(map.get("origin")); + } else { + if (map.containsKey("x")) { + float[] xinfo = SpaceAtom.getLength(map.get("x")); + this.xunit = (int) xinfo[0]; + this.x = xinfo[1]; + } else { + this.xunit = TeXConstants.UNIT_POINT; + this.x = 0; + } + if (map.containsKey("y")) { + float[] yinfo = SpaceAtom.getLength(map.get("y")); + this.yunit = (int) yinfo[0]; + this.y = yinfo[1]; + } else { + this.yunit = TeXConstants.UNIT_POINT; + this.y = 0; + } + } } - + public Box createBox(TeXEnvironment env) { - if (option != -1) { - return new RotateBox(base.createBox(env), angle, option); - } else { - return new RotateBox(base.createBox(env), angle, x * SpaceAtom.getFactor(xunit, env), y * SpaceAtom.getFactor(yunit, env)); - } + if (option != -1) { + return new RotateBox(base.createBox(env), angle, option); + } else { + return new RotateBox(base.createBox(env), angle, x * SpaceAtom.getFactor(xunit, env), y * SpaceAtom.getFactor(yunit, env)); + } } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RotateBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RotateBox.java (.../RotateBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RotateBox.java (.../RotateBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -69,7 +69,6 @@ protected double angle = 0; private Box box; private float xmax, xmin, ymax, ymin; - private int option; private float shiftX; private float shiftY; @@ -135,7 +134,7 @@ return BBR; } else - return BBL; + return BBL; } private static Point2D.Float calculateShift(Box b, int option) { Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Row.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Row.java (.../Row.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/Row.java (.../Row.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,64 +1,64 @@ /* Row.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * A "composed atom": an atom that consists of child atoms that will be displayed + * A "composed atom": an atom that consists of child atoms that will be displayed * next to each other horizontally with glue between them. */ public interface Row { /** * Sets the given dummy containing the atom that comes just before * the first child atom of this "composed atom". This method will allways be called - * by another composed atom, so this composed atom will be a child of it (nested). - * This is necessary to determine the glue to insert between the first child atom - * of this nested composed atom and the atom that the dummy contains. - * + * by another composed atom, so this composed atom will be a child of it (nested). + * This is necessary to determine the glue to insert between the first child atom + * of this nested composed atom and the atom that the dummy contains. + * * @param dummy the dummy that comes just before this "composed atom" */ public void setPreviousAtom(Dummy dummy); Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RowAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RowAtom.java (.../RowAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RowAtom.java (.../RowAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet to handle the case where several ligatures occure*/ @@ -50,7 +50,6 @@ import java.util.BitSet; import java.util.LinkedList; -import java.util.List; import java.util.ListIterator; import org.scilab.forge.jlatexmath.dynamic.DynamicAtom; @@ -154,19 +153,19 @@ Atom at = it.next(); position++; - boolean markAdded = false; - while (at instanceof BreakMarkAtom) { - if (!markAdded) { - markAdded = true; - } - if (it.hasNext()) { - at = it.next(); - position++; - } else { - break; - } - } - + boolean markAdded = false; + while (at instanceof BreakMarkAtom) { + if (!markAdded) { + markAdded = true; + } + if (it.hasNext()) { + at = it.next(); + position++; + } else { + break; + } + } + if (at instanceof DynamicAtom && ((DynamicAtom) at).getInsertMode()) { Atom a = ((DynamicAtom) at).getAtom(); if (a instanceof RowAtom) { @@ -205,8 +204,7 @@ it.previous(); position--; break; // iterator remains unchanged (no ligature!) - } - else { // ligature + } else { // ligature atom.changeAtom(new FixedCharAtom(lig)); // go on with the // ligature } @@ -232,9 +230,9 @@ CharBox cb = (CharBox) b; cb.addItalicCorrectionToWidth(); } - if (markAdded || (at instanceof CharAtom && Character.isDigit(((CharAtom) at).getCharacter()))) { - hBox.addBreakPosition(hBox.children.size()); - } + if (markAdded || (at instanceof CharAtom && Character.isDigit(((CharAtom) at).getCharacter()))) { + hBox.addBreakPosition(hBox.children.size()); + } hBox.add(b); // set last used fontId (for next atom) @@ -243,17 +241,17 @@ // insert kern if (Math.abs(kern) > TeXFormula.PREC) { hBox.add(new StrutBox(kern, 0, 0, 0)); - } + } // kerns do not interfere with the normal glue-rules without kerns if (!atom.isKern()) { previousAtom = atom; - } + } } // reset previousAtom previousAtom = null; - - return hBox; + + return hBox; } public void setPreviousAtom(Dummy prev) { Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RuleAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RuleAtom.java (.../RuleAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/RuleAtom.java (.../RuleAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,69 +1,68 @@ /* RuleAtom.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * An atom representing a rule. + * An atom representing a rule. */ public class RuleAtom extends Atom { - + private int wunit, hunit, runit; private float w, h, r; - private SpaceAtom width, height, raise; - + public RuleAtom(int wunit, float width, int hunit, float height, int runit, float raise) { - this.wunit = wunit; - this.hunit = hunit; - this.runit = runit; - this.w = width; - this.h = height; - this.r = raise; + this.wunit = wunit; + this.hunit = hunit; + this.runit = runit; + this.w = width; + this.h = height; + this.r = raise; } - + public Box createBox(TeXEnvironment env) { - return new HorizontalRule(h * SpaceAtom.getFactor(hunit, env), w * SpaceAtom.getFactor(wunit, env), r * SpaceAtom.getFactor(runit, env)); - } + return new HorizontalRule(h * SpaceAtom.getFactor(hunit, env), w * SpaceAtom.getFactor(wunit, env), r * SpaceAtom.getFactor(runit, env)); + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ScaleBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ScaleBox.java (.../ScaleBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ScaleBox.java (.../ScaleBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,46 +1,46 @@ /* ScaleBox.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -54,36 +54,34 @@ private Box box; private double xscl, yscl; - private float factor = 1; public ScaleBox(Box b, double xscl, double yscl) { - this.box = b; - this.xscl = (Double.isNaN(xscl) || Double.isInfinite(xscl)) ? 0 : xscl; - this.yscl = (Double.isNaN(yscl) || Double.isInfinite(yscl)) ? 0 : yscl; - width = b.width * (float) Math.abs(this.xscl); - height = this.yscl > 0 ? b.height * (float) this.yscl : -b.depth * (float) this.yscl; - depth = this.yscl > 0 ? b.depth * (float) this.yscl : -b.height * (float) this.yscl; - shift = b.shift * (float) this.yscl; + this.box = b; + this.xscl = (Double.isNaN(xscl) || Double.isInfinite(xscl)) ? 0 : xscl; + this.yscl = (Double.isNaN(yscl) || Double.isInfinite(yscl)) ? 0 : yscl; + width = b.width * (float) Math.abs(this.xscl); + height = this.yscl > 0 ? b.height * (float) this.yscl : -b.depth * (float) this.yscl; + depth = this.yscl > 0 ? b.depth * (float) this.yscl : -b.height * (float) this.yscl; + shift = b.shift * (float) this.yscl; } public ScaleBox(Box b, float factor) { - this(b, (double) factor, (double) factor); - this.factor = factor; + this(b, (double) factor, (double) factor); } - + public void draw(Graphics2D g2, float x, float y) { - drawDebug(g2, x, y); - if (xscl != 0 && yscl != 0) { - float dec = xscl < 0 ? width : 0; - g2.translate(x + dec, y); - g2.scale(xscl, yscl); - box.draw(g2, 0, 0); - g2.scale(1 / xscl, 1 / yscl); - g2.translate(-x - dec, -y); - } + drawDebug(g2, x, y); + if (xscl != 0 && yscl != 0) { + float dec = xscl < 0 ? width : 0; + g2.translate(x + dec, y); + g2.scale(xscl, yscl); + box.draw(g2, 0, 0); + g2.scale(1 / xscl, 1 / yscl); + g2.translate(-x - dec, -y); + } } public int getLastFontId() { - return box.getLastFontId(); + return box.getLastFontId(); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ScriptsAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ScriptsAtom.java (.../ScriptsAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ScriptsAtom.java (.../ScriptsAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,47 +1,47 @@ /* ScriptsAtom.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ @@ -52,178 +52,178 @@ * An atom representing scripts to be attached to another atom. */ public class ScriptsAtom extends Atom { - + // TeX constant: what's the use??? private final static SpaceAtom SCRIPT_SPACE = new SpaceAtom(TeXConstants.UNIT_POINT, 0.5f, 0, 0); - + // base atom private final Atom base; - + // subscript and superscript to be attached to the base (if not null) private final Atom subscript; private final Atom superscript; private int align = TeXConstants.ALIGN_LEFT; - + public ScriptsAtom(Atom base, Atom sub, Atom sup) { - this.base = base; - subscript = sub; - superscript = sup; + this.base = base; + subscript = sub; + superscript = sup; } - + public ScriptsAtom(Atom base, Atom sub, Atom sup, boolean left) { - this(base, sub, sup); - if (!left) - align = TeXConstants.ALIGN_RIGHT; + this(base, sub, sup); + if (!left) + align = TeXConstants.ALIGN_RIGHT; } - + public Box createBox(TeXEnvironment env) { - Box b = (base == null ? new StrutBox(0, 0, 0, 0) : base.createBox(env)); + Box b = (base == null ? new StrutBox(0, 0, 0, 0) : base.createBox(env)); Box deltaSymbol = new StrutBox(0, 0, 0, 0); - if (subscript == null && superscript == null) - return b; - else { - TeXFont tf = env.getTeXFont(); - int style = env.getStyle(); - - if (base.type_limits == TeXConstants.SCRIPT_LIMITS || (base.type_limits == TeXConstants.SCRIPT_NORMAL && style == TeXConstants.STYLE_DISPLAY)) - return new UnderOverAtom(new UnderOverAtom(base, subscript, TeXConstants.UNIT_POINT, 0.3f, true, false), - superscript, TeXConstants.UNIT_POINT, 3.0f, true, true).createBox(env); - - HorizontalBox hor = new HorizontalBox(b); - - int lastFontId = b.getLastFontId(); - // if no last font found (whitespace box), use default "mu font" - if (lastFontId == TeXFont.NO_FONT) - lastFontId = tf.getMuFontId(); - - TeXEnvironment subStyle = env.subStyle(), supStyle = env.supStyle(); - - // set delta and preliminary shift-up and shift-down values - float delta = 0, shiftUp, shiftDown; - - // TODO: use polymorphism? - if (base instanceof AccentedAtom) { // special case : - // accent. This positions superscripts better next to the accent! - Box box = ((AccentedAtom) base).base.createBox(env.crampStyle()); - shiftUp = box.getHeight() - tf.getSupDrop(supStyle.getStyle()); - shiftDown = box.getDepth() + tf.getSubDrop(subStyle.getStyle()); - } else if (base instanceof SymbolAtom - && base.type == TeXConstants.TYPE_BIG_OPERATOR) { // single big operator symbol - Char c = tf.getChar(((SymbolAtom) base).getName(), style); - if (style < TeXConstants.STYLE_TEXT && tf.hasNextLarger(c)) // display - // style - c = tf.getNextLarger(c, style); - Box x = new CharBox(c); - - x.setShift(-(x.getHeight() + x.getDepth()) / 2 - - env.getTeXFont().getAxisHeight(env.getStyle())); - hor = new HorizontalBox(x); - - // include delta in width or not? - delta = c.getItalic(); + if (subscript == null && superscript == null) + return b; + else { + TeXFont tf = env.getTeXFont(); + int style = env.getStyle(); + + if (base.type_limits == TeXConstants.SCRIPT_LIMITS || (base.type_limits == TeXConstants.SCRIPT_NORMAL && style == TeXConstants.STYLE_DISPLAY)) + return new UnderOverAtom(new UnderOverAtom(base, subscript, TeXConstants.UNIT_POINT, 0.3f, true, false), + superscript, TeXConstants.UNIT_POINT, 3.0f, true, true).createBox(env); + + HorizontalBox hor = new HorizontalBox(b); + + int lastFontId = b.getLastFontId(); + // if no last font found (whitespace box), use default "mu font" + if (lastFontId == TeXFont.NO_FONT) + lastFontId = tf.getMuFontId(); + + TeXEnvironment subStyle = env.subStyle(), supStyle = env.supStyle(); + + // set delta and preliminary shift-up and shift-down values + float delta = 0, shiftUp, shiftDown; + + // TODO: use polymorphism? + if (base instanceof AccentedAtom) { // special case : + // accent. This positions superscripts better next to the accent! + Box box = ((AccentedAtom) base).base.createBox(env.crampStyle()); + shiftUp = box.getHeight() - tf.getSupDrop(supStyle.getStyle()); + shiftDown = box.getDepth() + tf.getSubDrop(subStyle.getStyle()); + } else if (base instanceof SymbolAtom + && base.type == TeXConstants.TYPE_BIG_OPERATOR) { // single big operator symbol + Char c = tf.getChar(((SymbolAtom) base).getName(), style); + if (style < TeXConstants.STYLE_TEXT && tf.hasNextLarger(c)) // display + // style + c = tf.getNextLarger(c, style); + Box x = new CharBox(c); + + x.setShift(-(x.getHeight() + x.getDepth()) / 2 + - env.getTeXFont().getAxisHeight(env.getStyle())); + hor = new HorizontalBox(x); + + // include delta in width or not? + delta = c.getItalic(); deltaSymbol = new SpaceAtom(TeXConstants.MEDMUSKIP).createBox(env); - if (delta > TeXFormula.PREC && subscript == null) - hor.add(new StrutBox(delta, 0, 0, 0)); - - shiftUp = hor.getHeight() - tf.getSupDrop(supStyle.getStyle()); - shiftDown = hor.getDepth() + tf.getSubDrop(subStyle.getStyle()); - } else if (base instanceof CharSymbol) { - shiftUp = shiftDown = 0; - CharFont cf = ((CharSymbol) base).getCharFont(tf); - if (!((CharSymbol) base).isMarkedAsTextSymbol() || !tf.hasSpace(cf.fontId)) { - delta = tf.getChar(cf, style).getItalic(); - } - if (delta > TeXFormula.PREC && subscript == null) { - hor.add(new StrutBox(delta, 0, 0, 0)); - delta = 0; - } - } else { - shiftUp = b.getHeight() - tf.getSupDrop(supStyle.getStyle()); - shiftDown = b.getDepth() + tf.getSubDrop(subStyle.getStyle()); - } - - if (superscript == null) { // only subscript - Box x = subscript.createBox(subStyle); - // calculate and set shift amount - x.setShift(Math.max(Math.max(shiftDown, tf.getSub1(style)), x.getHeight() - 4 * Math.abs(tf.getXHeight(style, lastFontId)) / 5)); - hor.add(x); - hor.add(deltaSymbol); - - return hor; - } else { - Box x = superscript.createBox(supStyle); - float msiz = x.getWidth(); - if (subscript != null && align == TeXConstants.ALIGN_RIGHT) { - msiz = Math.max(msiz, subscript.createBox(subStyle).getWidth()); - } - - HorizontalBox sup = new HorizontalBox(x, msiz, align); - // add scriptspace (constant value!) - sup.add(SCRIPT_SPACE.createBox(env)); - // adjust shift-up - float p; - if (style == TeXConstants.STYLE_DISPLAY) - p = tf.getSup1(style); - else if (env.crampStyle().getStyle() == style) - p = tf.getSup3(style); - else - p = tf.getSup2(style); - shiftUp = Math.max(Math.max(shiftUp, p), x.getDepth() - + Math.abs(tf.getXHeight(style, lastFontId)) / 4); - - if (subscript == null) { // only superscript - sup.setShift(-shiftUp); - hor.add(sup); - } else { // both superscript and subscript - Box y = subscript.createBox(subStyle); - HorizontalBox sub = new HorizontalBox(y, msiz, align); - // add scriptspace (constant value!) - sub.add(SCRIPT_SPACE.createBox(env)); - // adjust shift-down - shiftDown = Math.max(shiftDown, tf.getSub2(style)); - // position both sub- and superscript - float drt = tf.getDefaultRuleThickness(style); - float interSpace = shiftUp - x.getDepth() + shiftDown - - y.getHeight(); // space between sub- en - // superscript - if (interSpace < 4 * drt) { // too small - shiftUp += 4 * drt - interSpace; - // set bottom superscript at least 4/5 of X-height - // above - // baseline - float psi = 4 * Math.abs(tf.getXHeight(style, lastFontId)) - / 5 - (shiftUp - x.getDepth()); - - if (psi > 0) { - shiftUp += psi; - shiftDown -= psi; - } - } - // create total box - - VerticalBox vBox = new VerticalBox(); - sup.setShift(delta); - vBox.add(sup); - // recalculate interspace - interSpace = shiftUp - x.getDepth() + shiftDown - y.getHeight(); - vBox.add(new StrutBox(0, interSpace, 0, 0)); - vBox.add(sub); - vBox.setHeight(shiftUp + x.getHeight()); - vBox.setDepth(shiftDown + y.getDepth()); - hor.add(vBox); - } + if (delta > TeXFormula.PREC && subscript == null) + hor.add(new StrutBox(delta, 0, 0, 0)); + + shiftUp = hor.getHeight() - tf.getSupDrop(supStyle.getStyle()); + shiftDown = hor.getDepth() + tf.getSubDrop(subStyle.getStyle()); + } else if (base instanceof CharSymbol) { + shiftUp = shiftDown = 0; + CharFont cf = ((CharSymbol) base).getCharFont(tf); + if (!((CharSymbol) base).isMarkedAsTextSymbol() || !tf.hasSpace(cf.fontId)) { + delta = tf.getChar(cf, style).getItalic(); + } + if (delta > TeXFormula.PREC && subscript == null) { + hor.add(new StrutBox(delta, 0, 0, 0)); + delta = 0; + } + } else { + shiftUp = b.getHeight() - tf.getSupDrop(supStyle.getStyle()); + shiftDown = b.getDepth() + tf.getSubDrop(subStyle.getStyle()); + } + + if (superscript == null) { // only subscript + Box x = subscript.createBox(subStyle); + // calculate and set shift amount + x.setShift(Math.max(Math.max(shiftDown, tf.getSub1(style)), x.getHeight() - 4 * Math.abs(tf.getXHeight(style, lastFontId)) / 5)); + hor.add(x); hor.add(deltaSymbol); - return hor; - } - } + return hor; + } else { + Box x = superscript.createBox(supStyle); + float msiz = x.getWidth(); + if (subscript != null && align == TeXConstants.ALIGN_RIGHT) { + msiz = Math.max(msiz, subscript.createBox(subStyle).getWidth()); + } + + HorizontalBox sup = new HorizontalBox(x, msiz, align); + // add scriptspace (constant value!) + sup.add(SCRIPT_SPACE.createBox(env)); + // adjust shift-up + float p; + if (style == TeXConstants.STYLE_DISPLAY) + p = tf.getSup1(style); + else if (env.crampStyle().getStyle() == style) + p = tf.getSup3(style); + else + p = tf.getSup2(style); + shiftUp = Math.max(Math.max(shiftUp, p), x.getDepth() + + Math.abs(tf.getXHeight(style, lastFontId)) / 4); + + if (subscript == null) { // only superscript + sup.setShift(-shiftUp); + hor.add(sup); + } else { // both superscript and subscript + Box y = subscript.createBox(subStyle); + HorizontalBox sub = new HorizontalBox(y, msiz, align); + // add scriptspace (constant value!) + sub.add(SCRIPT_SPACE.createBox(env)); + // adjust shift-down + shiftDown = Math.max(shiftDown, tf.getSub2(style)); + // position both sub- and superscript + float drt = tf.getDefaultRuleThickness(style); + float interSpace = shiftUp - x.getDepth() + shiftDown + - y.getHeight(); // space between sub- en + // superscript + if (interSpace < 4 * drt) { // too small + shiftUp += 4 * drt - interSpace; + // set bottom superscript at least 4/5 of X-height + // above + // baseline + float psi = 4 * Math.abs(tf.getXHeight(style, lastFontId)) + / 5 - (shiftUp - x.getDepth()); + + if (psi > 0) { + shiftUp += psi; + shiftDown -= psi; + } + } + // create total box + + VerticalBox vBox = new VerticalBox(); + sup.setShift(delta); + vBox.add(sup); + // recalculate interspace + interSpace = shiftUp - x.getDepth() + shiftDown - y.getHeight(); + vBox.add(new StrutBox(0, interSpace, 0, 0)); + vBox.add(sub); + vBox.setHeight(shiftUp + x.getHeight()); + vBox.setDepth(shiftDown + y.getDepth()); + hor.add(vBox); + } + hor.add(deltaSymbol); + + return hor; + } + } } - + public int getLeftType() { - return base.getLeftType(); + return base.getLeftType(); } - + public int getRightType() { - return base.getRightType(); + return base.getRightType(); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ShadowAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ShadowAtom.java (.../ShadowAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ShadowAtom.java (.../ShadowAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,62 +1,60 @@ /* ShadowAtom.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.awt.Color; - /** - * An atom representing a boxed base atom. + * An atom representing a boxed base atom. */ public class ShadowAtom extends FBoxAtom { public ShadowAtom(Atom base) { - super(base); + super(base); } - + public Box createBox(TeXEnvironment env) { - return new ShadowBox((FramedBox) super.createBox(env), env.getTeXFont().getDefaultRuleThickness(env.getStyle()) * 4); + return new ShadowBox((FramedBox) super.createBox(env), env.getTeXFont().getDefaultRuleThickness(env.getStyle()) * 4); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ShadowBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ShadowBox.java (.../ShadowBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/ShadowBox.java (.../ShadowBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,85 +1,85 @@ /* FramedBox.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; +import java.awt.BasicStroke; import java.awt.Graphics2D; import java.awt.Stroke; -import java.awt.BasicStroke; import java.awt.geom.Rectangle2D; /** * A box representing a rotated box. */ public class ShadowBox extends FramedBox { - + private float shadowRule; public ShadowBox(FramedBox fbox, float shadowRule) { - super(fbox.box, fbox.thickness, fbox.space); - this.shadowRule = shadowRule; - depth += shadowRule; - width += shadowRule; + super(fbox.box, fbox.thickness, fbox.space); + this.shadowRule = shadowRule; + depth += shadowRule; + width += shadowRule; } public void draw(Graphics2D g2, float x, float y) { - float th = thickness / 2; - box.draw(g2, x + space + thickness, y); - Stroke st = g2.getStroke(); - g2.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); - g2.draw(new Rectangle2D.Float(x + th, y - height + th, width - shadowRule - thickness, height + depth - shadowRule - thickness)); - float penth = (float) Math.abs(1 / g2.getTransform().getScaleX()); - g2.setStroke(new BasicStroke(penth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); - g2.fill(new Rectangle2D.Float(x + shadowRule - penth, y + depth - shadowRule - penth, width - shadowRule, shadowRule)); - g2.fill(new Rectangle2D.Float(x + width - shadowRule - penth, y - height + th + shadowRule, shadowRule, depth + height - 2 * shadowRule - th)); - //drawDebug(g2, x, y); - g2.setStroke(st); + float th = thickness / 2; + box.draw(g2, x + space + thickness, y); + Stroke st = g2.getStroke(); + g2.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); + g2.draw(new Rectangle2D.Float(x + th, y - height + th, width - shadowRule - thickness, height + depth - shadowRule - thickness)); + float penth = (float) Math.abs(1 / g2.getTransform().getScaleX()); + g2.setStroke(new BasicStroke(penth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); + g2.fill(new Rectangle2D.Float(x + shadowRule - penth, y + depth - shadowRule - penth, width - shadowRule, shadowRule)); + g2.fill(new Rectangle2D.Float(x + width - shadowRule - penth, y - height + th + shadowRule, shadowRule, depth + height - 2 * shadowRule - th)); + //drawDebug(g2, x, y); + g2.setStroke(st); } public int getLastFontId() { - return box.getLastFontId(); + return box.getLastFontId(); } } /* Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SmallCapAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SmallCapAtom.java (.../SmallCapAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SmallCapAtom.java (.../SmallCapAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,66 +1,66 @@ /* RomanAtom.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * An atom representing a small capital atom. + * An atom representing a small capital atom. */ public class SmallCapAtom extends Atom { - + protected Atom base; - + public SmallCapAtom(Atom base) { - this.base = base; + this.base = base; } - + public Box createBox(TeXEnvironment env) { - boolean prev = env.getSmallCap(); - env.setSmallCap(true); - Box box = base.createBox(env); - env.setSmallCap(prev); - return box; - } + boolean prev = env.getSmallCap(); + env.setSmallCap(true); + Box box = base.createBox(env); + env.setSmallCap(prev); + return box; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SmashedAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SmashedAtom.java (.../SmashedAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SmashedAtom.java (.../SmashedAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,53 +24,53 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * An atom representing a smashed atom (i.e. with no height and no depth). + * An atom representing a smashed atom (i.e. with no height and no depth). */ public class SmashedAtom extends Atom { private Atom at; private boolean h = true, d = true; - + public SmashedAtom(Atom at, String opt) { this.at = at; - if ("t".equals(opt)) - d = false; - else if ("b".equals(opt)) - h = false; + if ("t".equals(opt)) + d = false; + else if ("b".equals(opt)) + h = false; } public SmashedAtom(Atom at) { this.at = at; } - + public Box createBox(TeXEnvironment env) { Box b = at.createBox(env); - if (h) - b.setHeight(0); - if (d) - b.setDepth(0); - return b; + if (h) + b.setHeight(0); + if (d) + b.setDepth(0); + return b; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SpaceAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SpaceAtom.java (.../SpaceAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SpaceAtom.java (.../SpaceAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ @@ -83,90 +83,90 @@ private static UnitConversion[] unitConversions = new UnitConversion[] { - new UnitConversion() {//EM - public float getPixelConversion(TeXEnvironment env) { - return env.getTeXFont().getEM(env.getStyle()); - } - }, + new UnitConversion() {//EM + public float getPixelConversion(TeXEnvironment env) { + return env.getTeXFont().getEM(env.getStyle()); + } + }, - new UnitConversion() {//EX - public float getPixelConversion(TeXEnvironment env) { - return env.getTeXFont().getXHeight(env.getStyle(), env.getLastFontId()); - } - }, + new UnitConversion() {//EX + public float getPixelConversion(TeXEnvironment env) { + return env.getTeXFont().getXHeight(env.getStyle(), env.getLastFontId()); + } + }, - new UnitConversion() {//PIXEL - public float getPixelConversion(TeXEnvironment env) { - return 1 / env.getSize(); - } - }, + new UnitConversion() {//PIXEL + public float getPixelConversion(TeXEnvironment env) { + return 1 / env.getSize(); + } + }, - new UnitConversion() {//BP (or PostScript point) - public float getPixelConversion(TeXEnvironment env) { - return TeXFormula.PIXELS_PER_POINT / env.getSize(); - } - }, + new UnitConversion() {//BP (or PostScript point) + public float getPixelConversion(TeXEnvironment env) { + return TeXFormula.PIXELS_PER_POINT / env.getSize(); + } + }, - new UnitConversion() {//PICA - public float getPixelConversion(TeXEnvironment env) { - return (12 * TeXFormula.PIXELS_PER_POINT) / env.getSize(); - } - }, + new UnitConversion() {//PICA + public float getPixelConversion(TeXEnvironment env) { + return (12 * TeXFormula.PIXELS_PER_POINT) / env.getSize(); + } + }, - new UnitConversion() {//MU - public float getPixelConversion(TeXEnvironment env) { - TeXFont tf = env.getTeXFont(); - return tf.getQuad(env.getStyle(), tf.getMuFontId()) / 18; - } - }, + new UnitConversion() {//MU + public float getPixelConversion(TeXEnvironment env) { + TeXFont tf = env.getTeXFont(); + return tf.getQuad(env.getStyle(), tf.getMuFontId()) / 18; + } + }, - new UnitConversion() {//CM - public float getPixelConversion(TeXEnvironment env) { - return (28.346456693f * TeXFormula.PIXELS_PER_POINT) / env.getSize(); - } - }, + new UnitConversion() {//CM + public float getPixelConversion(TeXEnvironment env) { + return (28.346456693f * TeXFormula.PIXELS_PER_POINT) / env.getSize(); + } + }, - new UnitConversion() {//MM - public float getPixelConversion(TeXEnvironment env) { - return (2.8346456693f * TeXFormula.PIXELS_PER_POINT) / env.getSize(); - } - }, + new UnitConversion() {//MM + public float getPixelConversion(TeXEnvironment env) { + return (2.8346456693f * TeXFormula.PIXELS_PER_POINT) / env.getSize(); + } + }, - new UnitConversion() {//IN - public float getPixelConversion(TeXEnvironment env) { - return (72 * TeXFormula.PIXELS_PER_POINT) / env.getSize(); - } - }, + new UnitConversion() {//IN + public float getPixelConversion(TeXEnvironment env) { + return (72 * TeXFormula.PIXELS_PER_POINT) / env.getSize(); + } + }, - new UnitConversion() {//SP - public float getPixelConversion(TeXEnvironment env) { - return (65536 * TeXFormula.PIXELS_PER_POINT) / env.getSize(); - } - }, + new UnitConversion() {//SP + public float getPixelConversion(TeXEnvironment env) { + return (65536 * TeXFormula.PIXELS_PER_POINT) / env.getSize(); + } + }, - new UnitConversion() {//PT (or Standard Anglo-American point) - public float getPixelConversion(TeXEnvironment env) { - return (.9962640099f * TeXFormula.PIXELS_PER_POINT) / env.getSize(); - } - }, + new UnitConversion() {//PT (or Standard Anglo-American point) + public float getPixelConversion(TeXEnvironment env) { + return (.9962640099f * TeXFormula.PIXELS_PER_POINT) / env.getSize(); + } + }, - new UnitConversion() {//DD - public float getPixelConversion(TeXEnvironment env) { - return (1.0660349422f * TeXFormula.PIXELS_PER_POINT) / env.getSize(); - } - }, + new UnitConversion() {//DD + public float getPixelConversion(TeXEnvironment env) { + return (1.0660349422f * TeXFormula.PIXELS_PER_POINT) / env.getSize(); + } + }, - new UnitConversion() {//CC - public float getPixelConversion(TeXEnvironment env) { - return (12.7924193070f * TeXFormula.PIXELS_PER_POINT) / env.getSize(); - } - }, - - new UnitConversion() {//X8 - public float getPixelConversion(TeXEnvironment env) { - return env.getTeXFont().getDefaultRuleThickness(env.getStyle()); - } + new UnitConversion() {//CC + public float getPixelConversion(TeXEnvironment env) { + return (12.7924193070f * TeXFormula.PIXELS_PER_POINT) / env.getSize(); } + }, + + new UnitConversion() {//X8 + public float getPixelConversion(TeXEnvironment env) { + return env.getTeXFont().getDefaultRuleThickness(env.getStyle()); + } + } }; // whether a hard space should be represented @@ -242,7 +242,7 @@ public static float[] getLength(String lgth) { if (lgth == null) { - return new float[]{TeXConstants.UNIT_PIXEL, 0f}; + return new float[] {TeXConstants.UNIT_PIXEL, 0f}; } int i = 0; @@ -251,7 +251,7 @@ try { f = Float.parseFloat(lgth.substring(0, i)); } catch (NumberFormatException e) { - return new float[]{Float.NaN}; + return new float[] {Float.NaN}; } int unit; @@ -261,7 +261,7 @@ unit = TeXConstants.UNIT_PIXEL; } - return new float[]{(float) unit, f}; + return new float[] {(float) unit, f}; } public Box createBox(TeXEnvironment env) { Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SsAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SsAtom.java (.../SsAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SsAtom.java (.../SsAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,67 +1,67 @@ /* SsAtom.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * An atom representing a sans serif atom. + * An atom representing a sans serif atom. */ public class SsAtom extends Atom { - + private Atom base; - + public SsAtom(Atom base) { - this.base = base; + this.base = base; } - + public Box createBox(TeXEnvironment env) { - env = env.copy(env.getTeXFont().copy()); - env.getTeXFont().setSs(true); - Box box = base.createBox(env); - env.getTeXFont().setSs(false); - return box; + env = env.copy(env.getTeXFont().copy()); + env.getTeXFont().setSs(true); + Box box = base.createBox(env); + env.getTeXFont().setSs(false); + return box; } - + } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/StrikeThroughAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/StrikeThroughAtom.java (.../StrikeThroughAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/StrikeThroughAtom.java (.../StrikeThroughAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,50 +24,50 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * An atom representing a smashed atom (i.e. with no height and no depth). + * An atom representing a smashed atom (i.e. with no height and no depth). */ public class StrikeThroughAtom extends Atom { private Atom at; - + public StrikeThroughAtom(Atom at) { this.at = at; } - + public Box createBox(TeXEnvironment env) { TeXFont tf = env.getTeXFont(); int style = env.getStyle(); - float axis = tf.getAxisHeight(style); + float axis = tf.getAxisHeight(style); float drt = tf.getDefaultRuleThickness(style); - Box b = at.createBox(env); - HorizontalRule rule = new HorizontalRule(drt, b.getWidth(), -axis + drt, false); - HorizontalBox hb = new HorizontalBox(); - hb.add(b); - hb.add(new StrutBox(-b.getWidth(), 0, 0, 0)); - hb.add(rule); - - return hb; + Box b = at.createBox(env); + HorizontalRule rule = new HorizontalRule(drt, b.getWidth(), -axis + drt, false); + HorizontalBox hb = new HorizontalBox(); + hb.add(b); + hb.add(new StrutBox(-b.getWidth(), 0, 0, 0)); + hb.add(rule); + + return hb; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/StrutBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/StrutBox.java (.../StrutBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/StrutBox.java (.../StrutBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -52,18 +52,18 @@ * A box representing whitespace. */ public class StrutBox extends Box { - + public StrutBox(float w, float h, float d, float s) { width = w; height = h; depth = d; shift = s; } - + public void draw(Graphics2D g2, float x, float y) { // no visual effect } - + public int getLastFontId() { return TeXFont.NO_FONT; } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/StyleAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/StyleAtom.java (.../StyleAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/StyleAtom.java (.../StyleAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,20 +49,20 @@ * An atom representing a modification of style in a formula (e.g. textstyle or displaystyle). */ public class StyleAtom extends Atom { - + private int style; private Atom at; - + public StyleAtom(int style, Atom at) { - this.style = style; - this.at = at; + this.style = style; + this.at = at; } public Box createBox(TeXEnvironment env) { - int sstyle = env.getStyle(); - env.setStyle(style); - Box box = at.createBox(env); - env.setStyle(sstyle); - return box; - } + int sstyle = env.getStyle(); + env.setStyle(style); + Box box = at.createBox(env); + env.setStyle(sstyle); + return box; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SymbolAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SymbolAtom.java (.../SymbolAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SymbolAtom.java (.../SymbolAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,57 +25,57 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ package org.scilab.forge.jlatexmath; -import java.util.BitSet; -import java.util.Map; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; +import java.util.BitSet; +import java.util.Map; /** * A box representing a symbol (a non-alphanumeric character). */ public class SymbolAtom extends CharSymbol { - + // whether it's is a delimiter symbol private final boolean delimiter; - + // symbol name private final String name; - + // contains all defined symbols public static Map symbols; - + // contains all the possible valid symbol types private static BitSet validSymbolTypes; private char unicode; - + static { symbols = new TeXSymbolParser().readSymbols(); - + // set valid symbol types validSymbolTypes = new BitSet(16); validSymbolTypes.set(TeXConstants.TYPE_ORDINARY); @@ -87,20 +87,20 @@ validSymbolTypes.set(TeXConstants.TYPE_PUNCTUATION); validSymbolTypes.set(TeXConstants.TYPE_ACCENT); } - + public SymbolAtom(SymbolAtom s, int type) throws InvalidSymbolTypeException { if (!validSymbolTypes.get(type)) throw new InvalidSymbolTypeException( - "The symbol type was not valid! " - + "Use one of the symbol type constants from the class 'TeXConstants'."); + "The symbol type was not valid! " + + "Use one of the symbol type constants from the class 'TeXConstants'."); name = s.name; this.type = type; - if (type == TeXConstants.TYPE_BIG_OPERATOR) - this.type_limits = TeXConstants.SCRIPT_NORMAL; + if (type == TeXConstants.TYPE_BIG_OPERATOR) + this.type_limits = TeXConstants.SCRIPT_NORMAL; delimiter = s.delimiter; } - + /** * Constructs a new symbol. This used by "TeXSymbolParser" and the symbol * types are guaranteed to be valid. @@ -112,40 +112,40 @@ public SymbolAtom(String name, int type, boolean del) { this.name = name; this.type = type; - if (type == TeXConstants.TYPE_BIG_OPERATOR) - this.type_limits = TeXConstants.SCRIPT_NORMAL; + if (type == TeXConstants.TYPE_BIG_OPERATOR) + this.type_limits = TeXConstants.SCRIPT_NORMAL; delimiter = del; } public SymbolAtom setUnicode(char c) { - this.unicode = c; - return this; + this.unicode = c; + return this; } public char getUnicode() { - return unicode; + return unicode; } - + public static void addSymbolAtom(String file) { - FileInputStream in; - try { - in = new FileInputStream(file); - } catch (FileNotFoundException e) { - throw new ResourceParseException(file, e); - } - addSymbolAtom(in, file); + FileInputStream in; + try { + in = new FileInputStream(file); + } catch (FileNotFoundException e) { + throw new ResourceParseException(file, e); + } + addSymbolAtom(in, file); } public static void addSymbolAtom(InputStream in, String name) { - TeXSymbolParser tsp = new TeXSymbolParser(in, name); - symbols.putAll(tsp.readSymbols()); + TeXSymbolParser tsp = new TeXSymbolParser(in, name); + symbols.putAll(tsp.readSymbols()); } public static void addSymbolAtom(SymbolAtom sym) { - symbols.put(sym.name, sym); + symbols.put(sym.name, sym); } - + /** * Looks up the name in the table and returns the corresponding SymbolAtom representing * the symbol (if it's found). @@ -161,44 +161,44 @@ else return (SymbolAtom) obj; } - + /** * * @return true if this symbol can act as a delimiter to embrace formulas */ public boolean isDelimiter() { return delimiter; } - + public String getName() { return name; } - + public Box createBox(TeXEnvironment env) { TeXFont tf = env.getTeXFont(); int style = env.getStyle(); - Char c = tf.getChar(name, style); - Box cb = new CharBox(c); - if (env.getSmallCap() && unicode != 0 && Character.isLowerCase(unicode)) { - try { - cb = new ScaleBox(new CharBox(tf.getChar(TeXFormula.symbolTextMappings[Character.toUpperCase(unicode)], style)), 0.8, 0.8); - } catch (SymbolMappingNotFoundException e) { } - } + Char c = tf.getChar(name, style); + Box cb = new CharBox(c); + if (env.getSmallCap() && unicode != 0 && Character.isLowerCase(unicode)) { + try { + cb = new ScaleBox(new CharBox(tf.getChar(TeXFormula.symbolTextMappings[Character.toUpperCase(unicode)], style)), 0.8, 0.8); + } catch (SymbolMappingNotFoundException e) { } + } - if (type == TeXConstants.TYPE_BIG_OPERATOR) { - if (style < TeXConstants.STYLE_TEXT && tf.hasNextLarger(c)) - c = tf.getNextLarger(c, style); - cb = new CharBox(c); - cb.setShift(-(cb.getHeight() + cb.getDepth()) / 2 - env.getTeXFont().getAxisHeight(env.getStyle())); - float delta = c.getItalic(); - HorizontalBox hb = new HorizontalBox(cb); - if (delta > TeXFormula.PREC) - hb.add(new StrutBox(delta, 0, 0, 0)); - return hb; - } - return cb; + if (type == TeXConstants.TYPE_BIG_OPERATOR) { + if (style < TeXConstants.STYLE_TEXT && tf.hasNextLarger(c)) + c = tf.getNextLarger(c, style); + cb = new CharBox(c); + cb.setShift(-(cb.getHeight() + cb.getDepth()) / 2 - env.getTeXFont().getAxisHeight(env.getStyle())); + float delta = c.getItalic(); + HorizontalBox hb = new HorizontalBox(cb); + if (delta > TeXFormula.PREC) + hb.add(new StrutBox(delta, 0, 0, 0)); + return hb; + } + return cb; } - + public CharFont getCharFont(TeXFont tf) { // style doesn't matter here return tf.getChar(name, TeXConstants.STYLE_DISPLAY).getCharFont(); Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SymbolMappingNotFoundException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SymbolMappingNotFoundException.java (.../SymbolMappingNotFoundException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SymbolMappingNotFoundException.java (.../SymbolMappingNotFoundException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,61 +1,63 @@ /* SymbolMappingNotFoundException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals a missing symbol mapping. - * + * * @author Kurt Vermeulen */ public class SymbolMappingNotFoundException extends JMathTeXException { + private static final long serialVersionUID = 2659192520874275262L; + protected SymbolMappingNotFoundException(String symbolName) { - super("No mapping found for the symbol '" + symbolName + "'! " - + "Insert a <" + DefaultTeXFontParser.SYMBOL_MAPPING_EL - + ">-element in '" + DefaultTeXFontParser.RESOURCE_NAME + "'."); + super("No mapping found for the symbol '" + symbolName + "'! " + + "Insert a <" + DefaultTeXFontParser.SYMBOL_MAPPING_EL + + ">-element in '" + DefaultTeXFontParser.RESOURCE_NAME + "'."); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SymbolNotFoundException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SymbolNotFoundException.java (.../SymbolNotFoundException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/SymbolNotFoundException.java (.../SymbolNotFoundException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,61 +1,63 @@ /* SymbolNotFoundException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals that an unknown symbol was used. - * + * * @author Kurt Vermeulen */ public class SymbolNotFoundException extends JMathTeXException { + private static final long serialVersionUID = -3005021333407670912L; + protected SymbolNotFoundException(String name) { - super("There's no symbol with the name '" + name + "' defined in '" - + TeXSymbolParser.RESOURCE_NAME + "'!"); + super("There's no symbol with the name '" + name + "' defined in '" + + TeXSymbolParser.RESOURCE_NAME + "'!"); } - + } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TStrokeAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TStrokeAtom.java (.../TStrokeAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TStrokeAtom.java (.../TStrokeAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,61 +49,61 @@ * An atom with a stroked T */ public class TStrokeAtom extends Atom { - + private boolean upper; public TStrokeAtom(boolean upper) { - this.upper = upper; + this.upper = upper; } - + public Box createBox(TeXEnvironment env) { - Char ch = env.getTeXFont().getChar("bar", env.getStyle()); - float italic = ch.getItalic(); - CharBox T = new CharBox(env.getTeXFont().getChar(upper ? 'T' : 't', "mathnormal", env.getStyle())); - CharBox B = new CharBox(ch); - Box y; - if (Math.abs(italic) > TeXFormula.PREC) { + Char ch = env.getTeXFont().getChar("bar", env.getStyle()); + float italic = ch.getItalic(); + CharBox T = new CharBox(env.getTeXFont().getChar(upper ? 'T' : 't', "mathnormal", env.getStyle())); + CharBox B = new CharBox(ch); + Box y; + if (Math.abs(italic) > TeXFormula.PREC) { y = new HorizontalBox(new StrutBox(-italic, 0, 0, 0)); y.add(B); } else y = B; - Box b = new HorizontalBox(y, T.getWidth(), TeXConstants.ALIGN_CENTER); - VerticalBox vb = new VerticalBox(); - vb.add(T); - vb.add(new StrutBox(0, -0.5f * T.getHeight(), 0, 0)); - vb.add(b); - return vb; + Box b = new HorizontalBox(y, T.getWidth(), TeXConstants.ALIGN_CENTER); + VerticalBox vb = new VerticalBox(); + vb.add(T); + vb.add(new StrutBox(0, -0.5f * T.getHeight(), 0, 0)); + vb.add(b); + return vb; } } - /*if (upper) - hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.7f, 0, 0).createBox(env)); - else - hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.3f, 0, 0).createBox(env)); - hb.add(A); - return hb; - } +/*if (upper) + hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.7f, 0, 0).createBox(env)); +else + hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.3f, 0, 0).createBox(env)); + hb.add(A); +return hb; +} - public Box createBox(TeXEnvironment env) { - Box b = base.createBox(env); - VerticalBox vb = new VerticalBox(); - vb.add(b); - Char ch = env.getTeXFont().getChar("ogonek", env.getStyle()); - float italic = ch.getItalic(); - float x = new SpaceAtom(TeXConstants.UNIT_MU, 1f, 0, 0).createBox(env).getWidth(); - Box ogonek = new CharBox(ch); - Box y; - if (Math.abs(italic) > TeXFormula.PREC) { - y = new HorizontalBox(new StrutBox(-italic, 0, 0, 0)); - y.add(ogonek); - } else - y = ogonek; +public Box createBox(TeXEnvironment env) { +Box b = base.createBox(env); +VerticalBox vb = new VerticalBox(); +vb.add(b); +Char ch = env.getTeXFont().getChar("ogonek", env.getStyle()); +float italic = ch.getItalic(); +float x = new SpaceAtom(TeXConstants.UNIT_MU, 1f, 0, 0).createBox(env).getWidth(); +Box ogonek = new CharBox(ch); +Box y; +if (Math.abs(italic) > TeXFormula.PREC) { + y = new HorizontalBox(new StrutBox(-italic, 0, 0, 0)); + y.add(ogonek); + } else + y = ogonek; - Box og = new HorizontalBox(y, b.getWidth(), TeXConstants.ALIGN_RIGHT); - vb.add(new StrutBox(0, -ogonek.getHeight(), 0, 0)); - vb.add(og); - float f = vb.getHeight() + vb.getDepth(); - vb.setHeight(b.getHeight()); - vb.setDepth(f - b.getHeight()); - return vb; - } +Box og = new HorizontalBox(y, b.getWidth(), TeXConstants.ALIGN_RIGHT); +vb.add(new StrutBox(0, -ogonek.getHeight(), 0, 0)); +vb.add(og); +float f = vb.getHeight() + vb.getDepth(); +vb.setHeight(b.getHeight()); +vb.setDepth(f - b.getHeight()); +return vb; +} }*/ Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXConstants.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXConstants.java (.../TeXConstants.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXConstants.java (.../TeXConstants.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,84 +1,84 @@ /* TeXConstants.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ package org.scilab.forge.jlatexmath; /** - * The collection of constants that can be used in the methods of the classes of - * this package. + * The collection of constants that can be used in the methods of the classes of + * this package. */ public class TeXConstants { - + // ******************* // ALIGNMENT CONSTANTS // ******************* - - /** - * Alignment constant: extra space will be added to the right of the formula - */ + + /** + * Alignment constant: extra space will be added to the right of the formula + */ public static final int ALIGN_LEFT = 0; - + /** * Alignment constant: extra space will be added to the left of the formula */ public static final int ALIGN_RIGHT = 1; - + /** - * Alignment constant: the formula will be centered in the middle. This constant + * Alignment constant: the formula will be centered in the middle. This constant * can be used for both horizontal and vertical alignment. */ public static final int ALIGN_CENTER = 2; - + /** * Alignment constant: extra space will be added under the formula */ public static final int ALIGN_TOP = 3; - + /** * Alignment constant: extra space will be added above the formula */ @@ -88,226 +88,226 @@ * Alignment constant: none */ public static final int ALIGN_NONE = 5; - + public static final int THINMUSKIP = 1; - public static final int MEDMUSKIP = 2; + public static final int MEDMUSKIP = 2; public static final int THICKMUSKIP = 3; public static final int NEGTHINMUSKIP = -1; - public static final int NEGMEDMUSKIP = -2; + public static final int NEGMEDMUSKIP = -2; public static final int NEGTHICKMUSKIP = -3; - - public static final int QUAD = 3; - + + public static final int QUAD = 3; + public static final int SCRIPT_NORMAL = 0; - public static final int SCRIPT_NOLIMITS = 1; + public static final int SCRIPT_NOLIMITS = 1; public static final int SCRIPT_LIMITS = 2; - + // ********************* // SYMBOL TYPE CONSTANTS // ********************* - + /** * Symbol/Atom type: ordinary symbol, e.g. "slash" */ public static final int TYPE_ORDINARY = 0; - + /** * Symbol/Atom type: big operator (= large operator), e.g. "sum" */ public static final int TYPE_BIG_OPERATOR = 1; - + /** * Symbol/Atom type: binary operator, e.g. "plus" */ public static final int TYPE_BINARY_OPERATOR = 2; - + /** * Symbol/Atom type: relation, e.g. "equals" */ public static final int TYPE_RELATION = 3; - + /** * Symbol/Atom type: opening symbol, e.g. "lbrace" */ - public static final int TYPE_OPENING = 4; - + public static final int TYPE_OPENING = 4; + /** * Symbol/Atom type: closing symbol, e.g. "rbrace" */ public static final int TYPE_CLOSING = 5; - + /** * Symbol/Atom type: punctuation symbol, e.g. "comma" */ - public static final int TYPE_PUNCTUATION = 6; - + public static final int TYPE_PUNCTUATION = 6; + /** * Atom type: inner atom (NOT FOR SYMBOLS!!!) */ public static final int TYPE_INNER = 7; - + /** * Symbol type: accent, e.g. "hat" */ public static final int TYPE_ACCENT = 10; - + public static final int TYPE_INTERTEXT = 11; public static final int TYPE_MULTICOLUMN = 12; public static final int TYPE_HLINE = 13; - + // *************************************** // OVER AND UNDER DELIMITER TYPE CONSTANTS // *************************************** - + /** * Delimiter type constant for putting delimiters over and under formula's: brace */ public static final int DELIM_BRACE = 0; - + /** * Delimiter type constant for putting delimiters over and under formula's: square bracket */ public static final int DELIM_SQUARE_BRACKET = 1; - + /** * Delimiter type constant for putting delimiters over and under formula's: parenthesis */ public static final int DELIM_BRACKET = 2; - + /** * Delimiter type constant for putting delimiters over and under formula's: * arrow with single line pointing to the left */ public static final int DELIM_LEFT_ARROW = 3; - + /** - * Delimiter type constant for putting delimiters over and under formula's: + * Delimiter type constant for putting delimiters over and under formula's: * arrow with single line pointing to the right */ public static final int DELIM_RIGHT_ARROW = 4; - + /** * Delimiter type constant for putting delimiters over and under formula's: * arrow with single line pointing to the left and to the right */ public static final int DELIM_LEFT_RIGHT_ARROW = 5; - + /** * Delimiter type constant for putting delimiters over and under formula's: * arrow with two lines pointing to the left */ public static final int DELIM_DOUBLE_LEFT_ARROW = 6; - + /** * Delimiter type constant for putting delimiters over and under formula's: * arrow with two lines pointing to the right */ public static final int DELIM_DOUBLE_RIGHT_ARROW = 7; - + /** * Delimiter type constant for putting delimiters over and under formula's: * arrow with two lines pointing to the left and to the right */ public static final int DELIM_DOUBLE_LEFT_RIGHT_ARROW = 8; - + /** * Delimiter type constant for putting delimiters over and under formula's: * underline once */ public static final int DELIM_SINGLE_LINE = 9; - + /** * Delimiter type constant for putting delimiters over and under formula's: * underline twice */ public static final int DELIM_DOUBLE_LINE = 10; - + // ******************* // TEX STYLE CONSTANTS // ******************* - + /** * TeX style: display style. *

- * The large versions of big operators are used and limits are placed under and over + * The large versions of big operators are used and limits are placed under and over * these operators (default). Symbols are rendered in the largest size. */ public static final int STYLE_DISPLAY = 0; - + /** * TeX style: text style. *

- * The small versions of big operators are used and limits are attached to + * The small versions of big operators are used and limits are attached to * these operators as scripts (default). The same size as in the display style * is used to render symbols. */ public static final int STYLE_TEXT = 2; - + /** * TeX style: script style. *

* The same as the text style, but symbols are rendered in a smaller size. */ public static final int STYLE_SCRIPT = 4; - + /** * TeX style: script_script style. *

* The same as the script style, but symbols are rendered in a smaller size. */ public static final int STYLE_SCRIPT_SCRIPT = 6; - + // ************** // UNIT CONSTANTS // ************** - + /** * Unit constant: em *

* 1 em = the width of the capital 'M' in the current font */ public static final int UNIT_EM = 0; - + /** * Unit constant: ex *

* 1 ex = the height of the character 'x' in the current font */ public static final int UNIT_EX = 1; - + /** * Unit constant: pixel */ public static final int UNIT_PIXEL = 2; - + /** * Unit constant: postscript point */ public static final int UNIT_POINT = 3; - + /** * Unit constant: pica *

* 1 pica = 12 point */ public static final int UNIT_PICA = 4; - + /** * Unit constant: math unit (mu) *

* 1 mu = 1/18 em (em taken from the "mufont") */ - public static final int UNIT_MU = 5; - + public static final int UNIT_MU = 5; + /** * Unit constant: cm *

* 1 cm = 28.346456693 point */ public static final int UNIT_CM = 6; - + /** * Unit constant: mm *

@@ -320,40 +320,40 @@ *

* 1 in = 72 point */ - public static final int UNIT_IN = 8; + public static final int UNIT_IN = 8; /** * Unit constant: sp *

* 1 sp = 65536 point */ - public static final int UNIT_SP = 9; + public static final int UNIT_SP = 9; /** * Unit constant: in *

* 1 in = 72.27 pt */ - public static final int UNIT_PT = 10; + public static final int UNIT_PT = 10; /** * Unit constant: in *

* 1 in = 72 point */ - public static final int UNIT_DD = 11; + public static final int UNIT_DD = 11; /** * Unit constant: in *

* 1 in = 72 point */ - public static final int UNIT_CC = 12; + public static final int UNIT_CC = 12; /** * Unit constant: x8 *

* 1 s8 = 1 default rule thickness */ - public static final int UNIT_X8 = 13; + public static final int UNIT_X8 = 13; } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXEnvironment.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXEnvironment.java (.../TeXEnvironment.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXEnvironment.java (.../TeXEnvironment.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ @@ -56,19 +56,19 @@ * apply the style changing rules for subformula's. */ public class TeXEnvironment { - + // colors private Color background = null, color = null; - + // current style private int style = TeXConstants.STYLE_DISPLAY; - + // TeXFont used private TeXFont tf; - + // last used font private int lastFontId = TeXFont.NO_FONT; - + private float textwidth = Float.POSITIVE_INFINITY; private String textStyle; @@ -78,58 +78,58 @@ private float interline; public boolean isColored = false; - + public TeXEnvironment(int style, TeXFont tf) { this(style, tf, null, null); } public TeXEnvironment(int style, TeXFont tf, int widthUnit, float textwidth) { this(style, tf, null, null); - this.textwidth = textwidth * SpaceAtom.getFactor(widthUnit, this); + this.textwidth = textwidth * SpaceAtom.getFactor(widthUnit, this); } private TeXEnvironment(int style, TeXFont tf, Color bg, Color c) { this.style = style; this.tf = tf; background = bg; color = c; - setInterline(TeXConstants.UNIT_EX, 1f); + setInterline(TeXConstants.UNIT_EX, 1f); } private TeXEnvironment(int style, float scaleFactor, TeXFont tf, Color bg, Color c, String textStyle, boolean smallCap) { this.style = style; - this.scaleFactor = scaleFactor; + this.scaleFactor = scaleFactor; this.tf = tf; - this.textStyle = textStyle; - this.smallCap = smallCap; + this.textStyle = textStyle; + this.smallCap = smallCap; background = bg; color = c; - setInterline(TeXConstants.UNIT_EX, 1f); + setInterline(TeXConstants.UNIT_EX, 1f); } public void setInterline(int unit, float len) { - this.interline = len; - this.interlineUnit = unit; - } + this.interline = len; + this.interlineUnit = unit; + } public float getInterline() { - return interline * SpaceAtom.getFactor(interlineUnit, this); + return interline * SpaceAtom.getFactor(interlineUnit, this); } public void setTextwidth(int widthUnit, float textwidth) { - this.textwidth = textwidth * SpaceAtom.getFactor(widthUnit, this); + this.textwidth = textwidth * SpaceAtom.getFactor(widthUnit, this); } - + public float getTextwidth() { - return textwidth; + return textwidth; } public void setScaleFactor(float f) { - scaleFactor = f; + scaleFactor = f; } public float getScaleFactor() { - return scaleFactor; + return scaleFactor; } protected TeXEnvironment copy() { @@ -138,12 +138,12 @@ protected TeXEnvironment copy(TeXFont tf) { TeXEnvironment te = new TeXEnvironment(style, scaleFactor, tf, background, color, textStyle, smallCap); - te.textwidth = textwidth; - te.interline = interline; - te.interlineUnit = interlineUnit; - return te; + te.textwidth = textwidth; + te.interline = interline; + te.interlineUnit = interlineUnit; + return te; } - + /** * @return a copy of the environment, but in a cramped style. */ @@ -152,7 +152,7 @@ s.style = (style % 2 == 1 ? style : style + 1); return s; } - + /** * * @return a copy of the environment, but in denominator style. @@ -162,31 +162,31 @@ s.style = 2 * (style / 2) + 1 + 2 - 2 * (style / 6); return s; } - + /** * * @return the background color setting */ public Color getBackground() { return background; } - + /** * * @return the foreground color setting */ public Color getColor() { return color; } - + /** * * @return the point size of the TeXFont */ public float getSize() { return tf.getSize(); } - + /** * * @return the current style @@ -220,15 +220,15 @@ public void setSmallCap(boolean smallCap) { this.smallCap = smallCap; } - + /** * * @return the TeXFont to be used */ public TeXFont getTeXFont() { return tf; } - + /** * * @return a copy of the environment, but in numerator style. @@ -238,7 +238,7 @@ s.style = style + 2 - 2 * (style / 6); return s; } - + /** * Resets the color settings. * @@ -247,7 +247,7 @@ color = null; background = null; } - + /** * * @return a copy of the environment, but with the style changed for roots @@ -257,23 +257,23 @@ s.style = TeXConstants.STYLE_SCRIPT_SCRIPT; return s; } - + /** * * @param c the background color to be set */ public void setBackground(Color c) { background = c; } - + /** * * @param c the foreground color to be set */ public void setColor(Color c) { color = c; } - + /** * * @return a copy of the environment, but in subscript style. @@ -283,7 +283,7 @@ s.style = 2 * (style / 4) + 4 + 1; return s; } - + /** * * @return a copy of the environment, but in superscript style. @@ -293,15 +293,15 @@ s.style = 2 * (style / 4) + 4 + (style % 2); return s; } - + public float getSpace() { return tf.getSpace(style) * tf.getScaleFactor(); } - + public void setLastFontId(int id) { lastFontId = id; } - + public int getLastFontId() { // if there was no last font id (whitespace boxes only), use default "mu font" return (lastFontId == TeXFont.NO_FONT ? tf.getMuFontId() : lastFontId); Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFont.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFont.java (.../TeXFont.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFont.java (.../TeXFont.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,64 +1,64 @@ /* TeXFont.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * An interface representing a "TeXFont", which is responsible for all the necessary - * fonts and font information. - * + * fonts and font information. + * * @author Kurt Vermeulen */ public interface TeXFont { - + 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 copy of this {@link TeXFont} with the new size */ @@ -69,188 +69,188 @@ public float getScaleFactor(); 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 + * @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; - + 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; - + 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 + * @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); public float getEM(int style); - + /** - * + * * @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); - + public void setBold(boolean bold); - + public boolean getBold(); public void setRoman(boolean rm); - + public boolean getRoman(); - + public void setTt(boolean tt); - + public boolean getTt(); public void setIt(boolean it); - + public boolean getIt(); public void setSs(boolean ss); - + public boolean getSs(); /** - * + * * @param c a character * @return true if the given character contains extension information to buid * an arbitrary large version of this character. Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFormula.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFormula.java (.../TeXFormula.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFormula.java (.../TeXFormula.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,53 +25,48 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ package org.scilab.forge.jlatexmath; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.List; -import java.util.LinkedList; -import java.util.Set; -import java.util.Stack; -import java.io.InputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; - import java.awt.Color; -import java.awt.Font; import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.image.BufferedImage; import java.awt.GraphicsEnvironment; import java.awt.Image; +import java.awt.Insets; import java.awt.Toolkit; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + import javax.imageio.ImageIO; import javax.imageio.stream.FileImageOutputStream; -import java.lang.Character.UnicodeBlock; /** * Represents a logical mathematical formula that will be displayed (by creating a @@ -107,28 +102,11 @@ public static final int ROMAN = 8; public static final int TYPEWRITER = 16; - // table for putting delimiters over and under formula's, - // indexed by constants from "TeXConstants" - private static final String[][] delimiterNames = { - { "lbrace", "rbrace" }, - { "lsqbrack", "rsqbrack" }, - { "lbrack", "rbrack" }, - { "downarrow", "downarrow" }, - { "uparrow", "uparrow" }, - { "updownarrow", "updownarrow" }, - { "Downarrow", "Downarrow" }, - { "Uparrow", "Uparrow" }, - { "Updownarrow", "Updownarrow" }, - { "vert", "vert" }, - { "Vert", "Vert" } - }; - // point-to-pixel conversion public static float PIXELS_PER_POINT = 1f; - // used as second index in "delimiterNames" table (over or under) - private static final int OVER_DEL = 0; - private static final int UNDER_DEL = 1; + // font scale for deriving + public static float FONT_SCALE_FACTOR = 100f; // for comparing floats with 0 protected static final float PREC = 0.0000001f; @@ -184,7 +162,7 @@ } public static boolean isRegisteredBlock(Character.UnicodeBlock block) { - return externalFontMap.get(block) != null; + return externalFontMap.get(block) != null; } public static FontInfos getExternalFont(Character.UnicodeBlock block) { @@ -253,7 +231,6 @@ */ public TeXFormula(String s, Map map) throws ParseException { this.jlmXMLMap = map; - this.textStyle = textStyle; parser = new TeXParser(s, this); parser.parse(); } @@ -397,7 +374,7 @@ } /** - * @param a formula + * @param formula a formula * @return a partial TeXFormula containing the valid part of formula */ public static TeXFormula getPartialTeXFormula(String formula) { @@ -557,7 +534,7 @@ * a valid unit */ public TeXFormula addStrut(int unit, float width, float height, float depth) - throws InvalidUnitException { + throws InvalidUnitException { return add(new SpaceAtom(unit, width, height, depth)); } @@ -571,7 +548,7 @@ * a valid unit */ public TeXFormula addStrut(int type) - throws InvalidUnitException { + throws InvalidUnitException { return add(new SpaceAtom(type)); } @@ -652,55 +629,50 @@ * @param style the style * @return the builder, used for chaining */ - public TeXIconBuilder setStyle(final int style) - { - this.style = style; - return this; - } + public TeXIconBuilder setStyle(final int style) { + this.style = style; + return this; + } /** * Specify the font size for rendering the given TeXFormula * @param size the size * @return the builder, used for chaining */ - public TeXIconBuilder setSize(final float size) - { - this.size = size; - return this; - } + public TeXIconBuilder setSize(final float size) { + this.size = size; + return this; + } /** * Specify the font type for rendering the given TeXFormula * @param type the font type * @return the builder, used for chaining */ - public TeXIconBuilder setType(final int type) - { - this.type = type; - return this; - } + public TeXIconBuilder setType(final int type) { + this.type = type; + return this; + } /** * Specify the background color for rendering the given TeXFormula * @param fgcolor the foreground color * @return the builder, used for chaining */ - public TeXIconBuilder setFGColor(final Color fgcolor) - { - this.fgcolor = fgcolor; - return this; - } + public TeXIconBuilder setFGColor(final Color fgcolor) { + this.fgcolor = fgcolor; + return this; + } /** * Specify the "true values" parameter for rendering the given TeXFormula * @param trueValues the "true values" value * @return the builder, used for chaining */ - public TeXIconBuilder setTrueValues(final boolean trueValues) - { - this.trueValues = trueValues; - return this; - } + public TeXIconBuilder setTrueValues(final boolean trueValues) { + this.trueValues = trueValues; + return this; + } /** * Specify the width of the formula (may be exact or maximum width, see {@link #setIsMaxWidth(boolean)}) @@ -709,123 +681,105 @@ * @param align the alignment * @return the builder, used for chaining */ - public TeXIconBuilder setWidth(final int widthUnit, final float textWidth, final int align) - { - this.widthUnit = widthUnit; - this.textWidth = textWidth; - this.align = align; - trueValues = true; // TODO: is this necessary? - return this; - } + public TeXIconBuilder setWidth(final int widthUnit, final float textWidth, final int align) { + this.widthUnit = widthUnit; + this.textWidth = textWidth; + this.align = align; + trueValues = true; // TODO: is this necessary? + return this; + } /** * Specifies whether the width is the exact or the maximum width * @param isMaxWidth whether the width is a maximum width * @return the builder, used for chaining */ - public TeXIconBuilder setIsMaxWidth(final boolean isMaxWidth) - { - if (widthUnit == null) - { - throw new IllegalStateException("Cannot set 'isMaxWidth' without having specified a width!"); - } - if (isMaxWidth) - { - // NOTE: Currently isMaxWidth==true does not work with ALIGN_CENTER or ALIGN_RIGHT (see HorizontalBox ctor) - // The case (1) we don't support by setting align := ALIGN_LEFT here is this: - // \text{hello world\\hello} with align=ALIGN_CENTER (but forced to ALIGN_LEFT) and isMaxWidth==true results in: - // [hello world] - // [hello ] - // and NOT: - // [hello world] - // [ hello ] - // However, this case (2) is currently not supported anyway (ALIGN_CENTER with isMaxWidth==false): - // [ hello world ] - // [ hello ] - // and NOT: - // [ hello world ] - // [ hello ] - // => until (2) is solved, we stick with the hack to set align := ALIGN_LEFT! - this.align = TeXConstants.ALIGN_LEFT; - } - this.isMaxWidth = isMaxWidth; - return this; + public TeXIconBuilder setIsMaxWidth(final boolean isMaxWidth) { + if (widthUnit == null) { + throw new IllegalStateException("Cannot set 'isMaxWidth' without having specified a width!"); } + if (isMaxWidth) { + // NOTE: Currently isMaxWidth==true does not work with ALIGN_CENTER or ALIGN_RIGHT (see HorizontalBox ctor) + // The case (1) we don't support by setting align := ALIGN_LEFT here is this: + // \text{hello world\\hello} with align=ALIGN_CENTER (but forced to ALIGN_LEFT) and isMaxWidth==true results in: + // [hello world] + // [hello ] + // and NOT: + // [hello world] + // [ hello ] + // However, this case (2) is currently not supported anyway (ALIGN_CENTER with isMaxWidth==false): + // [ hello world ] + // [ hello ] + // and NOT: + // [ hello world ] + // [ hello ] + // => until (2) is solved, we stick with the hack to set align := ALIGN_LEFT! + this.align = TeXConstants.ALIGN_LEFT; + } + this.isMaxWidth = isMaxWidth; + return this; + } /** * Specify the inter line spacing unit and value. NOTE: this is required for automatic linebreaks to work! * @param interLineUnit the unit * @param interLineSpacing the value * @return the builder, used for chaining */ - public TeXIconBuilder setInterLineSpacing(final int interLineUnit, final float interLineSpacing) - { - if (widthUnit == null) - { - throw new IllegalStateException("Cannot set inter line spacing without having specified a width!"); - } - this.interLineUnit = interLineUnit; - this.interLineSpacing = interLineSpacing; - return this; + public TeXIconBuilder setInterLineSpacing(final int interLineUnit, final float interLineSpacing) { + if (widthUnit == null) { + throw new IllegalStateException("Cannot set inter line spacing without having specified a width!"); } + this.interLineUnit = interLineUnit; + this.interLineSpacing = interLineSpacing; + return this; + } /** * Create a TeXIcon from the information gathered by the (chained) setXXX() methods. * (see Builder pattern) * @return the TeXIcon */ - public TeXIcon build() - { - if (style == null) - { - throw new IllegalStateException("A style is required. Use setStyle()"); - } - if (size == null) - { - throw new IllegalStateException("A size is required. Use setStyle()"); - } - DefaultTeXFont font = (type == null) ? new DefaultTeXFont(size) : createFont(size, type); - TeXEnvironment te; - if (widthUnit != null) - { - te = new TeXEnvironment(style, font, widthUnit, textWidth); - } - else - { - te = new TeXEnvironment(style, font); - } + public TeXIcon build() { + if (style == null) { + throw new IllegalStateException("A style is required. Use setStyle()"); + } + if (size == null) { + throw new IllegalStateException("A size is required. Use setStyle()"); + } + DefaultTeXFont font = (type == null) ? new DefaultTeXFont(size) : createFont(size, type); + TeXEnvironment te; + if (widthUnit != null) { + te = new TeXEnvironment(style, font, widthUnit, textWidth); + } else { + te = new TeXEnvironment(style, font); + } - if (interLineUnit != null) { - te.setInterline(interLineUnit, interLineSpacing); - } + if (interLineUnit != null) { + te.setInterline(interLineUnit, interLineSpacing); + } - Box box = createBox(te); - TeXIcon ti; - if (widthUnit != null) - { - HorizontalBox hb; - if (interLineUnit != null) - { - float il = interLineSpacing * SpaceAtom.getFactor(interLineUnit, te); - Box b = BreakFormula.split(box, te.getTextwidth(), il); - hb = new HorizontalBox(b, isMaxWidth ? b.getWidth() : te.getTextwidth(), align); - } - else - { - hb = new HorizontalBox(box, isMaxWidth ? box.getWidth() : te.getTextwidth(), align); - } - ti = new TeXIcon(hb, size, trueValues); + Box box = createBox(te); + TeXIcon ti; + if (widthUnit != null) { + HorizontalBox hb; + if (interLineUnit != null) { + float il = interLineSpacing * SpaceAtom.getFactor(interLineUnit, te); + Box b = BreakFormula.split(box, te.getTextwidth(), il); + hb = new HorizontalBox(b, isMaxWidth ? b.getWidth() : te.getTextwidth(), align); + } else { + hb = new HorizontalBox(box, isMaxWidth ? box.getWidth() : te.getTextwidth(), align); } - else - { - ti = new TeXIcon(box, size, trueValues); - } - if (fgcolor != null) { - ti.setForeground(fgcolor); - } - ti.isColored = te.isColored; - return ti; + ti = new TeXIcon(hb, size, trueValues); + } else { + ti = new TeXIcon(box, size, trueValues); } + if (fgcolor != null) { + ti.setForeground(fgcolor); + } + ti.isColored = te.isColored; + return ti; + } } /** @@ -913,7 +867,8 @@ * @param formula the formula * @param style the style * @param size the size - * @param transparency, if true the background is transparent + * @param fg the foreground color + * @param bg the background color * @return the generated image */ public static Image createBufferedImage(String formula, int style, float size, Color fg, Color bg) throws ParseException { @@ -937,10 +892,10 @@ } /** - * @param formula the formula * @param style the style * @param size the size - * @param transparency, if true the background is transparent + * @param fg the foreground color + * @param bg the background color * @return the generated image */ public Image createBufferedImage(int style, float size, Color fg, Color bg) throws ParseException { @@ -1020,7 +975,7 @@ * a valid atom type */ public TeXFormula setFixedTypes(int leftType, int rightType) - throws InvalidAtomTypeException { + throws InvalidAtomTypeException { root = new TypedAtom(leftType, rightType, root); return this; } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFormulaParser.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFormulaParser.java (.../TeXFormulaParser.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFormulaParser.java (.../TeXFormulaParser.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,35 +25,34 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; import java.awt.Color; import java.util.HashMap; import java.util.Map; -import java.util.List; import org.w3c.dom.Element; -import org.w3c.dom.NodeList; import org.w3c.dom.Node; +import org.w3c.dom.NodeList; /** * Parses a "TeXFormula"-element representing a predefined TeXFormula's from an XML-file. @@ -66,7 +65,7 @@ private interface ArgumentValueParser { // NOPMD public Object parseValue(String value, String type) - throws ResourceParseException; + throws ResourceParseException; } private class MethodInvocationParser implements ActionParser { @@ -91,7 +90,7 @@ // parse arguments NodeList args = el.getElementsByTagName("Argument"); // get argument classes and values - Class[] argClasses = getArgumentClasses(args); + Class[] argClasses = getArgumentClasses(args); Object[] argValues = getArgumentValues(args); // invoke method try { @@ -119,11 +118,11 @@ // parse arguments NodeList args = el.getElementsByTagName("Argument"); // get argument classes and values - Class[] argClasses = getArgumentClasses(args); + Class[] argClasses = getArgumentClasses(args); Object[] argValues = getArgumentValues(args); // create TeXFormula object - //String code = "TeXFormula.predefinedTeXFormulasAsString.put(\"%s\", \"%s\");"; - //System.out.println(String.format(code, formulaName, argValues[0])); + //String code = "TeXFormula.predefinedTeXFormulasAsString.put(\"%s\", \"%s\");"; + //System.out.println(String.format(code, formulaName, argValues[0])); try { TeXFormula f = TeXFormula.class.getConstructor(argClasses).newInstance(argValues); // succesfully created, so add to "temporary formula's"-hashtable @@ -149,27 +148,27 @@ // parse arguments NodeList args = el.getElementsByTagName("Argument"); // get argument classes and values - Class[] argClasses = getArgumentClasses(args); + Class[] argClasses = getArgumentClasses(args); Object[] argValues = getArgumentValues(args); // create TeXFormula object try { MacroInfo f = MacroInfo.class.getConstructor(argClasses).newInstance(argValues); // succesfully created, so add to "temporary formula's"-hashtable tempCommands.put(name, f); } catch (IllegalArgumentException e) { - String err = "IllegalArgumentException:\n"; - err += "ClassLoader to load this class (TeXFormulaParser): " + this.getClass().getClassLoader() + "\n"; - for (Class cl : argClasses) { - err += "Created class: " + cl + " loaded with the ClassLoader: " + cl.getClassLoader() + "\n"; - } - for (Object obj : argValues) { - err += "Created object: " + obj + "\n"; - } - throw new XMLResourceParseException( + String err = "IllegalArgumentException:\n"; + err += "ClassLoader to load this class (TeXFormulaParser): " + this.getClass().getClassLoader() + "\n"; + for (Class cl : argClasses) { + err += "Created class: " + cl + " loaded with the ClassLoader: " + cl.getClassLoader() + "\n"; + } + for (Object obj : argValues) { + err += "Created object: " + obj + "\n"; + } + throw new XMLResourceParseException( "Error creating the temporary command '" + name + "' while constructing the predefined command '" + formulaName + "'!\n" + err); - } catch (Exception e) { + } catch (Exception e) { throw new XMLResourceParseException( "Error creating the temporary command '" + name + "' while constructing the predefined command '" @@ -185,7 +184,7 @@ } public Object parseValue(String value, String type) - throws ResourceParseException { + throws ResourceParseException { checkNullValue(value, type); try { return new Float(Float.parseFloat(value)); @@ -205,7 +204,7 @@ } public Object parseValue(String value, String type) - throws ResourceParseException { + throws ResourceParseException { checkNullValue(value, type); if (value.length() == 1) { return new Character(value.charAt(0)); @@ -225,7 +224,7 @@ } public Object parseValue(String value, String type) - throws ResourceParseException { + throws ResourceParseException { checkNullValue(value, type); if ("true".equals(value)) { return Boolean.TRUE; @@ -247,7 +246,7 @@ } public Object parseValue(String value, String type) - throws ResourceParseException { + throws ResourceParseException { checkNullValue(value, type); try { int val = Integer.parseInt(value); @@ -290,7 +289,7 @@ } public Object parseValue(String value, String type) - throws ResourceParseException { + throws ResourceParseException { return value; } } @@ -302,7 +301,7 @@ } public Object parseValue(String value, String type) - throws ResourceParseException { + throws ResourceParseException { if (value == null) {// null pointer argument return null; } else { @@ -327,12 +326,12 @@ } public Object parseValue(String value, String type) - throws ResourceParseException { + throws ResourceParseException { checkNullValue(value, type); try { // get constant value (if present) int constant = TeXConstants.class.getDeclaredField(value).getInt( - null); + null); // return constant integer value return Integer.valueOf(constant); } catch (Exception e) { @@ -351,7 +350,7 @@ } public Object parseValue(String value, String type) - throws ResourceParseException { + throws ResourceParseException { checkNullValue(value, type); try { // return Color constant (if present) @@ -367,7 +366,7 @@ } private static final String ARG_VAL_ATTR = "value", RETURN_EL = "Return", - ARG_OBJ_ATTR = "formula"; + ARG_OBJ_ATTR = "formula"; private static Map> classMappings = new HashMap>(); @@ -455,9 +454,9 @@ return res; } - private static Class[] getArgumentClasses(NodeList args) - throws ResourceParseException { - Class[] res = new Class[args.getLength()]; + private static Class[] getArgumentClasses(NodeList args) + throws ResourceParseException { + Class[] res = new Class[args.getLength()]; int i = 0; for (int j = 0; j < args.getLength(); j++) { Element arg = (Element)args.item(j); @@ -470,15 +469,15 @@ PredefinedTeXFormulaParser.RESOURCE_NAME, "Argument", "type", "has an invalid class name value!"); } else { - res[i] = (Class) cl; + res[i] = (Class) cl; } i++; } return res; } private static void checkNullValue(String value, String type) - throws ResourceParseException { + throws ResourceParseException { if (value.equals("")) { throw new XMLResourceParseException( PredefinedTeXFormulaParser.RESOURCE_NAME, "Argument", @@ -488,7 +487,7 @@ } private static String getAttrValueAndCheckIfNotNull(String attrName, - Element element) throws ResourceParseException { + Element element) throws ResourceParseException { String attrValue = element.getAttribute(attrName); if (attrValue.equals("")) { throw new XMLResourceParseException( Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFormulaSettingsParser.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFormulaSettingsParser.java (.../TeXFormulaSettingsParser.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXFormulaSettingsParser.java (.../TeXFormulaSettingsParser.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,57 +25,55 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.util.HashSet; -import java.util.List; -import java.util.Set; import java.io.InputStream; import javax.xml.parsers.DocumentBuilderFactory; + import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * Parses predefined TeXFormula's from an XML-file. */ public class TeXFormulaSettingsParser { - + public static final String RESOURCE_NAME = "TeXFormulaSettings.xml"; public static final String CHARTODEL_MAPPING_EL = "Map"; - + private Element root; - + public TeXFormulaSettingsParser() throws ResourceParseException { - this(GlueSettingsParser.class.getResourceAsStream(RESOURCE_NAME), RESOURCE_NAME); + this(GlueSettingsParser.class.getResourceAsStream(RESOURCE_NAME), RESOURCE_NAME); } public TeXFormulaSettingsParser(InputStream file, String name) throws ResourceParseException { - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setIgnoringElementContentWhitespace(true); - factory.setIgnoringComments(true); - root = factory.newDocumentBuilder().parse(file).getDocumentElement(); - } catch (Exception e) { // JDOMException or IOException + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setIgnoringElementContentWhitespace(true); + factory.setIgnoringComments(true); + root = factory.newDocumentBuilder().parse(file).getDocumentElement(); + } catch (Exception e) { // JDOMException or IOException throw new XMLResourceParseException(name, e); } } @@ -97,52 +95,51 @@ Element map = (Element) mapList.item(i); String ch = map.getAttribute("char"); String symbol = map.getAttribute("symbol"); - String text = map.getAttribute("text"); + String text = map.getAttribute("text"); // both attributes are required! if (ch.equals("")) { throw new XMLResourceParseException(RESOURCE_NAME, map.getTagName(), "char", null); } else if (symbol.equals("")) { throw new XMLResourceParseException(RESOURCE_NAME, map.getTagName(), "symbol", null); } - if (ch.length() == 1) {// valid element found + if (ch.length() == 1) {// valid element found tableMath[ch.charAt(0)] = symbol; } else { // only single-character mappings allowed, ignore others throw new XMLResourceParseException(RESOURCE_NAME, map.getTagName(), "char", "must have a value that contains exactly 1 character!"); - } + } - if (tableText != null && !text.equals("")) { - tableText[ch.charAt(0)] = text; - } - } + if (tableText != null && !text.equals("")) { + tableText[ch.charAt(0)] = text; + } + } } private static void addFormulaToMap(NodeList mapList, String[] tableMath, String[] tableText) throws ResourceParseException { for (int i = 0; i < mapList.getLength(); i++) { Element map = (Element)mapList.item(i); String ch = map.getAttribute("char"); String formula = map.getAttribute("formula"); - String text = map.getAttribute("text"); + String text = map.getAttribute("text"); // both attributes are required! if (ch.equals("")) throw new XMLResourceParseException(RESOURCE_NAME, map.getTagName(), - "char", null); + "char", null); else if (formula.equals("")) throw new XMLResourceParseException(RESOURCE_NAME, map.getTagName(), - "formula", null); + "formula", null); if (ch.length() == 1) {// valid element found - tableMath[ch.charAt(0)] = formula; - } - else + tableMath[ch.charAt(0)] = formula; + } else // only single-character mappings allowed, ignore others throw new XMLResourceParseException(RESOURCE_NAME, map.getTagName(), - "char", - "must have a value that contains exactly 1 character!"); + "char", + "must have a value that contains exactly 1 character!"); - if (tableText != null && !text.equals("")) { - tableText[ch.charAt(0)] = text; - } + if (tableText != null && !text.equals("")) { + tableText[ch.charAt(0)] = text; + } } } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXIcon.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXIcon.java (.../TeXIcon.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXIcon.java (.../TeXIcon.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ /* Modified by Calixte Denizet */ @@ -235,7 +235,7 @@ } public Box getBox() { - return box; + return box; } /** Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXParser.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXParser.java (.../TeXParser.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXParser.java (.../TeXParser.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,30 +24,28 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; import java.awt.Color; -import java.awt.Font; -import java.lang.Character.UnicodeBlock; import java.util.HashSet; import java.util.Set; @@ -70,7 +68,6 @@ private boolean arrayMode; private boolean ignoreWhiteSpace = true; private boolean isPartial; - private boolean autoNumberBreaking; // the escape character private static final char ESCAPE = '\\'; @@ -86,10 +83,6 @@ // Percent char for comments private static final char PERCENT = '%'; - // used as second index in "delimiterNames" table (over or under) - private static final int OVER_DEL = 0; - private static final int UNDER_DEL = 1; - // script characters (for parsing) private static final char SUB_SCRIPT = '_'; private static final char SUPER_SCRIPT = '^'; @@ -202,7 +195,7 @@ } /** - * Create a new TeXParser in the context of an array. When the parser meets a & a new atom is added in the current line and when a \\ is met, a new line is created. + * Create a new TeXParser in the context of an array. When the parser meets a & a new atom is added in the current line and when a \\ is met, a new line is created. * * @param isPartial if true certains exceptions are not thrown * @param parseString the string to be parsed @@ -216,7 +209,7 @@ } /** - * Create a new TeXParser in the context of an array. When the parser meets a & a new atom is added in the current line and when a \\ is met, a new line is created. + * Create a new TeXParser in the context of an array. When the parser meets a & a new atom is added in the current line and when a \\ is met, a new line is created. * * @param isPartial if true certains exceptions are not thrown * @param parseString the string to be parsed @@ -230,7 +223,7 @@ } /** - * Create a new TeXParser in the context of an array. When the parser meets a & a new atom is added in the current line and when a \\ is met, a new line is created. + * Create a new TeXParser in the context of an array. When the parser meets a & a new atom is added in the current line and when a \\ is met, a new line is created. * * @param parseString the string to be parsed * @param aoa an ArrayOfAtoms where to put the elements @@ -491,7 +484,7 @@ pos = spos; break; case DEGRE : - parseString.replace(pos, pos + 1, "^\\circ"); + parseString.replace(pos, pos + 1, "^{\\circ}"); len = parseString.length(); pos++; break; @@ -1092,7 +1085,7 @@ if (pos == len) return null; - int ogroup = 1, spos; + int spos; char ch = '\0'; skipWhiteSpace(); @@ -1128,11 +1121,11 @@ String symbolName = TeXFormula.symbolMappings[c]; if (symbolName == null && (TeXFormula.symbolFormulaMappings == null || TeXFormula.symbolFormulaMappings[c] == null)) { - TeXFormula.FontInfos fontInfos = null; - boolean isLatin = Character.UnicodeBlock.BASIC_LATIN.equals(block); - if ((isLatin && TeXFormula.isRegisteredBlock(Character.UnicodeBlock.BASIC_LATIN)) || !isLatin) { - fontInfos = TeXFormula.getExternalFont(block); - } + TeXFormula.FontInfos fontInfos = null; + boolean isLatin = Character.UnicodeBlock.BASIC_LATIN.equals(block); + if ((isLatin && TeXFormula.isRegisteredBlock(Character.UnicodeBlock.BASIC_LATIN)) || !isLatin) { + fontInfos = TeXFormula.getExternalFont(block); + } if (fontInfos != null) { if (oneChar) { return new JavaFontRenderingAtom(Character.toString(c), fontInfos); @@ -1279,8 +1272,7 @@ skipWhiteSpace(); args[j] = getGroup(L_BRACK, R_BRACK); } - } - catch (ParseException e) { + } catch (ParseException e) { args[j] = null; } } @@ -1293,8 +1285,7 @@ if (parseString.charAt(pos) != '\\') { args[1] = "" + parseString.charAt(pos); pos++; - } - else + } else args[1] = getCommandWithArgs(getCommand()); } @@ -1306,8 +1297,7 @@ skipWhiteSpace(); args[j] = getGroup(L_BRACK, R_BRACK); } - } - catch (ParseException e) { + } catch (ParseException e) { args[j] = null; } } @@ -1321,8 +1311,7 @@ if (parseString.charAt(pos) != '\\') { args[i] = "" + parseString.charAt(pos); pos++; - } - else { + } else { args[i] = getCommandWithArgs(getCommand()); } } @@ -1342,7 +1331,7 @@ * @author Juan Enrique Escobar Robles */ private String getCommandWithArgs(String command) { - if (command.equals("left")){ + if (command.equals("left")) { return getGroup("\\left", "\\right"); } @@ -1424,9 +1413,9 @@ return Character.isLetter(c); } - /** Test the validity of a character in a command. It must contains only alpha characters and eventually a @ if makeAtletter activated - * @param com the command's name - * @return the validity of the name + /** Test the validity of a character in a command. It must contains only alpha characters and eventually a @ if makeAtletter activated. + * @param ch character to test + * @return the validity of the character */ public final boolean isValidCharacterInCommand(char ch) { return Character.isLetter(ch) || (atIsLetter != 0 && ch == '@'); Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXSymbolParser.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXSymbolParser.java (.../TeXSymbolParser.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TeXSymbolParser.java (.../TeXSymbolParser.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,56 +1,57 @@ /* TeXSymbolParser.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; +import java.io.InputStream; import java.util.HashMap; import java.util.Map; -import java.io.InputStream; import javax.xml.parsers.DocumentBuilderFactory; + import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -59,71 +60,71 @@ */ public class TeXSymbolParser { - public static final String RESOURCE_NAME = "TeXSymbols.xml", - DELIMITER_ATTR = "del", TYPE_ATTR = "type"; + public static final String RESOURCE_NAME = "TeXSymbols.xml", + DELIMITER_ATTR = "del", TYPE_ATTR = "type"; - private static Map typeMappings = new HashMap(); + private static Map typeMappings = new HashMap(); - private Element root; + private Element root; - public TeXSymbolParser() throws ResourceParseException { - this(TeXSymbolParser.class.getResourceAsStream(RESOURCE_NAME), RESOURCE_NAME); - } + public TeXSymbolParser() throws ResourceParseException { + this(TeXSymbolParser.class.getResourceAsStream(RESOURCE_NAME), RESOURCE_NAME); + } public TeXSymbolParser(InputStream file, String name) throws ResourceParseException { - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setIgnoringElementContentWhitespace(true); - factory.setIgnoringComments(true); - root = factory.newDocumentBuilder().parse(file).getDocumentElement(); - // set possible valid symbol type mappings - setTypeMappings(); - } catch (Exception e) { // JDOMException or IOException - throw new XMLResourceParseException(name, e); - } - } - - public Map readSymbols() throws ResourceParseException { - Map res = new HashMap(); - // iterate all "symbol"-elements - NodeList list = root.getElementsByTagName("Symbol"); - for (int i = 0; i < list.getLength(); i++) { - Element symbol = (Element)list.item(i); - // retrieve and check required attributes - String name = getAttrValueAndCheckIfNotNull("name", symbol), type = getAttrValueAndCheckIfNotNull( - TYPE_ATTR, symbol); - // retrieve optional attribute - String del = symbol.getAttribute(DELIMITER_ATTR); - boolean isDelimiter = (del != null && del.equals("true")); - // check if type is known - Object typeVal = typeMappings.get(type); - if (typeVal == null) // unknown type - throw new XMLResourceParseException(RESOURCE_NAME, "Symbol", - "type", "has an unknown value '" + type + "'!"); - // add symbol to the hash table - res.put(name, new SymbolAtom(name, ((Integer) typeVal).intValue(), - isDelimiter)); - } - return res; - } + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setIgnoringElementContentWhitespace(true); + factory.setIgnoringComments(true); + root = factory.newDocumentBuilder().parse(file).getDocumentElement(); + // set possible valid symbol type mappings + setTypeMappings(); + } catch (Exception e) { // JDOMException or IOException + throw new XMLResourceParseException(name, e); + } + } - private void setTypeMappings() { - typeMappings.put("ord", TeXConstants.TYPE_ORDINARY); - typeMappings.put("op", TeXConstants.TYPE_BIG_OPERATOR); - typeMappings.put("bin", TeXConstants.TYPE_BINARY_OPERATOR); - typeMappings.put("rel", TeXConstants.TYPE_RELATION); - typeMappings.put("open", TeXConstants.TYPE_OPENING); - typeMappings.put("close", TeXConstants.TYPE_CLOSING); - typeMappings.put("punct", TeXConstants.TYPE_PUNCTUATION); - typeMappings.put("acc", TeXConstants.TYPE_ACCENT); - } + public Map readSymbols() throws ResourceParseException { + Map res = new HashMap(); + // iterate all "symbol"-elements + NodeList list = root.getElementsByTagName("Symbol"); + for (int i = 0; i < list.getLength(); i++) { + Element symbol = (Element)list.item(i); + // retrieve and check required attributes + String name = getAttrValueAndCheckIfNotNull("name", symbol), type = getAttrValueAndCheckIfNotNull( + TYPE_ATTR, symbol); + // retrieve optional attribute + String del = symbol.getAttribute(DELIMITER_ATTR); + boolean isDelimiter = (del != null && del.equals("true")); + // check if type is known + Object typeVal = typeMappings.get(type); + if (typeVal == null) // unknown type + throw new XMLResourceParseException(RESOURCE_NAME, "Symbol", + "type", "has an unknown value '" + type + "'!"); + // add symbol to the hash table + res.put(name, new SymbolAtom(name, ((Integer) typeVal).intValue(), + isDelimiter)); + } + return res; + } - private static String getAttrValueAndCheckIfNotNull(String attrName, - Element element) throws ResourceParseException { - String attrValue = element.getAttribute(attrName); - if (attrValue.equals("")) - throw new XMLResourceParseException(RESOURCE_NAME, element.getTagName(), - attrName, null); - return attrValue; - } + private void setTypeMappings() { + typeMappings.put("ord", TeXConstants.TYPE_ORDINARY); + typeMappings.put("op", TeXConstants.TYPE_BIG_OPERATOR); + typeMappings.put("bin", TeXConstants.TYPE_BINARY_OPERATOR); + typeMappings.put("rel", TeXConstants.TYPE_RELATION); + typeMappings.put("open", TeXConstants.TYPE_OPENING); + typeMappings.put("close", TeXConstants.TYPE_CLOSING); + typeMappings.put("punct", TeXConstants.TYPE_PUNCTUATION); + typeMappings.put("acc", TeXConstants.TYPE_ACCENT); + } + + private static String getAttrValueAndCheckIfNotNull(String attrName, + Element element) throws ResourceParseException { + String attrValue = element.getAttribute(attrName); + if (attrValue.equals("")) + throw new XMLResourceParseException(RESOURCE_NAME, element.getTagName(), + attrName, null); + return attrValue; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TextCircledAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TextCircledAtom.java (.../TextCircledAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TextCircledAtom.java (.../TextCircledAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -53,16 +53,16 @@ private Atom at; public TextCircledAtom(Atom at) { - this.at = at; + this.at = at; } - + public Box createBox(TeXEnvironment env) { - Box circle = SymbolAtom.get("bigcirc").createBox(env); - circle.setShift(-0.07f * SpaceAtom.getFactor(TeXConstants.UNIT_EX, env)); - Box box = at.createBox(env); - HorizontalBox hb = new HorizontalBox(box, circle.getWidth(), TeXConstants.ALIGN_CENTER); - hb.add(new StrutBox(-hb.getWidth(), 0, 0, 0)); - hb.add(circle); - return hb; - } + Box circle = SymbolAtom.get("bigcirc").createBox(env); + circle.setShift(-0.07f * SpaceAtom.getFactor(TeXConstants.UNIT_EX, env)); + Box box = at.createBox(env); + HorizontalBox hb = new HorizontalBox(box, circle.getWidth(), TeXConstants.ALIGN_CENTER); + hb.add(new StrutBox(-hb.getWidth(), 0, 0, 0)); + hb.add(circle); + return hb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TextStyleAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TextStyleAtom.java (.../TextStyleAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TextStyleAtom.java (.../TextStyleAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,20 +49,20 @@ * An atom representing a modification of style in a formula (e.g. textstyle or displaystyle). */ public class TextStyleAtom extends Atom { - + private String style; private Atom at; - + public TextStyleAtom(Atom at, String style) { - this.style = style; - this.at = at; + this.style = style; + this.at = at; } public Box createBox(TeXEnvironment env) { - String prevStyle = env.getTextStyle(); - env.setTextStyle(style); - Box box = at.createBox(env); - env.setTextStyle(prevStyle); - return box; - } + String prevStyle = env.getTextStyle(); + env.setTextStyle(style); + Box box = at.createBox(env); + env.setTextStyle(prevStyle); + return box; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TextStyleMappingNotFoundException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TextStyleMappingNotFoundException.java (.../TextStyleMappingNotFoundException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TextStyleMappingNotFoundException.java (.../TextStyleMappingNotFoundException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,61 +1,63 @@ /* TextStyleMappingNotFoundException.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** * Signals a missing text style mapping. - * + * * @author Kurt Vermeulen */ public class TextStyleMappingNotFoundException extends JMathTeXException { - + + private static final long serialVersionUID = 4887043712790844966L; + protected TextStyleMappingNotFoundException(String styleName) { - super("No mapping found for the text style '" + styleName + "'! " - + "Insert a <" + DefaultTeXFontParser.STYLE_MAPPING_EL - + ">-element in '" + DefaultTeXFontParser.RESOURCE_NAME + "'."); + super("No mapping found for the text style '" + styleName + "'! " + + "Insert a <" + DefaultTeXFontParser.STYLE_MAPPING_EL + + ">-element in '" + DefaultTeXFontParser.RESOURCE_NAME + "'."); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TtAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TtAtom.java (.../TtAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TtAtom.java (.../TtAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,67 +1,67 @@ /* TtAtom.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * An atom representing a typewriter atom. + * An atom representing a typewriter atom. */ public class TtAtom extends Atom { - + private Atom base; - + public TtAtom(Atom base) { - this.base = base; + this.base = base; } - + public Box createBox(TeXEnvironment env) { - env = env.copy(env.getTeXFont().copy()); - env.getTeXFont().setTt(true); - Box box = base.createBox(env); - env.getTeXFont().setTt(false); - return box; + env = env.copy(env.getTeXFont().copy()); + env.getTeXFont().setTt(true); + Box box = base.createBox(env); + env.getTeXFont().setTt(false); + return box; } - + } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TypedAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TypedAtom.java (.../TypedAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/TypedAtom.java (.../TypedAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,46 +1,46 @@ /* TypedAtom.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -54,31 +54,31 @@ // new lefttype and righttype private final int leftType; private final int rightType; - + // atom for which new types are set private final Atom atom; - + public TypedAtom(int leftType, int rightType, Atom atom) { - this.leftType = leftType; - this.rightType = rightType; - this.atom = atom; - this.type_limits = atom.type_limits; + this.leftType = leftType; + this.rightType = rightType; + this.atom = atom; + this.type_limits = atom.type_limits; } - + public Atom getBase() { - atom.type_limits = type_limits; - return atom; + atom.type_limits = type_limits; + return atom; } - + public Box createBox(TeXEnvironment env) { - return atom.createBox(env); + return atom.createBox(env); } - + public int getLeftType() { - return leftType; + return leftType; } - + public int getRightType() { - return rightType; + return rightType; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/URLAlphabetRegistration.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/URLAlphabetRegistration.java (.../URLAlphabetRegistration.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/URLAlphabetRegistration.java (.../URLAlphabetRegistration.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,72 +24,70 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.lang.Character.UnicodeBlock; import java.net.URL; import java.net.URLClassLoader; -import java.lang.ClassLoader; public class URLAlphabetRegistration implements AlphabetRegistration { private URL url; private String language; private AlphabetRegistration pack = null; private Character.UnicodeBlock[] blocks; - + private URLAlphabetRegistration(URL url, String language, Character.UnicodeBlock[] blocks) { - this.url = url; - this.language = language; - this.blocks = blocks; + this.url = url; + this.language = language; + this.blocks = blocks; } public static void register(URL url, String language, Character.UnicodeBlock[] blocks) { - DefaultTeXFont.registerAlphabet(new URLAlphabetRegistration(url, language, blocks)); + DefaultTeXFont.registerAlphabet(new URLAlphabetRegistration(url, language, blocks)); } public Character.UnicodeBlock[] getUnicodeBlock() { - return blocks; + return blocks; } public Object getPackage() throws AlphabetRegistrationException { - URL urls[] = {url}; - language = language.toLowerCase(); - String name = "org.scilab.forge.jlatexmath." + language - + "." + Character.toString(Character.toUpperCase(language.charAt(0))) - + language.substring(1, language.length()) + "Registration"; - - try { - ClassLoader loader = new URLClassLoader(urls); - pack = (AlphabetRegistration) Class.forName(name, true, loader).newInstance(); - } catch (ClassNotFoundException e) { - throw new AlphabetRegistrationException("Class at " + url + " cannot be got."); - } catch (Exception e) { - throw new AlphabetRegistrationException("Problem in loading the class at " + url + " :\n" + e.getMessage()); - } - return pack; + URL urls[] = {url}; + language = language.toLowerCase(); + String name = "org.scilab.forge.jlatexmath." + language + + "." + Character.toString(Character.toUpperCase(language.charAt(0))) + + language.substring(1, language.length()) + "Registration"; + + try { + ClassLoader loader = new URLClassLoader(urls); + pack = (AlphabetRegistration) Class.forName(name, true, loader).newInstance(); + } catch (ClassNotFoundException e) { + throw new AlphabetRegistrationException("Class at " + url + " cannot be got."); + } catch (Exception e) { + throw new AlphabetRegistrationException("Problem in loading the class at " + url + " :\n" + e.getMessage()); + } + return pack; } public String getTeXFontFileName() { - return pack.getTeXFontFileName(); + return pack.getTeXFontFileName(); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderOverArrowAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderOverArrowAtom.java (.../UnderOverArrowAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderOverArrowAtom.java (.../UnderOverArrowAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -51,54 +51,50 @@ public class UnderOverArrowAtom extends Atom { private Atom base; - private String arrow; private boolean over, left = false, dble = false; public UnderOverArrowAtom(Atom base, boolean left, boolean over) { this.base = base; - this.arrow = left ? "leftarrow" : "rightarrow"; - this.left = left; - this.over = over; + this.left = left; + this.over = over; } - + public UnderOverArrowAtom(Atom base, boolean over) { this.base = base; - this.over = over; - this.dble = true; + this.over = over; + this.dble = true; } public Box createBox(TeXEnvironment env) { - TeXFont tf = env.getTeXFont(); - int style = env.getStyle(); - Box b = base != null ? base.createBox(env) : new StrutBox(0, 0, 0, 0); - float sep = new SpaceAtom(TeXConstants.UNIT_POINT, 1f, 0, 0).createBox(env).getWidth(); - Box arrow; + Box b = base != null ? base.createBox(env) : new StrutBox(0, 0, 0, 0); + float sep = new SpaceAtom(TeXConstants.UNIT_POINT, 1f, 0, 0).createBox(env).getWidth(); + Box arrow; - if (dble) { - arrow = XLeftRightArrowFactory.create(env, b.getWidth()); - sep = 4 * sep; - } else { - arrow = XLeftRightArrowFactory.create(left, env, b.getWidth()); - sep = -sep; - } + if (dble) { + arrow = XLeftRightArrowFactory.create(env, b.getWidth()); + sep = 4 * sep; + } else { + arrow = XLeftRightArrowFactory.create(left, env, b.getWidth()); + sep = -sep; + } - VerticalBox vb = new VerticalBox(); - if (over) { - vb.add(arrow); - vb.add(new HorizontalBox(b, arrow.getWidth(), TeXConstants.ALIGN_CENTER)); - float h = vb.getDepth() + vb.getHeight(); - vb.setDepth(b.getDepth()); - vb.setHeight(h - b.getDepth()); - } else { - vb.add(new HorizontalBox(b, arrow.getWidth(), TeXConstants.ALIGN_CENTER)); - vb.add(new StrutBox(0, sep, 0, 0)); - vb.add(arrow); - float h = vb.getDepth() + vb.getHeight(); - vb.setDepth(h - b.getHeight()); - vb.setHeight(b.getHeight()); - } + VerticalBox vb = new VerticalBox(); + if (over) { + vb.add(arrow); + vb.add(new HorizontalBox(b, arrow.getWidth(), TeXConstants.ALIGN_CENTER)); + float h = vb.getDepth() + vb.getHeight(); + vb.setDepth(b.getDepth()); + vb.setHeight(h - b.getDepth()); + } else { + vb.add(new HorizontalBox(b, arrow.getWidth(), TeXConstants.ALIGN_CENTER)); + vb.add(new StrutBox(0, sep, 0, 0)); + vb.add(arrow); + float h = vb.getDepth() + vb.getHeight(); + vb.setDepth(h - b.getHeight()); + vb.setHeight(b.getHeight()); + } - return vb; - + return vb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderOverAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderOverAtom.java (.../UnderOverAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderOverAtom.java (.../UnderOverAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderlinedAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderlinedAtom.java (.../UnderlinedAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderlinedAtom.java (.../UnderlinedAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,81 +1,81 @@ /* UnderlinedAtom.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * An atom representing another atom with a line under it. + * An atom representing another atom with a line under it. */ class UnderlinedAtom extends Atom { - // the base to be underlined - private final Atom base; + // the base to be underlined + private final Atom base; - public UnderlinedAtom(Atom f) { - base = f; - type = TeXConstants.TYPE_ORDINARY; // for spacing rules - } + public UnderlinedAtom(Atom f) { + base = f; + type = TeXConstants.TYPE_ORDINARY; // for spacing rules + } - public Box createBox(TeXEnvironment env) { - float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); + public Box createBox(TeXEnvironment env) { + float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); - // create formula box in same style - Box b = (base == null ? new StrutBox(0, 0, 0, 0) : base.createBox(env)); + // create formula box in same style + Box b = (base == null ? new StrutBox(0, 0, 0, 0) : base.createBox(env)); - // create vertical box - VerticalBox vBox = new VerticalBox(); - vBox.add(b); - vBox.add(new StrutBox(0, 3 * drt, 0, 0)); - vBox.add(new HorizontalRule(drt, b.getWidth(), 0)); + // create vertical box + VerticalBox vBox = new VerticalBox(); + vBox.add(b); + vBox.add(new StrutBox(0, 3 * drt, 0, 0)); + vBox.add(new HorizontalRule(drt, b.getWidth(), 0)); - // baseline vertical box = baseline box b - // there's also an invisible strut of height drt under the rule - vBox.setDepth(b.getDepth() + 5 * drt); - vBox.setHeight(b.getHeight()); + // baseline vertical box = baseline box b + // there's also an invisible strut of height drt under the rule + vBox.setDepth(b.getDepth() + 5 * drt); + vBox.setHeight(b.getHeight()); - return vBox; - } + return vBox; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderscoreAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderscoreAtom.java (.../UnderscoreAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/UnderscoreAtom.java (.../UnderscoreAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -55,11 +55,11 @@ public UnderscoreAtom() { } - + public Box createBox(TeXEnvironment env) { - float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); - HorizontalBox hb = new HorizontalBox(s.createBox(env)); - hb.add(new HorizontalRule(drt, w.createBox(env).getWidth(), 0)); - return hb; - } + float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); + HorizontalBox hb = new HorizontalBox(s.createBox(env)); + hb.add(new HorizontalRule(drt, w.createBox(env).getWidth(), 0)); + return hb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VCenteredAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VCenteredAtom.java (.../VCenteredAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VCenteredAtom.java (.../VCenteredAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,74 +1,74 @@ /* VCenteredAtom.java * ========================================================================= * This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net - * + * * Copyright (C) 2004-2007 Universiteit Gent * Copyright (C) 2009 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; /** - * An atom representing another atom vertically centered with respect to the axis + * An atom representing another atom vertically centered with respect to the axis * (determined by a general TeXFont parameter) */ public class VCenteredAtom extends Atom { - // atom to be centered vertically with respect to the axis - private final Atom atom; + // atom to be centered vertically with respect to the axis + private final Atom atom; - public VCenteredAtom(Atom atom) { - this.atom = atom; - } + public VCenteredAtom(Atom atom) { + this.atom = atom; + } - public Box createBox(TeXEnvironment env) { - Box b = atom.createBox(env); + public Box createBox(TeXEnvironment env) { + Box b = atom.createBox(env); - float total = b.getHeight() + b.getDepth(), axis = env.getTeXFont() - .getAxisHeight(env.getStyle()); + float total = b.getHeight() + b.getDepth(), axis = env.getTeXFont() + .getAxisHeight(env.getStyle()); - // center on axis - b.setShift(-(total / 2) - axis); - - // put in horizontal box, so shifting will be vertically! - return new HorizontalBox(b); - } + // center on axis + b.setShift(-(total / 2) - axis); + + // put in horizontal box, so shifting will be vertically! + return new HorizontalBox(b); + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VRowAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VRowAtom.java (.../VRowAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VRowAtom.java (.../VRowAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -48,9 +48,7 @@ package org.scilab.forge.jlatexmath; -import java.util.BitSet; import java.util.LinkedList; -import java.util.List; import java.util.ListIterator; /** @@ -126,8 +124,8 @@ if (halign != TeXConstants.ALIGN_NONE) { float maxWidth = -Float.POSITIVE_INFINITY; LinkedList boxes = new LinkedList<>(); - for (ListIterator it = elements.listIterator(); it.hasNext();) { - Box b = ((Atom)it.next()).createBox(env); + for (ListIterator it = elements.listIterator(); it.hasNext();) { + Box b = it.next().createBox(env); boxes.add(b); if (maxWidth < b.getWidth()) { maxWidth = b.getWidth(); @@ -136,25 +134,25 @@ Box interline = new StrutBox(0, env.getInterline(), 0, 0); // convert atoms to boxes and add to the horizontal box - for (ListIterator it = boxes.listIterator(); it.hasNext();) { - Box b = (Box) it.next(); + for (ListIterator it = boxes.listIterator(); it.hasNext();) { + Box b = it.next(); vb.add(new HorizontalBox(b, maxWidth, halign)); if (addInterline && it.hasNext()) { vb.add(interline); } - } + } } else { Box interline = new StrutBox(0, env.getInterline(), 0, 0); // convert atoms to boxes and add to the horizontal box - for (ListIterator it = elements.listIterator(); it.hasNext();) { - vb.add(((Atom)it.next()).createBox(env)); + for (ListIterator it = elements.listIterator(); it.hasNext();) { + vb.add(it.next().createBox(env)); if (addInterline && it.hasNext()) { vb.add(interline); } } } - + vb.setShift(-raise.createBox(env).getWidth()); if (vtop) { float t = vb.getSize() == 0 ? 0 : vb.children.getFirst().getHeight(); @@ -165,7 +163,7 @@ vb.setHeight(vb.getDepth() + vb.getHeight() - t); vb.setDepth(t); } - + return vb; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VdotsAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VdotsAtom.java (.../VdotsAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VdotsAtom.java (.../VdotsAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -51,20 +51,20 @@ public class VdotsAtom extends Atom { public VdotsAtom() { } - + public Box createBox(TeXEnvironment env) { - Box dot = SymbolAtom.get("ldotp").createBox(env); - VerticalBox vb = new VerticalBox(dot, 0, TeXConstants.ALIGN_BOTTOM); - Box b = new SpaceAtom(TeXConstants.UNIT_MU, 0, 4, 0).createBox(env); - vb.add(b); - vb.add(dot); - vb.add(b); - vb.add(dot); - float d = vb.getDepth(); - float h = vb.getHeight(); - vb.setDepth(0); - vb.setHeight(d + h); + Box dot = SymbolAtom.get("ldotp").createBox(env); + VerticalBox vb = new VerticalBox(dot, 0, TeXConstants.ALIGN_BOTTOM); + Box b = new SpaceAtom(TeXConstants.UNIT_MU, 0, 4, 0).createBox(env); + vb.add(b); + vb.add(dot); + vb.add(b); + vb.add(dot); + float d = vb.getDepth(); + float h = vb.getHeight(); + vb.setDepth(0); + vb.setHeight(d + h); - return vb; - } + return vb; + } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VerticalBox.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VerticalBox.java (.../VerticalBox.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VerticalBox.java (.../VerticalBox.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,23 +25,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -127,9 +127,9 @@ // iterate from the last child box (the lowest) to the first (the highest) // untill a font id is found that's not equal to NO_FONT int fontId = TeXFont.NO_FONT; - for (ListIterator it = children.listIterator(children.size()); fontId == TeXFont.NO_FONT - && it.hasPrevious();) - fontId = ((Box) it.previous()).getLastFontId(); + for (ListIterator it = children.listIterator(children.size()); fontId == TeXFont.NO_FONT + && it.hasPrevious();) + fontId = it.previous().getLastFontId(); return fontId; } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VlineAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VlineAtom.java (.../VlineAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/VlineAtom.java (.../VlineAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -49,49 +49,49 @@ * An atom representing a hline in array environment */ public class VlineAtom extends Atom { - + private float height; private float shift; private int n; - + public VlineAtom(int n) { - this.n = n; + this.n = n; } - + public void setHeight(float height) { - this.height = height; + this.height = height; } public void setShift(float shift) { - this.shift = shift; + this.shift = shift; } public float getWidth(TeXEnvironment env) { - if (n != 0) { - float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); - return drt * (3 * n - 2); - } else - return 0; + if (n != 0) { + float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); + return drt * (3 * n - 2); + } else + return 0; } public Box createBox(TeXEnvironment env) { - if (n != 0) { - float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); - Box b = new HorizontalRule(height, drt, shift); - Box sep = new StrutBox(2 * drt, 0, 0, 0); - HorizontalBox hb = new HorizontalBox(); - for (int i = 0; i < n - 1; i++) { - hb.add(b); - hb.add(sep); - } - - if (n > 0) { - hb.add(b); - } - - return hb; - } - - return new StrutBox(0, 0, 0, 0); + if (n != 0) { + float drt = env.getTeXFont().getDefaultRuleThickness(env.getStyle()); + Box b = new HorizontalRule(height, drt, shift); + Box sep = new StrutBox(2 * drt, 0, 0, 0); + HorizontalBox hb = new HorizontalBox(); + for (int i = 0; i < n - 1; i++) { + hb.add(b); + hb.add(sep); + } + + if (n > 0) { + hb.add(b); + } + + return hb; + } + + return new StrutBox(0, 0, 0, 0); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/WebStartAlphabetRegistration.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/WebStartAlphabetRegistration.java (.../WebStartAlphabetRegistration.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/WebStartAlphabetRegistration.java (.../WebStartAlphabetRegistration.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,61 +24,59 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.lang.Character.UnicodeBlock; - import org.scilab.forge.jlatexmath.cyrillic.CyrillicRegistration; import org.scilab.forge.jlatexmath.greek.GreekRegistration; public class WebStartAlphabetRegistration implements AlphabetRegistration { - + private Character.UnicodeBlock[] blocks; private AlphabetRegistration reg; private WebStartAlphabetRegistration(Character.UnicodeBlock[] blocks) { - this.blocks = blocks; + this.blocks = blocks; } - + public static void register(Character.UnicodeBlock[] blocks) { - DefaultTeXFont.registerAlphabet(new WebStartAlphabetRegistration(blocks)); - } + DefaultTeXFont.registerAlphabet(new WebStartAlphabetRegistration(blocks)); + } public Character.UnicodeBlock[] getUnicodeBlock() { - return blocks; + return blocks; } - + public Object getPackage() throws AlphabetRegistrationException { - if (blocks == JLM_GREEK) { - reg = new GreekRegistration(); - } else if (blocks == JLM_CYRILLIC) { - reg = new CyrillicRegistration(); - } else { - throw new AlphabetRegistrationException("Invalid Unicode Block"); - } - return reg; + if (blocks == JLM_GREEK) { + reg = new GreekRegistration(); + } else if (blocks == JLM_CYRILLIC) { + reg = new CyrillicRegistration(); + } else { + throw new AlphabetRegistrationException("Invalid Unicode Block"); + } + return reg; } public String getTeXFontFileName() { - return reg.getTeXFontFileName(); + return reg.getTeXFontFileName(); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/XArrowAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/XArrowAtom.java (.../XArrowAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/XArrowAtom.java (.../XArrowAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -55,37 +55,35 @@ public XArrowAtom(Atom over, Atom under, boolean left) { this.over = over; - this.under = under; - this.left = left; - } + this.under = under; + this.left = left; + } public Box createBox(TeXEnvironment env) { - TeXFont tf = env.getTeXFont(); - int style = env.getStyle(); - Box O = over != null ? over.createBox(env.supStyle()) : new StrutBox(0, 0, 0, 0); - Box U = under != null ? under.createBox(env.subStyle()) : new StrutBox(0, 0, 0, 0); - Box oside = new SpaceAtom(TeXConstants.UNIT_EM, 1.5f, 0, 0).createBox(env.supStyle()); - Box uside = new SpaceAtom(TeXConstants.UNIT_EM, 1.5f, 0, 0).createBox(env.subStyle()); - Box sep = new SpaceAtom(TeXConstants.UNIT_MU, 0, 2f, 0).createBox(env); - float width = Math.max(O.getWidth() + 2 * oside.getWidth(), U.getWidth() + 2 * uside.getWidth()); - Box arrow = XLeftRightArrowFactory.create(left, env, width); - - Box ohb = new HorizontalBox(O, width, TeXConstants.ALIGN_CENTER); - Box uhb = new HorizontalBox(U, width, TeXConstants.ALIGN_CENTER); - - VerticalBox vb = new VerticalBox(); - vb.add(ohb); - vb.add(sep); - vb.add(arrow); - vb.add(sep); - vb.add(uhb); + Box O = over != null ? over.createBox(env.supStyle()) : new StrutBox(0, 0, 0, 0); + Box U = under != null ? under.createBox(env.subStyle()) : new StrutBox(0, 0, 0, 0); + Box oside = new SpaceAtom(TeXConstants.UNIT_EM, 1.5f, 0, 0).createBox(env.supStyle()); + Box uside = new SpaceAtom(TeXConstants.UNIT_EM, 1.5f, 0, 0).createBox(env.subStyle()); + Box sep = new SpaceAtom(TeXConstants.UNIT_MU, 0, 2f, 0).createBox(env); + float width = Math.max(O.getWidth() + 2 * oside.getWidth(), U.getWidth() + 2 * uside.getWidth()); + Box arrow = XLeftRightArrowFactory.create(left, env, width); - float h = vb.getHeight() + vb.getDepth(); - float d = sep.getHeight() + sep.getDepth() + uhb.getHeight() + uhb.getDepth(); - vb.setDepth(d); - vb.setHeight(h - d); - - HorizontalBox hb = new HorizontalBox(vb, vb.getWidth() + 2*sep.getHeight(), TeXConstants.ALIGN_CENTER); - return hb; + Box ohb = new HorizontalBox(O, width, TeXConstants.ALIGN_CENTER); + Box uhb = new HorizontalBox(U, width, TeXConstants.ALIGN_CENTER); + + VerticalBox vb = new VerticalBox(); + vb.add(ohb); + vb.add(sep); + vb.add(arrow); + vb.add(sep); + vb.add(uhb); + + float h = vb.getHeight() + vb.getDepth(); + float d = sep.getHeight() + sep.getDepth() + uhb.getHeight() + uhb.getDepth(); + vb.setDepth(d); + vb.setHeight(h - d); + + HorizontalBox hb = new HorizontalBox(vb, vb.getWidth() + 2*sep.getHeight(), TeXConstants.ALIGN_CENTER); + return hb; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/XLeftRightArrowFactory.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/XLeftRightArrowFactory.java (.../XLeftRightArrowFactory.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/XLeftRightArrowFactory.java (.../XLeftRightArrowFactory.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,115 +24,109 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; -import java.awt.Color; - /** * Responsible for creating a box containing a delimiter symbol that exists * in different sizes. */ public class XLeftRightArrowFactory { - + private static final Atom MINUS = SymbolAtom.get("minus"); private static final Atom LEFT = SymbolAtom.get("leftarrow"); private static final Atom RIGHT = SymbolAtom.get("rightarrow"); - + public static Box create(boolean left, TeXEnvironment env, float width) { - TeXFont tf = env.getTeXFont(); - int style = env.getStyle(); - Box arr = left ? LEFT.createBox(env) : RIGHT.createBox(env); - float h = arr.getHeight(); - float d = arr.getDepth(); - - float swidth = arr.getWidth(); - if (width <= swidth) { - arr.setDepth(d / 2); - return arr; - } + Box arr = left ? LEFT.createBox(env) : RIGHT.createBox(env); + float h = arr.getHeight(); + float d = arr.getDepth(); - Box minus = new SmashedAtom(MINUS, "").createBox(env); - Box kern = new SpaceAtom(TeXConstants.UNIT_MU, -4f, 0, 0).createBox(env); - float mwidth = minus.getWidth() + kern.getWidth(); - swidth += kern.getWidth(); - HorizontalBox hb = new HorizontalBox(); - float w; - for (w = 0; w < width - swidth - mwidth; w += mwidth) { - hb.add(minus); - hb.add(kern); - } + float swidth = arr.getWidth(); + if (width <= swidth) { + arr.setDepth(d / 2); + return arr; + } - float sf = (width - swidth - w) / minus.getWidth(); + Box minus = new SmashedAtom(MINUS, "").createBox(env); + Box kern = new SpaceAtom(TeXConstants.UNIT_MU, -4f, 0, 0).createBox(env); + float mwidth = minus.getWidth() + kern.getWidth(); + swidth += kern.getWidth(); + HorizontalBox hb = new HorizontalBox(); + float w; + for (w = 0; w < width - swidth - mwidth; w += mwidth) { + hb.add(minus); + hb.add(kern); + } - hb.add(new SpaceAtom(TeXConstants.UNIT_MU, -2f * sf, 0, 0).createBox(env)); - hb.add(new ScaleAtom(MINUS, sf, 1).createBox(env)); - - if (left) { - hb.add(0, new SpaceAtom(TeXConstants.UNIT_MU, -3.5f, 0, 0).createBox(env)); - hb.add(0, arr); - } else { - hb.add(new SpaceAtom(TeXConstants.UNIT_MU, -2f * sf - 2f, 0, 0).createBox(env)); - hb.add(arr); - } + float sf = (width - swidth - w) / minus.getWidth(); - hb.setDepth(d / 2); - hb.setHeight(h); + hb.add(new SpaceAtom(TeXConstants.UNIT_MU, -2f * sf, 0, 0).createBox(env)); + hb.add(new ScaleAtom(MINUS, sf, 1).createBox(env)); - return hb; + if (left) { + hb.add(0, new SpaceAtom(TeXConstants.UNIT_MU, -3.5f, 0, 0).createBox(env)); + hb.add(0, arr); + } else { + hb.add(new SpaceAtom(TeXConstants.UNIT_MU, -2f * sf - 2f, 0, 0).createBox(env)); + hb.add(arr); + } + + hb.setDepth(d / 2); + hb.setHeight(h); + + return hb; } - + public static Box create(TeXEnvironment env, float width) { - TeXFont tf = env.getTeXFont(); - int style = env.getStyle(); - Box left = LEFT.createBox(env); - Box right = RIGHT.createBox(env); - float swidth = left.getWidth() + right.getWidth(); + Box left = LEFT.createBox(env); + Box right = RIGHT.createBox(env); + float swidth = left.getWidth() + right.getWidth(); - if (width < swidth) { - HorizontalBox hb = new HorizontalBox(left); - hb.add(new StrutBox(-Math.min(swidth - width, left.getWidth()), 0, 0, 0)); - hb.add(right); - return hb; - } + if (width < swidth) { + HorizontalBox hb = new HorizontalBox(left); + hb.add(new StrutBox(-Math.min(swidth - width, left.getWidth()), 0, 0, 0)); + hb.add(right); + return hb; + } - Box minus = new SmashedAtom(MINUS, "").createBox(env); - Box kern = new SpaceAtom(TeXConstants.UNIT_MU, -3.4f, 0, 0).createBox(env); - float mwidth = minus.getWidth() + kern.getWidth(); - swidth += 2 * kern.getWidth(); - - HorizontalBox hb = new HorizontalBox(); - float w; - for (w = 0; w < width - swidth - mwidth; w += mwidth) { - hb.add(minus); - hb.add(kern); - } - - hb.add(new ScaleBox(minus, (width - swidth - w) / minus.getWidth(), 1)); - - hb.add(0, kern); - hb.add(0, left); - hb.add(kern); - hb.add(right); + Box minus = new SmashedAtom(MINUS, "").createBox(env); + Box kern = new SpaceAtom(TeXConstants.UNIT_MU, -3.4f, 0, 0).createBox(env); + float mwidth = minus.getWidth() + kern.getWidth(); + swidth += 2 * kern.getWidth(); - return hb; + HorizontalBox hb = new HorizontalBox(); + float w; + for (w = 0; w < width - swidth - mwidth; w += mwidth) { + hb.add(minus); + hb.add(kern); + } + + hb.add(new ScaleBox(minus, (width - swidth - w) / minus.getWidth(), 1)); + + hb.add(0, kern); + hb.add(0, left); + hb.add(kern); + hb.add(right); + + return hb; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/XMLResourceParseException.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/XMLResourceParseException.java (.../XMLResourceParseException.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/XMLResourceParseException.java (.../XMLResourceParseException.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -25,29 +25,31 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; public class XMLResourceParseException extends ResourceParseException { + private static final long serialVersionUID = 2091302779298293946L; + /* * Attribute problem */ Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/cache/JLaTeXMathCache.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/cache/JLaTeXMathCache.java (.../JLaTeXMathCache.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/cache/JLaTeXMathCache.java (.../JLaTeXMathCache.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath.cache; @@ -51,12 +51,12 @@ import java.awt.Insets; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; -import java.lang.ref.ReferenceQueue; import java.lang.ref.Reference; +import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import java.util.Iterator; -import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import org.scilab.forge.jlatexmath.ParseException; import org.scilab.forge.jlatexmath.TeXFormula; @@ -71,7 +71,7 @@ private static final AffineTransform identity = new AffineTransform(); private static ConcurrentMap> cache = new ConcurrentHashMap>(128); private static int max = Integer.MAX_VALUE; - private static ReferenceQueue queue = new ReferenceQueue(); + private static ReferenceQueue queue = new ReferenceQueue(); private JLaTeXMathCache() { } @@ -106,15 +106,15 @@ */ public static int[] getCachedTeXFormulaDimensions(Object o) throws ParseException { if (o == null || !(o instanceof CachedTeXFormula)) { - return new int[]{0, 0, 0}; + return new int[] {0, 0, 0}; } CachedTeXFormula cached = (CachedTeXFormula) o; SoftReference img = cache.get(cached); if (img == null || img.get() == null) { img = makeImage(cached); } - return new int[]{cached.width, cached.height, cached.depth}; + return new int[] {cached.width, cached.height, cached.depth}; } /** @@ -253,7 +253,7 @@ SoftReference img = new SoftReference(new CachedImage(image, cached), queue); if (cache.size() >= max) { - Reference soft; + Reference soft; while ((soft = queue.poll()) != null) { CachedImage ci = (CachedImage) soft.get(); if (ci != null) { Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/cyrillic/CyrillicRegistration.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/cyrillic/CyrillicRegistration.java (.../CyrillicRegistration.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/cyrillic/CyrillicRegistration.java (.../CyrillicRegistration.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,29 +24,27 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath.cyrillic; -import java.lang.Character.UnicodeBlock; - import org.scilab.forge.jlatexmath.AlphabetRegistration; public class CyrillicRegistration implements AlphabetRegistration { @@ -55,14 +53,14 @@ } public Character.UnicodeBlock[] getUnicodeBlock() { - return new Character.UnicodeBlock[]{Character.UnicodeBlock.CYRILLIC}; + return new Character.UnicodeBlock[] {Character.UnicodeBlock.CYRILLIC}; } public Object getPackage() { - return this; + return this; } public String getTeXFontFileName() { - return "fonts/language_cyrillic.xml"; + return "fonts/language_cyrillic.xml"; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/dynamic/DynamicAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/dynamic/DynamicAtom.java (.../DynamicAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/dynamic/DynamicAtom.java (.../DynamicAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,46 +1,46 @@ /* DynamicAtom.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2010 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath.dynamic; @@ -56,10 +56,10 @@ * This kind of atom is used to have a dynamic content * which comes from an other soft such as ggb. * The goal is to avoid the reparsing (and the reatomization) - * of the expression. + * of the expression. */ public class DynamicAtom extends Atom { - + private static ExternalConverterFactory ecFactory; private ExternalConverter converter; private TeXFormula formula = new TeXFormula(); @@ -68,52 +68,52 @@ private boolean refreshed; public DynamicAtom(String externalCode, String option) { - this.externalCode = externalCode; - if (ecFactory != null) { - this.converter = ecFactory.getExternalConverter(); - } - if (option != null && option.equals("i")) { - insert = true; - } + this.externalCode = externalCode; + if (ecFactory != null) { + this.converter = ecFactory.getExternalConverter(); + } + if (option != null && option.equals("i")) { + insert = true; + } } public static boolean hasAnExternalConverterFactory() { - return ecFactory != null; + return ecFactory != null; } public static void setExternalConverterFactory(ExternalConverterFactory factory) { - ecFactory = factory; + ecFactory = factory; } public boolean getInsertMode() { - return insert; + return insert; } public Atom getAtom() { - if (!refreshed) { - formula.setLaTeX(converter.getLaTeXString(externalCode)); - refreshed = true; - } - - if (formula.root == null) { - return new EmptyAtom(); - } + if (!refreshed) { + formula.setLaTeX(converter.getLaTeXString(externalCode)); + refreshed = true; + } - return formula.root; + if (formula.root == null) { + return new EmptyAtom(); + } + + return formula.root; } public Box createBox(TeXEnvironment env) { - if (converter != null) { - if (refreshed) { - refreshed = false; - } else { - formula.setLaTeX(converter.getLaTeXString(externalCode)); - } - if (formula.root != null) { - return formula.root.createBox(env); - } - } + if (converter != null) { + if (refreshed) { + refreshed = false; + } else { + formula.setLaTeX(converter.getLaTeXString(externalCode)); + } + if (formula.root != null) { + return formula.root.createBox(env); + } + } - return new StrutBox(0, 0, 0, 0); + return new StrutBox(0, 0, 0, 0); } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/dynamic/ExternalConverter.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/dynamic/ExternalConverter.java (.../ExternalConverter.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/dynamic/ExternalConverter.java (.../ExternalConverter.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,52 +1,52 @@ /* ExternalConverter.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2010 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath.dynamic; public interface ExternalConverter { - + public String getLaTeXString(String externalCode); } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/dynamic/ExternalConverterFactory.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/dynamic/ExternalConverterFactory.java (.../ExternalConverterFactory.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/dynamic/ExternalConverterFactory.java (.../ExternalConverterFactory.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -1,51 +1,51 @@ /* ExternalConverterFactory.java * ========================================================================= * This file is part of the JLaTeXMath Library - http://forge.scilab.org/jlatexmath - * + * * Copyright (C) 2010 DENIZET Calixte - * + * * 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. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath.dynamic; public interface ExternalConverterFactory { - + public ExternalConverter getExternalConverter(); } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/greek/GreekRegistration.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/greek/GreekRegistration.java (.../GreekRegistration.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/greek/GreekRegistration.java (.../GreekRegistration.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -28,8 +28,6 @@ package org.scilab.forge.jlatexmath.greek; -import java.lang.Character.UnicodeBlock; - import org.scilab.forge.jlatexmath.AlphabetRegistration; public class GreekRegistration implements AlphabetRegistration { @@ -38,14 +36,14 @@ } public Character.UnicodeBlock[] getUnicodeBlock() { - return new Character.UnicodeBlock[]{Character.UnicodeBlock.GREEK, Character.UnicodeBlock.GREEK_EXTENDED}; + return new Character.UnicodeBlock[] {Character.UnicodeBlock.GREEK, Character.UnicodeBlock.GREEK_EXTENDED}; } public Object getPackage() { - return this; + return this; } public String getTeXFontFileName() { - return "fonts/language_greek.xml"; + return "fonts/language_greek.xml"; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/internal/util/Images.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/internal/util/Images.java (.../Images.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/internal/util/Images.java (.../Images.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,9 +24,9 @@ Color ca = new Color(imgA.getRGB(x, y)); Color cb = new Color(imgB.getRGB(x, y)); double variance = sqr(ca.getRed() - cb.getRed()) // - + sqr(ca.getBlue() - cb.getBlue()) // - + sqr(ca.getGreen() - cb.getGreen()) // - + sqr(ca.getAlpha() - cb.getAlpha()); + + sqr(ca.getBlue() - cb.getBlue()) // + + sqr(ca.getGreen() - cb.getGreen()) // + + sqr(ca.getAlpha() - cb.getAlpha()); mse += variance; } } Index: 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/tcaronAtom.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb78014365510c74b7eaa1ddb7090b9acedfd69e6 --- 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/tcaronAtom.java (.../tcaronAtom.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/jlatexmath/org/scilab/forge/jlatexmath/tcaronAtom.java (.../tcaronAtom.java) (revision b78014365510c74b7eaa1ddb7090b9acedfd69e6) @@ -24,23 +24,23 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * Linking this library statically or dynamically with other modules - * is making a combined work based on this library. Thus, the terms - * and conditions of the GNU General Public License cover the whole + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole * combination. - * - * As a special exception, the copyright holders of this library give you - * permission to link this library with independent modules to produce - * an executable, regardless of the license terms of these independent - * modules, and to copy and distribute the resulting executable under terms - * of your choice, provided that you also meet, for each linked independent - * module, the terms and conditions of the license of that module. - * An independent module is a module which is not derived from or based - * on this library. If you modify this library, you may extend this exception - * to your version of the library, but you are not obliged to do so. - * If you do not wish to do so, delete this exception statement from your + * + * As a special exception, the copyright holders of this library give you + * permission to link this library with independent modules to produce + * an executable, regardless of the license terms of these independent + * modules, and to copy and distribute the resulting executable under terms + * of your choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. + * An independent module is a module which is not derived from or based + * on this library. If you modify this library, you may extend this exception + * to your version of the library, but you are not obliged to do so. + * If you do not wish to do so, delete this exception statement from your * version. - * + * */ package org.scilab.forge.jlatexmath; @@ -52,13 +52,13 @@ public tcaronAtom() { } - + public Box createBox(TeXEnvironment env) { - CharBox A = new CharBox(env.getTeXFont().getChar("textapos", env.getStyle())); - CharBox t = new CharBox(env.getTeXFont().getChar('t', "mathnormal", env.getStyle())); - HorizontalBox hb = new HorizontalBox(t); - hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.3f, 0, 0).createBox(env)); - hb.add(A); - return hb; - } + CharBox A = new CharBox(env.getTeXFont().getChar("textapos", env.getStyle())); + CharBox t = new CharBox(env.getTeXFont().getChar('t', "mathnormal", env.getStyle())); + HorizontalBox hb = new HorizontalBox(t); + hb.add(new SpaceAtom(TeXConstants.UNIT_EM, -0.3f, 0, 0).createBox(env)); + hb.add(A); + return hb; + } }