[Wine-patches] [eter-2.1 1/2] wineps.drv: Add support for TrueType composite glyph transforms. (eterbug #9209).

Dmitry Timoshkov dtimoshkov на etersoft.ru
Вт Апр 2 10:20:11 MSK 2013


(cherry picked from commit a0b4ce601730a43f67de149fd9c66464a6f9ad1e)
---
 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 01c9c7e..6855019 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;
-- 
1.8.2



Подробная информация о списке рассылки Wine-patches