From 1a52a32e5d5ccf78639c268cc660d8d8b0d98092 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sun, 20 Feb 2005 13:18:21 +0000 Subject: [project @ 2005-02-20 13:18:21 by bursa] Font rewrite, part 2. svn path=/import/netsurf/; revision=1518 --- render/font.h | 66 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 34 deletions(-) (limited to 'render/font.h') diff --git a/render/font.h b/render/font.h index 4a983098a..68563e069 100644 --- a/render/font.h +++ b/render/font.h @@ -3,52 +3,50 @@ * Licensed under the GNU General Public License, * http://www.opensource.org/licenses/gpl-license * Copyright 2003 Phil Mellor - * Copyright 2003 James Bursa + * Copyright 2005 James Bursa * Copyright 2004 John Tytgat */ +/** \file + * Font handling (interface). + * + * These functions provide font related services. They all work on UTF-8 strings + * with lengths given. + * + * Note that an interface to painting is not defined here. Painting is + * redirected through platform-dependent plotters anyway, so there is no gain in + * abstracting it here. + */ + #ifndef _NETSURF_RENDER_FONT_H_ #define _NETSURF_RENDER_FONT_H_ +#include #include -#include "netsurf/css/css.h" - -typedef enum { - FONTTYPE_UFONT, - FONTTYPE_STANDARD_UTF8ENC, - FONTTYPE_STANDARD_LATIN1 -} fonttype_e; - -struct font_data { - int id; - int handle; - fonttype_e ftype; - unsigned int size; - unsigned int space_width; - struct font_data *next; -}; - -struct font_set *nsfont_new_set(void); -struct font_data *nsfont_open(struct font_set *set, struct css_style *style); -void nsfont_free_set(struct font_set *set); -unsigned long nsfont_width(struct font_data *font, const char *text, - size_t length); -bool nsfont_position_in_string(struct font_data *font, const char *text, - size_t length, unsigned long x, int *char_offset, - int *pixel_offset); -char *nsfont_split(struct font_data *font, const char *text, - size_t length, - unsigned int width, unsigned int *used_width); -bool nsfont_paint(struct font_data *font, const char *str, - size_t length, int xpos, int ypos, void *trfm); -void nsfont_txtenum(struct font_data *font, const char *text, + + +struct css_style; + + +bool nsfont_width(const struct css_style *style, + const char *string, size_t length, + int *width); +bool nsfont_position_in_string(const struct css_style *style, + const char *string, size_t length, + int x, size_t *char_offset, int *actual_x); +bool nsfont_split(const struct css_style *style, + const char *string, size_t length, + int x, size_t *char_offset, int *actual_x); + + + + +void nsfont_txtenum(void *font, const char *text, size_t length, unsigned int *width, const char **rofontname, const char **rotext, size_t *rolength, size_t *consumed); -void nsfont_fill_nametable(bool force_rescan); -void nsfont_reopen_set(struct font_set *fonts); #endif -- cgit v1.2.3