10#if defined(SK_BUILD_FOR_WIN)
43bool HasBitmapStrikes(
const SkTScopedComPtr<IDWriteFont>&
font) {
44 SkTScopedComPtr<IDWriteFontFace> fontFace;
45 HRB(
font->CreateFontFace(&fontFace));
49 return ebdtTable.fExists;
58HRESULT FirstMatchingFontWithoutSimulations(
const SkTScopedComPtr<IDWriteFontFamily>& family,
60 SkTScopedComPtr<IDWriteFont>&
font) {
61 bool noSimulations =
false;
62 while (!noSimulations) {
63 SkTScopedComPtr<IDWriteFont> searchFont;
64 HR(family->GetFirstMatchingFont(
66 DWRITE_FONT_SIMULATIONS simulations = searchFont->GetSimulations();
70#ifdef SK_WIN_FONTMGR_NO_SIMULATIONS
71 noSimulations = simulations == DWRITE_FONT_SIMULATIONS_NONE ||
72 (dwStyle.
fWeight == DWRITE_FONT_WEIGHT_REGULAR &&
73 dwStyle.
fSlant == DWRITE_FONT_STYLE_NORMAL) ||
74 HasBitmapStrikes(searchFont);
79 font = std::move(searchFont);
82 if (simulations & DWRITE_FONT_SIMULATIONS_BOLD) {
83 dwStyle.
fWeight = DWRITE_FONT_WEIGHT_REGULAR;
86 if (simulations & DWRITE_FONT_SIMULATIONS_OBLIQUE) {
87 dwStyle.
fSlant = DWRITE_FONT_STYLE_NORMAL;
97class SkFontMgr_DirectWrite :
public SkFontMgr {
100 SkFontMgr_DirectWrite(IDWriteFactory* factory, IDWriteFontCollection* fontCollection,
102 const WCHAR* localeName,
int localeNameLength,
103 const WCHAR* defaultFamilyName,
int defaultFamilyNameLength)
104 : fFactory(SkRefComPtr(factory))
105 , fFontFallback(SkSafeRefComPtr(
fallback))
106 , fFontCollection(SkRefComPtr(fontCollection))
107 , fLocaleName(localeNameLength)
108 , fDefaultFamilyName(defaultFamilyNameLength)
110 memcpy(fLocaleName.get(), localeName, localeNameLength *
sizeof(WCHAR));
111 memcpy(fDefaultFamilyName.get(), defaultFamilyName, defaultFamilyNameLength*
sizeof(WCHAR));
122 const char* bcp47[],
int bcp47Count,
131 HRESULT getByFamilyName(
const WCHAR familyName[], IDWriteFontFamily** fontFamily)
const;
133 const WCHAR* dwBcp47, UINT32
character)
const;
135 const WCHAR* dwBcp47, UINT32
character)
const;
140 IDWriteFontFamily* fontFamily)
const;
142 SkTScopedComPtr<IDWriteFactory> fFactory;
143 SkTScopedComPtr<IDWriteFontFallback> fFontFallback;
144 SkTScopedComPtr<IDWriteFontCollection> fFontCollection;
147 mutable SkMutex fTFCacheMutex;
150 friend class SkFontStyleSet_DirectWrite;
151 friend class FontFallbackRenderer;
156 SkFontStyleSet_DirectWrite(
const SkFontMgr_DirectWrite*
fontMgr,
157 IDWriteFontFamily* fontFamily)
159 , fFontFamily(SkRefComPtr(fontFamily))
162 int count()
override;
169 SkTScopedComPtr<IDWriteFontFamily> fFontFamily;
172static HRESULT are_same(IUnknown*
a, IUnknown*
b,
bool& same) {
173 SkTScopedComPtr<IUnknown> iunkA;
174 HRM(
a->QueryInterface(&iunkA),
"Failed to QI<IUnknown> for a.");
176 SkTScopedComPtr<IUnknown> iunkB;
177 HRM(
b->QueryInterface(&iunkB),
"Failed to QI<IUnknown> for b.");
179 same = (iunkA.get() == iunkB.get());
183struct ProtoDWriteTypeface {
184 IDWriteFontFace* fDWriteFontFace;
185 IDWriteFont* fDWriteFont;
186 IDWriteFontFamily* fDWriteFontFamily;
189static bool FindByDWriteFont(
SkTypeface* cached,
void* ctx) {
191 ProtoDWriteTypeface* ctxFace =
reinterpret_cast<ProtoDWriteTypeface*
>(ctx);
194 SkTScopedComPtr<IDWriteFontFace5> cshFontFace5;
195 SkTScopedComPtr<IDWriteFontFace5> ctxFontFace5;
197 ctxFace->fDWriteFontFace->QueryInterface(&ctxFontFace5);
198 if (cshFontFace5 && ctxFontFace5) {
199 return cshFontFace5->Equals(ctxFontFace5.get());
205 HRB(are_same(cshFace->
fDWriteFont.get(), ctxFace->fDWriteFont, same));
210 HRB(are_same(cshFace->
fDWriteFontFace.get(), ctxFace->fDWriteFontFace, same));
219 HRB(ctxFace->fDWriteFontFace->GetFiles(&ctxNumFiles,
nullptr));
220 if (cshNumFiles != ctxNumFiles) {
224 SkTScopedComPtr<IDWriteFontFile> cshFontFile;
225 SkTScopedComPtr<IDWriteFontFile> ctxFontFile;
227 HRB(ctxFace->fDWriteFontFace->GetFiles(&ctxNumFiles, &ctxFontFile));
230 SkTScopedComPtr<IDWriteFontFileLoader> cshFontFileLoader;
231 SkTScopedComPtr<IDWriteFontFileLoader> ctxFontFileLoader;
232 HRB(cshFontFile->GetLoader(&cshFontFileLoader));
233 HRB(ctxFontFile->GetLoader(&ctxFontFileLoader));
234 HRB(are_same(cshFontFileLoader.get(), ctxFontFileLoader.get(), same));
240 const void* cshRefKey;
241 UINT32 cshRefKeySize;
242 const void* ctxRefKey;
243 UINT32 ctxRefKeySize;
244 HRB(cshFontFile->GetReferenceKey(&cshRefKey, &cshRefKeySize));
245 HRB(ctxFontFile->GetReferenceKey(&ctxRefKey, &ctxRefKeySize));
246 if (cshRefKeySize != ctxRefKeySize) {
249 if (0 != memcmp(cshRefKey, ctxRefKey, ctxRefKeySize)) {
255 SkTScopedComPtr<IDWriteLocalizedStrings> cshFamilyNames;
256 SkTScopedComPtr<IDWriteLocalizedStrings> cshFaceNames;
258 HRB(cshFace->
fDWriteFont->GetFaceNames(&cshFaceNames));
259 UINT32 cshFamilyNameLength;
260 UINT32 cshFaceNameLength;
261 HRB(cshFamilyNames->GetStringLength(0, &cshFamilyNameLength));
262 HRB(cshFaceNames->GetStringLength(0, &cshFaceNameLength));
264 SkTScopedComPtr<IDWriteLocalizedStrings> ctxFamilyNames;
265 SkTScopedComPtr<IDWriteLocalizedStrings> ctxFaceNames;
266 HRB(ctxFace->fDWriteFontFamily->GetFamilyNames(&ctxFamilyNames));
267 HRB(ctxFace->fDWriteFont->GetFaceNames(&ctxFaceNames));
268 UINT32 ctxFamilyNameLength;
269 UINT32 ctxFaceNameLength;
270 HRB(ctxFamilyNames->GetStringLength(0, &ctxFamilyNameLength));
271 HRB(ctxFaceNames->GetStringLength(0, &ctxFaceNameLength));
273 if (cshFamilyNameLength != ctxFamilyNameLength ||
274 cshFaceNameLength != ctxFaceNameLength)
281 HRB(cshFamilyNames->GetString(0, cshFamilyName.get(), cshFamilyNameLength+1));
282 HRB(cshFaceNames->GetString(0, cshFaceName.get(), cshFaceNameLength+1));
286 HRB(ctxFamilyNames->GetString(0, ctxFamilyName.get(), ctxFamilyNameLength+1));
287 HRB(ctxFaceNames->GetString(0, ctxFaceName.get(), ctxFaceNameLength+1));
289 return wcscmp(cshFamilyName.get(), ctxFamilyName.get()) == 0 &&
290 wcscmp(cshFaceName.get(), ctxFaceName.get()) == 0;
294 IDWriteFontFace* fontFace,
296 IDWriteFontFamily* fontFamily)
const {
298 ProtoDWriteTypeface spec = { fontFace,
font, fontFamily };
300 if (
nullptr == face) {
310int SkFontMgr_DirectWrite::onCountFamilies()
const {
311 return fFontCollection->GetFontFamilyCount();
314void SkFontMgr_DirectWrite::onGetFamilyName(
int index,
SkString* familyName)
const {
315 SkTScopedComPtr<IDWriteFontFamily> fontFamily;
316 HRVM(fFontCollection->GetFontFamily(index, &fontFamily),
"Could not get requested family.");
318 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames;
319 HRVM(fontFamily->GetFamilyNames(&familyNames),
"Could not get family names.");
325 SkTScopedComPtr<IDWriteFontFamily> fontFamily;
326 HRNM(fFontCollection->GetFontFamily(index, &fontFamily),
"Could not get requested family.");
341 HRNM(fFontCollection->FindFamilyName(dwFamilyName.
get(), &index, &exists),
342 "Failed while finding family by name.");
347 return this->onCreateStyleSet(index);
350sk_sp<SkTypeface> SkFontMgr_DirectWrite::onMatchFamilyStyle(
const char familyName[],
353 return sset->matchStyle(fontstyle);
356class FontFallbackRenderer :
public IDWriteTextRenderer {
358 FontFallbackRenderer(
const SkFontMgr_DirectWrite* outer, UINT32
character)
359 : fRefCount(1), fOuter(
SkSafeRef(outer)), fCharacter(
character), fResolvedTypeface(nullptr) {
363 SK_STDMETHODIMP QueryInterface(IID
const& riid,
void** ppvObject)
override {
364 if (__uuidof(IUnknown) == riid ||
365 __uuidof(IDWritePixelSnapping) == riid ||
366 __uuidof(IDWriteTextRenderer) == riid)
372 *ppvObject =
nullptr;
377 return InterlockedIncrement(&fRefCount);
381 ULONG newCount = InterlockedDecrement(&fRefCount);
390 void* clientDrawingContext,
391 FLOAT baselineOriginX,
392 FLOAT baselineOriginY,
393 DWRITE_MEASURING_MODE measuringMode,
394 DWRITE_GLYPH_RUN
const* glyphRun,
395 DWRITE_GLYPH_RUN_DESCRIPTION
const* glyphRunDescription,
396 IUnknown* clientDrawingEffect)
override
398 if (!glyphRun->fontFace) {
399 HRM(E_INVALIDARG,
"Glyph run without font face.");
402 SkTScopedComPtr<IDWriteFont>
font;
403 HRM(fOuter->fFontCollection->GetFontFromFontFace(glyphRun->fontFace, &
font),
404 "Could not get font from font face.");
410 HRM(
font->HasCharacter(fCharacter, &exists),
"Could not find character.");
413 SkTScopedComPtr<IDWriteFontFamily> fontFamily;
414 HRM(
font->GetFontFamily(&fontFamily),
"Could not get family.");
415 fResolvedTypeface = fOuter->makeTypefaceFromDWriteFont(glyphRun->fontFace,
418 fHasSimulations = (
font->GetSimulations() != DWRITE_FONT_SIMULATIONS_NONE) &&
419 !HasBitmapStrikes(
font);
426 void* clientDrawingContext,
427 FLOAT baselineOriginX,
428 FLOAT baselineOriginY,
429 DWRITE_UNDERLINE
const* underline,
430 IUnknown* clientDrawingEffect)
override
431 {
return E_NOTIMPL; }
434 void* clientDrawingContext,
435 FLOAT baselineOriginX,
436 FLOAT baselineOriginY,
437 DWRITE_STRIKETHROUGH
const* strikethrough,
438 IUnknown* clientDrawingEffect)
override
439 {
return E_NOTIMPL; }
442 void* clientDrawingContext,
445 IDWriteInlineObject* inlineObject,
448 IUnknown* clientDrawingEffect)
override
449 {
return E_NOTIMPL; }
453 void* clientDrawingContext,
454 BOOL* isDisabled)
override
461 void* clientDrawingContext,
464 const DWRITE_MATRIX ident = { 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 };
470 void* clientDrawingContext,
471 FLOAT* pixelsPerDip)
override
473 *pixelsPerDip = 1.0f;
477 sk_sp<SkTypeface> ConsumeFallbackTypeface() {
return std::move(fResolvedTypeface); }
479 bool FallbackTypefaceHasSimulations() {
return fHasSimulations; }
482 virtual ~FontFallbackRenderer() { }
488 bool fHasSimulations{
false};
491class FontFallbackSource :
public IDWriteTextAnalysisSource {
493 FontFallbackSource(
const WCHAR*
string, UINT32
length,
const WCHAR* locale,
494 IDWriteNumberSubstitution* numberSubstitution)
499 , fNumberSubstitution(numberSubstitution)
503 SK_STDMETHODIMP QueryInterface(IID
const& riid,
void** ppvObject)
override {
504 if (__uuidof(IUnknown) == riid ||
505 __uuidof(IDWriteTextAnalysisSource) == riid)
511 *ppvObject =
nullptr;
516 return InterlockedIncrement(&fRefCount);
520 ULONG newCount = InterlockedDecrement(&fRefCount);
530 WCHAR
const** textString,
531 UINT32* textLength)
override
533 if (fLength <= textPosition) {
534 *textString =
nullptr;
538 *textString = fString + textPosition;
539 *textLength = fLength - textPosition;
545 WCHAR
const** textString,
546 UINT32* textLength)
override
548 if (textPosition < 1 || fLength <= textPosition) {
549 *textString =
nullptr;
553 *textString = fString;
554 *textLength = textPosition;
558 SK_STDMETHODIMP_(DWRITE_READING_DIRECTION) GetParagraphReadingDirection()
override {
560 return DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
566 WCHAR
const** localeName)
override
568 *localeName = fLocale;
575 IDWriteNumberSubstitution** numberSubstitution)
override
577 *numberSubstitution = fNumberSubstitution;
582 virtual ~FontFallbackSource() { }
585 const WCHAR* fString;
587 const WCHAR* fLocale;
588 IDWriteNumberSubstitution* fNumberSubstitution;
593 const char* bcp47[],
int bcp47Count,
598 const WCHAR* dwFamilyName =
nullptr;
602 dwFamilyName = dwFamilyNameLocal;
607 if (bcp47Count < 1) {
608 dwBcp47 = &fLocaleName;
614 dwBcp47 = &dwBcp47Local;
622 return this->layoutFallback(dwFamilyName, dwStyle, dwBcp47->
get(),
character);
627 const WCHAR* dwBcp47,
632 if (!fFontFallback) {
636 SkTScopedComPtr<IDWriteNumberSubstitution> numberSubstitution;
637 HRNM(fFactory->CreateNumberSubstitution(DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, dwBcp47,
638 TRUE, &numberSubstitution),
639 "Could not create number substitution.");
640 SkTScopedComPtr<FontFallbackSource> fontFallbackSource(
641 new FontFallbackSource(str, strLen, dwBcp47, numberSubstitution.get()));
644 SkTScopedComPtr<IDWriteFont>
font;
647 bool noSimulations =
false;
648 while (!noSimulations) {
650 HRNM(fFontFallback->MapCharacters(fontFallbackSource.get(),
653 fFontCollection.get(),
661 "Could not map characters");
666 DWRITE_FONT_SIMULATIONS simulations =
font->GetSimulations();
668#ifdef SK_WIN_FONTMGR_NO_SIMULATIONS
669 noSimulations = simulations == DWRITE_FONT_SIMULATIONS_NONE || HasBitmapStrikes(
font);
671 noSimulations =
true;
674 if (simulations & DWRITE_FONT_SIMULATIONS_BOLD) {
675 dwStyle.
fWeight = DWRITE_FONT_WEIGHT_REGULAR;
679 if (simulations & DWRITE_FONT_SIMULATIONS_OBLIQUE) {
680 dwStyle.
fSlant = DWRITE_FONT_STYLE_NORMAL;
685 SkTScopedComPtr<IDWriteFontFace> fontFace;
686 HRNM(
font->CreateFontFace(&fontFace),
"Could not get font face from font.");
688 SkTScopedComPtr<IDWriteFontFamily> fontFamily;
689 HRNM(
font->GetFontFamily(&fontFamily),
"Could not get family from font.");
690 return this->makeTypefaceFromDWriteFont(fontFace.get(),
font.get(), fontFamily.get());
693sk_sp<SkTypeface> SkFontMgr_DirectWrite::layoutFallback(
const WCHAR* dwFamilyName,
695 const WCHAR* dwBcp47,
701 bool noSimulations =
false;
703 while (!noSimulations) {
704 SkTScopedComPtr<IDWriteTextFormat> fallbackFormat;
705 HRNM(fFactory->CreateTextFormat(dwFamilyName ? dwFamilyName :
L"",
706 fFontCollection.get(),
713 "Could not create text format.");
717 SkTScopedComPtr<IDWriteTextLayout> fallbackLayout;
718 HRNM(fFactory->CreateTextLayout(
719 str, strLen, fallbackFormat.get(), 200.0f, 200.0f, &fallbackLayout),
720 "Could not create text layout.");
722 SkTScopedComPtr<FontFallbackRenderer> fontFallbackRenderer(
723 new FontFallbackRenderer(
this,
character));
725 HRNM(fallbackLayout->SetFontCollection(fFontCollection.get(), {0, strLen}),
726 "Could not set layout font collection.");
727 HRNM(fallbackLayout->Draw(
nullptr, fontFallbackRenderer.get(), 50.0f, 50.0f),
728 "Could not draw layout with renderer.");
730#ifdef SK_WIN_FONTMGR_NO_SIMULATIONS
731 noSimulations = !fontFallbackRenderer->FallbackTypefaceHasSimulations();
733 noSimulations =
true;
737 returnTypeface = fontFallbackRenderer->ConsumeFallbackTypeface();
740 if (dwStyle.
fWeight != DWRITE_FONT_WEIGHT_REGULAR) {
741 dwStyle.
fWeight = DWRITE_FONT_WEIGHT_REGULAR;
745 if (dwStyle.
fSlant != DWRITE_FONT_STYLE_NORMAL) {
746 dwStyle.
fSlant = DWRITE_FONT_STYLE_NORMAL;
751 return returnTypeface;
755 int ttcIndex)
const {
757 args.setCollectionIndex(ttcIndex);
758 return this->onMakeFromStreamArgs(std::move(
stream),
args);
767 return this->makeFromStream(std::make_unique<SkMemoryStream>(std::move(
data)), ttcIndex);
774HRESULT SkFontMgr_DirectWrite::getByFamilyName(
const WCHAR wideFamilyName[],
775 IDWriteFontFamily** fontFamily)
const {
778 HR(fFontCollection->FindFamilyName(wideFamilyName, &index, &exists));
781 HR(fFontCollection->GetFontFamily(index, fontFamily));
786sk_sp<SkTypeface> SkFontMgr_DirectWrite::onLegacyMakeTypeface(
const char familyName[],
788 SkTScopedComPtr<IDWriteFontFamily> fontFamily;
793 this->getByFamilyName(dwFamilyName, &fontFamily);
794 if (!fontFamily && fFontFallback) {
796 dwFamilyName, dwStyle, fLocaleName.
get(), 32);
803 return this->
fallback(
nullptr, dwStyle, fLocaleName.get(), 32);
807 HRNM(this->getByFamilyName(fDefaultFamilyName, &fontFamily),
808 "Could not create DWrite font family from LOGFONT.");
813 HRNM(fFontCollection->GetFontFamily(0, &fontFamily),
814 "Could not get default-default font family.");
817 SkTScopedComPtr<IDWriteFont>
font;
818 HRNM(FirstMatchingFontWithoutSimulations(fontFamily, dwStyle,
font),
819 "No font found from family.");
821 SkTScopedComPtr<IDWriteFontFace> fontFace;
822 HRNM(
font->CreateFontFace(&fontFace),
"Could not create font face.");
824 return this->makeTypefaceFromDWriteFont(fontFace.get(),
font.get(), fontFamily.get());
830 return fFontFamily->GetFontCount();
834 SkTScopedComPtr<IDWriteFont>
font;
835 HRNM(fFontFamily->GetFont(index, &
font),
"Could not get font.");
837 SkTScopedComPtr<IDWriteFontFace> fontFace;
838 HRNM(
font->CreateFontFace(&fontFace),
"Could not create font face.");
840 return fFontMgr->makeTypefaceFromDWriteFont(fontFace.get(),
font.get(), fFontFamily.get());
843void SkFontStyleSet_DirectWrite::getStyle(
int index,
SkFontStyle* fs,
SkString* styleName) {
844 SkTScopedComPtr<IDWriteFont>
font;
845 HRVM(fFontFamily->GetFont(index, &
font),
"Could not get font.");
848 SkTScopedComPtr<IDWriteFontFace> face;
849 HRVM(
font->CreateFontFace(&face),
"Could not get face.");
854 SkTScopedComPtr<IDWriteLocalizedStrings> faceNames;
862 SkTScopedComPtr<IDWriteFont>
font;
865 HRNM(FirstMatchingFontWithoutSimulations(fFontFamily, dwStyle,
font),
866 "No font found from family.");
868 SkTScopedComPtr<IDWriteFontFace> fontFace;
869 HRNM(
font->CreateFontFace(&fontFace),
"Could not create font face.");
871 return fFontMgr->makeTypefaceFromDWriteFont(fontFace.get(),
font.get(), fFontFamily.get());
878 IDWriteFontCollection* collection) {
879 return SkFontMgr_New_DirectWrite(factory, collection,
nullptr);
883 IDWriteFontCollection* collection,
885 if (
nullptr == factory) {
887 if (
nullptr == factory) {
892 SkTScopedComPtr<IDWriteFontCollection> systemFontCollection;
893 if (
nullptr == collection) {
894 HRNM(factory->GetSystemFontCollection(&systemFontCollection,
FALSE),
895 "Could not get system font collection.");
896 collection = systemFontCollection.get();
900 SkTScopedComPtr<IDWriteFontFallback> systemFontFallback;
902 SkTScopedComPtr<IDWriteFactory2> factory2;
903 if (!
SUCCEEDED(factory->QueryInterface(&factory2))) {
908 HRNM(factory2->GetSystemFontFallback(&systemFontFallback),
909 "Could not get system fallback.");
910 fallback = systemFontFallback.get();
914 const WCHAR* defaultFamilyName =
L"";
915 int defaultFamilyNameLen = 1;
916 NONCLIENTMETRICSW metrics;
917 metrics.cbSize =
sizeof(metrics);
921 if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
sizeof(metrics), &metrics, 0)) {
922 defaultFamilyName = metrics.lfMessageFont.lfFaceName;
923 defaultFamilyNameLen = LF_FACESIZE;
928 WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH];
929 const WCHAR* localeName =
L"";
930 int localeNameLen = 1;
935 if (
nullptr == getUserDefaultLocaleNameProc) {
936 SK_TRACEHR(hr,
"Could not get GetUserDefaultLocaleName.");
938 int size = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_NAME_MAX_LENGTH);
940 localeName = localeNameStorage;
941 localeNameLen =
size;
945 return sk_make_sp<SkFontMgr_DirectWrite>(factory, collection,
fallback,
946 localeName, localeNameLen,
947 defaultFamilyName, defaultFamilyNameLen);
#define SkASSERT_RELEASE(cond)
HRESULT sk_get_locale_string(IDWriteLocalizedStrings *names, const WCHAR *preferedLocale, SkString *skname)
int(WINAPI * SkGetUserDefaultLocaleNameProc)(LPWSTR, int)
HRESULT sk_cstring_to_wchar(const char *skname, SkSMallocWCHAR *name)
HRESULT SkGetGetUserDefaultLocaleNameProc(SkGetUserDefaultLocaleNameProc *proc)
IDWriteFactory * sk_get_dwrite_factory()
#define SkEndian_SwapBE32(n)
#define SK_STDMETHODIMP_(type)
static T * SkSafeRef(T *obj)
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
static sk_sp< SkTypeface > SK_SPI MakeFromStream(std::unique_ptr< SkStreamAsset >, const SkFontArguments &)
static SkFontStyle GetStyle(IDWriteFont *font, IDWriteFontFace *fontFace)
SkTScopedComPtr< IDWriteFontFamily > fDWriteFontFamily
SkTScopedComPtr< IDWriteFontFace > fDWriteFontFace
SkTScopedComPtr< IDWriteFont > fDWriteFont
static sk_sp< DWriteFontTypeface > Make(IDWriteFactory *factory, IDWriteFontFace *fontFace, IDWriteFont *font, IDWriteFontFamily *fontFamily, sk_sp< Loaders > loaders, const SkFontArguments::Palette &palette)
virtual void onGetFamilyName(int index, SkString *familyName) const =0
virtual sk_sp< SkTypeface > onMakeFromData(sk_sp< SkData >, int ttcIndex) const =0
virtual sk_sp< SkFontStyleSet > onCreateStyleSet(int index) const =0
virtual sk_sp< SkTypeface > onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const =0
virtual sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const =0
virtual sk_sp< SkTypeface > onMakeFromStreamIndex(std::unique_ptr< SkStreamAsset >, int ttcIndex) const =0
virtual sk_sp< SkTypeface > onMakeFromStreamArgs(std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const =0
virtual sk_sp< SkTypeface > onMatchFamilyStyle(const char familyName[], const SkFontStyle &) const =0
virtual sk_sp< SkTypeface > onLegacyMakeTypeface(const char familyName[], SkFontStyle) const =0
virtual sk_sp< SkTypeface > onMakeFromFile(const char path[], int ttcIndex) const =0
virtual int onCountFamilies() const =0
virtual sk_sp< SkTypeface > createTypeface(int index)=0
virtual sk_sp< SkTypeface > matchStyle(const SkFontStyle &pattern)=0
virtual void getStyle(int index, SkFontStyle *, SkString *style)=0
static std::unique_ptr< SkStreamAsset > MakeFromFile(const char path[])
sk_sp< SkFontMgr > fontMgr
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
SK_SPI size_t ToUTF16(SkUnichar uni, uint16_t utf16[2]=nullptr)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port fallback
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
font
Font Metadata and Metrics.
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
DWRITE_FONT_WEIGHT fWeight
DWRITE_FONT_STRETCH fWidth
std::shared_ptr< const fml::Mapping > data