Nikolay Sivov : dwrite: Added support for DWRITE_WORD_WRAPPING_CHARACTER mode.

Alexandre Julliard julliard at winehq.org
Tue Jan 31 15:42:51 CST 2017


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Jan 31 14:43:10 2017 +0300

dwrite: Added support for DWRITE_WORD_WRAPPING_CHARACTER mode.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/layout.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c
index 3d931cb..adc3493 100644
--- a/dlls/dwrite/layout.c
+++ b/dlls/dwrite/layout.c
@@ -1868,6 +1868,14 @@ static void layout_add_line(struct dwrite_textlayout *layout, UINT32 first_clust
     *textpos += metrics.length;
 }
 
+static BOOL layout_can_wrap_after(const struct dwrite_textlayout *layout, UINT32 cluster)
+{
+    if (layout->format.wrapping == DWRITE_WORD_WRAPPING_CHARACTER)
+        return TRUE;
+
+    return layout->clustermetrics[cluster].canWrapLineAfter;
+}
+
 static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
 {
     BOOL is_rtl = layout->format.readingdir == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT;
@@ -1907,7 +1915,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
             if (overflow)
                 break;
 
-            if (layout->clustermetrics[i].canWrapLineAfter)
+            if (layout_can_wrap_after(layout, i))
                 last_breaking_point = i;
             width += layout->clustermetrics[i].width;
             i++;
@@ -1916,7 +1924,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
 
         if (overflow) {
             /* Overflown on whitespace, ignore it */
-            if (layout->clustermetrics[i].isWhitespace && layout->clustermetrics[i].canWrapLineAfter)
+            if (layout->clustermetrics[i].isWhitespace && layout_can_wrap_after(layout, i))
                 i = i;
             /* Use most recently found breaking point */
             else if (last_breaking_point != ~0u) {
@@ -1926,7 +1934,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
             else {
                 /* Otherwise proceed forward to next newline or breaking point */
                 for (; i < layout->cluster_count; i++)
-                    if (layout->clustermetrics[i].canWrapLineAfter || layout->clustermetrics[i].isNewline)
+                    if (layout_can_wrap_after(layout, i) || layout->clustermetrics[i].isNewline)
                         break;
             }
         }




More information about the wine-cvs mailing list