summaryrefslogtreecommitdiff
path: root/riscos/font.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-02-15 22:19:43 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-02-15 22:19:43 +0000
commit88beb484c59a5839638adc962de7c57118fba89b (patch)
tree46dfc3921bb1c0ef780801cb81c87a3ddd02659b /riscos/font.c
parent2f0c135aed355ead78436bd6d534bce5d2ec729d (diff)
downloadnetsurf-88beb484c59a5839638adc962de7c57118fba89b.tar.gz
netsurf-88beb484c59a5839638adc962de7c57118fba89b.tar.bz2
[project @ 2004-02-15 22:19:43 by jmb]
Font support in draw export. svn path=/import/netsurf/; revision=549
Diffstat (limited to 'riscos/font.c')
-rw-r--r--riscos/font.c31
1 files changed, 31 insertions, 0 deletions
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);