зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1379444 - Use generic cmap-based font fallback if platform-specific code fails to find a usable font. r=lsalzman
This commit is contained in:
Родитель
416337ceb9
Коммит
e899441ccb
|
@ -1405,23 +1405,11 @@ IFACEMETHODIMP DWriteFontFallbackRenderer::DrawGlyphRun(
|
|||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxDWriteFontList::GlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
uint32_t& aCmapCount,
|
||||
gfxFontFamily** aMatchedFamily)
|
||||
gfxDWriteFontList::PlatformGlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
gfxFontFamily** aMatchedFamily)
|
||||
{
|
||||
bool useCmaps = IsFontFamilyWhitelistActive() ||
|
||||
gfxPlatform::GetPlatform()->UseCmapsDuringSystemFallback();
|
||||
|
||||
if (useCmaps) {
|
||||
return gfxPlatformFontList::GlobalFontFallback(aCh,
|
||||
aRunScript,
|
||||
aMatchStyle,
|
||||
aCmapCount,
|
||||
aMatchedFamily);
|
||||
}
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
RefPtr<IDWriteFactory> dwFactory =
|
||||
|
|
|
@ -393,6 +393,14 @@ protected:
|
|||
virtual gfxFontFamily*
|
||||
GetDefaultFontForPlatform(const gfxFontStyle* aStyle) override;
|
||||
|
||||
// attempt to use platform-specific fallback for the given character,
|
||||
// return null if no usable result found
|
||||
gfxFontEntry*
|
||||
PlatformGlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
gfxFontFamily** aMatchedFamily) override;
|
||||
|
||||
private:
|
||||
friend class gfxDWriteFontFamily;
|
||||
|
||||
|
@ -400,13 +408,6 @@ private:
|
|||
|
||||
void GetDirectWriteSubstitutes();
|
||||
|
||||
// search fonts system-wide for a given character, null otherwise
|
||||
virtual gfxFontEntry* GlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
uint32_t& aCmapCount,
|
||||
gfxFontFamily** aMatchedFamily);
|
||||
|
||||
virtual bool UsesSystemFallback() { return true; }
|
||||
|
||||
void GetFontsFromCollection(IDWriteFontCollection* aCollection);
|
||||
|
|
|
@ -156,12 +156,13 @@ private:
|
|||
const void *object,
|
||||
CFDictionaryRef userInfo);
|
||||
|
||||
// search fonts system-wide for a given character, null otherwise
|
||||
gfxFontEntry* GlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
uint32_t& aCmapCount,
|
||||
gfxFontFamily** aMatchedFamily) override;
|
||||
// attempt to use platform-specific fallback for the given character
|
||||
// return null if no usable result found
|
||||
gfxFontEntry*
|
||||
PlatformGlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
gfxFontFamily** aMatchedFamily) override;
|
||||
|
||||
bool UsesSystemFallback() override { return true; }
|
||||
|
||||
|
|
|
@ -1059,23 +1059,11 @@ gfxMacPlatformFontList::RegisteredFontsChangedNotificationCallback(CFNotificatio
|
|||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxMacPlatformFontList::GlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
uint32_t& aCmapCount,
|
||||
gfxFontFamily** aMatchedFamily)
|
||||
gfxMacPlatformFontList::PlatformGlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
gfxFontFamily** aMatchedFamily)
|
||||
{
|
||||
bool useCmaps = IsFontFamilyWhitelistActive() ||
|
||||
gfxPlatform::GetPlatform()->UseCmapsDuringSystemFallback();
|
||||
|
||||
if (useCmaps) {
|
||||
return gfxPlatformFontList::GlobalFontFallback(aCh,
|
||||
aRunScript,
|
||||
aMatchStyle,
|
||||
aCmapCount,
|
||||
aMatchedFamily);
|
||||
}
|
||||
|
||||
CFStringRef str;
|
||||
UniChar ch[2];
|
||||
CFIndex length = 1;
|
||||
|
|
|
@ -650,6 +650,18 @@ gfxPlatformFontList::GlobalFontFallback(const uint32_t aCh,
|
|||
uint32_t& aCmapCount,
|
||||
gfxFontFamily** aMatchedFamily)
|
||||
{
|
||||
bool useCmaps = IsFontFamilyWhitelistActive() ||
|
||||
gfxPlatform::GetPlatform()->UseCmapsDuringSystemFallback();
|
||||
if (!useCmaps) {
|
||||
// Allow platform-specific fallback code to try and find a usable font
|
||||
gfxFontEntry* fe =
|
||||
PlatformGlobalFontFallback(aCh, aRunScript, aMatchStyle,
|
||||
aMatchedFamily);
|
||||
if (fe) {
|
||||
return fe;
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise, try to find it among local fonts
|
||||
GlobalFontMatch data(aCh, aRunScript, aMatchStyle);
|
||||
|
||||
|
|
|
@ -344,12 +344,24 @@ protected:
|
|||
const gfxFontStyle* aMatchStyle,
|
||||
gfxFontFamily** aMatchedFamily);
|
||||
|
||||
// search fonts system-wide for a given character, null otherwise
|
||||
virtual gfxFontEntry* GlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
uint32_t& aCmapCount,
|
||||
gfxFontFamily** aMatchedFamily);
|
||||
// Search fonts system-wide for a given character, null if not found.
|
||||
gfxFontEntry* GlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
uint32_t& aCmapCount,
|
||||
gfxFontFamily** aMatchedFamily);
|
||||
|
||||
// Platform-specific implementation of global font fallback, if any;
|
||||
// this may return nullptr in which case the default cmap-based fallback
|
||||
// will be performed.
|
||||
virtual gfxFontEntry*
|
||||
PlatformGlobalFontFallback(const uint32_t aCh,
|
||||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
gfxFontFamily** aMatchedFamily)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// whether system-based font fallback is used or not
|
||||
// if system fallback is used, no need to load all cmaps
|
||||
|
|
Загрузка…
Ссылка в новой задаче