app_server: do not return a glyph when nothing is found in the font.
- Fixes BFont::GetHasGlyphs, the "empty square" which was returned led it to think the font had glyphs for everything - This means the "no character" empty square will not be drawn anymore, if we want it back, we will need to rework the implementation a bit more (either request it explicitly when there is a missing glyph, or return it as it was before but including an info that it is the "missing glyph") - Maybe GetHasGlyphs should also bypass the font fallback system, and return what's actually in the requested font only. This also fixes a locking problem in the GlyphLayoutEngine, the code didn't handle the read/write lock properly and tried to ReadUnlock from a place where only the write lock was held.
This commit is contained in:
@@ -304,7 +304,8 @@ FontCacheEntry::CreateGlyph(uint32 glyphCode, FontCacheEntry* fallbackEntry)
|
||||
// get the normal space glyph
|
||||
glyphIndex = engine->GlyphIndexForGlyphCode(0x20 /* space */);
|
||||
} else {
|
||||
// render the "missing glyph box" (by simply keeping glyphIndex 0)
|
||||
// The glyph was not found anywhere.
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -309,9 +309,15 @@ GlyphLayoutEngine::_WriteLockAndAcquireFallbackEntry(
|
||||
// glyphs from it. We need to obtain the fallback font while we have not
|
||||
// locked anything, since locking the FontManager with the write-lock held
|
||||
// can obvisouly lead to a deadlock.
|
||||
|
||||
bool writeLocked = entry->IsWriteLocked();
|
||||
|
||||
cacheReference.SetTo(NULL, false);
|
||||
entry->ReadUnlock();
|
||||
if (writeLocked) {
|
||||
entry->WriteUnlock();
|
||||
} else {
|
||||
cacheReference.SetTo(NULL, false);
|
||||
entry->ReadUnlock();
|
||||
}
|
||||
|
||||
if (gFontManager->Lock()) {
|
||||
// TODO: We always get the fallback glyphs from VL Gothic at the
|
||||
@@ -342,8 +348,10 @@ GlyphLayoutEngine::_WriteLockAndAcquireFallbackEntry(
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update the FontCacheReference, since the locking kind changed.
|
||||
cacheReference.SetTo(entry, true);
|
||||
if (!writeLocked) {
|
||||
// Update the FontCacheReference, since the locking kind changed.
|
||||
cacheReference.SetTo(entry, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user