Changed the GetTextExtentPoint graphics driver entry point to return
device coordinates. Removed not used breakCount field in the DC structure.
This commit is contained in:
parent
a631ef6369
commit
45468c06df
|
@ -310,7 +310,6 @@ BOOL PSDRV_GetTextExtentPoint(PSDRV_PDEVICE *physDev, LPCWSTR str, INT count, LP
|
|||
{
|
||||
int i;
|
||||
float width = 0.0;
|
||||
POINT pt[3];
|
||||
|
||||
assert(physDev->font.fontloc == Builtin);
|
||||
|
||||
|
@ -319,18 +318,8 @@ BOOL PSDRV_GetTextExtentPoint(PSDRV_PDEVICE *physDev, LPCWSTR str, INT count, LP
|
|||
for (i = 0; i < count && str[i] != '\0'; ++i)
|
||||
width += PSDRV_UVMetrics(str[i], physDev->font.fontinfo.Builtin.afm)->WX;
|
||||
|
||||
width *= physDev->font.fontinfo.Builtin.scale;
|
||||
|
||||
/* convert back to logical coords */
|
||||
pt[0].x = 0;
|
||||
pt[0].y = 0;
|
||||
pt[1].x = width;
|
||||
pt[1].y = 0;
|
||||
pt[2].x = 0;
|
||||
pt[2].y = physDev->font.fontinfo.Builtin.tm.tmHeight;
|
||||
DPtoLP( physDev->hdc, pt, 3 );
|
||||
size->cx = pt[1].x - pt[0].x;
|
||||
size->cy = pt[2].y - pt[0].y;
|
||||
size->cx = width * physDev->font.fontinfo.Builtin.scale;
|
||||
size->cy = physDev->font.fontinfo.Builtin.tm.tmHeight;
|
||||
|
||||
TRACE("cx=%li cy=%li\n", size->cx, size->cy);
|
||||
|
||||
|
|
|
@ -444,12 +444,10 @@ END:
|
|||
BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, INT count,
|
||||
LPSIZE size )
|
||||
{
|
||||
DC *dc = physDev->dc;
|
||||
fontObject* pfo = XFONT_GetFontObject( physDev->font );
|
||||
|
||||
TRACE("%s %d\n", debugstr_wn(str,count), count);
|
||||
if( pfo ) {
|
||||
INT charExtra = GetTextCharacterExtra( physDev->hdc );
|
||||
XChar2b *p = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, str, count );
|
||||
if (!p) return FALSE;
|
||||
if( !pfo->lpX11Trans ) {
|
||||
|
@ -458,10 +456,8 @@ BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, INT count,
|
|||
X11DRV_cptable[pfo->fi->cptable].pTextExtents( pfo, p,
|
||||
count, &dir, &ascent, &descent, &info_width );
|
||||
|
||||
size->cx = fabs((FLOAT)(info_width + dc->breakRem + count *
|
||||
charExtra) * dc->xformVport2World.eM11);
|
||||
size->cy = fabs((FLOAT)(pfo->fs->ascent + pfo->fs->descent) *
|
||||
dc->xformVport2World.eM22);
|
||||
size->cx = info_width;
|
||||
size->cy = pfo->fs->ascent + pfo->fs->descent;
|
||||
} else {
|
||||
INT i;
|
||||
float x = 0.0, y = 0.0;
|
||||
|
@ -473,11 +469,8 @@ BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, INT count,
|
|||
}
|
||||
y = pfo->lpX11Trans->RAW_ASCENT + pfo->lpX11Trans->RAW_DESCENT;
|
||||
TRACE("x = %f y = %f\n", x, y);
|
||||
x *= pfo->lpX11Trans->pixelsize / 1000.0;
|
||||
y *= pfo->lpX11Trans->pixelsize / 1000.0;
|
||||
size->cx = fabs((x + dc->breakRem + count * charExtra) *
|
||||
dc->xformVport2World.eM11);
|
||||
size->cy = fabs(y * dc->xformVport2World.eM22);
|
||||
size->cx = x * pfo->lpX11Trans->pixelsize / 1000.0;
|
||||
size->cy = y * pfo->lpX11Trans->pixelsize / 1000.0;
|
||||
}
|
||||
size->cx *= pfo->rescale;
|
||||
size->cy *= pfo->rescale;
|
||||
|
|
|
@ -139,7 +139,6 @@ typedef struct tagDC
|
|||
|
||||
WORD textAlign; /* Text alignment from SetTextAlign() */
|
||||
INT charExtra; /* Spacing from SetTextCharacterExtra() */
|
||||
INT breakCount; /* Break char. count */
|
||||
INT breakExtra; /* breakTotalExtra / breakCount */
|
||||
INT breakRem; /* breakTotalExtra % breakCount */
|
||||
INT MapMode;
|
||||
|
|
|
@ -98,7 +98,6 @@ DC *DC_AllocDC( const DC_FUNCTIONS *funcs, WORD magic )
|
|||
dc->brushOrgY = 0;
|
||||
dc->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP;
|
||||
dc->charExtra = 0;
|
||||
dc->breakCount = 0;
|
||||
dc->breakExtra = 0;
|
||||
dc->breakRem = 0;
|
||||
dc->MapMode = MM_TEXT;
|
||||
|
@ -306,7 +305,6 @@ HDC WINAPI GetDCState( HDC hdc )
|
|||
newdc->brushOrgY = dc->brushOrgY;
|
||||
newdc->textAlign = dc->textAlign;
|
||||
newdc->charExtra = dc->charExtra;
|
||||
newdc->breakCount = dc->breakCount;
|
||||
newdc->breakExtra = dc->breakExtra;
|
||||
newdc->breakRem = dc->breakRem;
|
||||
newdc->MapMode = dc->MapMode;
|
||||
|
@ -395,7 +393,6 @@ void WINAPI SetDCState( HDC hdc, HDC hdcs )
|
|||
dc->brushOrgY = dcs->brushOrgY;
|
||||
dc->textAlign = dcs->textAlign;
|
||||
dc->charExtra = dcs->charExtra;
|
||||
dc->breakCount = dcs->breakCount;
|
||||
dc->breakExtra = dcs->breakExtra;
|
||||
dc->breakRem = dcs->breakRem;
|
||||
dc->MapMode = dcs->MapMode;
|
||||
|
|
|
@ -900,11 +900,10 @@ BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
|
|||
{
|
||||
extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX);
|
||||
if (!extra) breaks = 0;
|
||||
dc->breakCount = breaks;
|
||||
if (breaks)
|
||||
{
|
||||
dc->breakExtra = extra / breaks;
|
||||
dc->breakRem = extra - (dc->breakCount * dc->breakExtra);
|
||||
dc->breakRem = extra - (breaks * dc->breakExtra);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1008,15 +1007,18 @@ BOOL WINAPI GetTextExtentPoint32W(
|
|||
DC * dc = DC_GetDCPtr( hdc );
|
||||
if (!dc) return FALSE;
|
||||
|
||||
if(dc->gdiFont) {
|
||||
if(dc->gdiFont)
|
||||
ret = WineEngGetTextExtentPoint(dc->gdiFont, str, count, size);
|
||||
size->cx = abs(INTERNAL_XDSTOWS(dc, size->cx));
|
||||
size->cy = abs(INTERNAL_YDSTOWS(dc, size->cy));
|
||||
size->cx += count * dc->charExtra;
|
||||
}
|
||||
else if(dc->funcs->pGetTextExtentPoint)
|
||||
ret = dc->funcs->pGetTextExtentPoint( dc->physDev, str, count, size );
|
||||
|
||||
if (ret)
|
||||
{
|
||||
size->cx = abs(INTERNAL_XDSTOWS(dc, size->cx));
|
||||
size->cy = abs(INTERNAL_YDSTOWS(dc, size->cy));
|
||||
size->cx += count * dc->charExtra + dc->breakRem;
|
||||
}
|
||||
|
||||
GDI_ReleaseObj( hdc );
|
||||
|
||||
TRACE("(%p %s %d %p): returning %ld x %ld\n",
|
||||
|
|
Loading…
Reference in New Issue