-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skia-pack used in this skiko: https://github.com/JetBrains/skia-pack/releases/tag/m126-1d69d9b-2
- Loading branch information
Showing
56 changed files
with
498 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include "FontMgrDefaultFactory.hh" | ||
|
||
|
||
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | ||
#include "ports/SkFontMgr_mac_ct.h" | ||
#endif | ||
|
||
#ifdef SK_BUILD_FOR_WIN | ||
#include "ports/SkTypeface_win.h" | ||
#endif | ||
|
||
#if (defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_LINUX)) && !defined(SKIKO_WASM) | ||
#include "ports/SkFontMgr_fontconfig.h" | ||
#endif | ||
|
||
#ifdef SK_BUILD_FOR_ANDROID | ||
#include "ports/SkFontMgr_android.h" | ||
#endif | ||
|
||
#ifdef SKIKO_WASM | ||
#include <vector> | ||
#include "SkData.h" | ||
#include "ports/SkFontMgr_data.h" | ||
struct SkEmbeddedResource { const uint8_t* data; size_t size; }; | ||
struct SkEmbeddedResourceHeader { const SkEmbeddedResource* entries; int count; }; | ||
extern "C" const SkEmbeddedResourceHeader SK_EMBEDDED_FONTS; | ||
#endif | ||
|
||
sk_sp<SkFontMgr> SkFontMgrSkikoDefault() { | ||
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | ||
return SkFontMgr_New_CoreText(nullptr); | ||
#endif | ||
|
||
#ifdef SK_BUILD_FOR_WIN | ||
return SkFontMgr_New_DirectWrite(); | ||
#endif | ||
|
||
#if (defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_LINUX)) && !defined(SKIKO_WASM) | ||
return SkFontMgr_New_FontConfig(nullptr); | ||
#endif | ||
|
||
#ifdef SK_BUILD_FOR_ANDROID | ||
return SkFontMgr_New_Android(nullptr); | ||
#endif | ||
|
||
#ifdef SKIKO_WASM | ||
sk_sp<SkData> embeddedFontData = | ||
SkData::MakeWithoutCopy(SK_EMBEDDED_FONTS.entries[0].data, SK_EMBEDDED_FONTS.entries[0].size); | ||
std::vector<sk_sp<SkData>> fontDataVector = { embeddedFontData }; | ||
SkSpan<sk_sp<SkData>> dataSpan(fontDataVector); | ||
return SkFontMgr_New_Custom_Data(dataSpan); | ||
#endif | ||
|
||
return nullptr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
skiko/src/commonMain/cpp/common/include/FontMgrDefaultFactory.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef FONT_MGR_DEFAULT_FACTORY_H | ||
#define FONT_MGR_DEFAULT_FACTORY_H | ||
|
||
#include "SkFontMgr.h" | ||
|
||
sk_sp<SkFontMgr> SkFontMgrSkikoDefault(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.