diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2011-01-09 00:02:47 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2011-01-09 00:02:47 +0000 |
commit | 3368407d9eb0fa10db910e2f7f054983fe56c31c (patch) | |
tree | 6bc3dacfd952a10892a357a1e7f7d7605ad7590b /render | |
parent | 6b544e94b9713ecc9b1863dd3177ced97b859f90 (diff) | |
download | netsurf-3368407d9eb0fa10db910e2f7f054983fe56c31c.tar.gz netsurf-3368407d9eb0fa10db910e2f7f054983fe56c31c.tar.bz2 |
Document font APIs -- specifically, string lengths are specified in bytes, not characters
svn path=/trunk/netsurf/; revision=11261
Diffstat (limited to 'render')
-rw-r--r-- | render/font.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/render/font.h b/render/font.h index 3012abce0..bc7dc7fba 100644 --- a/render/font.h +++ b/render/font.h @@ -40,12 +40,47 @@ struct font_functions { + /** + * Measure the width of a string. + * + * \param fstyle plot style for this text + * \param string UTF-8 string to measure + * \param length length of string, in bytes + * \param width updated to width of string[0..length) + * \return true on success, false on error and error reported + */ bool (*font_width)(const plot_font_style_t *fstyle, const char *string, size_t length, int *width); + /** + * Find the position in a string where an x coordinate falls. + * + * \param fstyle style for this text + * \param string UTF-8 string to measure + * \param length length of string, in bytes + * \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 + */ bool (*font_position_in_string)(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x); + /** + * Find where to split a string to make it fit a width. + * + * \param fstyle style for this text + * \param string UTF-8 string to measure + * \param length length of string, in bytes + * \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 + * + * On exit, [char_offset == 0 || + * string[char_offset] == ' ' || + * char_offset == length] + */ bool (*font_split)(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x); |