wineps: Add support for printing fake italic fonts.
This commit is contained in:
parent
8f80159d40
commit
bb1740a42e
|
@ -238,7 +238,7 @@ BOOL PSDRV_WriteSetBuiltinFont(PHYSDEV dev)
|
|||
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
|
||||
|
||||
return PSDRV_WriteSetFont(dev, physDev->font.fontinfo.Builtin.afm->FontName,
|
||||
physDev->font.size, physDev->font.escapement);
|
||||
physDev->font.size, physDev->font.escapement, FALSE);
|
||||
}
|
||||
|
||||
BOOL PSDRV_WriteBuiltinGlyphShow(PHYSDEV dev, LPCWSTR str, INT count)
|
||||
|
|
|
@ -239,6 +239,24 @@ static inline float ps_round(float f)
|
|||
{
|
||||
return (f > 0) ? (f + 0.5) : (f - 0.5);
|
||||
}
|
||||
|
||||
static BOOL is_fake_italic( HDC hdc )
|
||||
{
|
||||
TEXTMETRICW tm;
|
||||
BYTE head[54]; /* the head table is 54 bytes long */
|
||||
WORD mac_style;
|
||||
|
||||
GetTextMetricsW( hdc, &tm );
|
||||
if (!tm.tmItalic) return FALSE;
|
||||
|
||||
if (GetFontData( hdc, MS_MAKE_TAG('h','e','a','d'), 0, head, sizeof(head) ) == GDI_ERROR)
|
||||
return FALSE;
|
||||
|
||||
mac_style = GET_BE_WORD( head + 44 );
|
||||
TRACE( "mac style %04x\n", mac_style );
|
||||
return !(mac_style & 2);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* PSDRV_WriteSetDownloadFont
|
||||
*
|
||||
|
@ -328,7 +346,8 @@ BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev)
|
|||
}
|
||||
|
||||
|
||||
PSDRV_WriteSetFont(dev, ps_name, physDev->font.size, physDev->font.escapement);
|
||||
PSDRV_WriteSetFont(dev, ps_name, physDev->font.size, physDev->font.escapement,
|
||||
is_fake_italic( dev->hdc ));
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, ps_name);
|
||||
HeapFree(GetProcessHeap(), 0, potm);
|
||||
|
|
|
@ -129,11 +129,23 @@ static const char psrectangle[] = /* x, y, width, height, -width */
|
|||
static const char psglyphshow[] = /* glyph name */
|
||||
"/%s glyphshow\n";
|
||||
|
||||
static const char pssetfont[] = /* fontname, xx_scale, xy_scale, yx_scale, yy_scale, escapement */
|
||||
"/%s findfont\n"
|
||||
"[%d %d %d %d 0 0]\n"
|
||||
static const char psfindfont[] = /* fontname */
|
||||
"/%s findfont\n";
|
||||
|
||||
static const char psfakeitalic[] =
|
||||
"[1 0 0.25 1 0 0]\n";
|
||||
|
||||
static const char pssizematrix[] =
|
||||
"[%d %d %d %d 0 0]\n";
|
||||
|
||||
static const char psconcat[] =
|
||||
"matrix concatmatrix\n";
|
||||
|
||||
static const char psrotatefont[] = /* escapement */
|
||||
"%d 10 div matrix rotate\n"
|
||||
"matrix concatmatrix\n"
|
||||
"matrix concatmatrix\n";
|
||||
|
||||
static const char pssetfont[] =
|
||||
"makefont setfont\n";
|
||||
|
||||
static const char pssetline[] = /* width, join, endcap */
|
||||
|
@ -554,22 +566,36 @@ BOOL PSDRV_WriteCurveTo(PHYSDEV dev, POINT pts[3])
|
|||
return PSDRV_WriteSpool(dev, buf, strlen(buf));
|
||||
}
|
||||
|
||||
|
||||
BOOL PSDRV_WriteSetFont(PHYSDEV dev, const char *name, matrix size, INT escapement)
|
||||
BOOL PSDRV_WriteSetFont(PHYSDEV dev, const char *name, matrix size, INT escapement, BOOL fake_italic)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
buf = HeapAlloc( GetProcessHeap(), 0, sizeof(pssetfont) + strlen(name) + 40 );
|
||||
buf = HeapAlloc( GetProcessHeap(), 0, strlen(name) + 256 );
|
||||
|
||||
if(!buf) {
|
||||
WARN("HeapAlloc failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
sprintf(buf, pssetfont, name, size.xx, size.xy, size.yx, size.yy, -escapement);
|
||||
sprintf( buf, psfindfont, name );
|
||||
PSDRV_WriteSpool( dev, buf, strlen(buf) );
|
||||
|
||||
PSDRV_WriteSpool(dev, buf, strlen(buf));
|
||||
if (fake_italic) PSDRV_WriteSpool( dev, psfakeitalic, sizeof(psfakeitalic) - 1 );
|
||||
|
||||
sprintf( buf, pssizematrix, size.xx, size.xy, size.yx, size.yy );
|
||||
PSDRV_WriteSpool( dev, buf, strlen(buf) );
|
||||
|
||||
if (fake_italic) PSDRV_WriteSpool( dev, psconcat, sizeof(psconcat) - 1 );
|
||||
|
||||
if (escapement)
|
||||
{
|
||||
sprintf( buf, psrotatefont, -escapement );
|
||||
PSDRV_WriteSpool( dev, buf, strlen(buf) );
|
||||
}
|
||||
|
||||
PSDRV_WriteSpool( dev, pssetfont, sizeof(pssetfont) - 1 );
|
||||
HeapFree( GetProcessHeap(), 0, buf );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -489,7 +489,8 @@ extern BOOL PSDRV_WriteLineTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN;
|
|||
extern BOOL PSDRV_WriteStroke(PHYSDEV dev) DECLSPEC_HIDDEN;
|
||||
extern BOOL PSDRV_WriteRectangle(PHYSDEV dev, INT x, INT y, INT width, INT height) DECLSPEC_HIDDEN;
|
||||
extern BOOL PSDRV_WriteRRectangle(PHYSDEV dev, INT x, INT y, INT width, INT height) DECLSPEC_HIDDEN;
|
||||
extern BOOL PSDRV_WriteSetFont(PHYSDEV dev, const char *name, matrix size, INT escapement) DECLSPEC_HIDDEN;
|
||||
extern BOOL PSDRV_WriteSetFont(PHYSDEV dev, const char *name, matrix size, INT escapement,
|
||||
BOOL fake_italic) DECLSPEC_HIDDEN;
|
||||
extern BOOL PSDRV_WriteGlyphShow(PHYSDEV dev, LPCSTR g_name) DECLSPEC_HIDDEN;
|
||||
extern BOOL PSDRV_WriteSetPen(PHYSDEV dev) DECLSPEC_HIDDEN;
|
||||
extern BOOL PSDRV_WriteArc(PHYSDEV dev, INT x, INT y, INT w, INT h,
|
||||
|
|
Loading…
Reference in New Issue