1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-13 11:29:51 +03:00

LCD: fix lcd_outdezNAtt() for LEFT alignment with non-STDSIZE fonts

There were a few bugs affecting printing numbers with non-STDSIZE fonts. Most
of them were caused by improper calculation of decimal separator and minus sign
widths. Additionally, printing decimal separator for SMLSIZE has been fixed.

Fixes the following tests:
  * outdezNAtt.dblsize
  * outdezNAtt.xxlsize
  * outdezNAtt.midsize
  * outdezNAtt.smlsize
  * outdezNAtt.tinsize
This commit is contained in:
Michał Wróbel 2015-08-07 18:25:34 +02:00
parent 013c0492fa
commit a57a8c8bbc
2 changed files with 56 additions and 14 deletions

View file

@ -402,19 +402,40 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
fw -= 1;
}
else {
if (flags & LEFT) {
if (mode > 0)
x += 2;
}
#if defined(BOLD_FONT) && !defined(CPUM64) || defined(EXTSTD)
if (flags & BOLD) fw += 1;
#endif
}
if (flags & LEFT) {
if (mode > 0) {
if (xxlsize) {
x += 17;
}
else if (dblsize) {
// for DBLSIZE we the dot is pasted without moving digits
}
else if (midsize) {
x += 3;
}
else {
x += 2;
}
}
x += len * fw;
if (neg) {
x += ((xxlsize|dblsize|midsize) ? 7 : FWNUM);
if (xxlsize) {
x += 24;
}
else if (dblsize) {
x += 10;
}
else if (xxlsize || midsize) {
x += 7;
}
else {
x += FWNUM;
}
}
}
@ -457,9 +478,9 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
}
else if (smlsize) {
x -= 2;
lcd_plot(x+1, y+5);
lcd_plot(x, y+5);
if ((flags&INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE)) {
lcd_vline(x+1, y, 7);
lcd_vline(x, y-1, 8);
}
}
else if (tinsize) {

View file

@ -374,19 +374,40 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
fw -= 1;
}
else {
if (flags & LEFT) {
if (mode > 0)
x += 2;
}
#if defined(BOLD_FONT)
if (flags & BOLD) fw += 1;
#endif
}
if (flags & LEFT) {
if (mode > 0) {
if (xxlsize) {
x += 17;
}
else if (dblsize) {
// for DBLSIZE we the dot is pasted without moving digits
}
else if (midsize) {
x += 3;
}
else {
x += 2;
}
}
x += len * fw;
if (neg) {
x += ((xxlsize|dblsize|midsize) ? 7 : FWNUM);
if (xxlsize) {
x += 24;
}
else if (dblsize) {
x += 10;
}
else if (xxlsize || midsize) {
x += 7;
}
else {
x += FWNUM;
}
}
}
@ -425,9 +446,9 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
}
else if (smlsize) {
x -= 2;
lcd_plot(x+1, y+5);
lcd_plot(x, y+5);
if ((flags&INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE)) {
lcd_vline(x+1, y, 7);
lcd_vline(x, y-1, 8);
}
}
else if (tinsize) {