Backed out 10 changesets (bug 1056479) for bustage on a CLOSED TREE

Backed out changeset d5b1f2b78915 (bug 1056479)
Backed out changeset bcc65b714dd6 (bug 1056479)
Backed out changeset 0b35e8a463d2 (bug 1056479)
Backed out changeset 0933391809c9 (bug 1056479)
Backed out changeset 93bd67204fac (bug 1056479)
Backed out changeset 5260b93eb0b9 (bug 1056479)
Backed out changeset 130bea3f8623 (bug 1056479)
Backed out changeset 408e078cc18d (bug 1056479)
Backed out changeset a651c240979d (bug 1056479)
Backed out changeset d74ae8fcaac9 (bug 1056479)
This commit is contained in:
Carsten "Tomcat" Book 2015-05-12 08:25:19 +02:00
parent 7fc619a40b
commit 1dea6c6eeb
30 changed files with 79 additions and 2075 deletions

View File

@ -18,10 +18,6 @@
#include "mozilla/AppUnits.h"
#include "mozilla/gfx/2D.h"
#if defined(MOZ_WIDGET_GTK)
#include "gfxPlatformGtk.h" // xxx - for UseFcFontList
#endif
using namespace mozilla;
using namespace mozilla::a11y;
@ -632,30 +628,21 @@ TextAttrsMgr::FontWeightTextAttr::
if (font->IsSyntheticBold())
return 700;
bool useFontEntryWeight = true;
// Under Linux, when gfxPangoFontGroup code is used,
// font->GetStyle()->weight will give the absolute weight requested of the
// font face. The gfxPangoFontGroup code uses the gfxFontEntry constructor
// which doesn't initialize the weight field.
#if defined(MOZ_WIDGET_QT)
useFontEntryWeight = false;
#elif defined(MOZ_WIDGET_GTK)
useFontEntryWeight = gfxPlatformGtk::UseFcFontList();
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
// On Linux, font->GetStyle()->weight will give the absolute weight requested
// of the font face. The Linux code uses the gfxFontEntry constructor which
// doesn't initialize the weight field.
return font->GetStyle()->weight;
#else
// On Windows, font->GetStyle()->weight will give the same weight as
// fontEntry->Weight(), the weight of the first font in the font group, which
// may not be the weight of the font face used to render the characters.
// On Mac, font->GetStyle()->weight will just give the same number as
// getComputedStyle(). fontEntry->Weight() will give the weight of the font
// face used.
gfxFontEntry *fontEntry = font->GetFontEntry();
return fontEntry->Weight();
#endif
if (useFontEntryWeight) {
// On Windows, font->GetStyle()->weight will give the same weight as
// fontEntry->Weight(), the weight of the first font in the font group,
// which may not be the weight of the font face used to render the
// characters. On Mac, font->GetStyle()->weight will just give the same
// number as getComputedStyle(). fontEntry->Weight() will give the weight
// of the font face used.
gfxFontEntry *fontEntry = font->GetFontEntry();
return fontEntry->Weight();
} else {
return font->GetStyle()->weight;
}
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -2548,7 +2548,7 @@ bool
ContentParent::RecvReadFontList(InfallibleTArray<FontListEntry>* retValue)
{
#ifdef ANDROID
gfxAndroidPlatform::GetPlatform()->GetSystemFontList(retValue);
gfxAndroidPlatform::GetPlatform()->GetFontList(retValue);
#endif
return true;
}

View File

@ -102,7 +102,7 @@ load 783041-1.html
load 783041-2.html
load 783041-3.html
load 783041-4.html
load 798853.html # bug 868792
asserts-if(gtk2Widget,1) load 798853.html # bug 868792
asserts-if(winWidget,0-1) skip-if(B2G) load 815489.html
load 836225-1.html
load 839745-1.html

View File

@ -247,9 +247,9 @@ gfxAndroidPlatform::GetFontList(nsIAtom *aLangGroup,
}
void
gfxAndroidPlatform::GetSystemFontList(InfallibleTArray<FontListEntry>* retValue)
gfxAndroidPlatform::GetFontList(InfallibleTArray<FontListEntry>* retValue)
{
gfxFT2FontList::PlatformFontList()->GetSystemFontList(retValue);
gfxFT2FontList::PlatformFontList()->GetFontList(retValue);
}
nsresult

View File

@ -40,7 +40,7 @@ public:
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
// to support IPC font list (sharing between chrome and content)
void GetSystemFontList(InfallibleTArray<FontListEntry>* retValue);
void GetFontList(InfallibleTArray<FontListEntry>* retValue);
// platform implementations of font functions
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags);

View File

@ -1304,9 +1304,7 @@ gfxDWriteFontList::GetStandardFamilyName(const nsAString& aFontName,
}
gfxFontFamily*
gfxDWriteFontList::FindFamily(const nsAString& aFamily,
nsIAtom* aLanguage,
bool aUseSystemFonts)
gfxDWriteFontList::FindFamily(const nsAString& aFamily, bool aUseSystemFonts)
{
if (!mInitialized) {
mInitialized = true;

View File

@ -365,7 +365,6 @@ public:
bool UseGDIFontTableAccess() { return mGDIFontTableAccess; }
virtual gfxFontFamily* FindFamily(const nsAString& aFamily,
nsIAtom* aLanguage = nullptr,
bool aUseSystemFonts = false);
virtual void GetFontFamilyList(nsTArray<nsRefPtr<gfxFontFamily> >& aFamilyArray);

View File

@ -1357,7 +1357,7 @@ AddHiddenFamilyToFontList(nsStringHashKey::KeyType aKey,
}
void
gfxFT2FontList::GetSystemFontList(InfallibleTArray<FontListEntry>* retValue)
gfxFT2FontList::GetFontList(InfallibleTArray<FontListEntry>* retValue)
{
mFontFamilies.Enumerate(AddFamilyToFontList, retValue);
mHiddenFontFamilies.Enumerate(AddHiddenFamilyToFontList, retValue);

View File

@ -134,7 +134,7 @@ public:
const uint8_t* aFontData,
uint32_t aLength);
void GetSystemFontList(InfallibleTArray<FontListEntry>* retValue);
void GetFontList(InfallibleTArray<FontListEntry>* retValue);
static gfxFT2FontList* PlatformFontList() {
return static_cast<gfxFT2FontList*>(gfxPlatformFontList::PlatformFontList());

File diff suppressed because it is too large Load Diff

View File

@ -1,263 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GFXFCPLATFORMFONTLIST_H_
#define GFXFCPLATFORMFONTLIST_H_
#include "gfxFont.h"
#include "gfxFontEntry.h"
#include "gfxFT2FontBase.h"
#include "gfxPlatformFontList.h"
#include "mozilla/mozalloc.h"
#include <fontconfig/fontconfig.h>
#include "ft2build.h"
#include FT_FREETYPE_H
#include FT_TRUETYPE_TABLES_H
#include <cairo.h>
#include <cairo-ft.h>
#include "gfxFontconfigUtils.h" // xxx - only for nsAutoRefTraits<FcPattern>, etc.
template <>
class nsAutoRefTraits<FcObjectSet> : public nsPointerRefTraits<FcObjectSet>
{
public:
static void Release(FcObjectSet *ptr) { FcObjectSetDestroy(ptr); }
};
template <>
class nsAutoRefTraits<FcConfig> : public nsPointerRefTraits<FcConfig>
{
public:
static void Release(FcConfig *ptr) { FcConfigDestroy(ptr); }
static void AddRef(FcConfig *ptr) { FcConfigReference(ptr); }
};
// Helper classes used for clearning out user font data when cairo font
// face is destroyed. Since multiple faces may use the same data, be
// careful to assure that the data is only cleared out when all uses
// expire. The font entry object contains a refptr to FTUserFontData and
// each cairo font created from that font entry contains a
// FTUserFontDataRef with a refptr to that same FTUserFontData object.
class FTUserFontData {
public:
NS_INLINE_DECL_REFCOUNTING(FTUserFontData)
explicit FTUserFontData(FT_Face aFace, const uint8_t* aData)
: mFace(aFace), mFontData(aData)
{
}
const uint8_t *FontData() const { return mFontData; }
private:
~FTUserFontData()
{
FT_Done_Face(mFace);
if (mFontData) {
NS_Free((void*)mFontData);
}
}
FT_Face mFace;
const uint8_t *mFontData;
};
class FTUserFontDataRef {
public:
explicit FTUserFontDataRef(FTUserFontData *aUserFontData)
: mUserFontData(aUserFontData)
{
}
static void Destroy(void* aData) {
FTUserFontDataRef* aUserFontDataRef =
static_cast<FTUserFontDataRef*>(aData);
delete aUserFontDataRef;
}
private:
nsRefPtr<FTUserFontData> mUserFontData;
};
// The names for the font entry and font classes should really
// the common 'Fc' abbreviation but the gfxPangoFontGroup code already
// defines versions of these, so use the verbose name for now.
class gfxFontconfigFontEntry : public gfxFontEntry {
public:
// used for system fonts with explicit patterns
explicit gfxFontconfigFontEntry(const nsAString& aFaceName,
FcPattern* aFontPattern);
// used for data fonts where the fontentry takes ownership
// of the font data and the FT_Face
explicit gfxFontconfigFontEntry(const nsAString& aFaceName,
uint16_t aWeight,
int16_t aStretch,
bool aItalic,
const uint8_t *aData,
FT_Face aFace);
// used for @font-face local system fonts with explicit patterns
explicit gfxFontconfigFontEntry(const nsAString& aFaceName,
FcPattern* aFontPattern,
uint16_t aWeight,
int16_t aStretch,
bool aItalic);
FcPattern* GetPattern() { return mFontPattern; }
bool SupportsLangGroup(nsIAtom *aLangGroup) const override;
nsresult ReadCMAP(FontInfoData *aFontInfoData = nullptr) override;
bool TestCharacterMap(uint32_t aCh) override;
hb_blob_t* GetFontTable(uint32_t aTableTag) override;
void ForgetHBFace() override;
void ReleaseGrFace(gr_face* aFace) override;
protected:
virtual ~gfxFontconfigFontEntry();
gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle,
bool aNeedsBold) override;
// helper method for creating cairo font from pattern
cairo_scaled_font_t*
CreateScaledFont(FcPattern* aRenderPattern,
const gfxFontStyle *aStyle,
bool aNeedsBold);
// override to pull data from FTFace
virtual nsresult
CopyFontTable(uint32_t aTableTag,
FallibleTArray<uint8_t>& aBuffer) override;
// if HB or GR faces are gone, close down the FT_Face
void MaybeReleaseFTFace();
double GetAspect();
// pattern for a single face of a family
nsCountedRef<FcPattern> mFontPattern;
// user font data, when needed
nsRefPtr<FTUserFontData> mUserFontData;
// FTFace - initialized when needed
FT_Face mFTFace;
bool mFTFaceInitialized;
double mAspect;
// data font
const uint8_t* mFontData;
};
class gfxFontconfigFontFamily : public gfxFontFamily {
public:
gfxFontconfigFontFamily(const nsAString& aName) :
gfxFontFamily(aName) { }
void FindStyleVariations(FontInfoData *aFontInfoData = nullptr) override;
// Families are constructed initially with just references to patterns.
// When necessary, these are enumerated within FindStyleVariations.
void AddFontPattern(FcPattern* aFontPattern);
protected:
virtual ~gfxFontconfigFontFamily() { }
nsTArray<nsCountedRef<FcPattern> > mFontPatterns;
};
class gfxFontconfigFont : public gfxFT2FontBase {
public:
gfxFontconfigFont(cairo_scaled_font_t *aScaledFont,
gfxFontEntry *aFontEntry,
const gfxFontStyle *aFontStyle,
bool aNeedsBold);
#ifdef USE_SKIA
virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions>
GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) override;
#endif
protected:
virtual ~gfxFontconfigFont();
};
class gfxFcPlatformFontList : public gfxPlatformFontList {
public:
gfxFcPlatformFontList();
// initialize font lists
nsresult InitFontList() override;
void GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts) override;
gfxFontFamily*
GetDefaultFont(const gfxFontStyle* aStyle) override;
gfxFontEntry*
LookupLocalFont(const nsAString& aFontName, uint16_t aWeight,
int16_t aStretch, bool aItalic) override;
gfxFontEntry*
MakePlatformFont(const nsAString& aFontName, uint16_t aWeight,
int16_t aStretch, bool aItalic,
const uint8_t* aFontData,
uint32_t aLength) override;
gfxFontFamily* FindFamily(const nsAString& aFamily,
nsIAtom* aLanguage = nullptr,
bool aUseSystemFonts = false) override;
bool GetStandardFamilyName(const nsAString& aFontName,
nsAString& aFamilyName) override;
FcConfig* GetLastConfig() const { return mLastConfig; }
static FT_Library GetFTLibrary();
protected:
virtual ~gfxFcPlatformFontList();
// add all the font families found in a font set
void AddFontSetFamilies(FcFontSet* aFontSet);
// figure out which family fontconfig maps a generic to
// (aGeneric assumed already lowercase)
gfxFontFamily* FindGenericFamily(const nsAString& aGeneric,
nsIAtom* aLanguage);
static void CheckFontUpdates(nsITimer *aTimer, void *aThis);
#ifdef MOZ_BUNDLED_FONTS
void ActivateBundledFonts();
nsCString mBundledFontsPath;
bool mBundledFontsInitialized;
#endif
// to avoid enumerating all fonts, maintain a mapping of local font
// names to family
nsRefPtrHashtable<nsStringHashKey, gfxFontFamily> mLocalNames;
// caching generic/lang ==> font family
nsRefPtrHashtable<nsCStringHashKey, gfxFontFamily> mGenericMappings;
nsCOMPtr<nsITimer> mCheckFontUpdatesTimer;
nsCountedRef<FcConfig> mLastConfig;
static FT_Library sCairoFTLibrary;
};
#endif /* GFXPLATFORMFONTLIST_H_ */

View File

@ -54,8 +54,6 @@ class gfxTextContextPaint;
// we use a platform-dependent value to harmonize with the platform's own APIs.
#ifdef XP_WIN
#define OBLIQUE_SKEW_FACTOR 0.3
#elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
#define OBLIQUE_SKEW_FACTOR 0.2
#else
#define OBLIQUE_SKEW_FACTOR 0.25
#endif

View File

@ -830,9 +830,7 @@ gfxGDIFontList::MakePlatformFont(const nsAString& aFontName,
}
gfxFontFamily*
gfxGDIFontList::FindFamily(const nsAString& aFamily,
nsIAtom* aLanguage,
bool aUseSystemFonts)
gfxGDIFontList::FindFamily(const nsAString& aFamily, bool aUseSystemFonts)
{
nsAutoString keyName(aFamily);
BuildKeyNameFromFontName(keyName);

View File

@ -310,7 +310,6 @@ public:
virtual gfxFontFamily* GetDefaultFont(const gfxFontStyle* aStyle);
virtual gfxFontFamily* FindFamily(const nsAString& aFamily,
nsIAtom* aLanguage = nullptr,
bool aUseSystemFonts = false);
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,

View File

@ -1262,7 +1262,6 @@ gfxPangoFontGroup::gfxPangoFontGroup(const FontFamilyList& aFontFamilyList,
// dummy entry, will be replaced when actually needed
mFonts.AppendElement(FamilyFace());
mSkipUpdateUserFonts = true;
}
gfxPangoFontGroup::~gfxPangoFontGroup()

View File

@ -76,10 +76,6 @@
#include "GLContextProvider.h"
#include "mozilla/gfx/Logging.h"
#if defined(MOZ_WIDGET_GTK)
#include "gfxPlatformGtk.h" // xxx - for UseFcFontList
#endif
#ifdef MOZ_WIDGET_ANDROID
#include "TexturePoolOGL.h"
#endif
@ -386,39 +382,6 @@ static const char *gPrefLangNames[] = {
"x-unicode",
};
// this needs to match the list of pref font.default.xx entries listed in all.js!
// the order *must* match the order in eFontPrefLang
static nsIAtom* gPrefLangToLangGroups[] = {
nsGkAtoms::x_western,
nsGkAtoms::Japanese,
nsGkAtoms::Taiwanese,
nsGkAtoms::Chinese,
nsGkAtoms::HongKongChinese,
nsGkAtoms::ko,
nsGkAtoms::x_cyrillic,
nsGkAtoms::el,
nsGkAtoms::th,
nsGkAtoms::he,
nsGkAtoms::ar,
nsGkAtoms::x_devanagari,
nsGkAtoms::x_tamil,
nsGkAtoms::x_armn,
nsGkAtoms::x_beng,
nsGkAtoms::x_cans,
nsGkAtoms::x_ethi,
nsGkAtoms::x_geor,
nsGkAtoms::x_gujr,
nsGkAtoms::x_guru,
nsGkAtoms::x_khmr,
nsGkAtoms::x_mlym,
nsGkAtoms::x_orya,
nsGkAtoms::x_telu,
nsGkAtoms::x_knda,
nsGkAtoms::x_sinh,
nsGkAtoms::x_tibt,
nsGkAtoms::Unicode
};
gfxPlatform::gfxPlatform()
: mTileWidth(-1)
, mTileHeight(-1)
@ -540,19 +503,12 @@ gfxPlatform::Init()
nsresult rv;
bool usePlatformFontList = true;
#if defined(MOZ_WIDGET_GTK)
usePlatformFontList = gfxPlatformGtk::UseFcFontList();
#elif defined(MOZ_WIDGET_QT)
usePlatformFontList = false;
#endif
if (usePlatformFontList) {
rv = gfxPlatformFontList::Init();
if (NS_FAILED(rv)) {
NS_RUNTIMEABORT("Could not initialize gfxPlatformFontList");
}
#if defined(XP_MACOSX) || defined(XP_WIN) || defined(ANDROID) // temporary, until this is implemented on others
rv = gfxPlatformFontList::Init();
if (NS_FAILED(rv)) {
NS_RUNTIMEABORT("Could not initialize gfxPlatformFontList");
}
#endif
gPlatform->mScreenReferenceSurface =
gPlatform->CreateOffscreenSurface(IntSize(1, 1),
@ -1518,19 +1474,6 @@ gfxPlatform::GetFontPrefLangFor(nsIAtom *aLang)
return GetFontPrefLangFor(lang.get());
}
nsIAtom*
gfxPlatform::GetLangGroupForPrefLang(eFontPrefLang aLang)
{
// the special CJK set pref lang should be resolved into separate
// calls to individual CJK pref langs before getting here
NS_ASSERTION(aLang != eFontPrefLang_CJKSet, "unresolved CJK set pref lang");
if (uint32_t(aLang) < ArrayLength(gPrefLangToLangGroups)) {
return gPrefLangToLangGroups[uint32_t(aLang)];
}
return nsGkAtoms::Unicode;
}
const char*
gfxPlatform::GetPrefLangName(eFontPrefLang aLang)
{

View File

@ -470,9 +470,6 @@ public:
// convert a lang group atom to enum constant
static eFontPrefLang GetFontPrefLangFor(nsIAtom *aLang);
// convert an enum constant to a lang group atom
static nsIAtom* GetLangGroupForPrefLang(eFontPrefLang aLang);
// convert a enum constant to lang group string (i.e. eFontPrefLang_ChineseTW ==> "zh-TW")
static const char* GetPrefLangName(eFontPrefLang aLang);

View File

@ -650,7 +650,8 @@ gfxPlatformFontList::CommonFontFallback(uint32_t aCh, uint32_t aNextCh,
const char *fallbackFamily = defaultFallbacks[i];
familyName.AppendASCII(fallbackFamily);
gfxFontFamily *fallback = FindFamilyByCanonicalName(familyName);
gfxFontFamily *fallback =
gfxPlatformFontList::PlatformFontList()->FindFamily(familyName);
if (!fallback)
continue;
@ -725,9 +726,7 @@ gfxPlatformFontList::CheckFamily(gfxFontFamily *aFamily)
}
gfxFontFamily*
gfxPlatformFontList::FindFamily(const nsAString& aFamily,
nsIAtom* aLanguage,
bool aUseSystemFonts)
gfxPlatformFontList::FindFamily(const nsAString& aFamily, bool aUseSystemFonts)
{
nsAutoString key;
gfxFontFamily *familyEntry;

View File

@ -110,9 +110,9 @@ public:
// initialize font lists
virtual nsresult InitFontList();
virtual void GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts);
void GetFontList (nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts);
void UpdateFontList();
@ -126,7 +126,6 @@ public:
const gfxFontStyle* aStyle);
virtual gfxFontFamily* FindFamily(const nsAString& aFamily,
nsIAtom* aLanguage = nullptr,
bool aUseSystemFonts = false);
gfxFontEntry* FindFontForFamily(const nsAString& aFamily, const gfxFontStyle* aStyle, bool& aNeedsBold);
@ -211,18 +210,6 @@ protected:
nsRefPtr<gfxFontFamily>& aFamilyEntry,
void* userArg);
// Lookup family name in global family list without substitutions or
// localized family name lookup. Used for common font fallback families.
gfxFontFamily* FindFamilyByCanonicalName(const nsAString& aFamily) {
nsAutoString key;
gfxFontFamily *familyEntry;
GenerateFontListKey(aFamily, key);
if ((familyEntry = mFontFamilies.GetWeak(key))) {
return CheckFamily(familyEntry);
}
return nullptr;
}
// returns default font for a given character, null otherwise
gfxFontEntry* CommonFontFallback(uint32_t aCh, uint32_t aNextCh,
int32_t aRunScript,

View File

@ -12,7 +12,6 @@
#include "nsUnicharUtils.h"
#include "nsUnicodeProperties.h"
#include "gfx2DGlue.h"
#include "gfxFcPlatformFontList.h"
#include "gfxFontconfigUtils.h"
#include "gfxPangoFonts.h"
#include "gfxContext.h"
@ -60,15 +59,10 @@ static cairo_user_data_key_t cairo_gdk_drawable_key;
bool gfxPlatformGtk::sUseXRender = true;
#endif
bool gfxPlatformGtk::sUseFcFontList = false;
gfxPlatformGtk::gfxPlatformGtk()
{
sUseFcFontList = mozilla::Preferences::GetBool("gfx.font_rendering.fontconfig.fontlist.enabled");
if (!sUseFcFontList && !sFontconfigUtils) {
if (!sFontconfigUtils)
sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
}
#ifdef MOZ_X11
sUseXRender = (GDK_IS_X11_DISPLAY(gdk_display_get_default())) ?
mozilla::Preferences::GetBool("gfx.xrender.enabled") : false;
@ -82,11 +76,10 @@ gfxPlatformGtk::gfxPlatformGtk()
gfxPlatformGtk::~gfxPlatformGtk()
{
if (!sUseFcFontList) {
gfxFontconfigUtils::Shutdown();
sFontconfigUtils = nullptr;
gfxPangoFontGroup::Shutdown();
}
gfxFontconfigUtils::Shutdown();
sFontconfigUtils = nullptr;
gfxPangoFontGroup::Shutdown();
}
void
@ -156,84 +149,19 @@ gfxPlatformGtk::GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts)
{
if (sUseFcFontList) {
gfxPlatformFontList::PlatformFontList()->GetFontList(aLangGroup,
aGenericFamily,
aListOfFonts);
return NS_OK;
}
return sFontconfigUtils->GetFontList(aLangGroup,
aGenericFamily,
return sFontconfigUtils->GetFontList(aLangGroup, aGenericFamily,
aListOfFonts);
}
nsresult
gfxPlatformGtk::UpdateFontList()
{
if (sUseFcFontList) {
gfxPlatformFontList::PlatformFontList()->UpdateFontList();
return NS_OK;
}
return sFontconfigUtils->UpdateFontList();
}
// xxx - this is ubuntu centric, need to go through other distros and flesh
// out a more general list
static const char kFontDejaVuSans[] = "DejaVu Sans";
static const char kFontDejaVuSerif[] = "DejaVu Serif";
static const char kFontFreeSans[] = "FreeSans";
static const char kFontFreeSerif[] = "FreeSerif";
static const char kFontTakaoPGothic[] = "TakaoPGothic";
static const char kFontDroidSansFallback[] = "Droid Sans Fallback";
static const char kFontWenQuanYiMicroHei[] = "WenQuanYi Micro Hei";
static const char kFontNanumGothic[] = "NanumGothic";
void
gfxPlatformGtk::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
int32_t aRunScript,
nsTArray<const char*>& aFontList)
{
aFontList.AppendElement(kFontDejaVuSerif);
aFontList.AppendElement(kFontFreeSerif);
aFontList.AppendElement(kFontDejaVuSans);
aFontList.AppendElement(kFontFreeSans);
// add fonts for CJK ranges
// xxx - this isn't really correct, should use the same CJK font ordering
// as the pref font code
if (aCh >= 0x3000 &&
((aCh < 0xe000) ||
(aCh >= 0xf900 && aCh < 0xfff0) ||
((aCh >> 16) == 2))) {
aFontList.AppendElement(kFontTakaoPGothic);
aFontList.AppendElement(kFontDroidSansFallback);
aFontList.AppendElement(kFontWenQuanYiMicroHei);
aFontList.AppendElement(kFontNanumGothic);
}
}
gfxPlatformFontList*
gfxPlatformGtk::CreatePlatformFontList()
{
gfxPlatformFontList* list = new gfxFcPlatformFontList();
if (NS_SUCCEEDED(list->InitFontList())) {
return list;
}
gfxPlatformFontList::Shutdown();
return nullptr;
}
nsresult
gfxPlatformGtk::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName)
{
if (sUseFcFontList) {
gfxPlatformFontList::PlatformFontList()->
GetStandardFamilyName(aFontName, aFamilyName);
return NS_OK;
}
return sFontconfigUtils->GetStandardFamilyName(aFontName, aFamilyName);
}
@ -242,10 +170,6 @@ gfxPlatformGtk::CreateFontGroup(const FontFamilyList& aFontFamilyList,
const gfxFontStyle *aStyle,
gfxUserFontSet *aUserFontSet)
{
if (sUseFcFontList) {
return new gfxFontGroup(aFontFamilyList, aStyle, aUserFontSet);
}
return new gfxPangoFontGroup(aFontFamilyList, aStyle, aUserFontSet);
}
@ -255,11 +179,6 @@ gfxPlatformGtk::LookupLocalFont(const nsAString& aFontName,
int16_t aStretch,
bool aItalic)
{
if (sUseFcFontList) {
gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
return pfl->LookupLocalFont(aFontName, aWeight, aStretch, aItalic);
}
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
aStretch, aItalic);
}
@ -272,12 +191,6 @@ gfxPlatformGtk::MakePlatformFont(const nsAString& aFontName,
const uint8_t* aFontData,
uint32_t aLength)
{
if (sUseFcFontList) {
gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
return pfl->MakePlatformFont(aFontName, aWeight, aStretch, aItalic,
aFontData, aLength);
}
// passing ownership of the font data to the new font entry
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
aStretch, aItalic,

View File

@ -41,13 +41,6 @@ public:
virtual nsresult UpdateFontList() override;
virtual void
GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
int32_t aRunScript,
nsTArray<const char*>& aFontList) override;
virtual gfxPlatformFontList* CreatePlatformFontList();
virtual nsresult GetStandardFamilyName(const nsAString& aFontName,
nsAString& aFamilyName) override;
@ -108,8 +101,6 @@ public:
#endif
}
static bool UseFcFontList() { return sUseFcFontList; }
bool UseImageOffscreenSurfaces() {
// We want to turn on image offscreen surfaces ONLY for GTK3 builds
// since GTK2 theme rendering still requires xlib surfaces per se.
@ -138,10 +129,6 @@ private:
#ifdef MOZ_X11
static bool sUseXRender;
#endif
// xxx - this will be removed once the new fontconfig platform font list
// replaces gfxPangoFontGroup
static bool sUseFcFontList;
};
#endif /* GFX_PLATFORM_GTK_H */

View File

@ -23,10 +23,6 @@
#include "mozilla/Likely.h"
#include "gfx2DGlue.h"
#if defined(MOZ_WIDGET_GTK)
#include "gfxPlatformGtk.h" // xxx - for UseFcFontList
#endif
#include "cairo.h"
using namespace mozilla;
@ -1540,7 +1536,6 @@ gfxFontGroup::gfxFontGroup(const FontFamilyList& aFontFamilyList,
, mTextPerf(nullptr)
, mPageLang(gfxPlatform::GetFontPrefLangFor(aStyle->language))
, mSkipDrawing(false)
, mSkipUpdateUserFonts(false)
{
// We don't use SetUserFontSet() here, as we want to unconditionally call
// BuildFontList() rather than only do UpdateUserFonts() if it changed.
@ -1687,17 +1682,10 @@ void gfxFontGroup::EnumerateFontList(nsIAtom *aLanguage, void *aClosure)
void
gfxFontGroup::BuildFontList()
{
bool enumerateFonts = true;
#if defined(MOZ_WIDGET_GTK)
// xxx - eliminate this once gfxPangoFontGroup is no longer needed
enumerateFonts = gfxPlatformGtk::UseFcFontList();
#elif defined(MOZ_WIDGET_QT)
enumerateFonts = false;
// gfxPangoFontGroup behaves differently, so this method is a no-op on that platform
#if defined(XP_MACOSX) || defined(XP_WIN) || defined(ANDROID)
EnumerateFontList(mStyle.language);
#endif
if (enumerateFonts) {
EnumerateFontList(mStyle.language);
}
}
void
@ -1736,7 +1724,7 @@ gfxFontGroup::FindPlatformFont(const nsAString& aName,
// Not known in the user font set ==> check system fonts
if (!family) {
gfxPlatformFontList *fontList = gfxPlatformFontList::PlatformFontList();
family = fontList->FindFamily(aName, mStyle.language, mStyle.systemFont);
family = fontList->FindFamily(aName, mStyle.systemFont);
if (family) {
fe = family->FindFontForStyle(mStyle, needsBold);
}
@ -2357,11 +2345,13 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext,
NS_ASSERTION(aTextRun->GetShapingState() != gfxTextRun::eShapingState_Aborted,
"don't call InitScriptRun with aborted shaping state");
// confirm the load state of userfonts in the list
if (!mSkipUpdateUserFonts && mUserFontSet &&
mCurrGeneration != mUserFontSet->GetGeneration()) {
#if defined(XP_MACOSX) || defined(XP_WIN) || defined(ANDROID)
// non-linux platforms build the fontlist lazily and include userfonts
// so need to confirm the load state of userfonts in the list
if (mUserFontSet && mCurrGeneration != mUserFontSet->GetGeneration()) {
UpdateUserFonts();
}
#endif
gfxFont *mainFont = GetFirstValidFont();
@ -2617,6 +2607,10 @@ gfxFontGroup::FindNonItalicFaceForChar(gfxFontFamily* aFamily, uint32_t aCh)
NS_ASSERTION(mStyle.style != NS_FONT_STYLE_NORMAL,
"should only be called in the italic/oblique case");
if (!aFamily->TestCharacterMap(aCh)) {
return nullptr;
}
gfxFontStyle regularStyle = mStyle;
regularStyle.style = NS_FONT_STYLE_NORMAL;
bool needsBold;
@ -2803,11 +2797,9 @@ gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh, uint32_t aNextCh,
// If italic, test the regular face to see if it supports the character.
// Only do this for platform fonts, not userfonts.
fe = ff.FontEntry();
if (mStyle.style != NS_FONT_STYLE_NORMAL &&
!fe->mIsUserFontContainer &&
!fe->IsUserFont()) {
font = FindNonItalicFaceForChar(ff.Family(), aCh);
!ff.FontEntry()->IsUserFont()) {
font = FindNonItalicFaceForChar(mFonts[i].Family(), aCh);
if (font) {
*aMatchType = gfxTextRange::kFontGroup;
return font.forget();
@ -3090,10 +3082,7 @@ struct PrefFontCallbackData {
{
PrefFontCallbackData *prefFontData = static_cast<PrefFontCallbackData*>(aClosure);
// map pref lang to langGroup for language-sensitive lookups
nsIAtom* lang = gfxPlatform::GetLangGroupForPrefLang(aLang);
gfxFontFamily *family =
gfxPlatformFontList::PlatformFontList()->FindFamily(aName, lang);
gfxFontFamily *family = gfxPlatformFontList::PlatformFontList()->FindFamily(aName);
if (family) {
prefFontData->mPrefFamilies.AppendElement(family);
}

View File

@ -1056,9 +1056,6 @@ protected:
// download to complete (or fallback
// timer to fire)
// xxx - gfxPangoFontGroup skips UpdateUserFonts
bool mSkipUpdateUserFonts;
/**
* Textrun creation short-cuts for special cases where we don't need to
* call a font shaper to generate glyphs.

View File

@ -111,7 +111,6 @@ elif CONFIG['MOZ_WIDGET_GTK']:
]
SOURCES += [
'gfxFcPlatformFontList.cpp',
'gfxFontconfigUtils.cpp',
'gfxFT2FontBase.cpp',
'gfxFT2Utils.cpp',

View File

@ -68,11 +68,6 @@
#include "gfxTextRun.h"
#include "nsFontFaceUtils.h"
#if defined(MOZ_WIDGET_GTK)
#include "gfxPlatformGtk.h" // xxx - for UseFcFontList
#endif
// Needed for Start/Stop of Image Animation
#include "imgIContainer.h"
#include "nsIImageLoadingContent.h"
@ -2175,10 +2170,8 @@ nsPresContext::UserFontSetUpdated(gfxUserFontEntry* aUpdatedFont)
return;
bool usePlatformFontList = true;
#if defined(MOZ_WIDGET_GTK)
usePlatformFontList = gfxPlatformGtk::UseFcFontList();
#elif defined(MOZ_WIDGET_QT)
usePlatformFontList = false;
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
usePlatformFontList = false;
#endif
// xxx - until the Linux platform font list is always used, use full

View File

@ -126,7 +126,7 @@ function startTest1() {
window.frames[0].document.body.firstChild.innerHTML = "Print preview";
printpreview();
ctx1.drawWindow(window.frames[1], 0, 0, 400, 400, "rgb(256,256,256)");
ctx1.drawWindow(window.frames[1], 0, 0, 300, 300, "rgb(256,256,256)");
window.frames[0].document.body.firstChild.innerHTML = "Galley presentation";
// Add some elements.
@ -140,7 +140,7 @@ function startTest1() {
}
function finalizeTest1() {
ctx2.drawWindow(window.frames[1], 0, 0, 400, 400, "rgb(256,256,256)");
ctx2.drawWindow(window.frames[1], 0, 0, 300, 300, "rgb(256,256,256)");
exitprintpreview();
ok(compareCanvases(), "Canvas should be the same!");
counter = window.frames[0].counter;
@ -210,13 +210,13 @@ function compareFormElementPrint(el1, el2, equals) {
window.frames[0].document.body.firstChild.value =
window.frames[0].document.body.firstChild.getAttribute('value');
printpreview();
ctx1.drawWindow(window.frames[1], 0, 0, 400, 400, "rgb(256,256,256)");
ctx1.drawWindow(window.frames[1], 0, 0, 300, 300, "rgb(256,256,256)");
exitprintpreview();
window.frames[0].document.body.innerHTML = el2;
window.frames[0].document.body.firstChild.value =
window.frames[0].document.body.firstChild.getAttribute('value');
printpreview();
ctx2.drawWindow(window.frames[1], 0, 0, 400, 400, "rgb(256,256,256)");
ctx2.drawWindow(window.frames[1], 0, 0, 300, 300, "rgb(256,256,256)");
exitprintpreview();
is(compareCanvases(), equals,
"Comparing print preview didn't succeed [" + el1 + " : " + el2 + "]");
@ -268,7 +268,7 @@ function runTest6end() {
<table style="border: 1px solid black;" xmlns="http://www.w3.org/1999/xhtml">
<tr><th>Print preview canvas 1</th><th>Print preview canvas 2</th></tr>
<tr>
<td><canvas height="400" width="400"></canvas></td>
<td><canvas height="400" width="400"></canvas></td>
<td><canvas height="300" width="300"></canvas></td>
<td><canvas height="300" width="300"></canvas></td>
</tr></table>
</window>

View File

@ -43,15 +43,14 @@ skip-if(B2G||Mulet) HTTP(..) == src-list-actual-font-ref.html src-list-data-1.ht
# localized full fontnames should *not* match, only English ones (need locale-invariant key)
skip HTTP(..) == src-list-local-localized.html src-list-local-localized-ref.html # 486787, 486497
# postscript name lookup
# fontconfig only supports postscript name lookup from 2.10.92, Android/B2G not supported
skip-if(B2G||Mulet) fails-if(Android) random-if(gtk2Widget) == src-list-local-ps.html src-list-local-full-ref.html # bug 773482
# Postscript name lookup only supported on MacOS/Windows currently
skip-if(B2G||Mulet) fails-if(Android) random-if(gtk2Widget) == src-list-local-ps.html src-list-local-full-ref.html # bug 773482 # Initial mulet triage: parity with B2G/B2G Desktop
# Mac-specific test of 100 weight faces
random-if(!cocoaWidget) == helveticaneue-ultra.html helveticaneue-ultra-ref.html
HTTP(..) == order-1.html order-1-ref.html
pref(layout.css.unicode-range.enabled,true) HTTP(..) == order-2.html order-2-ref.html
pref(layout.css.unicode-range.enabled,true) HTTP(..) == order-3.html order-3-ref.html
pref(layout.css.unicode-range.enabled,true) random-if(gtk2Widget) HTTP(..) == order-2.html order-2-ref.html # bug 1056479
pref(layout.css.unicode-range.enabled,true) random-if(gtk2Widget) HTTP(..) == order-3.html order-3-ref.html # bug 1056479
HTTP(..) == multiple-in-family-1.html multiple-in-family-1-ref.html
HTTP(..) == multiple-in-family-1b.html multiple-in-family-1-ref.html
HTTP(..) != multiple-in-family-1.html multiple-in-family-1-notref.html
@ -60,11 +59,11 @@ HTTP(..) == prop-order-over-rule-order-1b.html prop-order-over-rule-order-2b.htm
HTTP(..) != prop-order-over-rule-order-1a.html prop-order-over-rule-order-1b.html
skip-if(B2G||Mulet) HTTP(..) == cross-iframe-1.html cross-iframe-1-ref.html # bug 773482 # Initial mulet triage: parity with B2G/B2G Desktop
# unicode-range
pref(layout.css.unicode-range.enabled,true) HTTP(..) == unicoderange-1.html unicoderange-1-ref.html
pref(layout.css.unicode-range.enabled,true) HTTP(..) == unicoderange-2.html unicoderange-2-ref.html
pref(layout.css.unicode-range.enabled,true) HTTP(..) == unicoderange-3.html unicoderange-3-ref.html
pref(layout.css.unicode-range.enabled,true) HTTP(..) == unicoderange-4.html unicoderange-4-ref.html
# unicode-range (Linux implementation - bug 1056479)
pref(layout.css.unicode-range.enabled,true) random-if(gtk2Widget) HTTP(..) == unicoderange-1.html unicoderange-1-ref.html
pref(layout.css.unicode-range.enabled,true) random-if(gtk2Widget) HTTP(..) == unicoderange-2.html unicoderange-2-ref.html
pref(layout.css.unicode-range.enabled,true) random-if(gtk2Widget) HTTP(..) == unicoderange-3.html unicoderange-3-ref.html
pref(layout.css.unicode-range.enabled,true) random-if(gtk2Widget) HTTP(..) == unicoderange-4.html unicoderange-4-ref.html
# Dynamic changes
# we need to skip these because of the bug that's causing order-2.html to fail

View File

@ -15,18 +15,18 @@ body {
@font-face {
font-family: test-regular;
src: local("Helvetica Neue"), local("Bitstream Vera Sans"), local("Bitstream Vera Sans Roman"), local("FreeSans"), local("Free Sans"), local("SwissA"), local("DejaVu Sans"), local("Arial");
src: local("Helvetica Neue"), local("Bitstream Vera Sans"), local("Bitstream Vera Sans Roman"), local("Free Sans"), local("SwissA"), local("DejaVu Sans"), local("Arial");
}
/* use Helvetica on the Mac, since Futura has no bold face on 10.4, 10.5 */
@font-face {
font-family: test-bold;
src: local("Helvetica Neue Bold"), local("Bitstream Vera Sans Bold"), local("FreeSans Bold"), local("Free Sans Bold"), local("SwissA Bold"), local("DejaVu Sans Bold"), local("Arial Bold");
src: local("Helvetica Neue Bold"), local("Bitstream Vera Sans Bold"), local("Free Sans Bold"), local("SwissA Bold"), local("DejaVu Sans Bold"), local("Arial Bold");
}
@font-face {
font-family: test-italic;
src: local("Helvetica Neue Italic"), local("Bitstream Vera Sans Oblique"), local("FreeSans Oblique"), local("Free Sans Oblique"), local("SwissA Italic"), local("DejaVu Sans Oblique"), local("Arial Italic");
src: local("Helvetica Neue Italic"), local("Bitstream Vera Sans Oblique"), local("Free Sans Oblique"), local("SwissA Italic"), local("DejaVu Sans Oblique"), local("Arial Italic");
}
.regular { font-family: test-regular, serif; }

View File

@ -15,18 +15,18 @@ body {
@font-face {
font-family: test-regular;
src: local(Helvetica Neue), local(Bitstream Vera Sans), local(Bitstream Vera Sans Roman), local(FreeSans), local(Free Sans), local(SwissA), local(DejaVu Sans), local(Arial);
src: local(Helvetica Neue), local(Bitstream Vera Sans), local(Bitstream Vera Sans Roman), local(Free Sans), local(SwissA), local(DejaVu Sans), local(Arial);
}
/* use Helvetica on the Mac, since Futura has no bold face on 10.4, 10.5 */
@font-face {
font-family: test-bold;
src: local(Helvetica Neue Bold), local(Bitstream Vera Sans Bold), local(FreeSans Bold), local(Free Sans Bold), local(SwissA Bold), local(DejaVu Sans Bold), local(Arial Bold);
src: local(Helvetica Neue Bold), local(Bitstream Vera Sans Bold), local(Free Sans Bold), local(SwissA Bold), local(DejaVu Sans Bold), local(Arial Bold);
}
@font-face {
font-family: test-italic;
src: local(Helvetica Neue Italic), local(Bitstream Vera Sans Oblique), local(FreeSans Oblique), local(Free Sans Oblique), local(SwissA Italic), local(DejaVu Sans Oblique), local(Arial Italic);
src: local(Helvetica Neue Italic), local(Bitstream Vera Sans Oblique), local(Free Sans Oblique), local(SwissA Italic), local(DejaVu Sans Oblique), local(Arial Italic);
}
.regular { font-family: test-regular, serif; }

View File

@ -3608,18 +3608,6 @@ pref("intl.ime.use_simple_context_on_password_field", true);
pref("intl.ime.use_simple_context_on_password_field", false);
#endif
# enable new platform fontlist for linux on GTK platforms
# temporary pref to allow flipping back to the existing
# gfxPangoFontGroup/gfxFontconfigUtils code for handling system fonts
#ifdef MOZ_WIDGET_GTK
#ifdef RELEASE_BUILD
pref("gfx.font_rendering.fontconfig.fontlist.enabled", false);
#else
pref("gfx.font_rendering.fontconfig.fontlist.enabled", true);
#endif
#endif
# XP_UNIX
#endif
#endif