From 4cbc56ebc103e1b8302a4b710309e3af6a553ffc Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 6 May 2014 21:31:05 +0100 Subject: Add Unicode support to internal font. + Now contains more glpyhs (was previously limited to cp-1252). + When a glyph is unavailable, the codepoint is now rendered. + Added glyph data file. + Added converter to generate the font's .c file from the data. TODO: The generated file is currently checked into the repo, but it should be generated as part of the build process, in the build-* directory. To update the generated source file, first build the converter: $ gcc -O2 -Wall framebuffer/convert_font.c -lm \ -o build-Linux-framebuffer/tools/convert_font And then use it to generate the souce file: $ build-Linux-framebuffer/tools/convert_font \ framebuffer/res/fonts/glyph_data \ framebuffer/GEN_font_internal.c -v The converter's usage is: convert_font [options] See convert_font --help for more details. --- framebuffer/font_internal.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'framebuffer/font_internal.h') diff --git a/framebuffer/font_internal.h b/framebuffer/font_internal.h index 6b6de2f34..236183ace 100644 --- a/framebuffer/font_internal.h +++ b/framebuffer/font_internal.h @@ -21,22 +21,23 @@ struct fb_font_desc { const char *name; - int width, height; - const char *encoding; - const uint32_t *data; + int width, height, pitch; }; -extern const struct fb_font_desc font_regular; -extern const struct fb_font_desc font_italic; -extern const struct fb_font_desc font_bold; -extern const struct fb_font_desc font_italic_bold; +#define FB_FONT_WIDTH 8 +#define FB_FONT_HEIGHT 16 +#define FB_FONT_PITCH 8 -extern const struct fb_font_desc* fb_get_font(const plot_font_style_t *fstyle); +enum fb_font_style { + FB_REGULAR = 0, + FB_ITALIC = (1 << 0), + FB_BOLD = (1 << 1), + FB_BOLD_ITALIC = (FB_ITALIC | FB_BOLD) +}; + +enum fb_font_style fb_get_font_style(const plot_font_style_t *fstyle); -extern nserror utf8_to_font_encoding(const struct fb_font_desc* font, - const char *string, - size_t len, - char **result); +const uint8_t * fb_get_glyph(uint32_t ucs4, enum fb_font_style style); #endif /* NETSURF_FB_FONT_INTERNAL_H */ -- cgit v1.2.3