app_server: fix font fallback
Actually check that the replacement font contains the needed glyph. Change-Id: I6d774361fcf16a36dc3d05ce8b0fe1cb407fabff Reviewed-on: https://review.haiku-os.org/c/haiku/+/2767 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
c0e0ba1fd8
commit
4dcd8c81b1
|
@ -266,6 +266,16 @@ FontCacheEntry::CachedGlyph(uint32 glyphCode)
|
|||
}
|
||||
|
||||
|
||||
bool
|
||||
FontCacheEntry::CanCreateGlyph(uint32 glyphCode)
|
||||
{
|
||||
// Note that this bypass any fallback or caching because it is used in
|
||||
// the fallback code itself.
|
||||
uint32 glyphIndex = fEngine.GlyphIndexForGlyphCode(glyphCode);
|
||||
return glyphIndex != 0;
|
||||
}
|
||||
|
||||
|
||||
const GlyphCache*
|
||||
FontCacheEntry::CreateGlyph(uint32 glyphCode, FontCacheEntry* fallbackEntry)
|
||||
{
|
||||
|
|
|
@ -112,6 +112,7 @@ class FontCacheEntry : public MultiLocker, public BReferenceable {
|
|||
const GlyphCache* CachedGlyph(uint32 glyphCode);
|
||||
const GlyphCache* CreateGlyph(uint32 glyphCode,
|
||||
FontCacheEntry* fallbackEntry = NULL);
|
||||
bool CanCreateGlyph(uint32 glyphCode);
|
||||
|
||||
void InitAdaptors(const GlyphCache* glyph,
|
||||
double x, double y,
|
||||
|
|
|
@ -147,6 +147,11 @@ GlyphLayoutEngine::FontCacheEntryFor(const ServerFont& font, bool forceVector,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (glyphCode != 0 && !entry->CanCreateGlyph(glyphCode)) {
|
||||
cache->Recycle(entry);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (needsWriteLock) {
|
||||
if (!entry->WriteLock()) {
|
||||
cache->Recycle(entry);
|
||||
|
@ -163,6 +168,7 @@ GlyphLayoutEngine::FontCacheEntryFor(const ServerFont& font, bool forceVector,
|
|||
// proper mode. We can setup the FontCacheReference so it takes care of
|
||||
// the locking and recycling from now and return the entry.
|
||||
cacheReference.SetTo(entry, needsWriteLock);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue