comparison BootLoader/Src/gfx_engine_mini.c @ 1002:23e94766d00a BootloaderOstc5

Bootloader remove not needed fonts: Only font48 and 24 are used by the bootloader. To reduce bootloader size the other fonts have been removed and the character set of font24 was reduce (no special characters)
author Ideenmodellierer
date Thu, 01 May 2025 17:48:25 +0200
parents 45a2bd04b156
children 0dd92e9b70a2
comparison
equal deleted inserted replaced
992:39f28cd9dc46 1002:23e94766d00a
1522 } 1522 }
1523 } 1523 }
1524 if(found) 1524 if(found)
1525 { 1525 {
1526 distance += (uint16_t)(Font->chars[i].image->width); 1526 distance += (uint16_t)(Font->chars[i].image->width);
1527 if(Font == &FontT105)
1528 distance += 2;
1529 } 1527 }
1530 } 1528 }
1531 return distance; 1529 return distance;
1532 1530
1533 /* FEHLT: 1531 /* FEHLT:
1534 if(*pText < ' ') 1532 if(*pText < ' ')
1535 if((*pText) & 0x80) 1533 if((*pText) & 0x80)
1536 1534
1537 if(((tFont *)settings.font == &FontT105) && settings.dualFont && ((*pText == '.') || (*pText == ':')))
1538 settings.font = (uint32_t)&FontT54;
1539 */ 1535 */
1540 } 1536 }
1541 1537
1542 void GFX_clean_line(GFX_DrawCfgWindow* hgfx, uint32_t line_number) 1538 void GFX_clean_line(GFX_DrawCfgWindow* hgfx, uint32_t line_number)
1543 { 1539 {
1658 if((*pText) == TXT_MINIMAL) // for customtext and anything with Sonderzeichen 1654 if((*pText) == TXT_MINIMAL) // for customtext and anything with Sonderzeichen
1659 minimal = 1; 1655 minimal = 1;
1660 else 1656 else
1661 minimal = 0; 1657 minimal = 0;
1662 1658
1663 if(Font == &FontT105)
1664 settings.TinyFont = (uint32_t)&FontT54;
1665 else
1666 if(Font == &FontT54)
1667 {
1668 settings.TinyFont = (uint32_t)&FontT48;
1669 settings.TinyFontExtraYdelta = -9;
1670 }
1671 else
1672 if(Font == &FontT48) 1659 if(Font == &FontT48)
1673 { 1660 {
1674 settings.TinyFont = (uint32_t)&FontT24; 1661 settings.TinyFont = (uint32_t)&FontT24;
1675 settings.TinyFontExtraYdelta = 6; 1662 settings.TinyFontExtraYdelta = 6;
1676 }
1677 else
1678 if(Font == &FontT42)
1679 {
1680 settings.TinyFont = (uint32_t)&FontT24;
1681 settings.TinyFontExtraYdelta = 2;
1682 } 1663 }
1683 1664
1684 settings.actualFont = (tFont *)settings.font; 1665 settings.actualFont = (tFont *)settings.font;
1685 1666
1686 while ((*pText != 0) && (settings.Xdelta != 0x0000FFFF))// und fehlend: Abfrage window / image size 1667 while ((*pText != 0) && (settings.Xdelta != 0x0000FFFF))// und fehlend: Abfrage window / image size
1783 else 1764 else
1784 if((settings.spaceMode == 1) && (*pText == ' ')) 1765 if((settings.spaceMode == 1) && (*pText == ' '))
1785 settings.Xdelta += ((tFont *)settings.font)->spacesize2Monospaced; 1766 settings.Xdelta += ((tFont *)settings.font)->spacesize2Monospaced;
1786 else 1767 else
1787 { 1768 {
1788 if(((tFont *)settings.font == &FontT105) && settings.dualFont && ((*pText == '.') || (*pText == ':')))
1789 settings.actualFont = (tFont *)settings.TinyFont;
1790
1791 if(settings.actualFont == (tFont *)settings.TinyFont) 1769 if(settings.actualFont == (tFont *)settings.TinyFont)
1792 settings.Ydelta += settings.TinyFontExtraYdelta; 1770 settings.Ydelta += settings.TinyFontExtraYdelta;
1793 1771
1794 newXdelta = GFX_write_char(hgfx, &settings, *(uint8_t *)pText, settings.actualFont); 1772 newXdelta = GFX_write_char(hgfx, &settings, *(uint8_t *)pText, settings.actualFont);
1795 settings.Xdelta = newXdelta; 1773 settings.Xdelta = newXdelta;
2227 pDestination += stepdir * (OffsetDestination + nextLine); 2205 pDestination += stepdir * (OffsetDestination + nextLine);
2228 } 2206 }
2229 } 2207 }
2230 } 2208 }
2231 2209
2232 // -----------------------------
2233
2234 if(Font == &FontT105)
2235 width += 4;
2236 2210
2237 // ----------------------------- 2211 // -----------------------------
2238 2212
2239 if(char_truncated_WidthFlag) 2213 if(char_truncated_WidthFlag)
2240 return 0x0000FFFF; 2214 return 0x0000FFFF;
2519 pDestination += stepdir * OffsetDestination; 2493 pDestination += stepdir * OffsetDestination;
2520 } 2494 }
2521 } 2495 }
2522 } 2496 }
2523 2497
2524 // ----------------------------- 2498
2525 if(Font == &FontT105)
2526 width += 2;
2527 /* 2499 /*
2528 else 2500 else
2529 if(Font == &Font144) 2501 if(Font == &Font144)
2530 width += 3; 2502 width += 3;
2531 else 2503 else
2578 if(*(char*)pText == '\017') /* request font reset */ 2550 if(*(char*)pText == '\017') /* request font reset */
2579 { 2551 {
2580 tinyState = 0; 2552 tinyState = 0;
2581 } 2553 }
2582 2554
2583 if((ptargetFont == &FontT105) && ((*(char*)pText == '.') || (*(char*)pText == ':')))
2584 {
2585 tinyState++;
2586 }
2587
2588 if(tinyState > 1) 2555 if(tinyState > 1)
2589 { 2556 {
2590 ptargetFont = (tFont *)cfg->TinyFont; 2557 ptargetFont = (tFont *)cfg->TinyFont;
2591 } 2558 }
2592 else 2559 else
2614 Xsum += GFX_Character_Width(decodeUTF8, ptargetFont); 2581 Xsum += GFX_Character_Width(decodeUTF8, ptargetFont);
2615 } 2582 }
2616 2583
2617 pText++; 2584 pText++;
2618 j++; 2585 j++;
2619 if((ptargetFont == &FontT105) && (*(char*)pText != 0))
2620 Xsum += 2;
2621 } 2586 }
2622 pText -= j; 2587 pText -= j;
2623 2588
2624 if(cfg->doubleSize) 2589 if(cfg->doubleSize)
2625 Xsum *= 2; 2590 Xsum *= 2;
2664 tinyState++; 2629 tinyState++;
2665 } 2630 }
2666 if(*(char*)pText == '\017') /* request font reset */ 2631 if(*(char*)pText == '\017') /* request font reset */
2667 { 2632 {
2668 tinyState = 0; 2633 tinyState = 0;
2669 }
2670
2671 if((font == &FontT105) && ((*(char*)pText == '.') || (*(char*)pText == ':')))
2672 {
2673 tinyState++;
2674 } 2634 }
2675 2635
2676 if(tinyState > 1) 2636 if(tinyState > 1)
2677 { 2637 {
2678 font = (tFont *)cfg->TinyFont; 2638 font = (tFont *)cfg->TinyFont;
2705 } 2665 }
2706 Xsum += GFX_Character_Width(decodeUTF8, font); /* lookup character and add width */ 2666 Xsum += GFX_Character_Width(decodeUTF8, font); /* lookup character and add width */
2707 } 2667 }
2708 pText++; 2668 pText++;
2709 j++; 2669 j++;
2710
2711 if((font == &FontT105) && (*(char*)pText != 0))
2712 Xsum += 2;
2713 } 2670 }
2714 pText -= j; 2671 pText -= j;
2715 2672
2716 if(cfg->doubleSize) 2673 if(cfg->doubleSize)
2717 Xsum *= 2; 2674 Xsum *= 2;