diff options
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/framebuffer/Makefile.defaults | 2 | ||||
-rw-r--r-- | frontends/framebuffer/font_freetype.c | 9 | ||||
-rw-r--r-- | frontends/framebuffer/font_internal.c | 8 | ||||
-rw-r--r-- | frontends/windows/font.c | 24 |
4 files changed, 23 insertions, 20 deletions
diff --git a/frontends/framebuffer/Makefile.defaults b/frontends/framebuffer/Makefile.defaults index 92d837ed4..cc712e992 100644 --- a/frontends/framebuffer/Makefile.defaults +++ b/frontends/framebuffer/Makefile.defaults @@ -47,5 +47,5 @@ NETSURF_FRAMEBUFFER_RESOURCES := $(PREFIX)/share/netsurf/ NETSURF_FB_RESPATH := $${HOME}/.netsurf/:$${NETSURFRES}:$(NETSURF_FRAMEBUFFER_RESOURCES):./frontends/framebuffer/res # freetype compiled in font serch path -NETSURF_FB_FONTPATH := /usr/share/fonts/truetype/ttf-dejavu:/usr/share/fonts/truetype/msttcorefonts +NETSURF_FB_FONTPATH := /usr/share/fonts/truetype/dejavu:/usr/share/fonts/truetype/msttcorefonts diff --git a/frontends/framebuffer/font_freetype.c b/frontends/framebuffer/font_freetype.c index 9235ad476..323982014 100644 --- a/frontends/framebuffer/font_freetype.c +++ b/frontends/framebuffer/font_freetype.c @@ -444,8 +444,7 @@ fb_font_width(const plot_font_style_t *fstyle, *width += glyph->advance.x >> 16; } - - return true; + return NSERROR_OK; } @@ -481,7 +480,7 @@ fb_font_position(const plot_font_style_t *fstyle, *actual_x = prev_x; *char_offset = nxtchr; - return true; + return NSERROR_OK; } @@ -537,7 +536,7 @@ fb_font_split(const plot_font_style_t *fstyle, * found a space; return previous space */ *actual_x = last_space_x; *char_offset = last_space_idx; - return true; + return NSERROR_OK; } nxtchr = utf8_next(string, length, nxtchr); @@ -545,7 +544,7 @@ fb_font_split(const plot_font_style_t *fstyle, *char_offset = nxtchr; - return true; + return NSERROR_OK; } static struct gui_layout_table layout_table = { diff --git a/frontends/framebuffer/font_internal.c b/frontends/framebuffer/font_internal.c index 9164a29db..3fd3ac6ef 100644 --- a/frontends/framebuffer/font_internal.c +++ b/frontends/framebuffer/font_internal.c @@ -364,7 +364,7 @@ fb_font_width(const plot_font_style_t *fstyle, } *width *= fb_get_font_size(fstyle); - return true; + return NSERROR_OK; } @@ -397,7 +397,7 @@ fb_font_position(const plot_font_style_t *fstyle, *actual_x = x_pos; *char_offset = nxtchr; - return true; + return NSERROR_OK; } @@ -455,7 +455,7 @@ fb_font_split(const plot_font_style_t *fstyle, * found a space; return previous space */ *actual_x = last_space_x; *char_offset = last_space_idx; - return true; + return NSERROR_OK; } nxtchr = utf8_next(string, length, nxtchr); @@ -463,7 +463,7 @@ fb_font_split(const plot_font_style_t *fstyle, *char_offset = nxtchr; - return true; + return NSERROR_OK; } diff --git a/frontends/windows/font.c b/frontends/windows/font.c index 551a0eb30..1e99a78d6 100644 --- a/frontends/windows/font.c +++ b/frontends/windows/font.c @@ -138,7 +138,7 @@ HFONT get_font(const plot_font_style_t *style) * \param[in] string UTF-8 string to measure * \param[in] length length of string, in bytes * \param[out] width updated to width of string[0..length) - * \return true on success and width updated else false + * \return NSERROR_OK on success otherwise apropriate error code */ static nserror win32_font_width(const plot_font_style_t *style, @@ -150,7 +150,7 @@ win32_font_width(const plot_font_style_t *style, HFONT font; HFONT fontbak; SIZE s; - bool ret = true; + nserror ret = NSERROR_OK; if (length == 0) { *width = 0; @@ -163,7 +163,7 @@ win32_font_width(const plot_font_style_t *style, if (GetTextExtentPoint32A(hdc, string, length, &s) != 0) { *width = s.cx; } else { - ret = false; + ret = NSERROR_UNKNOWN; } font = SelectObject(hdc, fontbak); DeleteObject(font); @@ -183,7 +183,7 @@ win32_font_width(const plot_font_style_t *style, * \param x x coordinate to search for * \param char_offset updated to offset in string of actual_x, [0..length] * \param actual_x updated to x coordinate of character closest to x - * \return true on success, false on error and error reported + * \return NSERROR_OK on success otherwise apropriate error code */ static nserror win32_font_position(const plot_font_style_t *style, @@ -198,7 +198,7 @@ win32_font_position(const plot_font_style_t *style, HFONT fontbak; SIZE s; int offset; - bool ret = true; + nserror ret = NSERROR_OK; if ((length == 0) || (x < 1)) { *char_offset = 0; @@ -213,7 +213,7 @@ win32_font_position(const plot_font_style_t *style, *char_offset = (size_t)offset; *actual_x = s.cx; } else { - ret = false; + ret = NSERROR_UNKNOWN; } font = SelectObject(hdc, fontbak); DeleteObject(font); @@ -234,7 +234,7 @@ win32_font_position(const plot_font_style_t *style, * \param x width available * \param char_offset updated to offset in string of actual_x, [0..length] * \param actual_x updated to x coordinate of character closest to x - * \return true on success, false on error and error reported + * \return NSERROR_OK on success otherwise apropriate error code * * On exit, [char_offset == 0 || * string[char_offset] == ' ' || @@ -249,13 +249,14 @@ win32_font_split(const plot_font_style_t *style, int *actual_x) { int c_off; - bool ret = false; + nserror ret = NSERROR_UNKNOWN; if (win32_font_position(style, string, length, x, char_offset, actual_x)) { c_off = *char_offset; if (*char_offset == length) { - ret = true; + ret = NSERROR_OK; } else { + bool success; while ((string[*char_offset] != ' ') && (*char_offset > 0)) { (*char_offset)--; @@ -269,7 +270,10 @@ win32_font_split(const plot_font_style_t *style, } } - ret = win32_font_width(style, string, *char_offset, actual_x); + success = win32_font_width(style, string, *char_offset, actual_x); + if (success) { + ret = NSERROR_OK; + } } } |