## Summary This PR optimizes the text rendering process by skipping underline style calculations and measurements during the initial font cache scanning phase. This prevents excessive and unnecessary SD card reads on pages with heavy use of underlines (e.g., Table of Contents pages). ### **The Problem** During the first rendering pass (the font cache scan pass used to collect text for prewarming), `GfxRenderer::drawText()` early-returns after recording text as expected. However, `TextBlock::render()` continued past this point to execute the underline decoration logic. Because underline calculation calls `getTextWidth()` and `getTextAdvanceX()`, it triggered immediate glyph lookups via `EpdFont::getGlyph()`. Since the SD card font had not been prewarmed yet at this stage, the lookups fell back to the `glyphMissHandler`, resulting in hundreds of individual, slow SD card reads into a limited 8-slot ring buffer. ### **The Fix** 1. **Exposed Scan State:** Added `GfxRenderer::isFontCacheScanning()` to safely check if the font cache manager is currently in text-collection/scan mode. 2. **Bypassed Underline Logic:** Modified `TextBlock::render()` to check this state and skip underline measurement and drawing entirely while scanning is active. > [!NOTE] > The text itself is still properly captured for prewarming via `drawText()`. The underlines will be safely and efficiently calculated and drawn during the actual render pass after the fonts have been completely prewarmed. --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**< YES >**_
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into the executable file.
The source code of each library should be placed in a separate directory
("lib/your_library_name/[Code]").
For example, see the structure of the following example libraries `Foo` and `Bar`:
|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c
Example contents of `src/main.c` using Foo and Bar:
```
#include <Foo.h>
#include <Bar.h>
int main (void)
{
...
}
```
The PlatformIO Library Dependency Finder will find automatically dependent
libraries by scanning project source files.
More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html