hrev54241 adds 3 changesets to branch 'master'
old head: cdd33d8e6112b3d080b1f28be89130675d123d3e
new head: afc74b61fe070cb58906d8a20a6ab42c9b019add
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=afc74b61fe07+%5Ecdd33d8e6112
----------------------------------------------------------------------------
c0e0ba1fd81b: GlyphLayoutEngine: cleanup, no functional change.
Change-Id: I688d4a5f1c93de10f15bd34045cf342ea03fa984
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2766
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
4dcd8c81b127: 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@xxxxxxxxx>
afc74b61fe07: Add Thai font to the font fallback system.
Fixes #16077.
Change-Id: I9809dcdcad61fc2956a270ff92b1ccaef4e8efb3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2768
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
[ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
3 files changed, 51 insertions(+), 27 deletions(-)
src/servers/app/font/FontCacheEntry.cpp | 10 +++++
src/servers/app/font/FontCacheEntry.h | 1 +
src/servers/app/font/GlyphLayoutEngine.h | 67 +++++++++++++++++-----------
############################################################################
Commit: c0e0ba1fd81bf26576e7bba166f03628adfa6b1d
URL: https://git.haiku-os.org/haiku/commit/?id=c0e0ba1fd81b
Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Thu May 21 15:36:44 2020 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Fri May 22 01:28:57 2020 UTC
GlyphLayoutEngine: cleanup, no functional change.
Change-Id: I688d4a5f1c93de10f15bd34045cf342ea03fa984
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2766
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
----------------------------------------------------------------------------
diff --git a/src/servers/app/font/GlyphLayoutEngine.h
b/src/servers/app/font/GlyphLayoutEngine.h
index e488eb9604..7bd51d41ae 100644
--- a/src/servers/app/font/GlyphLayoutEngine.h
+++ b/src/servers/app/font/GlyphLayoutEngine.h
@@ -82,7 +82,7 @@ public:
static FontCacheEntry* FontCacheEntryFor(const ServerFont&
font,
bool
forceVector,
const
FontCacheEntry* disallowedEntry,
- const
char* utf8String, int32 length,
+ uint32
glyphCode,
FontCacheReference& cacheReference,
bool
needsWriteLock);
@@ -101,7 +101,7 @@ private:
FontCacheReference& cacheReference,
FontCacheEntry* entry,
const
ServerFont& font, bool needsVector,
- const
char* utf8String, int32 length,
+ uint32
glyphCode,
FontCacheReference& fallbackCacheReference,
FontCacheEntry*& fallbackEntry);
@@ -132,7 +132,7 @@ GlyphLayoutEngine::IsWhiteSpace(uint32 charCode)
inline FontCacheEntry*
GlyphLayoutEngine::FontCacheEntryFor(const ServerFont& font, bool forceVector,
- const FontCacheEntry* disallowedEntry, const char* utf8String, int32
length,
+ const FontCacheEntry* disallowedEntry, uint32 glyphCode,
FontCacheReference& cacheReference, bool needsWriteLock)
{
ASSERT(cacheReference.Entry() == NULL);
@@ -192,8 +192,8 @@ GlyphLayoutEngine::LayoutGlyphs(GlyphConsumer& consumer,
}
if (entry == NULL) {
- entry = FontCacheEntryFor(font, consumer.NeedsVector(), NULL,
- utf8String, length, cacheReference, false);
+ entry = FontCacheEntryFor(font, consumer.NeedsVector(), NULL, 0,
+ cacheReference, false);
if (entry == NULL)
return false;
@@ -240,7 +240,7 @@ GlyphLayoutEngine::LayoutGlyphs(GlyphConsumer& consumer,
// we only have to do this switch once for the whole
string.
if (!writeLocked) {
writeLocked =
_WriteLockAndAcquireFallbackEntry(cacheReference,
- entry, font, consumer.NeedsVector(),
utf8String, length,
+ entry, font, consumer.NeedsVector(),
charCode,
fallbackCacheReference, fallbackEntry);
}
@@ -301,8 +301,8 @@ GlyphLayoutEngine::LayoutGlyphs(GlyphConsumer& consumer,
inline bool
GlyphLayoutEngine::_WriteLockAndAcquireFallbackEntry(
FontCacheReference& cacheReference, FontCacheEntry* entry,
- const ServerFont& font, bool forceVector, const char* utf8String,
- int32 length, FontCacheReference& fallbackCacheReference,
+ const ServerFont& font, bool forceVector, uint32 charCode,
+ FontCacheReference& fallbackCacheReference,
FontCacheEntry*& fallbackEntry)
{
// We need a fallback font, since potentially, we have to obtain missing
@@ -331,33 +331,39 @@ GlyphLayoutEngine::_WriteLockAndAcquireFallbackEntry(
};
int i = 0;
+ fallbackEntry = NULL;
// Try to get the glyph from the fallback fonts
- while (fallbacks[i] != NULL) {
+ for (i = 0; fallbacks[i] != NULL; i++) {
if (gFontManager->Lock()) {
- FontStyle* fallbackStyle = gFontManager->GetStyle(
- fallbacks[i], font.Style());
+ FontStyle* fallbackStyle =
gFontManager->GetStyle(fallbacks[i],
+ font.Style());
- if (fallbackStyle != NULL) {
- ServerFont fallbackFont(*fallbackStyle,
font.Size());
+ if (fallbackStyle == NULL) {
gFontManager->Unlock();
+ continue;
+ }
- // Force the write-lock on the fallback entry,
since we
- // don't transfer or copy GlyphCache objects
from one cache
- // to the other, but create new glyphs which
are stored in
- // "entry" in any case, which requires the
write cache for
- // sure (used FontEngine of fallbackEntry).
- fallbackEntry = FontCacheEntryFor(fallbackFont,
forceVector,
- entry, utf8String, length,
fallbackCacheReference, true);
-
- if (fallbackEntry != NULL)
- break;
- } else
- gFontManager->Unlock();
+ ServerFont fallbackFont(*fallbackStyle, font.Size());
+ gFontManager->Unlock();
+
+ // Force the write-lock on the fallback entry, since we
+ // don't transfer or copy GlyphCache objects from one
cache
+ // to the other, but create new glyphs which are stored
in
+ // "entry" in any case, which requires the write cache
for
+ // sure (used FontEngine of fallbackEntry).
+ FontCacheEntry* candidateFallbackEntry =
FontCacheEntryFor(
+ fallbackFont, forceVector, entry, charCode,
+ fallbackCacheReference, true);
+
+ // Stop when we find a font that indeed has the glyph
we need.
+ if (candidateFallbackEntry != NULL) {
+ fallbackEntry = candidateFallbackEntry;
+ break;
+ }
}
-
- i++;
}
+
// NOTE: We don't care if fallbackEntry is still NULL, fetching
// alternate glyphs will simply not work.
############################################################################
Commit: 4dcd8c81b12790b0ad7661f3ab8742ae619996be
URL: https://git.haiku-os.org/haiku/commit/?id=4dcd8c81b127
Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Thu May 21 17:34:13 2020 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Fri May 22 01:28:57 2020 UTC
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@xxxxxxxxx>
----------------------------------------------------------------------------
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;
}
############################################################################
Revision: hrev54241
Commit: afc74b61fe070cb58906d8a20a6ab42c9b019add
URL: https://git.haiku-os.org/haiku/commit/?id=afc74b61fe07
Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Thu May 21 17:55:28 2020 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Fri May 22 01:28:57 2020 UTC
Ticket: https://dev.haiku-os.org/ticket/16077
Add Thai font to the font fallback system.
Fixes #16077.
Change-Id: I9809dcdcad61fc2956a270ff92b1ccaef4e8efb3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2768
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
----------------------------------------------------------------------------
diff --git a/src/servers/app/font/GlyphLayoutEngine.h
b/src/servers/app/font/GlyphLayoutEngine.h
index 910b88e189..5b5af5c66e 100644
--- a/src/servers/app/font/GlyphLayoutEngine.h
+++ b/src/servers/app/font/GlyphLayoutEngine.h
@@ -331,6 +331,7 @@ GlyphLayoutEngine::_WriteLockAndAcquireFallbackEntry(
// of some kind to know the most suitable fallback font.
static const char* fallbacks[] = {
"Noto Sans Display",
+ "Noto Sans Thai",
"Noto Sans CJK JP",
"Noto Sans Symbols",
NULL