private void drawCharactersGL(GL gl, List<IFontCharacter> characterList, int charListSize, int lastXAdv, int lineTotalAdv){
int lastXAdvancement = lastXAdv;
int thisLineTotalXAdvancement = lineTotalAdv;
for (int i = 0; i < charListSize; i++) {
IFontCharacter character = characterList.get(i);
//Step to the right by the amount of the last characters x advancement
gl.glTranslatef(lastXAdvancement, 0, 0);
//Save total amount gone to the right in this line
thisLineTotalXAdvancement += lastXAdvancement;
lastXAdvancement = 0;
//Draw the letter
character.drawComponent(gl);
//Check if newLine occurs, goto start at new line
if (character.getUnicode().equals("\n")){
gl.glTranslatef(-thisLineTotalXAdvancement, fontHeight, 0);
thisLineTotalXAdvancement = 0;
lastXAdvancement = innerPaddingLeft;
}else{
//If caret is showing and we are at index one before caret calc the advancement to include the caret in the text area
if (enableCaret && showCaret && i == charListSize-2){
if (character.getUnicode().equals("\t")){
lastXAdvancement = character.getHorizontalDist() - character.getHorizontalDist() / 20;
}else{
//approximated value, cant get the real one
lastXAdvancement = 2 + character.getHorizontalDist() - (character.getHorizontalDist() / 3);
}
}else{
lastXAdvancement = character.getHorizontalDist();
}
}
}
}