diff options
author | June McEnroe <june@causal.agency> | 2018-01-29 15:06:47 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-01-29 15:06:47 -0500 |
commit | 2f7a12a6a5705e02d5698a2381276174d04d4ada (patch) | |
tree | 528577916dd41d2df15860815e61c8459da60951 /bin | |
parent | Take font path on fbclock argv (diff) | |
download | src-2f7a12a6a5705e02d5698a2381276174d04d4ada.tar.gz src-2f7a12a6a5705e02d5698a2381276174d04d4ada.zip |
Support fbclock fonts wider than 8
Diffstat (limited to '')
-rw-r--r-- | bin/fbclock.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/fbclock.c b/bin/fbclock.c index e15deb82..19a48e4b 100644 --- a/bin/fbclock.c +++ b/bin/fbclock.c @@ -108,9 +108,11 @@ int main(int argc, char *argv[]) { for (char *s = str; *s; ++s) { uint8_t *glyph = glyphs[(uint8_t)*s]; for (uint32_t y = 0; y < header.glyphHeight; ++y) { + uint32_t stride = header.glyphSize / header.glyphHeight; for (uint32_t x = 0; x < header.glyphWidth; ++x) { - uint8_t b = glyph[y] >> (header.glyphWidth - x) & 1; - buf[y * info.xres + left + x] = b ? FG : BG; + uint8_t bits = glyph[y * stride + x / 8]; + uint8_t bit = bits >> (7 - x % 8) & 1; + buf[y * info.xres + left + x] = bit ? FG : BG; } } left += header.glyphWidth; |