1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/*
* 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_unicode_map(struct rufl_unicode_map *umap);
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");
}
if (rufl_font_list[i].umap) {
printf(" ");
rufl_dump_unicode_map(rufl_font_list[i].umap);
printf("\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 a unicode map to stdout.
*
* \param umap unicode map to print
*/
void rufl_dump_unicode_map(struct rufl_unicode_map *umap)
{
unsigned int i;
for (i = 0; i != umap->entries; i++)
printf("%x:%x ", umap->map[i].u, umap->map[i].c);
}
/**
* 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);
}
}
|