Convert the Unicode Character id to a glyph id in

X11DRV_GetTextExtentPoint.
This commit is contained in:
Albert den Haan 2000-08-29 03:51:45 +00:00 committed by Alexandre Julliard
parent 2ca7b74846
commit 618ce03ed3
1 changed files with 5 additions and 4 deletions

View File

@ -394,24 +394,24 @@ BOOL X11DRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count,
TRACE("%s %d\n", debugstr_wn(str,count), count); TRACE("%s %d\n", debugstr_wn(str,count), count);
if( pfo ) { if( pfo ) {
XChar2b *p = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, str, count );
if (!p) return FALSE;
if( !pfo->lpX11Trans ) { if( !pfo->lpX11Trans ) {
int dir, ascent, descent; int dir, ascent, descent;
int info_width; 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, X11DRV_cptable[pfo->fi->cptable].pTextExtents( pfo, p,
count, &dir, &ascent, &descent, &info_width ); count, &dir, &ascent, &descent, &info_width );
size->cx = abs((info_width + dc->w.breakRem + count * size->cx = abs((info_width + dc->w.breakRem + count *
dc->w.charExtra) * dc->wndExtX / dc->vportExtX); dc->w.charExtra) * dc->wndExtX / dc->vportExtX);
size->cy = abs((pfo->fs->ascent + pfo->fs->descent) * size->cy = abs((pfo->fs->ascent + pfo->fs->descent) *
dc->wndExtY / dc->vportExtY); dc->wndExtY / dc->vportExtY);
HeapFree( GetProcessHeap(), 0, p );
} else { } else {
INT i; INT i;
float x = 0.0, y = 0.0; float x = 0.0, y = 0.0;
/* FIXME: Deal with *_char_or_byte2 != 0 situations */
for(i = 0; i < count; i++) { for(i = 0; i < count; i++) {
x += pfo->fs->per_char ? 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; pfo->fs->min_bounds.attributes;
} }
y = pfo->lpX11Trans->RAW_ASCENT + pfo->lpX11Trans->RAW_DESCENT; 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) * size->cx = fabs((x + dc->w.breakRem + count * dc->w.charExtra) *
dc->wndExtX / dc->vportExtX); dc->wndExtX / dc->vportExtX);
size->cy = fabs(y * dc->wndExtY / dc->vportExtY); size->cy = fabs(y * dc->wndExtY / dc->vportExtY);
HeapFree( GetProcessHeap(), 0, p );
} }
size->cx *= pfo->rescale; size->cx *= pfo->rescale;
size->cy *= pfo->rescale; size->cy *= pfo->rescale;