app_server: Fall back into non-matching font variants if necessary.
7a8d5a2db3
introduced that the fallback tries to match the style instead of using regular, the fallback was broken in a different way until commit4dcd8c81b1
fixed the remaining issue, this commit makes the fallback first try the matching style and afterwards try the regular style (so as to improve above falling back to regular in every case). Fixes #16189. Change-Id: Iee956c4c1461794b4836c94e09d66d8cbf196678 Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com> Style fixes and use of BAutolock by me. Also changed the style fallback to use style 0 instead of "Regular". (cherry picked from commit3c6422ea0f
) Reviewed-on: https://review.haiku-os.org/c/haiku/+/2877
This commit is contained in:
parent
532b6aa459
commit
290fd41d06
|
@ -16,6 +16,7 @@
|
|||
#include "FontManager.h"
|
||||
#include "ServerFont.h"
|
||||
|
||||
#include <Autolock.h>
|
||||
#include <Debug.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -337,22 +338,29 @@ GlyphLayoutEngine::_WriteLockAndAcquireFallbackEntry(
|
|||
NULL
|
||||
};
|
||||
|
||||
int i = 0;
|
||||
fallbackEntry = NULL;
|
||||
|
||||
// Try to get the glyph from the fallback fonts
|
||||
for (i = 0; fallbacks[i] != NULL; i++) {
|
||||
if (gFontManager->Lock()) {
|
||||
FontStyle* fallbackStyle = gFontManager->GetStyle(fallbacks[i],
|
||||
font.Style());
|
||||
// Try to get the glyph from the fallback fonts.
|
||||
for (int c = 0; c < 2; c++) {
|
||||
const char* fontStyle;
|
||||
if (c == 0)
|
||||
fontStyle = font.Style();
|
||||
else
|
||||
fontStyle = NULL;
|
||||
|
||||
if (fallbackStyle == NULL) {
|
||||
gFontManager->Unlock();
|
||||
for (int i = 0; fallbacks[i] != NULL; i++) {
|
||||
BAutolock locker(gFontManager);
|
||||
if (!locker.IsLocked())
|
||||
continue;
|
||||
|
||||
FontStyle* fallbackStyle = gFontManager->GetStyle(fallbacks[i],
|
||||
fontStyle, 0xffff, 0);
|
||||
|
||||
if (fallbackStyle == NULL)
|
||||
continue;
|
||||
}
|
||||
|
||||
ServerFont fallbackFont(*fallbackStyle, font.Size());
|
||||
gFontManager->Unlock();
|
||||
locker.Unlock();
|
||||
|
||||
// Force the write-lock on the fallback entry, since we
|
||||
// don't transfer or copy GlyphCache objects from one cache
|
||||
|
@ -369,6 +377,9 @@ GlyphLayoutEngine::_WriteLockAndAcquireFallbackEntry(
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fallbackEntry != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
// NOTE: We don't care if fallbackEntry is still NULL, fetching
|
||||
|
|
Loading…
Reference in New Issue