y += (int)Math.round(trans.getTranslateY());
win32.SetTextColor(hdc, getGDIColor(g.getColor().getRGB()));
win32.SetBkMode(hdc, WindowsDefs.TRANSPARENT);
CompositeFont wcf = (CompositeFont)(g.getFont().getPeer());
int charFontIndex = wcf.getCharFontIndex(str.charAt(0), 0);
int fontIndex = charFontIndex;
WindowsFont physFont = (WindowsFont)wcf.fPhysicalFonts[charFontIndex];
long font = physFont.getFontHandle();
win32.SelectObject(hdc, font);
int ascent = physFont.getAscent(); // Font ascent
int offs = 0; // width of substring with the same font header
int yOffset = y - ascent; // Y offset to draw (y - font.ascent)
int xOffset = x; // X offset to draw
int start = 0;
int count = 0;
for (int i=0; i < len; i++){
char c = str.charAt(i);
Glyph gl = wcf.getGlyph(c);
int glWidth = Math.round(gl.getGlyphPointMetrics().getAdvance());
if (glWidth ==0){
continue;
}
fontIndex = wcf.getCharFontIndex(c, 0);
if (fontIndex != charFontIndex){
charFontIndex = fontIndex;
win32.TextOutW(hdc, xOffset, yOffset,
str.substring(start, start + count), count);