diff options
author | Vincent Sanders <vince@kyllikki.org> | 2016-04-24 11:05:05 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2016-04-24 11:05:05 +0100 |
commit | 0b7edfd252423edf097d82b8354ef34946a1a290 (patch) | |
tree | ad677799a161f9180c0284eeb8f4f921f01bd0d4 /framebuffer/font.h | |
parent | ae01f3661938b14b44a907113b6b65c0e3d1721d (diff) | |
download | netsurf-0b7edfd252423edf097d82b8354ef34946a1a290.tar.gz netsurf-0b7edfd252423edf097d82b8354ef34946a1a290.tar.bz2 |
update framebuffer frontend to use layout table
Diffstat (limited to 'framebuffer/font.h')
-rw-r--r-- | framebuffer/font.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/framebuffer/font.h b/framebuffer/font.h index 6350421e7..722a604e4 100644 --- a/framebuffer/font.h +++ b/framebuffer/font.h @@ -19,13 +19,45 @@ #ifndef NETSURF_FB_FONT_H #define NETSURF_FB_FONT_H -#include "utils/utf8.h" - +extern struct gui_layout_table *framebuffer_layout_table; extern struct gui_utf8_table *framebuffer_utf8_table; +/** + * Initialise framebuffer font handling. + */ bool fb_font_init(void); + +/** + * Finalise framebuffer font handling. + */ bool fb_font_finalise(void); +/** + * Find the position in a string where an x coordinate falls. + * + * \param[in] fstyle style for this text + * \param[in] string UTF-8 string to measure + * \param[in] length length of string, in bytes + * \param[in] x coordinate to search for + * \param[out] char_offset updated to offset in string of actual_x, [0..length] + * \param[out] actual_x updated to x coordinate of character closest to x + * \return NSERROR_OK and char_offset and actual_x updated or + * appropriate error code on faliure + */ +nserror fb_font_position(const struct plot_font_style *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x); + +/** + * Measure the width of a string. + * + * \param[in] fstyle plot style for this text + * \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 NSERROR_OK and width updated or appropriate error code on faliure + */ +nserror fb_font_width(const struct plot_font_style *fstyle, const char *string, size_t length, int *width); + + #ifdef FB_USE_FREETYPE #include "framebuffer/font_freetype.h" #else |