Nikolay Sivov : dwrite: Implement layout getters derived from text format.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 18 16:08:48 CDT 2014


Module: wine
Branch: master
Commit: c8ec6918c74cdda8389ae11e9418e6409b885495
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c8ec6918c74cdda8389ae11e9418e6409b885495

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Aug 15 07:27:30 2014 +0400

dwrite: Implement layout getters derived from text format.

---

 dlls/dwrite/layout.c       | 74 +++++++++++++++++++++++++++++-----------------
 dlls/dwrite/tests/layout.c |  2 --
 2 files changed, 47 insertions(+), 29 deletions(-)

diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c
index aed6652..7a4ac18 100644
--- a/dlls/dwrite/layout.c
+++ b/dlls/dwrite/layout.c
@@ -560,36 +560,36 @@ static HRESULT WINAPI dwritetextlayout_SetLineSpacing(IDWriteTextLayout *iface,
 static DWRITE_TEXT_ALIGNMENT WINAPI dwritetextlayout_GetTextAlignment(IDWriteTextLayout *iface)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p): stub\n", This);
-    return DWRITE_TEXT_ALIGNMENT_LEADING;
+    TRACE("(%p)\n", This);
+    return This->format.textalignment;
 }
 
 static DWRITE_PARAGRAPH_ALIGNMENT WINAPI dwritetextlayout_GetParagraphAlignment(IDWriteTextLayout *iface)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p): stub\n", This);
-    return DWRITE_PARAGRAPH_ALIGNMENT_NEAR;
+    TRACE("(%p)\n", This);
+    return This->format.paralign;
 }
 
 static DWRITE_WORD_WRAPPING WINAPI dwritetextlayout_GetWordWrapping(IDWriteTextLayout *iface)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
     FIXME("(%p): stub\n", This);
-    return DWRITE_WORD_WRAPPING_NO_WRAP;
+    return This->format.wrapping;
 }
 
 static DWRITE_READING_DIRECTION WINAPI dwritetextlayout_GetReadingDirection(IDWriteTextLayout *iface)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p): stub\n", This);
-    return DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
+    TRACE("(%p)\n", This);
+    return This->format.readingdir;
 }
 
 static DWRITE_FLOW_DIRECTION WINAPI dwritetextlayout_GetFlowDirection(IDWriteTextLayout *iface)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p): stub\n", This);
-    return DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM;
+    TRACE("(%p)\n", This);
+    return This->format.flow;
 }
 
 static FLOAT WINAPI dwritetextlayout_GetIncrementalTabStop(IDWriteTextLayout *iface)
@@ -603,65 +603,85 @@ static HRESULT WINAPI dwritetextlayout_GetTrimming(IDWriteTextLayout *iface, DWR
     IDWriteInlineObject **trimming_sign)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p)->(%p %p): stub\n", This, options, trimming_sign);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p %p)\n", This, options, trimming_sign);
+
+    *options = This->format.trimming;
+    *trimming_sign = This->format.trimmingsign;
+    if (*trimming_sign)
+        IDWriteInlineObject_AddRef(*trimming_sign);
+    return S_OK;
 }
 
 static HRESULT WINAPI dwritetextlayout_GetLineSpacing(IDWriteTextLayout *iface, DWRITE_LINE_SPACING_METHOD *method,
     FLOAT *spacing, FLOAT *baseline)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p)->(%p %p %p): stub\n", This, method, spacing, baseline);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p %p %p)\n", This, method, spacing, baseline);
+
+    *method = This->format.spacingmethod;
+    *spacing = This->format.spacing;
+    *baseline = This->format.baseline;
+    return S_OK;
 }
 
 static HRESULT WINAPI dwritetextlayout_GetFontCollection(IDWriteTextLayout *iface, IDWriteFontCollection **collection)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p)->(%p): stub\n", This, collection);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, collection);
+
+    *collection = This->format.collection;
+    if (*collection)
+        IDWriteFontCollection_AddRef(*collection);
+    return S_OK;
 }
 
 static UINT32 WINAPI dwritetextlayout_GetFontFamilyNameLength(IDWriteTextLayout *iface)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p): stub\n", This);
-    return 0;
+    TRACE("(%p)\n", This);
+    return This->format.family_len;
 }
 
 static HRESULT WINAPI dwritetextlayout_GetFontFamilyName(IDWriteTextLayout *iface, WCHAR *name, UINT32 size)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p)->(%p %u): stub\n", This, name, size);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p %u)\n", This, name, size);
+
+    if (size <= This->format.family_len) return E_NOT_SUFFICIENT_BUFFER;
+    strcpyW(name, This->format.family_name);
+    return S_OK;
 }
 
 static DWRITE_FONT_WEIGHT WINAPI dwritetextlayout_GetFontWeight(IDWriteTextLayout *iface)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p): stub\n", This);
-    return DWRITE_FONT_WEIGHT_NORMAL;
+    TRACE("(%p)\n", This);
+    return This->format.weight;
 }
 
 static DWRITE_FONT_STYLE WINAPI dwritetextlayout_GetFontStyle(IDWriteTextLayout *iface)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p): stub\n", This);
-    return DWRITE_FONT_STYLE_NORMAL;
+    TRACE("(%p)\n", This);
+    return This->format.style;
 }
 
 static DWRITE_FONT_STRETCH WINAPI dwritetextlayout_GetFontStretch(IDWriteTextLayout *iface)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p): stub\n", This);
-    return DWRITE_FONT_STRETCH_NORMAL;
+    TRACE("(%p)\n", This);
+    return This->format.stretch;
 }
 
 static FLOAT WINAPI dwritetextlayout_GetFontSize(IDWriteTextLayout *iface)
 {
     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
-    FIXME("(%p): stub\n", This);
-    return 0.0;
+    TRACE("(%p)\n", This);
+    return This->format.size;
 }
 
 static UINT32 WINAPI dwritetextlayout_GetLocaleNameLength(IDWriteTextLayout *iface)
diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index 236c34b..019a8f7 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -558,7 +558,6 @@ static void test_fontweight(void)
     ok(hr == S_OK, "got 0x%08x\n", hr);
 
     weight = IDWriteTextFormat_GetFontWeight(fmt2);
-todo_wine
     ok(weight == DWRITE_FONT_WEIGHT_BOLD, "got %u\n", weight);
 
     range.startPosition = 0;
@@ -568,7 +567,6 @@ todo_wine
 
     /* IDWriteTextFormat methods output doesn't reflect layout changes */
     weight = IDWriteTextFormat_GetFontWeight(fmt2);
-todo_wine
     ok(weight == DWRITE_FONT_WEIGHT_BOLD, "got %u\n", weight);
 
     range.length = 0;




More information about the wine-cvs mailing list