Skip to content
Snippets Groups Projects
Commit a319df34 authored by Thuy Nguyen's avatar Thuy Nguyen Committed by Alexandre Julliard
Browse files

Implemented the underline and strikeout text attributes for the Wine

PostScript driver.
parent 31c58546
No related branches found
No related tags found
No related merge requests found
......@@ -104,6 +104,13 @@ static char psrectangle[] = /* x, y, width, height, -width */
"%d 0 rlineto\n"
"closepath\n";
static char psrrectangle[] = /* x, y, width, height, -width */
"%d %d rmoveto\n"
"%d 0 rlineto\n"
"0 %d rlineto\n"
"%d 0 rlineto\n"
"closepath\n";
static char psshow[] = /* string */
"(%s) show\n";
......@@ -482,6 +489,15 @@ BOOL PSDRV_WriteRectangle(DC *dc, INT x, INT y, INT width,
return PSDRV_WriteSpool(dc, buf, strlen(buf));
}
BOOL PSDRV_WriteRRectangle(DC *dc, INT x, INT y, INT width,
INT height)
{
char buf[100];
sprintf(buf, psrrectangle, x, y, width, height, -width);
return PSDRV_WriteSpool(dc, buf, strlen(buf));
}
BOOL PSDRV_WriteArc(DC *dc, INT x, INT y, INT w, INT h, double ang1,
double ang2)
{
......
......@@ -81,6 +81,76 @@ BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
PSDRV_WriteMoveTo(dc, x, y);
PSDRV_WriteShow(dc, strbuf, strlen(strbuf));
/*
* Underline and strikeout attributes.
*/
if ((physDev->font.tm.tmUnderlined) || (physDev->font.tm.tmStruckOut)) {
/* Get the thickness and the position for the underline attribute */
/* We'll use the same thickness for the strikeout attribute */
float thick = physDev->font.afm->UnderlineThickness * physDev->font.scale;
float pos = -physDev->font.afm->UnderlinePosition * physDev->font.scale;
SIZE size;
INT escapement = physDev->font.escapement;
TRACE(psdrv, "Position = %f Thickness %f Escapement %d\n",
pos, thick, escapement);
/* Get the width of the text */
PSDRV_GetTextExtentPoint(dc, strbuf, strlen(strbuf), &size);
size.cx = XLSTODS(dc, size.cx);
/* Do the underline */
if (physDev->font.tm.tmUnderlined) {
if (escapement != 0) /* rotated text */
{
PSDRV_WriteGSave(dc); /* save the graphics state */
PSDRV_WriteMoveTo(dc, x, y); /* move to the start */
/* temporarily rotate the coord system */
PSDRV_WriteRotate(dc, -escapement/10);
/* draw the underline relative to the starting point */
PSDRV_WriteRRectangle(dc, 0, (INT)pos, size.cx, (INT)thick);
}
else
PSDRV_WriteRectangle(dc, x, y + (INT)pos, size.cx, (INT)thick);
PSDRV_WriteFill(dc);
if (escapement != 0) /* rotated text */
PSDRV_WriteGRestore(dc); /* restore the graphics state */
}
/* Do the strikeout */
if (physDev->font.tm.tmStruckOut) {
pos = -physDev->font.tm.tmAscent / 2;
if (escapement != 0) /* rotated text */
{
PSDRV_WriteGSave(dc); /* save the graphics state */
PSDRV_WriteMoveTo(dc, x, y); /* move to the start */
/* temporarily rotate the coord system */
PSDRV_WriteRotate(dc, -escapement/10);
/* draw the underline relative to the starting point */
PSDRV_WriteRRectangle(dc, 0, (INT)pos, size.cx, (INT)thick);
}
else
PSDRV_WriteRectangle(dc, x, y + (INT)pos, size.cx, (INT)thick);
PSDRV_WriteFill(dc);
if (escapement != 0) /* rotated text */
PSDRV_WriteGRestore(dc); /* restore the graphics state */
}
}
HeapFree(PSDRV_Heap, 0, strbuf);
return TRUE;
}
......@@ -272,6 +272,8 @@ extern BOOL PSDRV_WriteLineTo(DC *dc, INT x, INT y);
extern BOOL PSDRV_WriteStroke(DC *dc);
extern BOOL PSDRV_WriteRectangle(DC *dc, INT x, INT y, INT width,
INT height);
extern BOOL PSDRV_WriteRRectangle(DC *dc, INT x, INT y, INT width,
INT height);
extern BOOL PSDRV_WriteSetFont(DC *dc, BOOL UseANSI);
extern BOOL PSDRV_WriteShow(DC *dc, char *str, INT count);
extern BOOL PSDRV_WriteReencodeFont(DC *dc);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment