app_server: font style 0 may not exist
In which case failure to find it in the styles hash table does not tell us anything about the existence of its family. Change-Id: I77c8960a96e7283547650daae67ea71fd022567e Reviewed-on: https://review.haiku-os.org/c/haiku/+/7631 Haiku-Format: Haiku-format Bot <[email protected]> Reviewed-by: Fredrik Holmqvist <[email protected]> Tested-by: Commit checker robot <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
d2ac1f5ab2
commit
f657c49d1c
@@ -166,7 +166,8 @@ FontManager::GetFamily(uint16 familyID) const
|
|||||||
if (style != NULL)
|
if (style != NULL)
|
||||||
return style->Family();
|
return style->Family();
|
||||||
|
|
||||||
return NULL;
|
// Try the slow route in case style 0 was removed
|
||||||
|
return _FindFamily(familyID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -374,6 +375,21 @@ FontManager::_FindFamily(const char* name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FontFamily*
|
||||||
|
FontManager::_FindFamily(uint16 familyID) const
|
||||||
|
{
|
||||||
|
int32 count = fFamilies.CountItems();
|
||||||
|
|
||||||
|
for (int32 i = 0; i < count; i++) {
|
||||||
|
FontFamily* family = fFamilies.ItemAt(i);
|
||||||
|
if (family->ID() == familyID)
|
||||||
|
return family;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16
|
uint16
|
||||||
FontManager::_NextID()
|
FontManager::_NextID()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ protected:
|
|||||||
FT_CharMap _GetSupportedCharmap(const FT_Face& face);
|
FT_CharMap _GetSupportedCharmap(const FT_Face& face);
|
||||||
|
|
||||||
FontFamily* _FindFamily(const char* family) const;
|
FontFamily* _FindFamily(const char* family) const;
|
||||||
|
FontFamily* _FindFamily(uint16 familyID) const;
|
||||||
|
|
||||||
status_t _AddFont(FT_Face face, node_ref nodeRef,
|
status_t _AddFont(FT_Face face, node_ref nodeRef,
|
||||||
const char* path,
|
const char* path,
|
||||||
|
|||||||
@@ -429,20 +429,27 @@ GlyphLayoutEngine::PopulateFallbacks(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
static const int nFallbacks = B_COUNT_OF(fallbacks);
|
static const int nFallbacks = B_COUNT_OF(fallbacks);
|
||||||
|
static const int acceptAnyStyle = 2;
|
||||||
|
|
||||||
for (int c = 0; c < 3; c++) {
|
for (int degradeLevel = 0; degradeLevel <= acceptAnyStyle; degradeLevel++) {
|
||||||
const char* fontStyle;
|
const char* fontStyle;
|
||||||
if (c == 0)
|
if (degradeLevel == 0)
|
||||||
fontStyle = font.Style();
|
fontStyle = font.Style();
|
||||||
else if (c == 1)
|
else if (degradeLevel == 1)
|
||||||
fontStyle = "Regular";
|
fontStyle = "Regular";
|
||||||
else
|
else
|
||||||
fontStyle = NULL;
|
fontStyle = NULL;
|
||||||
|
|
||||||
for (int i = 0; i < nFallbacks; i++) {
|
for (int i = 0; i < nFallbacks; i++) {
|
||||||
|
|
||||||
FontStyle* fallbackStyle = gFontManager->GetStyle(fallbacks[i],
|
FontStyle* fallbackStyle;
|
||||||
fontStyle, 0xffff, 0);
|
if (degradeLevel != acceptAnyStyle) {
|
||||||
|
fallbackStyle = gFontManager->GetStyle(fallbacks[i], fontStyle);
|
||||||
|
} else {
|
||||||
|
// At this point we'll just take whatever we are given
|
||||||
|
fallbackStyle = gFontManager->GetStyleByIndex(fallbacks[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (fallbackStyle == NULL)
|
if (fallbackStyle == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -458,9 +465,7 @@ GlyphLayoutEngine::PopulateFallbacks(
|
|||||||
fallbacksList.AddItem(cacheReference);
|
fallbacksList.AddItem(cacheReference);
|
||||||
} else
|
} else
|
||||||
FontCache::Default()->Recycle(entry);
|
FontCache::Default()->Recycle(entry);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gFontManager->Unlock();
|
gFontManager->Unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user