Skip to content

Commit c98cf9a

Browse files
author
michael
committed
scaletext patch from Stefan Kuhne
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1170 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
1 parent 8c2ea5b commit c98cf9a

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Diff for: drv_dpf.c

+13-1
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,23 @@ static int drv_dpf_start2(const char *section)
146146
}
147147

148148
/* Fixme: provider other fonts someday... */
149-
if (XRES != 6 && YRES != 8) {
149+
/* Overridden - we have scaled the textout drawing */
150+
/* if (XRES != 6 && YRES != 8) {
150151
error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
151152
return -1;
153+
} */
154+
155+
/* we dont want fonts below 6 width */
156+
if (XRES < 6) {
157+
error("%s: bad Font '%s' width '%d' using minimum of 6)", Name, s, XRES);
158+
XRES = 6;
152159
}
153160

161+
/* we dont want fonts below 8 height */
162+
if (YRES < 8) {
163+
error("%s: bad Font '%s' height '%d' using minimum of 8)", Name, s, YRES);
164+
YRES = 8;
165+
}
154166

155167
/* open communication with the display */
156168
if (drv_dpf_open(section) < 0) {

Diff for: drv_generic_graphic.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ static void drv_generic_graphic_render(const int layer, const int row, const int
267267
}
268268

269269
for (y = 0; y < YRES; y++) {
270-
int mask = 1 << XRES;
271270
for (x = 0; x < XRES; x++) {
272-
mask >>= 1;
273-
if (chr[y] & mask)
271+
int mask = 1 << 6;
272+
mask >>= ((x * 6) / (XRES)) + 1;
273+
if (chr[(y * 8) / (YRES)] & mask)
274274
drv_generic_graphic_FB[layer][(r + y) * LCOLS + c + x] = fg;
275275
else
276276
drv_generic_graphic_FB[layer][(r + y) * LCOLS + c + x] = bg;

0 commit comments

Comments
 (0)