1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed genfontfile.c (wrong width, shifted values)

This commit is contained in:
Klaus Schmidinger 2004-12-18 13:30:19 +01:00
parent 9bbcf23a86
commit f5fc989ac7
2 changed files with 9 additions and 4 deletions

View File

@ -3199,3 +3199,5 @@ Video Disk Recorder Revision History
- Fixed setting 'synced' in cRemux when recording radio channels (thanks to - Fixed setting 'synced' in cRemux when recording radio channels (thanks to
Laurence Abbott). Laurence Abbott).
- Removed the LOCK_THREAD from the LIRC thread (thanks to Ludwig Nussel). - Removed the LOCK_THREAD from the LIRC thread (thanks to Ludwig Nussel).
- Fixed genfontfile.c (sometimes the character width was wrong, and the codes were
shifted one too far to the left).

View File

@ -240,7 +240,7 @@ printGlyph(FontInfoPtr font, int c)
{ {
PerGlyphInfoPtr glyph; PerGlyphInfoPtr glyph;
unsigned char *bitmapData; unsigned char *bitmapData;
int width, height, spanLength; int width, height, spanLength, charWidth;
int x, y, l; int x, y, l;
char buf[1000], *b; char buf[1000], *b;
@ -253,12 +253,15 @@ printGlyph(FontInfoPtr font, int c)
width = glyph->width; width = glyph->width;
spanLength = (width + 7) / 8; spanLength = (width + 7) / 8;
height = glyph->height; height = glyph->height;
charWidth = glyph->xoffset + width;
if (charWidth < glyph->advance)
charWidth = glyph->advance;
printf(" { // %d\n", c); printf(" { // %d\n", c);
printf(" %d, %d,\n", glyph->advance, font->max_ascent + font->max_descent); printf(" %d, %d,\n", charWidth, font->max_ascent + font->max_descent);
for (y = 0; y < font->max_ascent - glyph->yoffset - height; y++) { for (y = 0; y < font->max_ascent - glyph->yoffset - height; y++) {
printf(" 0x%08X, // ", 0); printf(" 0x%08X, // ", 0);
for (x = 0; x < glyph->xoffset + width || x < glyph->advance; x++) for (x = 0; x < charWidth; x++)
putchar('.'); putchar('.');
putchar('\n'); putchar('\n');
} }
@ -269,13 +272,13 @@ printGlyph(FontInfoPtr font, int c)
*b++ = '.'; *b++ = '.';
if (bitmapData) { if (bitmapData) {
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
l <<= 1;
if (bitmapData[y * spanLength + x / 8] & (1 << (x & 7))) { if (bitmapData[y * spanLength + x / 8] & (1 << (x & 7))) {
*b++ = '*'; *b++ = '*';
l |= 1; l |= 1;
} }
else else
*b++ = '.'; *b++ = '.';
l <<= 1;
} }
for (x = 0; x < glyph->advance - width - glyph->xoffset; x++) { for (x = 0; x < glyph->advance - width - glyph->xoffset; x++) {
*b++ = '.'; *b++ = '.';