From a0b4ce601730a43f67de149fd9c66464a6f9ad1e Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 1 Apr 2013 19:47:01 +0900 Subject: [PATCH] wineps.drv: Add support for TrueType composite glyph transforms. --- dlls/wineps.drv/type1.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/dlls/wineps.drv/type1.c b/dlls/wineps.drv/type1.c index 01c9c7e86a6..68550190b4c 100644 --- a/dlls/wineps.drv/type1.c +++ b/dlls/wineps.drv/type1.c @@ -423,7 +423,7 @@ static BOOL append_complex_glyph(HDC hdc, const BYTE *data, glyph_outline *outli const BYTE *ptr = data; WORD flags, index; short arg1, arg2; - WORD scale_xx = 1 << 14, scale_xy = 0, scale_yx = 0, scale_yy = 1 << 14; + FLOAT scale_xx = 1, scale_xy = 0, scale_yx = 0, scale_yy = 1; WORD start_pt, end_pt; ptr += 10; @@ -447,37 +447,44 @@ static BOOL append_complex_glyph(HDC hdc, const BYTE *data, glyph_outline *outli } if(flags & WE_HAVE_A_SCALE) { - scale_xx = scale_yy = get_be_word(ptr); + scale_xx = scale_yy = (FLOAT)(short)get_be_word(ptr) / 0x4000; ptr += 2; } else if(flags & WE_HAVE_AN_X_AND_Y_SCALE) { - scale_xx = get_be_word(ptr); + scale_xx = (FLOAT)(short)get_be_word(ptr) / 0x4000; ptr += 2; - scale_yy = get_be_word(ptr); + scale_yy = (FLOAT)(short)get_be_word(ptr) / 0x4000; ptr += 2; } else if(flags & WE_HAVE_A_TWO_BY_TWO) { - scale_xx = get_be_word(ptr); + scale_xx = (FLOAT)(short)get_be_word(ptr) / 0x4000; ptr += 2; - scale_xy = get_be_word(ptr); + scale_xy = (FLOAT)(short)get_be_word(ptr) / 0x4000; ptr += 2; - scale_yx = get_be_word(ptr); + scale_yx = (FLOAT)(short)get_be_word(ptr) / 0x4000; ptr += 2; - scale_yy = get_be_word(ptr); + scale_yy = (FLOAT)(short)get_be_word(ptr) / 0x4000; ptr += 2; } - if ((flags & (WE_HAVE_A_SCALE | WE_HAVE_AN_X_AND_Y_SCALE | WE_HAVE_A_TWO_BY_TWO)) && - (scale_xx != 1 << 14 || scale_yy != 1 << 14 || scale_xy || scale_yx)) - FIXME( "unhandled scaling %x,%x,%x,%x of glyph %x\n", - scale_xx, scale_xy, scale_yx, scale_yy, index ); - start_pt = pts_in_outline(outline); append_glyph_outline(hdc, index, outline); end_pt = pts_in_outline(outline); + if (flags & (WE_HAVE_A_SCALE | WE_HAVE_AN_X_AND_Y_SCALE | WE_HAVE_A_TWO_BY_TWO)) + { + WORD i; + TRACE("transform %f,%f,%f,%f of glyph %x\n", scale_xx, scale_xy, scale_yx, scale_yy, index); + for (i = start_pt; i < end_pt; i++) + { + LONG x = outline->pts[i].x, y = outline->pts[i].y; + outline->pts[i].x = x * scale_xx + y * scale_yx; + outline->pts[i].y = x * scale_xy + y * scale_yy; + } + } + if((flags & ARGS_ARE_XY_VALUES) == 0) { WORD orig_pt = arg1, new_pt = arg2; -- 2.11.4.GIT