Changeset 98895c5c in mainline for contrib/font/bdf2c.pl
- Timestamp:
- 2009-03-24T16:09:17Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2fce275
- Parents:
- 6a75902c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
contrib/font/bdf2c.pl
r6a75902c r98895c5c 102 102 @chars = sort { $a <=> $b } (@chars); 103 103 104 print "#define FONT_GLYPHS " . @chars. "\n";104 print "#define FONT_GLYPHS " . (@chars + 1). "\n"; 105 105 print "#define FONT_SCANLINES " . $height . "\n"; 106 106 107 107 print "\n"; 108 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 113 my $pos = 0; … … 118 120 if ($start == $prev) { 119 121 printf "\tif (ch == 0x%.4x)\n", $start; 122 print "\t\treturn " . $start_pos . ";\n"; 120 123 } else { 121 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 128 print "\t\n"; 126 129 } … … 129 132 $start_pos = $pos; 130 133 } 134 131 135 $pos++; 132 136 $prev = $index; 133 137 } 134 138 135 print "\treturn 31;\n";139 print "\treturn " . @chars . ";\n"; 136 140 print "}\n"; 137 141 … … 139 143 print "uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES] = {"; 140 144 141 my $f1 = 0;142 145 for $index (@chars) { 143 print "," if ($f1 > 0);144 146 print "\n\t{"; 145 147 … … 150 152 } 151 153 152 print "}"; 153 $f1++; 154 print "},"; 154 155 } 155 156 156 print "\n};\n"; 157 print "\n\t\n\t/* Special glyph for unknown character */\n\t{"; 158 my $y; 159 for ($y = 0; $y < $height; $y++) { 160 print ", " if ($y > 0); 161 printf "0x%.2x", $glyphs[63]->[$y]; 162 } 163 164 print "}\n};\n";
Note:
See TracChangeset
for help on using the changeset viewer.