currentGlyphName = "missing-glyph";
}
}else if (currentAttributeName.equalsIgnoreCase("unicode")){
currentUnicode = currentAttribueValue;
if (currentUnicode.equalsIgnoreCase(" ")){
Vertex[] spaceVerts = new Vertex[]{new Vertex(0,0,0), new Vertex(fontDefaultXAdvancing,0,0),new Vertex(fontDefaultXAdvancing,100,0), /*new Vertex(0,100,0)*/};
ArrayList<Vertex[]> spaceContours = new ArrayList<Vertex[]>();
spaceContours.add(spaceVerts);
VectorFontCharacter spaceCharacter = new VectorFontCharacter(spaceContours, pa);
// VectorFontCharacter spaceCharacter = new VectorFontCharacter(new Vertex[]{new Vertex(0,0,0), new Vertex(100,0,0),new Vertex(100,100,0),new Vertex(0,100,0)}, new ArrayList<Vertex[]>(), pa);
spaceCharacter.setPickable(false);
if (MT4jSettings.getInstance().isOpenGlMode()){
spaceCharacter.setUseDirectGL(true);
// spaceCharacter.generateAndUseDisplayLists();
}
spaceCharacter.setVisible(false);
spaceCharacter.setNoFill(true);
spaceCharacter.setNoStroke(true);
currentCharacter = spaceCharacter;
}
}else if (currentAttributeName.equalsIgnoreCase("glyph-name")){
currentGlyphName = currentAttribueValue;
if (currentUnicode.equalsIgnoreCase("space")){
Vertex[] spaceVerts = new Vertex[]{new Vertex(0,0,0), new Vertex(fontDefaultXAdvancing,0,0),new Vertex(fontDefaultXAdvancing,100,0), /*new Vertex(0,100,0)*/};
ArrayList<Vertex[]> spaceContours = new ArrayList<Vertex[]>();
spaceContours.add(spaceVerts);
VectorFontCharacter spaceCharacter = new VectorFontCharacter(spaceContours, pa);
// VectorFontCharacter spaceCharacter = new VectorFontCharacter(new Vertex[]{new Vertex(0,0,0), new Vertex(100,0,0),new Vertex(100,100,0),new Vertex(0,100,0)}, new ArrayList<Vertex[]>(), pa);
spaceCharacter.setPickable(false);
if (MT4jSettings.getInstance().isOpenGlMode()){
spaceCharacter.setUseDirectGL(true);
// spaceCharacter.generateAndUseDisplayLists();
}
spaceCharacter.setVisible(false);
spaceCharacter.setNoFill(true);
spaceCharacter.setNoStroke(true);
currentCharacter = spaceCharacter;
}
}else if (currentAttributeName.equalsIgnoreCase("horiz-adv-x")){
currenthorizontalAdvX = Integer.parseInt(currentAttribueValue);
}
}
if (currentCharacter != null){
currentCharacter.setName(currentGlyphName);
currentGlyphName = "";
currentCharacter.setUnicode(currentUnicode);
currentUnicode = "";
if (currenthorizontalAdvX != 0){
currentCharacter.setHorizontalDist(currenthorizontalAdvX);
}else{
currentCharacter.setHorizontalDist(fontDefaultXAdvancing); //Default if character, nor the font specified this
}
//TODO this caused performance problems in the past - reason UNKOWN! DISABLE IF PERFORMANCE DROPS SIGNIFICANTLY!
//Scale character advance distances according to fontsize
// float tmp = currentCharacter.getHorizontalDist() * (float)(1.0/(float)font_units_per_em);
// currentCharacter.setHorizontalDist(Math.round(tmp * fontSize));
currentCharacter.setHorizontalDist(Math.round(currentCharacter.getHorizontalDist() * this.scaleFactor));
//Set space's vertices to its horizontal advancement value
//the vertices are important for showing the textbox caret
//at the right position
if (currentCharacter.getUnicode().equals(" ") || currentUnicode.equalsIgnoreCase("space")){
int xadvance = currentCharacter.getHorizontalDist();
currentCharacter.setVertices(new Vertex[]{new Vertex(0,0,0), new Vertex(xadvance,0,0),new Vertex(xadvance,100,0) /*,new Vertex(0,100,0)*/});
}
characters.add(currentCharacter);
currenthorizontalAdvX = 0; //Reset