refactor: Simplify REPLACEMENT_GLYPH fallback (#1119)
## Summary **What is the goal of this PR?** Consolidated repeated logic to fall back to REPLACEMENT_GLYPH. --- ### 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? _**NO**_
This commit is contained in:
1 parent
410c70ab89
commit
13fc8b94b0
2 files changed
+3
-27
No files matched your search
@@ -25,11 +25,6 @@ void EpdFont::getTextBounds(const char* string, const int startX, const int star
|
||||
uint32_t cp;
|
||||
while ((cp = utf8NextCodepoint(reinterpret_cast<const uint8_t**>(&string)))) {
|
||||
const EpdGlyph* glyph = getGlyph(cp);
|
||||
|
||||
if (!glyph) {
|
||||
glyph = getGlyph(REPLACEMENT_GLYPH);
|
||||
}
|
||||
|
||||
if (!glyph) {
|
||||
// TODO: Better handle this?
|
||||
continue;
|
||||
@@ -95,6 +90,8 @@ const EpdGlyph* EpdFont::getGlyph(const uint32_t cp) const {
|
||||
return &data->glyph[interval->offset + (cp - interval->first)];
|
||||
}
|
||||
}
|
||||
|
||||
if (cp != REPLACEMENT_GLYPH) {
|
||||
return getGlyph(REPLACEMENT_GLYPH);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
Reference in new issue
Block a user