From 618ce03ed355553b4bcb66f41c83231a4c0c8530 Mon Sep 17 00:00:00 2001 From: Albert den Haan Date: Tue, 29 Aug 2000 03:51:45 +0000 Subject: [PATCH] Convert the Unicode Character id to a glyph id in X11DRV_GetTextExtentPoint. --- graphics/x11drv/text.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/graphics/x11drv/text.c b/graphics/x11drv/text.c index 7a90fd28c8a..d57048a7b4a 100644 --- a/graphics/x11drv/text.c +++ b/graphics/x11drv/text.c @@ -394,24 +394,24 @@ BOOL X11DRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count, TRACE("%s %d\n", debugstr_wn(str,count), count); if( pfo ) { + XChar2b *p = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, str, count ); + if (!p) return FALSE; if( !pfo->lpX11Trans ) { int dir, ascent, descent; int info_width; - XChar2b *p = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, str, count ); - if (!p) return FALSE; X11DRV_cptable[pfo->fi->cptable].pTextExtents( pfo, p, count, &dir, &ascent, &descent, &info_width ); size->cx = abs((info_width + dc->w.breakRem + count * dc->w.charExtra) * dc->wndExtX / dc->vportExtX); size->cy = abs((pfo->fs->ascent + pfo->fs->descent) * dc->wndExtY / dc->vportExtY); - HeapFree( GetProcessHeap(), 0, p ); } else { INT i; float x = 0.0, y = 0.0; + /* FIXME: Deal with *_char_or_byte2 != 0 situations */ for(i = 0; i < count; i++) { x += pfo->fs->per_char ? - pfo->fs->per_char[str[i] - pfo->fs->min_char_or_byte2].attributes : + pfo->fs->per_char[p[i].byte2 - pfo->fs->min_char_or_byte2].attributes : pfo->fs->min_bounds.attributes; } y = pfo->lpX11Trans->RAW_ASCENT + pfo->lpX11Trans->RAW_DESCENT; @@ -421,6 +421,7 @@ BOOL X11DRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count, size->cx = fabs((x + dc->w.breakRem + count * dc->w.charExtra) * dc->wndExtX / dc->vportExtX); size->cy = fabs(y * dc->wndExtY / dc->vportExtY); + HeapFree( GetProcessHeap(), 0, p ); } size->cx *= pfo->rescale; size->cy *= pfo->rescale;