Skip to content

Commit b8ca7d1

Browse files
Merge pull request #126 from rbultman/master
Set yAdvance to glyph height if face height is zero
2 parents 3cd8e19 + ceca9ac commit b8ca7d1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
default.vim
2+
fontconvert/fontconvert

fontconvert/fontconvert.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,14 @@ int main(int argc, char *argv[]) {
222222
printf("const GFXfont %s PROGMEM = {\n", fontName);
223223
printf(" (uint8_t *)%sBitmaps,\n", fontName);
224224
printf(" (GFXglyph *)%sGlyphs,\n", fontName);
225-
printf(" 0x%02X, 0x%02X, %ld };\n\n",
226-
first, last, face->size->metrics.height >> 6);
225+
if (face->size->metrics.height == 0) {
226+
// No face height info, assume fixed width and get from a glyph.
227+
printf(" 0x%02X, 0x%02X, %d };\n\n",
228+
first, last, table[0].height);
229+
} else {
230+
printf(" 0x%02X, 0x%02X, %ld };\n\n",
231+
first, last, face->size->metrics.height >> 6);
232+
}
227233
printf("// Approx. %d bytes\n",
228234
bitmapOffset + (last - first + 1) * 7 + 7);
229235
// Size estimate is based on AVR struct and pointer sizes;

0 commit comments

Comments
 (0)