Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/c0bfe7dfdff84f5072975d38263b6fa8d6594f9a
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/c0bfe7dfdff84f5072975d38263b6fa8d6594f9a
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/c0bfe7dfdff84f5072975d38263b6fa8d6594f9a

The branch, master has been updated
       via  c0bfe7dfdff84f5072975d38263b6fa8d6594f9a (commit)
      from  a92f2aa0a6405682084fe040960e710fd3c3179d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commitdiff/c0bfe7dfdff84f5072975d38263b6fa8d6594f9a
commit c0bfe7dfdff84f5072975d38263b6fa8d6594f9a
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    Fix freetype nsfont_position_in_string to return nearest, rather than next.

diff --git a/framebuffer/font_freetype.c b/framebuffer/font_freetype.c
index b3c993f..581fd9a 100644
--- a/framebuffer/font_freetype.c
+++ b/framebuffer/font_freetype.c
@@ -462,6 +462,7 @@ static bool nsfont_position_in_string(const 
plot_font_style_t *fstyle,
         uint32_t ucs4;
         size_t nxtchr = 0;
         FT_Glyph glyph;
+        int prev_x = 0;
 
         *actual_x = 0;
         while (nxtchr < length) {
@@ -475,9 +476,14 @@ static bool nsfont_position_in_string(const 
plot_font_style_t *fstyle,
                 if (*actual_x > x)
                         break;
 
+                prev_x = *actual_x;
                 nxtchr = utf8_next(string, length, nxtchr);
         }
 
+        /* choose nearest of previous and last x */
+        if (abs(*actual_x - x) > abs(prev_x - x))
+                *actual_x = prev_x;
+
         *char_offset = nxtchr;
        return true;
 }


-----------------------------------------------------------------------

Summary of changes:
 framebuffer/font_freetype.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/framebuffer/font_freetype.c b/framebuffer/font_freetype.c
index b3c993f..581fd9a 100644
--- a/framebuffer/font_freetype.c
+++ b/framebuffer/font_freetype.c
@@ -462,6 +462,7 @@ static bool nsfont_position_in_string(const 
plot_font_style_t *fstyle,
         uint32_t ucs4;
         size_t nxtchr = 0;
         FT_Glyph glyph;
+        int prev_x = 0;
 
         *actual_x = 0;
         while (nxtchr < length) {
@@ -475,9 +476,14 @@ static bool nsfont_position_in_string(const 
plot_font_style_t *fstyle,
                 if (*actual_x > x)
                         break;
 
+                prev_x = *actual_x;
                 nxtchr = utf8_next(string, length, nxtchr);
         }
 
+        /* choose nearest of previous and last x */
+        if (abs(*actual_x - x) > abs(prev_x - x))
+                *actual_x = prev_x;
+
         *char_offset = nxtchr;
        return true;
 }


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://vlists.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to