Code

Export. add emf text rotation (Bug 681262)
authorAlvin Penner <penner@vaxxine.com>
Fri, 7 Jan 2011 23:44:43 +0000 (18:44 -0500)
committerAlvin Penner <penner@vaxxine.com>
Fri, 7 Jan 2011 23:44:43 +0000 (18:44 -0500)
src/extension/internal/emf-win32-print.cpp

index c7f8e3d4cb93f66207638057385d990ba09282aa..e1ef77ae51c24ea2b59334a5bafa37ab5cc47220 100644 (file)
@@ -863,6 +863,8 @@ PrintEmfWin32::text(Inkscape::Extension::Print * /*mod*/, char const *text, Geom
     if (!hdc) return 0;
 
     HFONT hfont = NULL;
+    Geom::Matrix tf = m_tr_stack.top();
+    double rot = 1800.0*std::atan2(tf[1], tf[0])/M_PI; // 0.1 degree rotation
     
 #ifdef USE_PANGO_WIN32
 /*
@@ -883,8 +885,8 @@ PrintEmfWin32::text(Inkscape::Extension::Print * /*mod*/, char const *text, Geom
             
             lf->lfHeight = style->font_size.computed * IN_PER_PX * dwDPI;
             lf->lfWidth = 0;
-            lf->lfEscapement = 0;
-            lf->lfOrientation = 0;
+            lf->lfEscapement = rot;
+            lf->lfOrientation = rot;
             lf->lfWeight =
                 style->font_weight.computed == SP_CSS_FONT_WEIGHT_100 ? FW_THIN :
                 style->font_weight.computed == SP_CSS_FONT_WEIGHT_200 ? FW_EXTRALIGHT :
@@ -919,8 +921,8 @@ PrintEmfWin32::text(Inkscape::Extension::Print * /*mod*/, char const *text, Geom
             
             lf->lfHeight = style->font_size.computed * IN_PER_PX * dwDPI;
             lf->lfWidth = 0;
-            lf->lfEscapement = 0;
-            lf->lfOrientation = 0;
+            lf->lfEscapement = rot;
+            lf->lfOrientation = rot;
             lf->lfWeight =
                 style->font_weight.computed == SP_CSS_FONT_WEIGHT_100 ? FW_THIN :
                 style->font_weight.computed == SP_CSS_FONT_WEIGHT_200 ? FW_EXTRALIGHT :
@@ -964,8 +966,6 @@ PrintEmfWin32::text(Inkscape::Extension::Print * /*mod*/, char const *text, Geom
     // Transparent text background
     SetBkMode(hdc, TRANSPARENT);
 
-    Geom::Matrix tf = m_tr_stack.top();
-
     p = p * tf;
     p[Geom::X] = (p[Geom::X] * IN_PER_PX * dwDPI);
     p[Geom::Y] = (p[Geom::Y] * IN_PER_PX * dwDPI);