MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / discover

Method discover

lib/EpdFont/SdCardFontRegistry.cpp:230–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230bool SdCardFontRegistry::discover() {
231 families_.clear();
232 families_.reserve(MAX_SD_FAMILIES);
233
234 // Hidden root is scanned first so it wins on name collisions, matching the
235 // sleep-folder pattern (/.sleep preferred over /sleep).
236 scanRoot(FONTS_DIR_HIDDEN, families_);
237 scanRoot(FONTS_DIR_VISIBLE, families_);
238
239 // Sort families alphabetically
240 std::sort(families_.begin(), families_.end(),
241 [](const SdCardFontFamilyInfo& a, const SdCardFontFamilyInfo& b) { return a.name < b.name; });
242
243 // Cap at MAX_SD_FAMILIES
244 if (static_cast<int>(families_.size()) > MAX_SD_FAMILIES) {
245 families_.resize(MAX_SD_FAMILIES);
246 }
247
248 LOG_DBG("SDREG", "Discovery complete: %d families", static_cast<int>(families_.size()));
249 return !families_.empty();
250}
251
252const char* SdCardFontRegistry::findFamilyRoot(const char* familyName) {
253 if (!familyName || !*familyName) return nullptr;

Callers 4

beginMethod · 0.80
ensureLoadedMethod · 0.80
refreshRegistryMethod · 0.80
refreshIfDirtyMethod · 0.80

Calls 5

endMethod · 0.80
clearMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected