app_server: include the manager in the font cache key

App-loaded fonts get the same IDs for different apps, so the cache
entries can be easily overwritten or used for an unexpected font. The
FontManager adds a unique chunk to the string.

Change-Id: I67ea9971784f425370d1aad516af4dae8489c45b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6071
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Máximo Castañeda 2023-02-16 21:04:02 +01:00 committed by Adrien Destugues
parent f369023834
commit 76b2fd5bed
3 changed files with 8 additions and 2 deletions

View File

@ -171,6 +171,9 @@ class ServerFont {
status_t IncludesUnicodeBlock(uint32 start, uint32 end,
bool &hasBlock);
FontManagerBase* Manager() const
{ return fStyle->Manager(); }
void SetFontData(FT_Byte* location, uint32 size);
uint32 FontDataSize() const
{ return fStyle->FontDataSize(); }

View File

@ -399,8 +399,8 @@ FontCacheEntry::GenerateSignature(char* signature, size_t signatureSize,
bool hinting = font.Hinting();
uint8 averageWeight = gSubpixelAverageWeight;
snprintf(signature, signatureSize, "%" B_PRId32 ",%u,%d,%d,%.1f,%d,%d",
font.GetFamilyAndStyle(), charMap,
snprintf(signature, signatureSize, "%" B_PRId32 ",%p,%u,%d,%d,%.1f,%d,%d",
font.GetFamilyAndStyle(), font.Manager(), charMap,
font.Face(), int(renderingType), font.Size(), hinting, averageWeight);
}

View File

@ -132,6 +132,9 @@ class FontStyle : public BReferenceable {
status_t UpdateFace(FT_Face face);
FontManagerBase* Manager() const
{ return fFontManager; }
uint32 FontDataSize() const
{ return fFontDataSize; }