Loading gfx/src/nsFont.cpp +12 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include "nsString.h" #include "nsUnicharUtils.h" #include "nsCRT.h" #include "gfxFont.h" nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant, PRUint16 aWeight, PRInt16 aStretch, PRUint8 aDecoration, Loading Loading @@ -101,6 +102,7 @@ nsFont::nsFont(const nsFont& aOther) sizeAdjust = aOther.sizeAdjust; featureSettings = aOther.featureSettings; languageOverride = aOther.languageOverride; fontFeatureSettings = aOther.fontFeatureSettings; } nsFont::nsFont() Loading @@ -121,7 +123,8 @@ bool nsFont::BaseEquals(const nsFont& aOther) const (sizeAdjust == aOther.sizeAdjust) && name.Equals(aOther.name, nsCaseInsensitiveStringComparator()) && (featureSettings == aOther.featureSettings) && (languageOverride == aOther.languageOverride)) { (languageOverride == aOther.languageOverride) && (fontFeatureSettings == aOther.fontFeatureSettings)) { return true; } return false; Loading Loading @@ -150,9 +153,17 @@ nsFont& nsFont::operator=(const nsFont& aOther) sizeAdjust = aOther.sizeAdjust; featureSettings = aOther.featureSettings; languageOverride = aOther.languageOverride; fontFeatureSettings = aOther.fontFeatureSettings; return *this; } void nsFont::AddFontFeaturesToStyle(gfxFontStyle *aStyle) const { // simple copy for now, font-variant implementation will expand aStyle->featureSettings.AppendElements(fontFeatureSettings); } static bool IsGenericFontFamily(const nsString& aFamily) { PRUint8 generic; Loading gfx/src/nsFont.h +9 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ #include "nsCoord.h" #include "nsStringGlue.h" #include "gfxFontConstants.h" #include "gfxFontFeatures.h" // XXX we need a method to enumerate all of the possible fonts on the // system across family, weight, style, size, etc. But not here! Loading @@ -63,6 +64,8 @@ const PRUint8 kGenericFont_monospace = 0x08; const PRUint8 kGenericFont_cursive = 0x10; const PRUint8 kGenericFont_fantasy = 0x20; class gfxFontStyle; // Font structure. struct NS_GFX nsFont { // The family name of the font Loading Loading @@ -99,6 +102,9 @@ struct NS_GFX nsFont { float sizeAdjust; // Font features from CSS font-feature-settings nsTArray<gfxFontFeature> fontFeatureSettings; // old-style font-feature-settings (trimmed in later patch) nsString featureSettings; // Language system tag, to override document language; Loading Loading @@ -136,6 +142,9 @@ struct NS_GFX nsFont { nsFont& operator=(const nsFont& aOther); // Add featureSettings into style void AddFontFeaturesToStyle(gfxFontStyle *aStyle) const; // Utility method to interpret name string // enumerates all families specified by this font only // returns true if completed, false if stopped Loading gfx/thebes/Makefile.in +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ EXPORTS = \ gfxFailure.h \ gfxFont.h \ gfxFontConstants.h \ gfxFontFeatures.h \ gfxFontUtils.h \ gfxFontTest.h \ gfxImageSurface.h \ Loading gfx/thebes/gfxFont.h +1 −20 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ #include "gfxPattern.h" #include "mozilla/HashFunctions.h" #include "nsIMemoryReporter.h" #include "gfxFontFeatures.h" typedef struct _cairo_scaled_font cairo_scaled_font_t; Loading @@ -84,28 +85,8 @@ typedef struct _hb_blob_t hb_blob_t; #define NO_FONT_LANGUAGE_OVERRIDE 0 // An OpenType feature tag and value pair struct THEBES_API gfxFontFeature { PRUint32 mTag; // see http://www.microsoft.com/typography/otspec/featuretags.htm PRUint32 mValue; // 0 = off, 1 = on, larger values may be used as parameters // to features that select among multiple alternatives }; struct FontListSizes; inline bool operator<(const gfxFontFeature& a, const gfxFontFeature& b) { return (a.mTag < b.mTag) || ((a.mTag == b.mTag) && (a.mValue < b.mValue)); } inline bool operator==(const gfxFontFeature& a, const gfxFontFeature& b) { return (a.mTag == b.mTag) && (a.mValue == b.mValue); } struct THEBES_API gfxFontStyle { gfxFontStyle(); gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch, Loading gfx/thebes/gfxFontFeatures.h 0 → 100644 +31 −0 Original line number Diff line number Diff line /* -*- 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 GFX_FONT_FEATURES_H #define GFX_FONT_FEATURES_H #include "prtypes.h" // An OpenType feature tag and value pair struct gfxFontFeature { PRUint32 mTag; // see http://www.microsoft.com/typography/otspec/featuretags.htm PRUint32 mValue; // 0 = off, 1 = on, larger values may be used as parameters // to features that select among multiple alternatives }; inline bool operator<(const gfxFontFeature& a, const gfxFontFeature& b) { return (a.mTag < b.mTag) || ((a.mTag == b.mTag) && (a.mValue < b.mValue)); } inline bool operator==(const gfxFontFeature& a, const gfxFontFeature& b) { return (a.mTag == b.mTag) && (a.mValue == b.mValue); } #endif Loading
gfx/src/nsFont.cpp +12 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include "nsString.h" #include "nsUnicharUtils.h" #include "nsCRT.h" #include "gfxFont.h" nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant, PRUint16 aWeight, PRInt16 aStretch, PRUint8 aDecoration, Loading Loading @@ -101,6 +102,7 @@ nsFont::nsFont(const nsFont& aOther) sizeAdjust = aOther.sizeAdjust; featureSettings = aOther.featureSettings; languageOverride = aOther.languageOverride; fontFeatureSettings = aOther.fontFeatureSettings; } nsFont::nsFont() Loading @@ -121,7 +123,8 @@ bool nsFont::BaseEquals(const nsFont& aOther) const (sizeAdjust == aOther.sizeAdjust) && name.Equals(aOther.name, nsCaseInsensitiveStringComparator()) && (featureSettings == aOther.featureSettings) && (languageOverride == aOther.languageOverride)) { (languageOverride == aOther.languageOverride) && (fontFeatureSettings == aOther.fontFeatureSettings)) { return true; } return false; Loading Loading @@ -150,9 +153,17 @@ nsFont& nsFont::operator=(const nsFont& aOther) sizeAdjust = aOther.sizeAdjust; featureSettings = aOther.featureSettings; languageOverride = aOther.languageOverride; fontFeatureSettings = aOther.fontFeatureSettings; return *this; } void nsFont::AddFontFeaturesToStyle(gfxFontStyle *aStyle) const { // simple copy for now, font-variant implementation will expand aStyle->featureSettings.AppendElements(fontFeatureSettings); } static bool IsGenericFontFamily(const nsString& aFamily) { PRUint8 generic; Loading
gfx/src/nsFont.h +9 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ #include "nsCoord.h" #include "nsStringGlue.h" #include "gfxFontConstants.h" #include "gfxFontFeatures.h" // XXX we need a method to enumerate all of the possible fonts on the // system across family, weight, style, size, etc. But not here! Loading @@ -63,6 +64,8 @@ const PRUint8 kGenericFont_monospace = 0x08; const PRUint8 kGenericFont_cursive = 0x10; const PRUint8 kGenericFont_fantasy = 0x20; class gfxFontStyle; // Font structure. struct NS_GFX nsFont { // The family name of the font Loading Loading @@ -99,6 +102,9 @@ struct NS_GFX nsFont { float sizeAdjust; // Font features from CSS font-feature-settings nsTArray<gfxFontFeature> fontFeatureSettings; // old-style font-feature-settings (trimmed in later patch) nsString featureSettings; // Language system tag, to override document language; Loading Loading @@ -136,6 +142,9 @@ struct NS_GFX nsFont { nsFont& operator=(const nsFont& aOther); // Add featureSettings into style void AddFontFeaturesToStyle(gfxFontStyle *aStyle) const; // Utility method to interpret name string // enumerates all families specified by this font only // returns true if completed, false if stopped Loading
gfx/thebes/Makefile.in +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ EXPORTS = \ gfxFailure.h \ gfxFont.h \ gfxFontConstants.h \ gfxFontFeatures.h \ gfxFontUtils.h \ gfxFontTest.h \ gfxImageSurface.h \ Loading
gfx/thebes/gfxFont.h +1 −20 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ #include "gfxPattern.h" #include "mozilla/HashFunctions.h" #include "nsIMemoryReporter.h" #include "gfxFontFeatures.h" typedef struct _cairo_scaled_font cairo_scaled_font_t; Loading @@ -84,28 +85,8 @@ typedef struct _hb_blob_t hb_blob_t; #define NO_FONT_LANGUAGE_OVERRIDE 0 // An OpenType feature tag and value pair struct THEBES_API gfxFontFeature { PRUint32 mTag; // see http://www.microsoft.com/typography/otspec/featuretags.htm PRUint32 mValue; // 0 = off, 1 = on, larger values may be used as parameters // to features that select among multiple alternatives }; struct FontListSizes; inline bool operator<(const gfxFontFeature& a, const gfxFontFeature& b) { return (a.mTag < b.mTag) || ((a.mTag == b.mTag) && (a.mValue < b.mValue)); } inline bool operator==(const gfxFontFeature& a, const gfxFontFeature& b) { return (a.mTag == b.mTag) && (a.mValue == b.mValue); } struct THEBES_API gfxFontStyle { gfxFontStyle(); gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch, Loading
gfx/thebes/gfxFontFeatures.h 0 → 100644 +31 −0 Original line number Diff line number Diff line /* -*- 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 GFX_FONT_FEATURES_H #define GFX_FONT_FEATURES_H #include "prtypes.h" // An OpenType feature tag and value pair struct gfxFontFeature { PRUint32 mTag; // see http://www.microsoft.com/typography/otspec/featuretags.htm PRUint32 mValue; // 0 = off, 1 = on, larger values may be used as parameters // to features that select among multiple alternatives }; inline bool operator<(const gfxFontFeature& a, const gfxFontFeature& b) { return (a.mTag < b.mTag) || ((a.mTag == b.mTag) && (a.mValue < b.mValue)); } inline bool operator==(const gfxFontFeature& a, const gfxFontFeature& b) { return (a.mTag == b.mTag) && (a.mValue == b.mValue); } #endif