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;
|
int i;
|
||||||
float width = 0.0;
|
float width = 0.0;
|
||||||
POINT pt[3];
|
|
||||||
|
|
||||||
assert(physDev->font.fontloc == Builtin);
|
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)
|
for (i = 0; i < count && str[i] != '\0'; ++i)
|
||||||
width += PSDRV_UVMetrics(str[i], physDev->font.fontinfo.Builtin.afm)->WX;
|
width += PSDRV_UVMetrics(str[i], physDev->font.fontinfo.Builtin.afm)->WX;
|
||||||
|
|
||||||
width *= physDev->font.fontinfo.Builtin.scale;
|
size->cx = width * physDev->font.fontinfo.Builtin.scale;
|
||||||
|
size->cy = physDev->font.fontinfo.Builtin.tm.tmHeight;
|
||||||
/* 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;
|
|
||||||
|
|
||||||
TRACE("cx=%li cy=%li\n", size->cx, size->cy);
|
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,
|
BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, INT count,
|
||||||
LPSIZE size )
|
LPSIZE size )
|
||||||
{
|
{
|
||||||
DC *dc = physDev->dc;
|
|
||||||
fontObject* pfo = XFONT_GetFontObject( physDev->font );
|
fontObject* pfo = XFONT_GetFontObject( physDev->font );
|
||||||
|
|
||||||
TRACE("%s %d\n", debugstr_wn(str,count), count);
|
TRACE("%s %d\n", debugstr_wn(str,count), count);
|
||||||
if( pfo ) {
|
if( pfo ) {
|
||||||
INT charExtra = GetTextCharacterExtra( physDev->hdc );
|
|
||||||
XChar2b *p = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, str, count );
|
XChar2b *p = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, str, count );
|
||||||
if (!p) return FALSE;
|
if (!p) return FALSE;
|
||||||
if( !pfo->lpX11Trans ) {
|
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,
|
X11DRV_cptable[pfo->fi->cptable].pTextExtents( pfo, p,
|
||||||
count, &dir, &ascent, &descent, &info_width );
|
count, &dir, &ascent, &descent, &info_width );
|
||||||
|
|
||||||
size->cx = fabs((FLOAT)(info_width + dc->breakRem + count *
|
size->cx = info_width;
|
||||||
charExtra) * dc->xformVport2World.eM11);
|
size->cy = pfo->fs->ascent + pfo->fs->descent;
|
||||||
size->cy = fabs((FLOAT)(pfo->fs->ascent + pfo->fs->descent) *
|
|
||||||
dc->xformVport2World.eM22);
|
|
||||||
} else {
|
} else {
|
||||||
INT i;
|
INT i;
|
||||||
float x = 0.0, y = 0.0;
|
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;
|
y = pfo->lpX11Trans->RAW_ASCENT + pfo->lpX11Trans->RAW_DESCENT;
|
||||||
TRACE("x = %f y = %f\n", x, y);
|
TRACE("x = %f y = %f\n", x, y);
|
||||||
x *= pfo->lpX11Trans->pixelsize / 1000.0;
|
size->cx = x * pfo->lpX11Trans->pixelsize / 1000.0;
|
||||||
y *= pfo->lpX11Trans->pixelsize / 1000.0;
|
size->cy = 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 *= pfo->rescale;
|
size->cx *= pfo->rescale;
|
||||||
size->cy *= pfo->rescale;
|
size->cy *= pfo->rescale;
|
||||||
|
|
|
@ -139,7 +139,6 @@ typedef struct tagDC
|
||||||
|
|
||||||
WORD textAlign; /* Text alignment from SetTextAlign() */
|
WORD textAlign; /* Text alignment from SetTextAlign() */
|
||||||
INT charExtra; /* Spacing from SetTextCharacterExtra() */
|
INT charExtra; /* Spacing from SetTextCharacterExtra() */
|
||||||
INT breakCount; /* Break char. count */
|
|
||||||
INT breakExtra; /* breakTotalExtra / breakCount */
|
INT breakExtra; /* breakTotalExtra / breakCount */
|
||||||
INT breakRem; /* breakTotalExtra % breakCount */
|
INT breakRem; /* breakTotalExtra % breakCount */
|
||||||
INT MapMode;
|
INT MapMode;
|
||||||
|
|
|
@ -98,7 +98,6 @@ DC *DC_AllocDC( const DC_FUNCTIONS *funcs, WORD magic )
|
||||||
dc->brushOrgY = 0;
|
dc->brushOrgY = 0;
|
||||||
dc->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP;
|
dc->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP;
|
||||||
dc->charExtra = 0;
|
dc->charExtra = 0;
|
||||||
dc->breakCount = 0;
|
|
||||||
dc->breakExtra = 0;
|
dc->breakExtra = 0;
|
||||||
dc->breakRem = 0;
|
dc->breakRem = 0;
|
||||||
dc->MapMode = MM_TEXT;
|
dc->MapMode = MM_TEXT;
|
||||||
|
@ -306,7 +305,6 @@ HDC WINAPI GetDCState( HDC hdc )
|
||||||
newdc->brushOrgY = dc->brushOrgY;
|
newdc->brushOrgY = dc->brushOrgY;
|
||||||
newdc->textAlign = dc->textAlign;
|
newdc->textAlign = dc->textAlign;
|
||||||
newdc->charExtra = dc->charExtra;
|
newdc->charExtra = dc->charExtra;
|
||||||
newdc->breakCount = dc->breakCount;
|
|
||||||
newdc->breakExtra = dc->breakExtra;
|
newdc->breakExtra = dc->breakExtra;
|
||||||
newdc->breakRem = dc->breakRem;
|
newdc->breakRem = dc->breakRem;
|
||||||
newdc->MapMode = dc->MapMode;
|
newdc->MapMode = dc->MapMode;
|
||||||
|
@ -395,7 +393,6 @@ void WINAPI SetDCState( HDC hdc, HDC hdcs )
|
||||||
dc->brushOrgY = dcs->brushOrgY;
|
dc->brushOrgY = dcs->brushOrgY;
|
||||||
dc->textAlign = dcs->textAlign;
|
dc->textAlign = dcs->textAlign;
|
||||||
dc->charExtra = dcs->charExtra;
|
dc->charExtra = dcs->charExtra;
|
||||||
dc->breakCount = dcs->breakCount;
|
|
||||||
dc->breakExtra = dcs->breakExtra;
|
dc->breakExtra = dcs->breakExtra;
|
||||||
dc->breakRem = dcs->breakRem;
|
dc->breakRem = dcs->breakRem;
|
||||||
dc->MapMode = dcs->MapMode;
|
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);
|
extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX);
|
||||||
if (!extra) breaks = 0;
|
if (!extra) breaks = 0;
|
||||||
dc->breakCount = breaks;
|
|
||||||
if (breaks)
|
if (breaks)
|
||||||
{
|
{
|
||||||
dc->breakExtra = extra / breaks;
|
dc->breakExtra = extra / breaks;
|
||||||
dc->breakRem = extra - (dc->breakCount * dc->breakExtra);
|
dc->breakRem = extra - (breaks * dc->breakExtra);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1008,15 +1007,18 @@ BOOL WINAPI GetTextExtentPoint32W(
|
||||||
DC * dc = DC_GetDCPtr( hdc );
|
DC * dc = DC_GetDCPtr( hdc );
|
||||||
if (!dc) return FALSE;
|
if (!dc) return FALSE;
|
||||||
|
|
||||||
if(dc->gdiFont) {
|
if(dc->gdiFont)
|
||||||
ret = WineEngGetTextExtentPoint(dc->gdiFont, str, count, size);
|
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)
|
else if(dc->funcs->pGetTextExtentPoint)
|
||||||
ret = dc->funcs->pGetTextExtentPoint( dc->physDev, str, count, size );
|
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 );
|
GDI_ReleaseObj( hdc );
|
||||||
|
|
||||||
TRACE("(%p %s %d %p): returning %ld x %ld\n",
|
TRACE("(%p %s %d %p): returning %ld x %ld\n",
|
||||||
|
|
Loading…
Reference in New Issue