summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2005-04-05 19:16:48 (GMT)
committer James Bursa <james@netsurf-browser.org>2005-04-05 19:16:48 (GMT)
commita9768c64b5df87af089e14401924b313ea2b0e72 (patch)
tree2d6dbcb5062678768301d1b33447496a9b29bff3
parent0d5d898413c1daa3d4b60a7865581d6582f1caef (diff)
downloadlibrufl-a9768c64b5df87af089e14401924b313ea2b0e72.tar.gz
librufl-a9768c64b5df87af089e14401924b313ea2b0e72.tar.bz2
[project @ 2005-04-05 19:16:48 by bursa]
Handle fonts which cause an error better (no longer attempt to save the uninitialized charset tables to the cache). svn path=/import/rufl/; revision=2460
-rw-r--r--rufl_character_set_test.c3
-rw-r--r--rufl_init.c12
-rw-r--r--rufl_paint.c4
3 files changed, 11 insertions, 8 deletions
diff --git a/rufl_character_set_test.c b/rufl_character_set_test.c
index 7134772..47f5743 100644
--- a/rufl_character_set_test.c
+++ b/rufl_character_set_test.c
@@ -11,7 +11,8 @@
/**
* Test if a character set contains a character.
*
- * \param c character code
+ * \param charset character set
+ * \param c character code
* \return true if present, false if absent
*/
diff --git a/rufl_init.c b/rufl_init.c
index 77f17d1..24687f6 100644
--- a/rufl_init.c
+++ b/rufl_init.c
@@ -144,7 +144,6 @@ rufl_code rufl_init(void)
xhourglass_off();
return code;
}
- assert(rufl_font_list[i].charset);
changes++;
}
@@ -336,9 +335,7 @@ rufl_code rufl_init_scan_font(unsigned int font_index)
if (rufl_fm_error) {
LOG("xfont_find_font(\"%s\"): 0x%x: %s", font_name,
rufl_fm_error->errnum, rufl_fm_error->errmess);
- for (u = 0; u != 256; u++)
- charset->index[u] = BLOCK_EMPTY;
- rufl_font_list[font_index].charset = charset;
+ free(charset);
return rufl_OK;
}
@@ -451,7 +448,7 @@ rufl_code rufl_init_scan_font_old(unsigned int font_index)
LOG("xfont_find_font(\"%s\"): 0x%x: %s", font_name,
rufl_fm_error->errnum, rufl_fm_error->errmess);
free(umap);
- rufl_font_list[font_index].charset = charset;
+ free(charset);
return rufl_OK;
}
@@ -643,6 +640,8 @@ rufl_code rufl_init_substitution_table(void)
for (i = 0; i != rufl_font_list_entries; i++) {
charset = rufl_font_list[i].charset;
+ if (!charset)
+ continue;
for (block = 0; block != 256; block++) {
if (charset->index[block] == BLOCK_EMPTY)
continue;
@@ -708,6 +707,9 @@ rufl_code rufl_save_cache(void)
}
for (i = 0; i != rufl_font_list_entries; i++) {
+ if (!rufl_font_list[i].charset)
+ continue;
+
/* length of font identifier */
len = strlen(rufl_font_list[i].identifier);
if (fwrite(&len, sizeof len, 1, fp) != 1) {
diff --git a/rufl_paint.c b/rufl_paint.c
index 3762859..adfcb4a 100644
--- a/rufl_paint.c
+++ b/rufl_paint.c
@@ -194,7 +194,7 @@ rufl_code rufl_process(rufl_action action,
offset_u = 0;
rufl_utf8_read(string, length, u);
- if (rufl_character_set_test(charset, u))
+ if (charset && rufl_character_set_test(charset, u))
font1 = font;
else
font1 = rufl_substitution_table[u];
@@ -209,7 +209,7 @@ rufl_code rufl_process(rufl_action action,
rufl_utf8_read(string, length, u);
s[n] = u;
offset_map[n] = offset_u;
- if (rufl_character_set_test(charset, u))
+ if (charset && rufl_character_set_test(charset, u))
font1 = font;
else
font1 = rufl_substitution_table[u];