Commit 4e1de86d authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

wineps: Don't use BUILTIN structure on PE side.

parent 96a6d1fd
...@@ -68,30 +68,26 @@ static VOID ScaleFont(const AFM *afm, LONG lfHeight, PSFONT *font, ...@@ -68,30 +68,26 @@ static VOID ScaleFont(const AFM *afm, LONG lfHeight, PSFONT *font,
const WINMETRICS *wm = &(afm->WinMetrics); const WINMETRICS *wm = &(afm->WinMetrics);
USHORT usUnitsPerEm, usWinAscent, usWinDescent; USHORT usUnitsPerEm, usWinAscent, usWinDescent;
SHORT sAscender, sDescender, sLineGap, sAvgCharWidth; SHORT sAscender, sDescender, sLineGap, sAvgCharWidth;
float scale;
TRACE("'%s' %li\n", afm->FontName, lfHeight); TRACE("'%s' %li\n", afm->FontName, lfHeight);
if (lfHeight < 0) /* match em height */ if (lfHeight < 0) /* match em height */
{ scale = - ((float)lfHeight / (float)(wm->usUnitsPerEm));
font->fontinfo.Builtin.scale = - ((float)lfHeight / (float)(wm->usUnitsPerEm));
}
else /* match cell height */ else /* match cell height */
{ scale = (float)lfHeight / (float)(wm->usWinAscent + wm->usWinDescent);
font->fontinfo.Builtin.scale = (float)lfHeight /
(float)(wm->usWinAscent + wm->usWinDescent);
}
font->size.xx = (INT)Round(font->fontinfo.Builtin.scale * (float)wm->usUnitsPerEm); font->size.xx = (INT)Round(scale * (float)wm->usUnitsPerEm);
font->size.xy = font->size.yx = 0; font->size.xy = font->size.yx = 0;
font->size.yy = -(INT)Round(font->fontinfo.Builtin.scale * (float)wm->usUnitsPerEm); font->size.yy = -(INT)Round(scale * (float)wm->usUnitsPerEm);
usUnitsPerEm = (USHORT)Round((float)(wm->usUnitsPerEm) * font->fontinfo.Builtin.scale); usUnitsPerEm = (USHORT)Round((float)(wm->usUnitsPerEm) * scale);
sAscender = (SHORT)Round((float)(wm->sAscender) * font->fontinfo.Builtin.scale); sAscender = (SHORT)Round((float)(wm->sAscender) * scale);
sDescender = (SHORT)Round((float)(wm->sDescender) * font->fontinfo.Builtin.scale); sDescender = (SHORT)Round((float)(wm->sDescender) * scale);
sLineGap = (SHORT)Round((float)(wm->sLineGap) * font->fontinfo.Builtin.scale); sLineGap = (SHORT)Round((float)(wm->sLineGap) * scale);
usWinAscent = (USHORT)Round((float)(wm->usWinAscent) * font->fontinfo.Builtin.scale); usWinAscent = (USHORT)Round((float)(wm->usWinAscent) * scale);
usWinDescent = (USHORT)Round((float)(wm->usWinDescent) * font->fontinfo.Builtin.scale); usWinDescent = (USHORT)Round((float)(wm->usWinDescent) * scale);
sAvgCharWidth = (SHORT)Round((float)(wm->sAvgCharWidth) * font->fontinfo.Builtin.scale); sAvgCharWidth = (SHORT)Round((float)(wm->sAvgCharWidth) * scale);
tm->tmAscent = (LONG)usWinAscent; tm->tmAscent = (LONG)usWinAscent;
tm->tmDescent = (LONG)usWinDescent; tm->tmDescent = (LONG)usWinDescent;
...@@ -133,10 +129,10 @@ static VOID ScaleFont(const AFM *afm, LONG lfHeight, PSFONT *font, ...@@ -133,10 +129,10 @@ static VOID ScaleFont(const AFM *afm, LONG lfHeight, PSFONT *font,
* similarly adjusted.. * similarly adjusted..
*/ */
font->fontinfo.Builtin.scale *= (float)wm->usUnitsPerEm / 1000.0; scale *= (float)wm->usUnitsPerEm / 1000.0;
tm->tmMaxCharWidth = (LONG)Round( tm->tmMaxCharWidth = (LONG)Round(
(afm->FontBBox.urx - afm->FontBBox.llx) * font->fontinfo.Builtin.scale); (afm->FontBBox.urx - afm->FontBBox.llx) * scale);
TRACE("Selected PS font '%s' size %d weight %ld.\n", afm->FontName, TRACE("Selected PS font '%s' size %d weight %ld.\n", afm->FontName,
font->size.xx, tm->tmWeight ); font->size.xx, tm->tmWeight );
...@@ -159,6 +155,7 @@ BOOL PSDRV_SelectBuiltinFont(PHYSDEV dev, HFONT hfont, ...@@ -159,6 +155,7 @@ BOOL PSDRV_SelectBuiltinFont(PHYSDEV dev, HFONT hfont,
AFMLISTENTRY *afmle; AFMLISTENTRY *afmle;
FONTFAMILY *family; FONTFAMILY *family;
BOOL bd = FALSE, it = FALSE; BOOL bd = FALSE, it = FALSE;
TEXTMETRICW tm;
LONG height; LONG height;
TRACE("Trying to find facename %s\n", debugstr_w(face_name)); TRACE("Trying to find facename %s\n", debugstr_w(face_name));
...@@ -207,7 +204,6 @@ BOOL PSDRV_SelectBuiltinFont(PHYSDEV dev, HFONT hfont, ...@@ -207,7 +204,6 @@ BOOL PSDRV_SelectBuiltinFont(PHYSDEV dev, HFONT hfont,
TRACE("Got font '%s'\n", afmle->afm->FontName); TRACE("Got font '%s'\n", afmle->afm->FontName);
physDev->font.fontloc = Builtin; physDev->font.fontloc = Builtin;
physDev->font.fontinfo.Builtin.afm = afmle->afm;
height = plf->lfHeight; height = plf->lfHeight;
/* stock fonts ignore the mapping mode */ /* stock fonts ignore the mapping mode */
...@@ -218,24 +214,29 @@ BOOL PSDRV_SelectBuiltinFont(PHYSDEV dev, HFONT hfont, ...@@ -218,24 +214,29 @@ BOOL PSDRV_SelectBuiltinFont(PHYSDEV dev, HFONT hfont,
LPtoDP(dev->hdc, pts, 2); LPtoDP(dev->hdc, pts, 2);
height = pts[1].y - pts[0].y; height = pts[1].y - pts[0].y;
} }
ScaleFont(physDev->font.fontinfo.Builtin.afm, height, ScaleFont(afmle->afm, height,
&(physDev->font), &(physDev->font.fontinfo.Builtin.tm)); &(physDev->font), &tm);
/* Does anyone know if these are supposed to be reversed like this? */ /* Does anyone know if these are supposed to be reversed like this? */
tm.tmDigitizedAspectX = physDev->logPixelsY;
physDev->font.fontinfo.Builtin.tm.tmDigitizedAspectX = physDev->logPixelsY; tm.tmDigitizedAspectY = physDev->logPixelsX;
physDev->font.fontinfo.Builtin.tm.tmDigitizedAspectY = physDev->logPixelsX;
return TRUE; return TRUE;
} }
BOOL PSDRV_WriteSetBuiltinFont(PHYSDEV dev) BOOL PSDRV_WriteSetBuiltinFont(PHYSDEV dev)
{ {
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); struct font_info font_info;
matrix size;
return PSDRV_WriteSetFont(dev, physDev->font.fontinfo.Builtin.afm->FontName,
physDev->font.size, physDev->font.escapement, FALSE); ExtEscape(dev->hdc, PSDRV_GET_BUILTIN_FONT_INFO, 0, NULL,
sizeof(font_info), (char *)&font_info);
size.xx = font_info.size.cx;
size.yy = font_info.size.cy;
size.xy = size.yx = 0;
return PSDRV_WriteSetFont(dev, font_info.font_name, size,
font_info.escapement, FALSE);
} }
BOOL PSDRV_WriteBuiltinGlyphShow(PHYSDEV dev, LPCWSTR str, INT count) BOOL PSDRV_WriteBuiltinGlyphShow(PHYSDEV dev, LPCWSTR str, INT count)
......
...@@ -809,6 +809,22 @@ static int CDECL ext_escape(PHYSDEV dev, int escape, int input_size, const void ...@@ -809,6 +809,22 @@ static int CDECL ext_escape(PHYSDEV dev, int escape, int input_size, const void
return 1; return 1;
} }
case PSDRV_GET_BUILTIN_FONT_INFO:
{
PSDRV_PDEVICE *pdev = get_psdrv_dev(dev);
struct font_info *font_info = (struct font_info *)output;
if (pdev->font.fontloc != Builtin)
return 0;
lstrcpynA(font_info->font_name, pdev->font.fontinfo.Builtin.afm->FontName,
sizeof(font_info->font_name));
font_info->size.cx = pdev->font.size.xx;
font_info->size.cy = pdev->font.size.yy;
font_info->escapement = pdev->font.escapement;
return 1;
}
default: default:
FIXME("Unimplemented code %d\n", escape); FIXME("Unimplemented code %d\n", escape);
return 0; return 0;
......
...@@ -20,6 +20,14 @@ ...@@ -20,6 +20,14 @@
#include "wine/unixlib.h" #include "wine/unixlib.h"
#define PSDRV_GET_GLYPH_NAME 0x10000 #define PSDRV_GET_GLYPH_NAME 0x10000
#define PSDRV_GET_BUILTIN_FONT_INFO 0x10001
struct font_info
{
char font_name[LF_FACESIZE];
SIZE size;
int escapement;
};
enum wineps_funcs enum wineps_funcs
{ {
......
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