From 88beb484c59a5839638adc962de7c57118fba89b Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 15 Feb 2004 22:19:43 +0000 Subject: [project @ 2004-02-15 22:19:43 by jmb] Font support in draw export. svn path=/import/netsurf/; revision=549 --- riscos/font.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'riscos/font.c') diff --git a/riscos/font.c b/riscos/font.c index 46234031f..0fea4b542 100644 --- a/riscos/font.c +++ b/riscos/font.c @@ -118,6 +118,36 @@ struct font_set *font_new_set() return set; } +/** + * Font enumerator + * + * Call this multiple times to enumerate all available font names. + * *handle should be zero (0) on first call. + * + * Returns a NULL pointer and a handle of -1 if there are no more fonts. + */ +const char *enumerate_fonts(struct font_set* set, int *handle) +{ + int i; + + assert(set); + + if (*handle < 0 || handle == 0) { /* a bit of sanity checking */ + *handle = -1; + return NULL; + } + + for (i = *handle; i!=FONT_FAMILIES*FONT_FACES && set->font[i]==0; + i++) ; /* find next font in use */ + + if (i == FONT_FAMILIES*FONT_FACES) { /* no more fonts */ + *handle = -1; + return NULL; + } + + *handle = i+1; /* update handle for next call */ + return font_table[i]; +} /** * Open a font for use based on a css_style. @@ -217,6 +247,7 @@ struct font_data *font_open(struct font_set *set, struct css_style *style) } } + data->id = f; data->handle = handle; data->size = size; data->space_width = font_width(data, " ", 1); -- cgit v1.2.3