Commit bc7df7ad authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

gdi32: Better error handling in enhanced metafile.

parent 54ac76a3
...@@ -756,7 +756,7 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, ...@@ -756,7 +756,7 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
textWidth += lpDx[i]; textWidth += lpDx[i];
} }
GetTextExtentPoint32W(physDev->hdc, str, count, &strSize); if (GetTextExtentPoint32W(physDev->hdc, str, count, &strSize))
textHeight = strSize.cy; textHeight = strSize.cy;
} }
else { else {
...@@ -764,12 +764,13 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, ...@@ -764,12 +764,13 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
INT *dx = (INT *)((char*)pemr + pemr->emrtext.offDx); INT *dx = (INT *)((char*)pemr + pemr->emrtext.offDx);
SIZE charSize; SIZE charSize;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
GetTextExtentPoint32W(physDev->hdc, str + i, 1, &charSize); if (GetTextExtentPoint32W(physDev->hdc, str + i, 1, &charSize)) {
dx[i] = charSize.cx; dx[i] = charSize.cx;
textWidth += charSize.cx; textWidth += charSize.cx;
textHeight = max(textHeight, charSize.cy); textHeight = max(textHeight, charSize.cy);
} }
} }
}
switch (textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER)) { switch (textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER)) {
case TA_CENTER: { case TA_CENTER: {
...@@ -791,7 +792,8 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, ...@@ -791,7 +792,8 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
switch (textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE)) { switch (textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE)) {
case TA_BASELINE: { case TA_BASELINE: {
TEXTMETRICW tm; TEXTMETRICW tm;
GetTextMetricsW(physDev->hdc, &tm); if (!GetTextMetricsW(physDev->hdc, &tm))
tm.tmDescent = 0;
/* Play safe here... it's better to have a bounding box */ /* Play safe here... it's better to have a bounding box */
/* that is too big than too small. */ /* that is too big than too small. */
pemr->rclBounds.top = y - textHeight - 1; pemr->rclBounds.top = y - textHeight - 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment