summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2012-05-09 22:23:10 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2012-05-09 22:23:10 +0000
commit560d5d2035793e8902d68ba94294dce0fe549d2f (patch)
tree57c1ee6fad1b6d5fea4f5236e0a6c3511dc05e65
parent722a75bdf503143b0c44f0440523d3cea7ce1484 (diff)
downloadnetsurf-560d5d2035793e8902d68ba94294dce0fe549d2f.tar.gz
netsurf-560d5d2035793e8902d68ba94294dce0fe549d2f.tar.bz2
Allow a comma-separated list of fonts to be specified in font_unicode_list
to provide more preferred fonts. eg. if a user has dedicated Japanese and Korean fonts available they might want a config like: font_unicode:Japanese font_unicode_list:Korean,Code2000 This will scan Japanese and Korean fonts first, then fill in any blanks with Code2000 (followed by alphabetically all other fonts installed) svn path=/trunk/netsurf/; revision=13917
-rw-r--r--amiga/font_scan.c19
-rwxr-xr-xamiga/gui.c2
-rw-r--r--amiga/options.h3
3 files changed, 22 insertions, 2 deletions
diff --git a/amiga/font_scan.c b/amiga/font_scan.c
index ed762769e..688347d8c 100644
--- a/amiga/font_scan.c
+++ b/amiga/font_scan.c
@@ -432,7 +432,7 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save,
ULONG i, found = 0, entries = 0;
struct MinList *list;
struct nsObject *node;
- char *unicode_font;
+ char *unicode_font, *csv;
struct ami_font_scan_window *win = NULL;
/* Ensure array zeroed */
@@ -453,6 +453,23 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save,
entries = 1;
}
+ /* add preferred fonts list */
+ if(nsoption_charp(font_unicode_list) &&
+ (csv = strdup(nsoption_charp(font_unicode_list))))
+ {
+ char *p;
+
+ while(p = strsep(&csv, ",")) {
+ asprintf(&unicode_font, "%s.font", p);
+ if(unicode_font != NULL) {
+ node = AddObject(list, AMINS_UNKNOWN);
+ if(node) node->dtz_Node.ln_Name = unicode_font;
+ entries++;
+ }
+ }
+ free(csv);
+ }
+
if(nsoption_bool(font_unicode_only) == false)
entries += ami_font_scan_list(list);
diff --git a/amiga/gui.c b/amiga/gui.c
index 136034987..cba209fb2 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -438,7 +438,7 @@ void ami_set_options(void)
search_engines_file_location = nsoption_charp(search_engines_file);
- sprintf(temp, "%s/UnicodeFontCache", current_user_dir);
+ sprintf(temp, "%s/FontGlyphCache", current_user_dir);
nsoption_setnull_charp(font_unicode_file,
(char *)strdup(temp));
diff --git a/amiga/options.h b/amiga/options.h
index 49dfc5323..1f4497bed 100644
--- a/amiga/options.h
+++ b/amiga/options.h
@@ -55,6 +55,7 @@
bool close_no_quit; \
bool hide_docky_icon; \
char *font_unicode; \
+ char *font_unicode_list; \
char *font_unicode_file; \
bool font_unicode_only; \
bool drag_save_icons; \
@@ -113,6 +114,7 @@
.close_no_quit = false, \
.hide_docky_icon = false, \
.font_unicode = NULL, \
+ .font_unicode_list = NULL, \
.font_unicode_file = NULL, \
.font_unicode_only = false, \
.drag_save_icons = true, \
@@ -170,6 +172,7 @@
{ "close_no_quit", OPTION_BOOL, &nsoptions.close_no_quit}, \
{ "hide_docky_icon", OPTION_BOOL, &nsoptions.hide_docky_icon}, \
{ "font_unicode", OPTION_STRING, &nsoptions.font_unicode }, \
+{ "font_unicode_list", OPTION_STRING, &nsoptions.font_unicode_list }, \
{ "font_unicode_file", OPTION_STRING, &nsoptions.font_unicode_file }, \
{ "font_unicode_only", OPTION_BOOL, &nsoptions.font_unicode_only }, \
{ "drag_save_icons", OPTION_BOOL, &nsoptions.drag_save_icons}, \