summaryrefslogtreecommitdiff
path: root/framebuffer/font.h
diff options
context:
space:
mode:
Diffstat (limited to 'framebuffer/font.h')
-rw-r--r--framebuffer/font.h36
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