@@ -75,10 +75,14 @@ static inline uint8_t *get_glyph_ptr(const struct cfb_font *fptr, uint8_t c)
75
75
}
76
76
77
77
static inline uint8_t get_glyph_byte (uint8_t * glyph_ptr , const struct cfb_font * fptr ,
78
- uint8_t x , uint8_t y )
78
+ uint8_t x , uint8_t y , bool vtiled )
79
79
{
80
80
if (fptr -> caps & CFB_FONT_MONO_VPACKED ) {
81
- return glyph_ptr [(x * fptr -> height + y ) / 8 ];
81
+ if (vtiled ) {
82
+ return glyph_ptr [x * (fptr -> height / 8U ) + y ];
83
+ } else {
84
+ return glyph_ptr [(x * fptr -> height + y ) / 8 ];
85
+ }
82
86
} else if (fptr -> caps & CFB_FONT_MONO_HPACKED ) {
83
87
return glyph_ptr [y * (fptr -> width ) + x ];
84
88
}
@@ -140,10 +144,11 @@ static uint8_t draw_char_vtmono(const struct char_framebuffer *fb,
140
144
* So, we process assume that nothing is drawn above.
141
145
*/
142
146
byte = 0 ;
143
- next_byte = get_glyph_byte (glyph_ptr , fptr , g_x , g_y / 8 );
147
+ next_byte = get_glyph_byte (glyph_ptr , fptr , g_x , g_y / 8 , true );
144
148
} else {
145
- byte = get_glyph_byte (glyph_ptr , fptr , g_x , g_y / 8 );
146
- next_byte = get_glyph_byte (glyph_ptr , fptr , g_x , (g_y + 8 ) / 8 );
149
+ byte = get_glyph_byte (glyph_ptr , fptr , g_x , g_y / 8 , true);
150
+ next_byte =
151
+ get_glyph_byte (glyph_ptr , fptr , g_x , (g_y + 8 ) / 8 , true);
147
152
}
148
153
149
154
if (font_is_msbfirst ) {
@@ -246,7 +251,7 @@ static uint8_t draw_char_htmono(const struct char_framebuffer *fb,
246
251
continue ;
247
252
}
248
253
249
- byte = get_glyph_byte (glyph_ptr , fptr , g_x , g_y );
254
+ byte = get_glyph_byte (glyph_ptr , fptr , g_x , g_y , false );
250
255
if (font_is_msbfirst ) {
251
256
byte = byte_reverse (byte );
252
257
}
0 commit comments