diff options
Diffstat (limited to 'framebuffer')
-rw-r--r-- | framebuffer/font.h | 2 | ||||
-rw-r--r-- | framebuffer/font_freetype.c | 33 | ||||
-rw-r--r-- | framebuffer/font_internal.c | 19 | ||||
-rw-r--r-- | framebuffer/gui.c | 1 |
4 files changed, 23 insertions, 32 deletions
diff --git a/framebuffer/font.h b/framebuffer/font.h index 5ae5bb3ad..6350421e7 100644 --- a/framebuffer/font.h +++ b/framebuffer/font.h @@ -21,6 +21,8 @@ #include "utils/utf8.h" +extern struct gui_utf8_table *framebuffer_utf8_table; + bool fb_font_init(void); bool fb_font_finalise(void); diff --git a/framebuffer/font_freetype.c b/framebuffer/font_freetype.c index eb7278c81..4381db62a 100644 --- a/framebuffer/font_freetype.c +++ b/framebuffer/font_freetype.c @@ -23,13 +23,14 @@ #include <ft2build.h> #include FT_CACHE_H -#include "css/css.h" -#include "css/utils.h" -#include "render/font.h" #include "utils/filepath.h" #include "utils/utf8.h" #include "utils/log.h" #include "utils/nsoption.h" +#include "css/css.h" +#include "css/utils.h" +#include "render/font.h" +#include "desktop/gui.h" #include "framebuffer/gui.h" #include "framebuffer/font.h" @@ -74,30 +75,6 @@ enum fb_face_e { static fb_faceid_t *fb_faces[FB_FACE_COUNT]; - -nserror utf8_to_local_encoding(const char *string, - size_t len, - char **result) -{ - return utf8_to_enc(string, "UTF-8", len, result); -} - -nserror utf8_from_local_encoding(const char *string, - size_t len, - char **result) -{ - *result = malloc(len + 1); - if (*result == NULL) { - return NSERROR_NOMEM; - } - - memcpy(*result, string, len); - - (*result)[len] = '\0'; - - return NSERROR_OK; -} - /* map cache manager handle to face id */ static FT_Error ft_face_requester(FTC_FaceID face_id, FT_Library library, FT_Pointer request_data, FT_Face *face ) { @@ -581,6 +558,8 @@ const struct font_functions nsfont = { nsfont_split }; +struct gui_utf8_table *framebuffer_utf8_table = NULL; + /* * Local Variables: * c-basic-offset:8 diff --git a/framebuffer/font_internal.c b/framebuffer/font_internal.c index 1eed00684..da5ca92a3 100644 --- a/framebuffer/font_internal.c +++ b/framebuffer/font_internal.c @@ -19,12 +19,13 @@ #include <inttypes.h> #include <string.h> - #include <assert.h> -#include "css/css.h" -#include "render/font.h" + #include "utils/nsoption.h" #include "utils/utf8.h" +#include "desktop/gui.h" +#include "css/css.h" +#include "render/font.h" #include "framebuffer/gui.h" #include "framebuffer/font.h" @@ -68,7 +69,7 @@ nserror utf8_to_font_encoding(const struct fb_font_desc* font, } -nserror utf8_to_local_encoding(const char *string, +static nserror utf8_to_local(const char *string, size_t len, char **result) { @@ -76,7 +77,7 @@ nserror utf8_to_local_encoding(const char *string, } -nserror utf8_from_local_encoding(const char *string, +static nserror utf8_from_local(const char *string, size_t len, char **result) { @@ -183,6 +184,14 @@ const struct font_functions nsfont = { nsfont_split }; +static struct gui_utf8_table utf8_table = { + .utf8_to_local = utf8_to_local, + .local_to_utf8 = utf8_from_local, +}; + +struct gui_utf8_table *framebuffer_utf8_table = &utf8_table; + + /* * Local Variables: * c-basic-offset:8 diff --git a/framebuffer/gui.c b/framebuffer/gui.c index e7f456d8b..678010dfd 100644 --- a/framebuffer/gui.c +++ b/framebuffer/gui.c @@ -1815,6 +1815,7 @@ main(int argc, char** argv) .window = &framebuffer_window_table, .clipboard = framebuffer_clipboard_table, .fetch = framebuffer_fetch_table, + .utf8 = framebuffer_utf8_table, }; respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH); |