Rev 4176 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4176 | Rev 4187 | ||
---|---|---|---|
Line 99... | Line 99... | ||
99 | 99 | ||
100 | close(BDF); |
100 | close(BDF); |
101 | 101 | ||
102 | @chars = sort { $a <=> $b } (@chars); |
102 | @chars = sort { $a <=> $b } (@chars); |
103 | 103 | ||
104 | print "#define FONT_GLYPHS " . @chars . "\n"; |
104 | print "#define FONT_GLYPHS " . (@chars + 1). "\n"; |
105 | print "#define FONT_SCANLINES " . $height . "\n"; |
105 | print "#define FONT_SCANLINES " . $height . "\n"; |
106 | 106 | ||
107 | print "\n"; |
107 | print "\n"; |
108 | print "index_t fb_font_glyph(const wchar_t ch)\n"; |
108 | print "index_t fb_font_glyph(const wchar_t ch)\n"; |
109 | print "{"; |
109 | print "{\n"; |
- | 110 | print "\tif (ch == 0x0000)\n"; |
|
- | 111 | print "\t\treturn 0;\n\n"; |
|
110 | 112 | ||
111 | my $pos = 0; |
113 | my $pos = 0; |
112 | my $start = -1; |
114 | my $start = -1; |
113 | my $start_pos = 0; |
115 | my $start_pos = 0; |
114 | my $prev = 0; |
116 | my $prev = 0; |
115 | for $index (@chars) { |
117 | for $index (@chars) { |
116 | if ($prev + 1 < $index) { |
118 | if ($prev + 1 < $index) { |
117 | if ($start != -1) { |
119 | if ($start != -1) { |
118 | if ($start == $prev) { |
120 | if ($start == $prev) { |
119 | printf "\tif (ch == 0x%.4x)\n", $start; |
121 | printf "\tif (ch == 0x%.4x)\n", $start; |
- | 122 | print "\t\treturn " . $start_pos . ";\n"; |
|
120 | } else { |
123 | } else { |
121 | printf "\tif ((ch >= 0x%.4x) && (ch <= 0x%.4x))\n", $start, $prev; |
124 | printf "\tif ((ch >= 0x%.4x) && (ch <= 0x%.4x))\n", $start, $prev; |
- | 125 | print "\t\treturn (ch - " . ($start - $start_pos) . ");\n"; |
|
122 | } |
126 | } |
123 | 127 | ||
124 | print "\t\treturn (ch - " . ($start - $start_pos) . ");\n"; |
- | |
125 | print "\t\n"; |
128 | print "\t\n"; |
126 | } |
129 | } |
127 | 130 | ||
128 | $start = $index; |
131 | $start = $index; |
129 | $start_pos = $pos; |
132 | $start_pos = $pos; |
130 | } |
133 | } |
- | 134 | ||
131 | $pos++; |
135 | $pos++; |
132 | $prev = $index; |
136 | $prev = $index; |
133 | } |
137 | } |
134 | 138 | ||
135 | print "\treturn 31;\n"; |
139 | print "\treturn " . @chars . ";\n"; |
136 | print "}\n"; |
140 | print "}\n"; |
137 | 141 | ||
138 | print "\n"; |
142 | print "\n"; |
139 | print "uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES] = {"; |
143 | print "uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES] = {"; |
140 | 144 | ||
141 | my $f1 = 0; |
- | |
142 | for $index (@chars) { |
145 | for $index (@chars) { |
143 | print "," if ($f1 > 0); |
- | |
144 | print "\n\t{"; |
146 | print "\n\t{"; |
145 | 147 | ||
146 | my $y; |
148 | my $y; |
147 | for ($y = 0; $y < $height; $y++) { |
149 | for ($y = 0; $y < $height; $y++) { |
148 | print ", " if ($y > 0); |
150 | print ", " if ($y > 0); |
149 | printf "0x%.2x", $glyphs[$index]->[$y]; |
151 | printf "0x%.2x", $glyphs[$index]->[$y]; |
150 | } |
152 | } |
151 | 153 | ||
152 | print "}"; |
154 | print "},"; |
- | 155 | } |
|
- | 156 | ||
- | 157 | print "\n\t\n\t/* Special glyph for unknown character */\n\t{"; |
|
153 | $f1++; |
158 | my $y; |
- | 159 | for ($y = 0; $y < $height; $y++) { |
|
- | 160 | print ", " if ($y > 0); |
|
- | 161 | printf "0x%.2x", $glyphs[63]->[$y]; |
|
154 | } |
162 | } |
155 | 163 | ||
156 | print "\n};\n"; |
164 | print "}\n};\n"; |