* */
char[] chars = new char[str.length()];
int j = 0;
for (int i=0; i < str.length(); i++){
char c = str.charAt(i);
Glyph gl = wf.getGlyph(c);
// We compare Advances because Width
// of a char can be 0 (e.g. "Space" char)
if (gl.getGlyphMetrics().getAdvance() != 0){
chars[j] = gl.getChar();
j++;
}
}
String out = new String(chars, 0, j);