[4/4] gdiplus: GdipStringFormatGetGenericTypographic implemented

Nikolay Sivov bunglehead at gmail.com
Mon Jul 28 16:13:06 CDT 2008


Changelog:
    - implemented GdipStringFormatGetGenericTypographic with tests

---
 dlls/gdiplus/gdiplus.spec         |    2 +-
 dlls/gdiplus/stringformat.c       |   24 ++++++++++++++++++++++
 dlls/gdiplus/tests/stringformat.c |   39 +++++++++++++++++++++++++++++++++++++
 include/gdiplusflat.h             |    1 +
 4 files changed, 65 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index e3186a3..0579ebe 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -601,7 +601,7 @@
 @ stdcall GdipShearMatrix(ptr long long long)
 @ stdcall GdipStartPathFigure(ptr)
 @ stdcall GdipStringFormatGetGenericDefault(ptr)
-@ stub GdipStringFormatGetGenericTypographic
+@ stdcall GdipStringFormatGetGenericTypographic(ptr)
 @ stub GdipTestControl
 @ stdcall GdipTransformMatrixPoints(ptr ptr long)
 @ stdcall GdipTransformMatrixPointsI(ptr ptr long)
diff --git a/dlls/gdiplus/stringformat.c b/dlls/gdiplus/stringformat.c
index 4bd5bb3..1be075b 100644
--- a/dlls/gdiplus/stringformat.c
+++ b/dlls/gdiplus/stringformat.c
@@ -237,3 +237,27 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt
 
     return Ok;
 }
+
+/*FIXME: add zero tab stops number */
+GpStatus WINGDIPAPI GdipStringFormatGetGenericTypographic(GpStringFormat **format)
+{
+    GpStatus stat;
+
+    if(!format)
+        return InvalidParameter;
+
+    stat = GdipCreateStringFormat(StringFormatFlagsNoFitBlackBox |
+                                  StringFormatFlagsLineLimit |
+                                  StringFormatFlagsNoClip, LANG_NEUTRAL, format);
+    if(stat != Ok)
+        return stat;
+
+    (*format)->digitlang = LANG_NEUTRAL;
+    (*format)->digitsub  = StringDigitSubstituteUser;
+    (*format)->trimming  = StringTrimmingNone;
+    (*format)->hkprefix  = HotkeyPrefixNone;
+    (*format)->align     = StringAlignmentNear;
+    (*format)->vertalign = StringAlignmentNear;
+
+    return Ok;
+}
diff --git a/dlls/gdiplus/tests/stringformat.c b/dlls/gdiplus/tests/stringformat.c
index 68d9d35..bbe0868 100644
--- a/dlls/gdiplus/tests/stringformat.c
+++ b/dlls/gdiplus/tests/stringformat.c
@@ -130,6 +130,44 @@ static void test_digitsubstitution(void)
     expect(Ok, stat);
 }
 
+static void test_getgenerictypographic(void)
+{
+    GpStringFormat *format;
+    GpStatus stat;
+    INT flags;
+    INT n;
+    StringAlignment align, valign;
+    StringTrimming trimming;
+    StringDigitSubstitute digitsub;
+    LANGID digitlang;
+
+    /* NULL arg */
+    stat = GdipStringFormatGetGenericTypographic(NULL);
+    expect(InvalidParameter, stat);
+
+    stat = GdipStringFormatGetGenericTypographic(&format);
+    expect(Ok, stat);
+
+    GdipGetStringFormatFlags(format, &flags);
+    GdipGetStringFormatAlign(format, &align);
+    GdipGetStringFormatLineAlign(format, &valign);
+    GdipGetStringFormatHotkeyPrefix(format, &n);
+    GdipGetStringFormatTrimming(format, &trimming);
+    GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
+
+    expect((StringFormatFlagsNoFitBlackBox |StringFormatFlagsLineLimit | StringFormatFlagsNoClip),
+            flags);
+    expect(HotkeyPrefixNone, n);
+    expect(StringAlignmentNear, align);
+    expect(StringAlignmentNear, align);
+    expect(StringTrimmingNone, trimming);
+    expect(StringDigitSubstituteUser, digitsub);
+    expect(LANG_NEUTRAL, digitlang);  
+
+    stat = GdipDeleteStringFormat(format);
+    expect(Ok, stat);
+}
+
 START_TEST(stringformat)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -145,6 +183,7 @@ START_TEST(stringformat)
     test_constructor();
     test_characterrange();
     test_digitsubstitution();
+    test_getgenerictypographic();
 
     GdiplusShutdown(gdiplusToken);
 }
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index ea4f200..963c9c6 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -435,6 +435,7 @@ GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList(GpFontCollection*, INT,
 GpStatus WINGDIPAPI GdipCreateStringFormat(INT,LANGID,GpStringFormat**);
 GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat*);
 GpStatus WINGDIPAPI GdipStringFormatGetGenericDefault(GpStringFormat **);
+GpStatus WINGDIPAPI GdipStringFormatGetGenericTypographic(GpStringFormat **);
 GpStatus WINGDIPAPI GdipGetStringFormatAlign(GpStringFormat*,StringAlignment*);
 GpStatus WINGDIPAPI GdipGetStringFormatDigitSubstitution(GDIPCONST GpStringFormat*,LANGID*,
         StringDigitSubstitute*);
-- 
1.4.4.4






More information about the wine-patches mailing list