2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
2009-10-07 18:13:40 +04:00
|
|
|
|
|
|
|
#ifndef GFX_GDIFONTLIST_H
|
|
|
|
#define GFX_GDIFONTLIST_H
|
|
|
|
|
2018-04-13 22:34:37 +03:00
|
|
|
#include "mozilla/FontPropertyTypes.h"
|
2013-06-23 16:03:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2009-10-07 18:13:40 +04:00
|
|
|
#include "gfxWindowsPlatform.h"
|
|
|
|
#include "gfxPlatformFontList.h"
|
2012-03-30 01:08:43 +04:00
|
|
|
#include "nsGkAtoms.h"
|
2017-04-07 00:41:02 +03:00
|
|
|
#include "mozilla/gfx/UnscaledFontGDI.h"
|
2009-10-07 18:13:40 +04:00
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
class AutoDC // get the global device context, and auto-release it on
|
|
|
|
// destruction
|
|
|
|
{
|
|
|
|
public:
|
2013-07-31 19:44:31 +04:00
|
|
|
AutoDC() { mDC = ::GetDC(nullptr); }
|
2009-10-07 18:13:40 +04:00
|
|
|
|
2013-07-31 19:44:31 +04:00
|
|
|
~AutoDC() { ::ReleaseDC(nullptr, mDC); }
|
2009-10-07 18:13:40 +04:00
|
|
|
|
|
|
|
HDC GetDC() { return mDC; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
HDC mDC;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AutoSelectFont // select a font into the given DC, and auto-restore
|
|
|
|
{
|
|
|
|
public:
|
2010-03-15 12:34:25 +03:00
|
|
|
AutoSelectFont(HDC aDC, LOGFONTW* aLogFont) : mOwnsFont(false) {
|
2009-10-07 18:13:40 +04:00
|
|
|
mFont = ::CreateFontIndirectW(aLogFont);
|
|
|
|
if (mFont) {
|
2011-10-17 18:59:28 +04:00
|
|
|
mOwnsFont = true;
|
2009-10-07 18:13:40 +04:00
|
|
|
mDC = aDC;
|
|
|
|
mOldFont = (HFONT)::SelectObject(aDC, mFont);
|
|
|
|
} else {
|
2013-07-31 19:44:31 +04:00
|
|
|
mOldFont = nullptr;
|
2009-10-07 18:13:40 +04:00
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2010-03-15 12:34:25 +03:00
|
|
|
AutoSelectFont(HDC aDC, HFONT aFont) : mOwnsFont(false) {
|
2009-10-07 18:13:40 +04:00
|
|
|
mDC = aDC;
|
|
|
|
mFont = aFont;
|
|
|
|
mOldFont = (HFONT)::SelectObject(aDC, aFont);
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2009-10-07 18:13:40 +04:00
|
|
|
~AutoSelectFont() {
|
|
|
|
if (mOldFont) {
|
|
|
|
::SelectObject(mDC, mOldFont);
|
2010-03-15 12:34:25 +03:00
|
|
|
if (mOwnsFont) {
|
|
|
|
::DeleteObject(mFont);
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2009-10-07 18:13:40 +04:00
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2009-10-07 18:13:40 +04:00
|
|
|
|
2010-03-15 12:34:25 +03:00
|
|
|
bool IsValid() const { return mFont != nullptr; }
|
2009-10-07 18:13:40 +04:00
|
|
|
|
|
|
|
HFONT GetFont() const { return mFont; }
|
|
|
|
|
|
|
|
private:
|
2010-03-15 12:34:25 +03:00
|
|
|
HDC mDC;
|
|
|
|
HFONT mFont;
|
|
|
|
HFONT mOldFont;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mOwnsFont;
|
2009-10-07 18:13:40 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of different types of fonts we support on Windows.
|
|
|
|
* These can generally be lumped in to 3 categories where we have to
|
|
|
|
* do special things: Really old fonts bitmap and vector fonts (device
|
|
|
|
* and raster), Type 1 fonts, and TrueType/OpenType fonts.
|
|
|
|
*
|
|
|
|
* This list is sorted in order from least prefered to most prefered.
|
|
|
|
* We prefer Type1 fonts over OpenType fonts to avoid falling back to
|
|
|
|
* things like Arial (opentype) when you ask for Helvetica (type1)
|
|
|
|
**/
|
|
|
|
enum gfxWindowsFontType {
|
|
|
|
GFX_FONT_TYPE_UNKNOWN = 0,
|
|
|
|
GFX_FONT_TYPE_DEVICE,
|
|
|
|
GFX_FONT_TYPE_RASTER,
|
|
|
|
GFX_FONT_TYPE_TRUETYPE,
|
|
|
|
GFX_FONT_TYPE_PS_OPENTYPE,
|
|
|
|
GFX_FONT_TYPE_TT_OPENTYPE,
|
|
|
|
GFX_FONT_TYPE_TYPE1
|
|
|
|
};
|
|
|
|
|
|
|
|
// A single member of a font family (i.e. a single face, such as Times Italic)
|
|
|
|
// represented as a LOGFONT that will resolve to the correct face.
|
|
|
|
// This replaces FontEntry from gfxWindowsFonts.h/cpp.
|
2020-03-10 18:00:56 +03:00
|
|
|
class GDIFontEntry final : public gfxFontEntry {
|
2009-10-07 18:13:40 +04:00
|
|
|
public:
|
|
|
|
LPLOGFONTW GetLogFont() { return &mLogFont; }
|
|
|
|
|
|
|
|
nsresult ReadCMAP(FontInfoData* aFontInfoData = nullptr) override;
|
|
|
|
|
|
|
|
void FillLogFont(LOGFONTW* aLogFont, LONG aWeight, gfxFloat aSize);
|
|
|
|
|
2017-09-11 21:22:15 +03:00
|
|
|
static gfxWindowsFontType DetermineFontType(const NEWTEXTMETRICW& metrics,
|
|
|
|
DWORD fontType) {
|
2009-10-07 18:13:40 +04:00
|
|
|
gfxWindowsFontType feType;
|
2017-09-11 21:22:15 +03:00
|
|
|
if (metrics.ntmFlags & NTM_TYPE1)
|
|
|
|
feType = GFX_FONT_TYPE_TYPE1;
|
|
|
|
else if (metrics.ntmFlags & NTM_PS_OPENTYPE)
|
2009-10-07 18:13:40 +04:00
|
|
|
feType = GFX_FONT_TYPE_PS_OPENTYPE;
|
|
|
|
else if (metrics.ntmFlags & NTM_TT_OPENTYPE)
|
|
|
|
feType = GFX_FONT_TYPE_TT_OPENTYPE;
|
|
|
|
else if (fontType == TRUETYPE_FONTTYPE)
|
|
|
|
feType = GFX_FONT_TYPE_TRUETYPE;
|
2017-09-11 21:22:15 +03:00
|
|
|
else if (fontType == RASTER_FONTTYPE)
|
|
|
|
feType = GFX_FONT_TYPE_RASTER;
|
|
|
|
else if (fontType == DEVICE_FONTTYPE)
|
2009-10-07 18:13:40 +04:00
|
|
|
feType = GFX_FONT_TYPE_DEVICE;
|
2018-11-30 13:46:48 +03:00
|
|
|
else
|
2017-09-11 21:22:15 +03:00
|
|
|
feType = GFX_FONT_TYPE_UNKNOWN;
|
|
|
|
|
2009-10-07 18:13:40 +04:00
|
|
|
return feType;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2017-09-11 21:22:15 +03:00
|
|
|
bool IsType1() const { return (mFontType == GFX_FONT_TYPE_TYPE1); }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsTrueType() const {
|
2009-10-07 18:13:40 +04:00
|
|
|
return (mFontType == GFX_FONT_TYPE_TRUETYPE ||
|
|
|
|
mFontType == GFX_FONT_TYPE_PS_OPENTYPE ||
|
|
|
|
mFontType == GFX_FONT_TYPE_TT_OPENTYPE);
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2017-09-11 21:22:15 +03:00
|
|
|
virtual bool SupportsRange(uint8_t range) {
|
|
|
|
return mUnicodeRanges.test(range);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool SkipDuringSystemFallback() {
|
|
|
|
return !HasCmapTable(); // explicitly skip non-SFNT fonts
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2017-09-11 21:22:15 +03:00
|
|
|
|
|
|
|
virtual bool TestCharacterMap(uint32_t aCh);
|
|
|
|
|
|
|
|
virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
|
|
|
FontListSizes* aSizes) const;
|
|
|
|
|
2018-04-26 19:08:18 +03:00
|
|
|
gfxFontEntry* Clone() const override;
|
2018-04-26 19:08:18 +03:00
|
|
|
|
2017-09-11 21:22:15 +03:00
|
|
|
// GDI backend doesn't support font variations:
|
|
|
|
bool HasVariations() override { return false; }
|
|
|
|
void GetVariationAxes(nsTArray<gfxFontVariationAxis>&) override {}
|
2018-09-12 22:34:57 +03:00
|
|
|
void GetVariationInstances(nsTArray<gfxFontVariationInstance>&) override {}
|
2017-09-11 21:22:15 +03:00
|
|
|
|
|
|
|
// create a font entry for a font with a given name
|
2018-09-12 22:34:57 +03:00
|
|
|
static GDIFontEntry* CreateFontEntry(const nsACString& aName,
|
2017-09-11 21:22:15 +03:00
|
|
|
gfxWindowsFontType aFontType,
|
2018-04-25 09:18:23 +03:00
|
|
|
SlantStyleRange aStyle,
|
|
|
|
WeightRange aWeight,
|
|
|
|
StretchRange aStretch,
|
2017-11-23 22:38:17 +03:00
|
|
|
gfxUserFontData* aUserFontData);
|
2017-09-11 21:22:15 +03:00
|
|
|
|
|
|
|
gfxWindowsFontType mFontType;
|
2017-11-23 22:38:17 +03:00
|
|
|
bool mForceGDI;
|
2017-09-11 21:22:15 +03:00
|
|
|
|
|
|
|
gfxSparseBitSet mUnicodeRanges;
|
|
|
|
|
2018-09-12 22:34:57 +03:00
|
|
|
protected:
|
|
|
|
friend class gfxGDIFont;
|
2017-09-11 21:22:15 +03:00
|
|
|
|
2018-09-12 22:34:57 +03:00
|
|
|
GDIFontEntry(const nsACString& aFaceName, gfxWindowsFontType aFontType,
|
2018-04-25 09:18:23 +03:00
|
|
|
SlantStyleRange aStyle, WeightRange aWeight,
|
2018-09-12 22:34:57 +03:00
|
|
|
StretchRange aStretch, gfxUserFontData* aUserFontData);
|
2017-09-11 21:22:15 +03:00
|
|
|
|
Bug 1449605 - part 1 - Rearrange thebes font code so that the decision whether to apply synthetic-bold is deferred until actually instantiating a font, not made during the font-matching process. r=jwatt
This rearranges how synthetic-bold use is determined in the font selection
& rendering code. Previously, we would decide during the font-selection
algorithm whether we need to apply synthetic-bold to the chosen face, and
then pass that decision through the fontgroup (storing it in the FamilyFace
entries of the mFonts array there) down to the actual rendering code that
instantiates fonts from the faces (font entries) we've selected.
That became a problem for variation fonts because in the case of a user
font, we may not have downloaded the resource yet, so we just have a "user
font container" entry, which carries the descriptors from the @font-face
rule and will fetch the actual resource when needed. But in the case of a
@font-face rule without a weight descriptor, we don't actually know at
font-selection time whether the face will support "true" bold (via a
variation axis) or not, so we can't reliably make the right decision about
applying synthetic bold.
So we now defer that decision until we actually instantiate a platform font
object to shape/measure/draw text. At that point, we have the requested
style and we also have the real font resource, so we can easily determine
whether fake-bold is required.
(This patch should not result in any visible behavior change; that will
come in a second patch now that the architecture supports it.)
2018-05-01 12:30:50 +03:00
|
|
|
void InitLogFont(const nsACString& aName, gfxWindowsFontType aFontType);
|
2017-09-11 21:22:15 +03:00
|
|
|
|
|
|
|
gfxFont* CreateFontInstance(const gfxFontStyle* aFontStyle) override;
|
|
|
|
|
|
|
|
virtual nsresult CopyFontTable(uint32_t aTableTag,
|
|
|
|
nsTArray<uint8_t>& aBuffer) override;
|
|
|
|
|
|
|
|
already_AddRefed<mozilla::gfx::UnscaledFontGDI> LookupUnscaledFont(
|
|
|
|
HFONT aFont);
|
|
|
|
|
2009-10-07 18:13:40 +04:00
|
|
|
LOGFONTW mLogFont;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-10-18 21:22:09 +03:00
|
|
|
mozilla::ThreadSafeWeakPtr<mozilla::gfx::UnscaledFontGDI> mUnscaledFont;
|
2017-09-11 21:22:15 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
// a single font family, referencing one or more faces
|
2020-03-10 18:00:56 +03:00
|
|
|
class GDIFontFamily final : public gfxFontFamily {
|
2017-09-11 21:22:15 +03:00
|
|
|
public:
|
2020-04-02 15:36:24 +03:00
|
|
|
GDIFontFamily(const nsACString& aName, FontVisibility aVisibility)
|
|
|
|
: gfxFontFamily(aName, aVisibility),
|
|
|
|
mWindowsFamily(0),
|
|
|
|
mWindowsPitch(0),
|
|
|
|
mCharset() {}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-09-11 21:22:15 +03:00
|
|
|
virtual void FindStyleVariations(FontInfoData* aFontInfoData = nullptr);
|
2017-09-11 21:24:01 +03:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
bool FilterForFontList(nsAtom* aLangGroup,
|
2018-02-06 09:46:57 +03:00
|
|
|
const nsACString& aGeneric) const final {
|
2017-09-11 21:24:01 +03:00
|
|
|
return !IsSymbolFontFamily() && SupportsLangGroup(aLangGroup) &&
|
|
|
|
MatchesGenericFamily(aGeneric);
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2017-09-11 21:24:01 +03:00
|
|
|
protected:
|
|
|
|
friend class gfxGDIFontList;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-09-11 21:24:01 +03:00
|
|
|
// helpers for FilterForFontList
|
|
|
|
bool IsSymbolFontFamily() const { return mCharset.test(SYMBOL_CHARSET); }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-09-11 21:24:01 +03:00
|
|
|
bool MatchesGenericFamily(const nsACString& aGeneric) const {
|
2010-02-26 02:02:54 +03:00
|
|
|
if (aGeneric.IsEmpty()) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2017-09-11 21:24:01 +03:00
|
|
|
|
|
|
|
// Japanese 'Mincho' fonts do not belong to FF_MODERN even if
|
|
|
|
// they are fixed pitch because they have variable stroke width.
|
|
|
|
if (mWindowsFamily == FF_ROMAN && mWindowsPitch & FIXED_PITCH) {
|
|
|
|
return aGeneric.EqualsLiteral("monospace");
|
|
|
|
}
|
2017-09-11 21:22:15 +03:00
|
|
|
|
2009-10-07 18:13:40 +04:00
|
|
|
// Japanese 'Gothic' fonts do not belong to FF_SWISS even if
|
|
|
|
// they are variable pitch because they have constant stroke width.
|
|
|
|
if (mWindowsFamily == FF_MODERN && mWindowsPitch & VARIABLE_PITCH) {
|
|
|
|
return aGeneric.EqualsLiteral("sans-serif");
|
|
|
|
}
|
|
|
|
|
|
|
|
// All other fonts will be grouped correctly using family...
|
|
|
|
switch (mWindowsFamily) {
|
|
|
|
case FF_DONTCARE:
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2009-10-07 18:13:40 +04:00
|
|
|
case FF_ROMAN:
|
|
|
|
return aGeneric.EqualsLiteral("serif");
|
|
|
|
case FF_SWISS:
|
|
|
|
return aGeneric.EqualsLiteral("sans-serif");
|
|
|
|
case FF_MODERN:
|
|
|
|
return aGeneric.EqualsLiteral("monospace");
|
|
|
|
case FF_SCRIPT:
|
|
|
|
return aGeneric.EqualsLiteral("cursive");
|
|
|
|
case FF_DECORATIVE:
|
|
|
|
return aGeneric.EqualsLiteral("fantasy");
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2012-03-30 01:08:43 +04:00
|
|
|
}
|
2009-10-07 18:13:40 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
bool SupportsLangGroup(nsAtom* aLangGroup) const {
|
2012-03-30 01:08:43 +04:00
|
|
|
if (!aLangGroup || aLangGroup == nsGkAtoms::Unicode) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int16_t bit = -1;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2009-10-07 18:13:40 +04:00
|
|
|
/* map our langgroup names in to Windows charset bits */
|
2012-03-30 01:08:43 +04:00
|
|
|
if (aLangGroup == nsGkAtoms::x_western) {
|
2009-10-07 18:13:40 +04:00
|
|
|
bit = ANSI_CHARSET;
|
2011-10-17 18:59:28 +04:00
|
|
|
} else if (aLangGroup == nsGkAtoms::Japanese) {
|
2009-10-07 18:13:40 +04:00
|
|
|
bit = SHIFTJIS_CHARSET;
|
2012-03-30 01:08:43 +04:00
|
|
|
} else if (aLangGroup == nsGkAtoms::ko) {
|
2009-10-07 18:13:40 +04:00
|
|
|
bit = HANGEUL_CHARSET;
|
2012-03-30 01:08:43 +04:00
|
|
|
} else if (aLangGroup == nsGkAtoms::zh_cn) {
|
2009-10-07 18:13:40 +04:00
|
|
|
bit = GB2312_CHARSET;
|
2012-03-30 01:08:43 +04:00
|
|
|
} else if (aLangGroup == nsGkAtoms::zh_tw) {
|
2009-10-07 18:13:40 +04:00
|
|
|
bit = CHINESEBIG5_CHARSET;
|
2018-03-14 02:27:25 +03:00
|
|
|
} else if (aLangGroup == nsGkAtoms::el) {
|
2009-10-07 18:13:40 +04:00
|
|
|
bit = GREEK_CHARSET;
|
2012-03-30 01:08:43 +04:00
|
|
|
} else if (aLangGroup == nsGkAtoms::he) {
|
2009-10-07 18:13:40 +04:00
|
|
|
bit = HEBREW_CHARSET;
|
2012-03-30 01:08:43 +04:00
|
|
|
} else if (aLangGroup == nsGkAtoms::ar) {
|
2009-10-07 18:13:40 +04:00
|
|
|
bit = ARABIC_CHARSET;
|
2012-03-30 01:08:43 +04:00
|
|
|
} else if (aLangGroup == nsGkAtoms::x_cyrillic) {
|
2009-10-07 18:13:40 +04:00
|
|
|
bit = RUSSIAN_CHARSET;
|
2012-03-30 01:08:43 +04:00
|
|
|
} else if (aLangGroup == nsGkAtoms::th) {
|
2009-10-07 18:13:40 +04:00
|
|
|
bit = THAI_CHARSET;
|
|
|
|
}
|
|
|
|
|
2017-09-11 21:24:01 +03:00
|
|
|
if (bit != -1) {
|
|
|
|
return mCharset.test(bit);
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2017-09-11 21:24:01 +03:00
|
|
|
|
|
|
|
uint8_t mWindowsFamily;
|
|
|
|
uint8_t mWindowsPitch;
|
2017-09-11 21:22:57 +03:00
|
|
|
|
2017-09-11 21:24:01 +03:00
|
|
|
gfxSparseBitSet mCharset;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2009-10-07 18:13:40 +04:00
|
|
|
private:
|
|
|
|
static int CALLBACK FamilyAddStylesProc(const ENUMLOGFONTEXW* lpelfe,
|
|
|
|
const NEWTEXTMETRICEXW* nmetrics,
|
|
|
|
DWORD fontType, LPARAM data);
|
|
|
|
};
|
|
|
|
|
2020-03-10 18:00:56 +03:00
|
|
|
class gfxGDIFontList final : public gfxPlatformFontList {
|
2009-10-07 18:13:40 +04:00
|
|
|
public:
|
|
|
|
static gfxGDIFontList* PlatformFontList() {
|
|
|
|
return static_cast<gfxGDIFontList*>(sPlatformFontList);
|
|
|
|
}
|
|
|
|
|
2010-11-08 14:02:27 +03:00
|
|
|
// initialize font lists
|
2016-08-23 03:06:07 +03:00
|
|
|
virtual nsresult InitFontListForPlatform() override;
|
2009-10-07 18:13:40 +04:00
|
|
|
|
2020-04-02 15:36:24 +03:00
|
|
|
gfxFontFamily* CreateFontFamily(const nsACString& aName,
|
|
|
|
FontVisibility aVisibility) const override;
|
2017-08-01 13:25:35 +03:00
|
|
|
|
2019-04-27 18:37:58 +03:00
|
|
|
bool FindAndAddFamilies(mozilla::StyleGenericFontFamily aGeneric,
|
|
|
|
const nsACString& aFamily,
|
2018-05-25 16:07:57 +03:00
|
|
|
nsTArray<FamilyAndGeneric>* aOutput,
|
2017-08-01 13:25:35 +03:00
|
|
|
FindFamiliesFlags aFlags,
|
2016-04-12 09:06:22 +03:00
|
|
|
gfxFontStyle* aStyle = nullptr,
|
|
|
|
gfxFloat aDevToCssSize = 1.0) override;
|
2014-06-06 10:09:23 +04:00
|
|
|
|
2018-09-12 22:34:57 +03:00
|
|
|
virtual gfxFontEntry* LookupLocalFont(const nsACString& aFontName,
|
2018-04-25 09:18:23 +03:00
|
|
|
WeightRange aWeightForEntry,
|
|
|
|
StretchRange aStretchForEntry,
|
|
|
|
SlantStyleRange aStyleForEntry);
|
2014-09-08 11:23:19 +04:00
|
|
|
|
2018-09-12 22:34:57 +03:00
|
|
|
virtual gfxFontEntry* MakePlatformFont(const nsACString& aFontName,
|
2018-04-25 09:18:23 +03:00
|
|
|
WeightRange aWeightForEntry,
|
|
|
|
StretchRange aStretchForEntry,
|
|
|
|
SlantStyleRange aStyleForEntry,
|
2014-09-08 11:23:19 +04:00
|
|
|
const uint8_t* aFontData,
|
|
|
|
uint32_t aLength);
|
2009-10-07 18:13:40 +04:00
|
|
|
|
2013-10-15 06:19:47 +04:00
|
|
|
virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
|
|
|
FontListSizes* aSizes) const;
|
|
|
|
virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
|
|
|
FontListSizes* aSizes) const;
|
2012-03-28 01:38:39 +04:00
|
|
|
|
2016-08-23 03:06:07 +03:00
|
|
|
protected:
|
2019-04-01 17:33:34 +03:00
|
|
|
FontFamily GetDefaultFontForPlatform(const gfxFontStyle* aStyle) override;
|
2016-08-23 03:06:07 +03:00
|
|
|
|
2009-10-07 18:13:40 +04:00
|
|
|
private:
|
|
|
|
friend class gfxWindowsPlatform;
|
|
|
|
|
|
|
|
gfxGDIFontList();
|
|
|
|
|
|
|
|
nsresult GetFontSubstitutes();
|
|
|
|
|
|
|
|
static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXW* lpelfe,
|
|
|
|
NEWTEXTMETRICEXW* lpntme,
|
|
|
|
DWORD fontType, LPARAM lParam);
|
|
|
|
|
2014-01-29 11:39:01 +04:00
|
|
|
virtual already_AddRefed<FontInfoData> CreateFontInfoData();
|
|
|
|
|
2014-05-29 16:00:59 +04:00
|
|
|
#ifdef MOZ_BUNDLED_FONTS
|
|
|
|
void ActivateBundledFonts();
|
|
|
|
#endif
|
|
|
|
|
2015-07-31 07:15:16 +03:00
|
|
|
FontFamilyTable mFontSubstitutes;
|
2018-09-12 22:34:57 +03:00
|
|
|
nsTArray<nsCString> mNonExistingFonts;
|
2009-10-07 18:13:40 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GFX_GDIFONTLIST_H */
|