Well, I reworked the fl_font_win32 version of ::draw() as follows:
void Fl_GDI_Graphics_Driver::draw(const char* str, int n, int x, int y) {
int i = 0;
int lx = 0;
char *end = (char *)&str[n];
COLORREF oldColor = SetTextColor(fl_gc, fl_RGB());
SelectObject(fl_gc, font_descriptor()->fid);
while (i < n) {
unsigned int u; // UCS value of next glyph
unsigned int u1; // UCS non-spacing glyph
unsigned cc; // UTF16 cell count for glyph - usually 1
unsigned short ucs[4]; // We assume any valid UCS will fit into 2 UTF16
cells
int l;
u = fl_utf8decode((const char*)(str + i), end, &l);
if ( (u1 = fl_nonspacing(u)) ) {
x -= lx;
u = u1;
} else {
lx = (int) width(u);
}
// Do we need a surrogate pair for this UCS value?
if(u > 0xFFFF) {
cc = fl_utf8toUtf16((str + i), l, ucs, 4);
//printf("0x%06x 0x%04x 0x%04x\n", u, (ucs[0] & 0xFFFF), (ucs[1] & 0xFFFF));
}
else { // not a surrogate pair, use a single value
ucs[0] = u;
cc = 1;
}
TextOutW(fl_gc, x, y, (WCHAR*)ucs, cc);
if (l < 1) l = 1;
i += l;
x += lx;
}
SetTextColor(fl_gc, oldColor);
}
This looks OK to me, and it compiles fine - and according to my sophisticated
debug (see the printf...) it is doing the Right Thing.
But still the glyphs do not display. Values below the 0xFFFF threshold seem to
be fine still, but I can't get glyphs from the higher supplementary planes to
draw.
I'm pretty sure the font is OK - it works fine on other systems anyway, so I'm
at a loss as to where to look next.
Any suggestions welcomed...
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev