diff options
author | James Bursa <james@netsurf-browser.org> | 2005-01-08 21:02:32 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2005-01-08 21:02:32 +0000 |
commit | c4580a33f78825e385626610fbbff9a675b248a4 (patch) | |
tree | d4ab197d183e4a917202415cb7bd44b75d5c7866 /rufl_dump_state.c | |
download | librufl-c4580a33f78825e385626610fbbff9a675b248a4.tar.gz librufl-c4580a33f78825e385626610fbbff9a675b248a4.tar.bz2 |
[project @ 2005-01-08 21:02:32 by bursa]
Initial version of RISC OS Unicode font library. Require Unicode (RO5) Font Manager.
svn path=/import/rufl/; revision=2443
Diffstat (limited to 'rufl_dump_state.c')
-rw-r--r-- | rufl_dump_state.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/rufl_dump_state.c b/rufl_dump_state.c new file mode 100644 index 0000000..3a1fe99 --- /dev/null +++ b/rufl_dump_state.c @@ -0,0 +1,98 @@ +/* + * This file is part of RUfl + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license + * Copyright 2005 James Bursa <james@semichrome.net> + */ + +#include <stdio.h> +#include "rufl_internal.h" + + +static void rufl_dump_character_set(struct rufl_character_set *charset); +static void rufl_dump_substitution_table(void); + + +/** + * Dump the internal library state to stdout. + */ + +void rufl_dump_state(void) +{ + unsigned int i, j; + + printf("rufl_font_list:\n"); + for (i = 0; i != rufl_font_list_entries; i++) { + printf(" %u \"%s\"\n", i, rufl_font_list[i].identifier); + if (rufl_font_list[i].charset) { + printf(" "); + rufl_dump_character_set(rufl_font_list[i].charset); + printf("\n"); + } else { + printf(" (no charset table)\n"); + } + } + + printf("rufl_family_list:\n"); + for (i = 0; i != rufl_family_list_entries; i++) { + printf(" %u \"%s\"\n", i, rufl_family_list[i]); + for (j = 0; j != rufl_STYLES; j++) + printf(" %u \"%s\"\n", j, rufl_font_list + [rufl_family_map[rufl_STYLES * i + j]] + .identifier); + } + + printf("rufl_substitution_table:\n"); + rufl_dump_substitution_table(); +} + + +/** + * Dump a representation of a character set to stdout. + * + * \param charset character set to print + */ + +void rufl_dump_character_set(struct rufl_character_set *charset) +{ + unsigned int u, t; + + u = 0; + while (u != 0x10000) { + while (u != 0x10000 && !rufl_character_set_test(charset, u)) + u++; + if (u != 0x10000) { + if (!rufl_character_set_test(charset, u + 1)) { + printf("%x ", u); + u++; + } else { + t = u; + while (rufl_character_set_test(charset, u)) + u++; + printf("%x-%x ", t, u - 1); + } + } + } +} + + +/** + * Dump a representation of the substitution table to stdout. + */ + +void rufl_dump_substitution_table(void) +{ + unsigned int font; + unsigned int u, t; + + u = 0; + while (u != 0x10000) { + t = u; + font = rufl_substitution_lookup(t); + while (u != 0x10000 && font == rufl_substitution_lookup(u)) + u++; + if (font != NOT_AVAILABLE) + printf(" %x-%x => %u \"%s\"\n", t, u - 1, + font, rufl_font_list[font].identifier); + } +} |