org.scilab.forge.jlatexmath
Class DefaultTeXFont

java.lang.Object
  extended by org.scilab.forge.jlatexmath.DefaultTeXFont
All Implemented Interfaces:
TeXFont

public class DefaultTeXFont
extends java.lang.Object
implements TeXFont

The default implementation of the TeXFont-interface. All font information is read from an xml-file.


Field Summary
protected static int BOT
           
protected static int CAPITALS
           
protected static int DEPTH
           
protected  float factor
           
protected static int HEIGHT
           
 boolean isBold
           
 boolean isIt
           
 boolean isRoman
           
 boolean isSs
           
 boolean isTt
           
protected static int IT
           
static java.util.List<java.lang.Character.UnicodeBlock> loadedAlphabets
           
protected static int MID
           
protected static int NONE
          No extension part for that kind (TOP,MID,REP or BOT)
protected static int NUMBERS
           
static java.util.Map<java.lang.Character.UnicodeBlock,AlphabetRegistration> registeredAlphabets
           
protected static int REP
           
protected static int SMALL
           
protected static int TOP
           
protected static int UNICODE
           
protected static int WIDTH
           
 
Fields inherited from interface org.scilab.forge.jlatexmath.TeXFont
NO_FONT
 
Constructor Summary
DefaultTeXFont(float pointSize)
           
DefaultTeXFont(float pointSize, boolean b, boolean rm, boolean ss, boolean tt, boolean it)
           
DefaultTeXFont(float pointSize, float f, boolean b, boolean rm, boolean ss, boolean tt, boolean it)
           
 
Method Summary
static void addAlphabet(AlphabetRegistration reg)
           
static void addAlphabet(java.lang.Character.UnicodeBlock alphabet, java.io.InputStream inlanguage, java.lang.String language, java.io.InputStream insymbols, java.lang.String symbols, java.io.InputStream inmappings, java.lang.String mappings)
           
static void addAlphabet(java.lang.Character.UnicodeBlock alphabet, java.lang.String name)
           
static void addAlphabet(java.lang.Object base, java.lang.Character.UnicodeBlock[] alphabet, java.lang.String language)
           
static void addTeXFontDescription(java.io.InputStream in, java.lang.String name)
           
static void addTeXFontDescription(java.lang.Object base, java.io.InputStream in, java.lang.String name)
           
static void addTeXFontDescription(java.lang.String file)
           
 TeXFont copy()
           
 TeXFont deriveFont(float size)
          Derives a new TeXFont object with the given point size
static void enableMagnification(boolean b)
           
 float getAxisHeight(int style)
           
 float getBigOpSpacing1(int style)
           
 float getBigOpSpacing2(int style)
           
 float getBigOpSpacing3(int style)
           
 float getBigOpSpacing4(int style)
           
 float getBigOpSpacing5(int style)
           
 boolean getBold()
           
 Char getChar(CharFont cf, int style)
          Get a Char-object for this specific character containing the metric information
 Char getChar(char c, java.lang.String textStyle, int style)
          Get a Char-object specifying the given character in the given text style with metric information depending on the given "style".
 Char getChar(java.lang.String symbolName, int style)
          Get a Char-object for the given symbol with metric information depending on "style".
 Char getDefaultChar(char c, int style)
          Get a Char-object specifying the given character in the default text style with metric information depending on the given "style".
 float getDefaultRuleThickness(int style)
           
 float getDenom1(int style)
           
 float getDenom2(int style)
           
 float getEM(int style)
           
 Extension getExtension(Char c, int style)
          Get an Extension-object for the given Char containing the 4 possible parts to build an arbitrary large variant.
 boolean getIt()
           
 float getKern(CharFont left, CharFont right, int style)
          Get the kern value to be inserted between the given characters in the given style.
 CharFont getLigature(CharFont left, CharFont right)
          Get the ligature that replaces both characters (if any).
 int getMuFontId()
           
 Char getNextLarger(Char c, int style)
          Get the next larger version of the given character.
 float getNum1(int style)
           
 float getNum2(int style)
           
 float getNum3(int style)
           
 float getQuad(int style, int fontCode)
           
 boolean getRoman()
           
 float getScaleFactor()
           
 float getSize()
           
static float getSizeFactor(int style)
           
 float getSkew(CharFont cf, int style)
          Get the kern amount of the character defined by the given CharFont followed by the "skewchar" of it's font.
 float getSpace(int style)
           
 boolean getSs()
           
 float getSub1(int style)
           
 float getSub2(int style)
           
 float getSubDrop(int style)
           
 float getSup1(int style)
           
 float getSup2(int style)
           
 float getSup3(int style)
           
 float getSupDrop(int style)
           
 boolean getTt()
           
 float getXHeight(int style, int fontCode)
           
 boolean hasNextLarger(Char c)
           
 boolean hasSpace(int font)
           
 boolean isExtensionChar(Char c)
           
static void registerAlphabet(AlphabetRegistration reg)
           
 TeXFont scaleFont(float factor)
           
 void setBold(boolean bold)
           
 void setIt(boolean it)
           
static void setMagnification(float mag)
           
static void setMathSizes(float ds, float ts, float ss, float sss)
           
 void setRoman(boolean rm)
           
 void setSs(boolean ss)
           
 void setTt(boolean tt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

protected static final int NONE
No extension part for that kind (TOP,MID,REP or BOT)

See Also:
Constant Field Values

NUMBERS

protected static final int NUMBERS
See Also:
Constant Field Values

CAPITALS

protected static final int CAPITALS
See Also:
Constant Field Values

SMALL

protected static final int SMALL
See Also:
Constant Field Values

UNICODE

protected static final int UNICODE
See Also:
Constant Field Values

TOP

protected static final int TOP
See Also:
Constant Field Values

MID

protected static final int MID
See Also:
Constant Field Values

REP

protected static final int REP
See Also:
Constant Field Values

BOT

protected static final int BOT
See Also:
Constant Field Values

WIDTH

protected static final int WIDTH
See Also:
Constant Field Values

HEIGHT

protected static final int HEIGHT
See Also:
Constant Field Values

DEPTH

protected static final int DEPTH
See Also:
Constant Field Values

IT

protected static final int IT
See Also:
Constant Field Values

loadedAlphabets

public static java.util.List<java.lang.Character.UnicodeBlock> loadedAlphabets

registeredAlphabets

public static java.util.Map<java.lang.Character.UnicodeBlock,AlphabetRegistration> registeredAlphabets

factor

protected float factor

isBold

public boolean isBold

isRoman

public boolean isRoman

isSs

public boolean isSs

isTt

public boolean isTt

isIt

public boolean isIt
Constructor Detail

DefaultTeXFont

public DefaultTeXFont(float pointSize)

DefaultTeXFont

public DefaultTeXFont(float pointSize,
                      boolean b,
                      boolean rm,
                      boolean ss,
                      boolean tt,
                      boolean it)

DefaultTeXFont

public DefaultTeXFont(float pointSize,
                      float f,
                      boolean b,
                      boolean rm,
                      boolean ss,
                      boolean tt,
                      boolean it)
Method Detail

addTeXFontDescription

public static void addTeXFontDescription(java.lang.String file)
                                  throws ResourceParseException
Throws:
ResourceParseException

addTeXFontDescription

public static void addTeXFontDescription(java.io.InputStream in,
                                         java.lang.String name)
                                  throws ResourceParseException
Throws:
ResourceParseException

addTeXFontDescription

public static void addTeXFontDescription(java.lang.Object base,
                                         java.io.InputStream in,
                                         java.lang.String name)
                                  throws ResourceParseException
Throws:
ResourceParseException

addAlphabet

public static void addAlphabet(java.lang.Character.UnicodeBlock alphabet,
                               java.io.InputStream inlanguage,
                               java.lang.String language,
                               java.io.InputStream insymbols,
                               java.lang.String symbols,
                               java.io.InputStream inmappings,
                               java.lang.String mappings)
                        throws ResourceParseException
Throws:
ResourceParseException

addAlphabet

public static void addAlphabet(java.lang.Object base,
                               java.lang.Character.UnicodeBlock[] alphabet,
                               java.lang.String language)
                        throws ResourceParseException
Throws:
ResourceParseException

addAlphabet

public static void addAlphabet(java.lang.Character.UnicodeBlock alphabet,
                               java.lang.String name)

addAlphabet

public static void addAlphabet(AlphabetRegistration reg)

registerAlphabet

public static void registerAlphabet(AlphabetRegistration reg)

copy

public TeXFont copy()
Specified by:
copy in interface TeXFont

deriveFont

public TeXFont deriveFont(float size)
Description copied from interface: TeXFont
Derives a new TeXFont object with the given point size

Specified by:
deriveFont in interface TeXFont
Parameters:
size - the new size (in points) of the derived TeXFont
Returns:
a copy of this TeXFont with the new size

scaleFont

public TeXFont scaleFont(float factor)
Specified by:
scaleFont in interface TeXFont

getScaleFactor

public float getScaleFactor()
Specified by:
getScaleFactor in interface TeXFont

getAxisHeight

public float getAxisHeight(int style)
Specified by:
getAxisHeight in interface TeXFont

getBigOpSpacing1

public float getBigOpSpacing1(int style)
Specified by:
getBigOpSpacing1 in interface TeXFont

getBigOpSpacing2

public float getBigOpSpacing2(int style)
Specified by:
getBigOpSpacing2 in interface TeXFont

getBigOpSpacing3

public float getBigOpSpacing3(int style)
Specified by:
getBigOpSpacing3 in interface TeXFont

getBigOpSpacing4

public float getBigOpSpacing4(int style)
Specified by:
getBigOpSpacing4 in interface TeXFont

getBigOpSpacing5

public float getBigOpSpacing5(int style)
Specified by:
getBigOpSpacing5 in interface TeXFont

getChar

public Char getChar(char c,
                    java.lang.String textStyle,
                    int style)
             throws TextStyleMappingNotFoundException
Description copied from interface: TeXFont
Get a Char-object specifying the given character in the given text style with metric information depending on the given "style".

Specified by:
getChar in interface TeXFont
Parameters:
c - alphanumeric character
textStyle - the text style in which the character should be drawn
style - the style in which the atom should be drawn
Returns:
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

getChar

public Char getChar(CharFont cf,
                    int style)
Description copied from interface: TeXFont
Get a Char-object for this specific character containing the metric information

Specified by:
getChar in interface TeXFont
Parameters:
cf - CharFont-object determining a specific character of a specific font
style - the style in which the atom should be drawn
Returns:
the Char-object for this character containing metric information

getChar

public Char getChar(java.lang.String symbolName,
                    int style)
             throws SymbolMappingNotFoundException
Description copied from interface: TeXFont
Get a Char-object for the given symbol with metric information depending on "style".

Specified by:
getChar in interface TeXFont
Parameters:
symbolName - the symbol name
style - the style in which the atom should be drawn
Returns:
a Char-object for this symbol with metric information
Throws:
SymbolMappingNotFoundException - if there's no symbol defined with the given name

getDefaultChar

public Char getDefaultChar(char c,
                           int style)
Description copied from interface: TeXFont
Get a Char-object specifying the given character in the default text style with metric information depending on the given "style".

Specified by:
getDefaultChar in interface TeXFont
Parameters:
c - alphanumeric character
style - the style in which the atom should be drawn
Returns:
the Char-object specifying the given character in the default text style

getDefaultRuleThickness

public float getDefaultRuleThickness(int style)
Specified by:
getDefaultRuleThickness in interface TeXFont

getDenom1

public float getDenom1(int style)
Specified by:
getDenom1 in interface TeXFont

getDenom2

public float getDenom2(int style)
Specified by:
getDenom2 in interface TeXFont

getExtension

public Extension getExtension(Char c,
                              int style)
Description copied from interface: TeXFont
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.

Specified by:
getExtension in interface TeXFont
Parameters:
c - a Char-object for a specific character
style - the style in which the atom should be drawn
Returns:
an Extension object containing the 4 possible parts

getKern

public float getKern(CharFont left,
                     CharFont right,
                     int style)
Description copied from interface: TeXFont
Get the kern value to be inserted between the given characters in the given style.

Specified by:
getKern in interface TeXFont
Parameters:
left - left character
right - right character
style - the style in which the atom should be drawn
Returns:
the kern value between both characters (default 0)

getLigature

public CharFont getLigature(CharFont left,
                            CharFont right)
Description copied from interface: TeXFont
Get the ligature that replaces both characters (if any).

Specified by:
getLigature in interface TeXFont
Parameters:
left - left character
right - right character
Returns:
a ligature replacing both characters (or null: no ligature)

getMuFontId

public int getMuFontId()
Specified by:
getMuFontId in interface TeXFont

getNextLarger

public Char getNextLarger(Char c,
                          int style)
Description copied from interface: TeXFont
Get the next larger version of the given character. This is only called if hasNextLarger(Char) returns true.

Specified by:
getNextLarger in interface TeXFont
Parameters:
c - character
style - the style in which the atom should be drawn
Returns:
the next larger version of this character

getNum1

public float getNum1(int style)
Specified by:
getNum1 in interface TeXFont

getNum2

public float getNum2(int style)
Specified by:
getNum2 in interface TeXFont

getNum3

public float getNum3(int style)
Specified by:
getNum3 in interface TeXFont

getQuad

public float getQuad(int style,
                     int fontCode)
Specified by:
getQuad in interface TeXFont

getSize

public float getSize()
Specified by:
getSize in interface TeXFont
Returns:
the point size of this TeXFont

getSkew

public float getSkew(CharFont cf,
                     int style)
Description copied from interface: TeXFont
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.

Specified by:
getSkew in interface TeXFont
Parameters:
cf - the character and it's font above which an accent has to be placed
style - the render style
Returns:
the kern amount of the character defined by cf followed by the "skewchar" of it's font.

getSpace

public float getSpace(int style)
Specified by:
getSpace in interface TeXFont

getSub1

public float getSub1(int style)
Specified by:
getSub1 in interface TeXFont

getSub2

public float getSub2(int style)
Specified by:
getSub2 in interface TeXFont

getSubDrop

public float getSubDrop(int style)
Specified by:
getSubDrop in interface TeXFont

getSup1

public float getSup1(int style)
Specified by:
getSup1 in interface TeXFont

getSup2

public float getSup2(int style)
Specified by:
getSup2 in interface TeXFont

getSup3

public float getSup3(int style)
Specified by:
getSup3 in interface TeXFont

getSupDrop

public float getSupDrop(int style)
Specified by:
getSupDrop in interface TeXFont

getXHeight

public float getXHeight(int style,
                        int fontCode)
Specified by:
getXHeight in interface TeXFont

getEM

public float getEM(int style)
Specified by:
getEM in interface TeXFont

hasNextLarger

public boolean hasNextLarger(Char c)
Specified by:
hasNextLarger in interface TeXFont
Parameters:
c - a character
Returns:
true if the given character has a larger version, false otherwise

setBold

public void setBold(boolean bold)
Specified by:
setBold in interface TeXFont

getBold

public boolean getBold()
Specified by:
getBold in interface TeXFont

setRoman

public void setRoman(boolean rm)
Specified by:
setRoman in interface TeXFont

getRoman

public boolean getRoman()
Specified by:
getRoman in interface TeXFont

setTt

public void setTt(boolean tt)
Specified by:
setTt in interface TeXFont

getTt

public boolean getTt()
Specified by:
getTt in interface TeXFont

setIt

public void setIt(boolean it)
Specified by:
setIt in interface TeXFont

getIt

public boolean getIt()
Specified by:
getIt in interface TeXFont

setSs

public void setSs(boolean ss)
Specified by:
setSs in interface TeXFont

getSs

public boolean getSs()
Specified by:
getSs in interface TeXFont

hasSpace

public boolean hasSpace(int font)
Specified by:
hasSpace in interface TeXFont

isExtensionChar

public boolean isExtensionChar(Char c)
Specified by:
isExtensionChar in interface TeXFont
Parameters:
c - a character
Returns:
true if the given character contains extension information to buid an arbitrary large version of this character.

setMathSizes

public static void setMathSizes(float ds,
                                float ts,
                                float ss,
                                float sss)

setMagnification

public static void setMagnification(float mag)

enableMagnification

public static void enableMagnification(boolean b)

getSizeFactor

public static float getSizeFactor(int style)