mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 718539. Move gfxFontFeature to a separate header. r=jkew
This commit is contained in:
parent
e78fb15e4c
commit
054972d607
@ -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,
|
||||
@ -101,6 +102,7 @@ nsFont::nsFont(const nsFont& aOther)
|
||||
sizeAdjust = aOther.sizeAdjust;
|
||||
featureSettings = aOther.featureSettings;
|
||||
languageOverride = aOther.languageOverride;
|
||||
fontFeatureSettings = aOther.fontFeatureSettings;
|
||||
}
|
||||
|
||||
nsFont::nsFont()
|
||||
@ -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;
|
||||
@ -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;
|
||||
|
@ -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!
|
||||
@ -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
|
||||
@ -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;
|
||||
@ -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
|
||||
|
@ -58,6 +58,7 @@ EXPORTS = \
|
||||
gfxFailure.h \
|
||||
gfxFont.h \
|
||||
gfxFontConstants.h \
|
||||
gfxFontFeatures.h \
|
||||
gfxFontUtils.h \
|
||||
gfxFontTest.h \
|
||||
gfxImageSurface.h \
|
||||
|
@ -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;
|
||||
|
||||
@ -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,
|
||||
|
31
gfx/thebes/gfxFontFeatures.h
Normal file
31
gfx/thebes/gfxFontFeatures.h
Normal file
@ -0,0 +1,31 @@
|
||||
/* -*- 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…
Reference in New Issue
Block a user