diff --git a/src/servers/app/font/FontCacheEntry.cpp b/src/servers/app/font/FontCacheEntry.cpp index fd2428d891..edc18d5380 100644 --- a/src/servers/app/font/FontCacheEntry.cpp +++ b/src/servers/app/font/FontCacheEntry.cpp @@ -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) { diff --git a/src/servers/app/font/FontCacheEntry.h b/src/servers/app/font/FontCacheEntry.h index abe085adec..233c510d5c 100644 --- a/src/servers/app/font/FontCacheEntry.h +++ b/src/servers/app/font/FontCacheEntry.h @@ -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, diff --git a/src/servers/app/font/GlyphLayoutEngine.h b/src/servers/app/font/GlyphLayoutEngine.h index 7bd51d41ae..910b88e189 100644 --- a/src/servers/app/font/GlyphLayoutEngine.h +++ b/src/servers/app/font/GlyphLayoutEngine.h @@ -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; }