bdf2sfd

BDF to SFD converter, allowing to vectorize bitmap fonts
Log | Files | Refs | README | LICENSE

commit 233ea60e96d5d95756143a3f800a1beefa0a6760
parent 11340adebdf97b0a2af5e6d26cb4ab9b91b795e6
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri, 20 Mar 2020 14:25:10 +0100

Drop the stride array, and calculate stride directly.

Diffstat:
Msrc/bdf2sfd.c | 5+++--
Msrc/config.h | 10+---------
2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/bdf2sfd.c b/src/bdf2sfd.c @@ -70,7 +70,7 @@ main(int argc, char *argv[]) uint32_t height = 0, width = 0; uint32_t ascent = 0, descent = 0; - int key; + int key, stride; float x = 0.0, y = 0.0; uint32_t mask = 0; float xlength = 64.0, ylength = 64.0; /* Default values for 8x16 fonts */ @@ -192,7 +192,8 @@ main(int argc, char *argv[]) xlength = 512.0 / width; ylength = 1024.0 / height; - mask = 1 << (stride[width] * 8 - 1); + stride = (width + 7) / 8; + mask = 1 << (stride * 8 - 1); continue; diff --git a/src/config.h b/src/config.h @@ -4,7 +4,7 @@ * https://github.com/fcambus/bdf2sfd * * Created: 2019-11-21 - * Last Updated: 2020-02-08 + * Last Updated: 2020-03-20 * * bdf2sfd is released under the BSD 2-Clause license * See LICENSE file for details @@ -19,12 +19,4 @@ enum { LINE_LENGTH_MAX = 65536 }; -int stride[] = { - 0, - 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4 -}; - #endif /* CONFIG_H */