[PATCH 2/3] gdiplus: Add internal string format properties used by EMF+ records

Nikolay Sivov <[email protected]>
Newsgroups gmane.comp.emulators.wine.patches
Message-ID <[email protected]>
Signed-off-by: Nikolay Sivov <[email protected]>
---
 dlls/gdiplus/gdiplus_private.h |  4 +++-
 dlls/gdiplus/graphics.c        |  6 +++---
 dlls/gdiplus/stringformat.c    | 15 ++++++---------
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 76e5b9b378..40275a47eb 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -522,7 +522,9 @@ struct GpStringFormat{
     REAL *tabs;
     CharacterRange *character_ranges;
     INT range_count;
-    BOOL generic_typographic;
+    REAL leading_margin;
+    REAL trailing_margin;
+    REAL tracking;
 };
 
 extern void init_generic_string_formats(void) DECLSPEC_HIDDEN;
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 06fb89e5d3..60dc82c0be 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -5298,7 +5298,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
     args.rel_height = sqrt((pt[2].Y-pt[0].Y)*(pt[2].Y-pt[0].Y)+
                       (pt[2].X-pt[0].X)*(pt[2].X-pt[0].X));
 
-    margin_x = stringFormat->generic_typographic ? 0.0 : font->emSize / 6.0;
+    margin_x = stringFormat->leading_margin * font->emSize;
     margin_x *= units_scale(font->unit, graphics->unit, graphics->xres);
 
     scaled_rect.X = (layoutRect->X + margin_x) * args.rel_width;
@@ -5421,7 +5421,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
     args.rel_height = sqrt((pt[2].Y-pt[0].Y)*(pt[2].Y-pt[0].Y)+
                       (pt[2].X-pt[0].X)*(pt[2].X-pt[0].X));
 
-    margin_x = (format && format->generic_typographic) ? 0.0 : font->emSize / 6.0;
+    margin_x = format ? font->emSize * format->leading_margin : font->emSize / 6.0;
     margin_x *= units_scale(font->unit, graphics->unit, graphics->xres);
 
     scaled_rect.X = (rect->X + margin_x) * args.rel_width;
@@ -5599,7 +5599,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
     gdip_transform_points(graphics, WineCoordinateSpaceGdiDevice, CoordinateSpaceWorld, rectcpy, 4);
     round_points(corners, rectcpy, 4);
 
-    margin_x = (format && format->generic_typographic) ? 0.0 : font->emSize / 6.0;
+    margin_x = format ? format->leading_margin * font->emSize : font->emSize / 6.0;
     margin_x *= units_scale(font->unit, graphics->unit, graphics->xres);
 
     scaled_rect.X = margin_x * rel_width;
diff --git a/dlls/gdiplus/stringformat.c b/dlls/gdiplus/stringformat.c
index e376e7b36c..55bc20930a 100644
--- a/dlls/gdiplus/stringformat.c
+++ b/dlls/gdiplus/stringformat.c
@@ -47,7 +47,9 @@ const GpStringFormat default_drawstring_format =
     NULL,
     NULL,
     0,
-    FALSE
+    0.0f,
+    0.0f,
+    1.0f,
 };
 
 static GpStringFormat generic_default_format;
@@ -61,7 +63,6 @@ void init_generic_string_formats(void)
     generic_typographic_format.attr = StringFormatFlagsNoFitBlackBox | StringFormatFlagsLineLimit |
         StringFormatFlagsNoClip;
     generic_typographic_format.trimming = StringTrimmingNone;
-    generic_typographic_format.generic_typographic = TRUE;
 }
 
 void free_generic_string_formats(void)
@@ -89,13 +90,9 @@ GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
     (*format)->digitlang = LANG_NEUTRAL;
     (*format)->trimming = StringTrimmingCharacter;
     (*format)->digitsub = StringDigitSubstituteUser;
-    (*format)->character_ranges = NULL;
-    (*format)->range_count = 0;
-    (*format)->generic_typographic = FALSE;
-    /* tabstops */
-    (*format)->tabcount = 0;
-    (*format)->firsttab = 0.0;
-    (*format)->tabs = NULL;
+    (*format)->leading_margin = 1.0 / 6.0;
+    (*format)->trailing_margin = 1.0 / 6.0;
+    (*format)->tracking = 1.03f;
 
     TRACE("<-- %p\n", *format);
 
-- 
2.14.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.