Skip to content

Commit

Permalink
Merge pull request #210 from HinTak/m120-public
Browse files Browse the repository at this point in the history
M120 public

The latest stats on CI is:

Linux
2072 passed, 108 skipped, 13 xfailed

Windows
1848 passed, 339 skipped, 6 xfailed, 1 warning

Mac
2061 passed, 120 skipped, 13 xfailed

Mac with older python 3.7/3.8
1838 passed, 349 skipped, 6 xfailed
  • Loading branch information
HinTak authored Dec 5, 2023
2 parents a942b21 + d55eba0 commit 8025331
Show file tree
Hide file tree
Showing 23 changed files with 325 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
skia
key: linux-aarch64-skia-${{ github.sha }}-3rd-party
- name: Pre-fetch skia deps
run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m119-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m119-minimize-download.patch
run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m120-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m120-minimize-download.patch
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build skia 3rd-Party
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ https://kyamagu.github.io/skia-python
- [Tutorial](https://kyamagu.github.io/skia-python/tutorial/)
- [Reference](https://kyamagu.github.io/skia-python/reference.html)

- For information about changes after `m116`, and tips on migration from `m87`: [README.m116](README.m116.md),
[README.m117](README.m117.md), [README.m118](README.m118.md), [README.m119](README.m119.md).
- For information about changes after `m116`, and tips on migration from `m87`: [README.m116](relnotes/README.m116.md),
[README.m117](relnotes/README.m117.md), [README.m118](relnotes/README.m118.md), [README.m119](relnotes/README.m119.md),
[README.m120](relnotes/README.m120.md).

## Contributing

Expand Down
69 changes: 69 additions & 0 deletions patch/skia-m120-minimize-download.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
diff --git a/DEPS b/DEPS
index cb5ae85..aeeea58 100644
--- a/DEPS
+++ b/DEPS
@@ -23,52 +23,18 @@ vars = {
# ./tools/git-sync-deps
deps = {
"buildtools" : "https://chromium.googlesource.com/chromium/src/buildtools.git@b138e6ce86ae843c42a1a08f37903207bebcca75",
- "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@95fe7e470418cd5ac18d203eb29a25101c650f14",
- "third_party/externals/brotli" : "https://skia.googlesource.com/external/github.com/google/brotli.git@6d03dfbedda1615c4cba1211f8d81735575209c8",
- "third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b",
- # Dawn requires jinja2 and markupsafe for the code generator, tint for SPIRV compilation, and abseil for string formatting.
- # When the Dawn revision is updated these should be updated from the Dawn DEPS as well.
- "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@52564ab1a0e3359b7bbadd282865cc28612c33ce",
- "third_party/externals/jinja2" : "https://chromium.googlesource.com/chromium/src/third_party/jinja2@515dd10de9bf63040045902a4a310d2ba25213a0",
- "third_party/externals/markupsafe" : "https://chromium.googlesource.com/chromium/src/third_party/markupsafe@006709ba3ed87660a17bd4548c45663628f5ed85",
- "third_party/externals/abseil-cpp" : "https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git@cb436cf0142b4cbe47aae94223443df7f82e2920",
"third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@c8d0c9b1d16bfda56f15165d39e0ffa360a11123",
- "third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@b055c9b483e70ecd57b3cf7204db21f5a06f9ffe",
- "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@a896e3d066448b3530dbcaa48869fafefd738f57",
"third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@441f98d02deafd9b090aea568282b28f66a50e36",
"third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@45903920b984540bb629bc89f4c010159c23a89a",
"third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@4cfc6d8e173e800df086d7be078da2e8c5cfca19",
- "third_party/externals/highway" : "https://chromium.googlesource.com/external/github.com/google/highway.git@424360251cdcfc314cfc528f53c872ecd63af0f0",
"third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@a0718d4f121727e30b8d52c7a189ebf5ab52421f",
- "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456",
- "third_party/externals/libavif" : "https://skia.googlesource.com/external/github.com/AOMediaCodec/libavif.git@55aab4ac0607ab651055d354d64c4615cf3d8000",
- "third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@5cf722e659014ebaf2f573a6dd935116d36eadf1",
- "third_party/externals/libgrapheme" : "https://skia.googlesource.com/external/github.com/FRIGN/libgrapheme/@c0cab63c5300fa12284194fbef57aa2ed62a94c0",
"third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@ed683925e4897a84b3bffc5c1414c85b97a129a3",
- "third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3",
"third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@386707c6d19b974ca2e3db7f5c61873813c6fe44",
"third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@2af26267cdfcb63a88e5c74a85927a12d6ca1d76",
- "third_party/externals/libyuv" : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96",
- "third_party/externals/microhttpd" : "https://android.googlesource.com/platform/external/libmicrohttpd@748945ec6f1c67b7efc934ab0808e1d32f2fb98d",
- "third_party/externals/oboe" : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419",
- "third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553",
- "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394",
"third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406",
- "third_party/externals/sfntly" : "https://chromium.googlesource.com/external/github.com/googlei18n/sfntly.git@b55ff303ea2f9e26702b514cf6a3196a2e3e2974",
- "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@d9ec9befba05a8dfca09c1e88f3f7be0e4b153c6",
"third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@a6bfc237255a6bac1513f7c1ebde6d8aed6b5191",
- # vulkan-deps is a meta-repo containing several interdependent Khronos Vulkan repositories.
- # When the vulkan-deps revision is updated, those repos (spirv-*, vulkan-*) should be updated as well.
"third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@e334b7a22bdd04b80d3d6f27207bfdaaa29684c0",
- "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@637cff3d05892801daa43c93907e17151c7dfd31",
- "third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@88bc5e321c2839707df8b1ab534e243e00744177",
- "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@4f014aff9c653e5e16de1cc5f7130e99e02982e5",
- "third_party/externals/vello" : "https://skia.googlesource.com/external/github.com/linebender/vello.git@ee3a076b291d206c361431cc841407adf265c692",
"third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@aff5071d4ee6215c60a91d8d983cad91bb25fb57",
- "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@2d956672d73321bfb22b378c06033f0bd885d61c",
- "third_party/externals/vulkan-utility-libraries": "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Utility-Libraries@5b3147a535e28a48ae760efacdf97b296d9e8c73",
- "third_party/externals/unicodetools" : "https://chromium.googlesource.com/external/github.com/unicode-org/unicodetools@66a3fa9dbdca3b67053a483d130564eabc5fe095",
- #"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4",
"third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@e3f919ccfe3ef542cfc983a82146070258fb57f8",
"third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@c876c8f87101c5a75f6014b0f832499afeb65b73",

diff --git a/bin/activate-emsdk b/bin/activate-emsdk
index 687ca9f..7167d8d 100755
--- a/bin/activate-emsdk
+++ b/bin/activate-emsdk
@@ -17,6 +17,7 @@ EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py')
EMSDK_VERSION = '3.1.44'

def main():
+ return
if sysconfig.get_platform() in ['linux-aarch64', 'linux-arm64']:
# This platform cannot install emsdk at the provided version. See
# https://github.com/emscripten-core/emsdk/blob/main/emscripten-releases-tags.json#L5
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions relnotes/README.m120.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
New in m120:

* Rudimentary support (TextBlob::MakeFromShapedText) of text-shaping via
upstream's libSkShaper module. Intially this was added to support
emoji's with skin-tone modifiers (#195), but has the fortunate side-effect
that now LTR languages (Arabic, Hebrew, Tibetan ...) work as desired in
skia-python's drawing. Note libSkShaper is buggy on windows.
( https://issues.skia.org/issues/310510988 )

* Option to use freetype as fontmgr on non-linux (#213) - using
skia.FontMgr.New_Custom_Empty() (upstream's SkFontMgr_New_Custom_Empty).
This allows Windows/Mac users to use some font formats not supported by
DirectWrite/CoreText (see #195); and also work around bug in CoreText (#138,
https://issues.skia.org/310510989 ).

* OT-SVG font support is on by default now (#212, also see #195).

* Vulkan is enabled for Linux/Windows. Most of the APIs were in m87 (stubs?)
but were made optional in m98+, and dependent on GPU backend compiled in.
For Mac OS X users, upstream removed MoltenVK support in m83, and recommend
using Metal backend (TODO).

Since m119:

* Removed upstream:

SkTypeface::UniqueID()
SkFont::refTypefaceOrDefault and SkFont::getTypefaceOrDefault()
GrBackendSemaphore::initGL and GrBackendSemaphore::glSync

* A few Image.* methods are re-enabled - they were emulated in m116+
but left disabled mistakenly.

MakeTextureFromCompressed, MakeFromCompressedTexture,
MakeFromYUVAPixmaps, makeNonTextureImage,
MakeRasterFromCompressed, MakeCrossContextFromPixmap,
MakeFromAdoptedTexture .

Since m87:

* sampleCnt in "GrBackendRenderTarget(int width, int height, int sampleCnt, const GrVkImageInfo& vkInfo)"
is ignored. In m87 header, "/** Deprecated. Samplecount is now part of GrVkImageInfo. */".
3 changes: 2 additions & 1 deletion scripts/build_Linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ git clone https://gn.googlesource.com/gn && \

# Build skia
cd skia && \
patch -p1 < ../patch/skia-m119-minimize-download.patch && \
patch -p1 < ../patch/skia-m120-minimize-download.patch && \
patch -p1 < ../patch/skia-m116-colrv1-freetype.diff && \
python3 tools/git-sync-deps && \
cp -f ../gn/out/gn bin/gn && \
bin/gn gen out/Release --args="
is_official_build=true
skia_enable_svg=true
skia_use_vulkan=true
skia_use_system_libjpeg_turbo=false
skia_use_system_libwebp=false
skia_use_system_libpng=false
Expand Down
6 changes: 5 additions & 1 deletion scripts/build_Windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ export PATH="${PWD}/depot_tools:$PATH"

# Build skia
cd skia && \
patch -p1 < ../patch/skia-m119-minimize-download.patch && \
patch -p1 < ../patch/skia-m120-minimize-download.patch && \
patch -p1 < ../patch/skia-m116-colrv1-freetype.diff && \
python tools/git-sync-deps && \
bin/gn gen out/Release --args='
is_official_build=true
skia_enable_svg=true
skia_use_vulkan=true
skia_use_freetype=true
skia_use_system_freetype2=false
skia_enable_fontmgr_custom_empty=true
skia_use_system_libjpeg_turbo=false
skia_use_system_libwebp=false
skia_use_system_libpng=false
Expand Down
5 changes: 4 additions & 1 deletion scripts/build_macOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ function apply_patch {
}

cd skia && \
patch -p1 < ../patch/skia-m119-minimize-download.patch && \
patch -p1 < ../patch/skia-m120-minimize-download.patch && \
patch -p1 < ../patch/skia-m116-colrv1-freetype.diff && \
python3 tools/git-sync-deps && \
bin/gn gen out/Release --args="
is_official_build=true
skia_enable_svg=true
skia_use_freetype=true
skia_use_system_freetype2=false
skia_enable_fontmgr_custom_empty=true
skia_use_system_libjpeg_turbo=false
skia_use_system_libwebp=false
skia_use_system_libpng=false
Expand Down
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
pass

NAME = 'skia-python'
__version__ = '119.0b4'
__version__ = '120.0b5'

SKIA_PATH = os.getenv('SKIA_PATH', 'skia')
SKIA_OUT_PATH = os.getenv(
Expand All @@ -32,12 +32,13 @@
'Advapi32',
]
EXTRA_OBJECTS = list(
) + [os.path.join(SKIA_OUT_PATH, 'svg.lib'), os.path.join(SKIA_OUT_PATH, 'skia.lib'),
) + [os.path.join(SKIA_OUT_PATH, 'svg.lib'), os.path.join(SKIA_OUT_PATH, 'skresources.lib'), os.path.join(SKIA_OUT_PATH, 'skia.lib'),
os.path.join(SKIA_OUT_PATH, 'skshaper.lib'), os.path.join(SKIA_OUT_PATH, 'skunicode.lib')]
EXTRA_COMPILE_ARGS = [
'/std:c++17', # c++20 fails.
'/DVERSION_INFO=%s' % __version__,
'/DSK_GL',
'/DSK_VULKAN',
'/DSK_GANESH=1',
'/Zc:inline',
# Disable a bunch of warnings.
Expand Down Expand Up @@ -72,7 +73,7 @@
]
EXTRA_LINK_ARGS = [
'-stdlib=libc++',
'-mmacosx-version-min=10.9',
'-mmacosx-version-min=10.13',
'-dead_strip',
'-framework',
'AppKit',
Expand All @@ -85,6 +86,7 @@
DEFINE_MACROS = [
('VERSION_INFO', __version__),
('SK_GL', ''),
('SK_VULKAN', ''),
('SK_GANESH', '1'),
]
LIBRARIES = [
Expand All @@ -94,7 +96,7 @@
'expat',
]
EXTRA_OBJECTS = list(
) + [os.path.join(SKIA_OUT_PATH, 'libsvg.a'), os.path.join(SKIA_OUT_PATH, 'libskia.a'),
) + [os.path.join(SKIA_OUT_PATH, 'libsvg.a'), os.path.join(SKIA_OUT_PATH, 'libskresources.a'), os.path.join(SKIA_OUT_PATH, 'libskia.a'),
os.path.join(SKIA_OUT_PATH, 'libskshaper.a'), os.path.join(SKIA_OUT_PATH, 'libskunicode.a')]
EXTRA_COMPILE_ARGS = [
'-std=c++17',
Expand Down Expand Up @@ -144,6 +146,7 @@ def build_extensions(self):
get_pybind_include(user=True),
SKIA_PATH,
os.path.join(SKIA_PATH, "third_party/externals/freetype/include"),
os.path.join(SKIA_PATH, "third_party/externals/vulkan-headers/include"),
os.path.join(SKIA_OUT_PATH, 'gen'),
],
define_macros=DEFINE_MACROS,
Expand Down
2 changes: 1 addition & 1 deletion skia
Submodule skia updated from ab212d to 746dbd
10 changes: 10 additions & 0 deletions src/skia/Font.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "common.h"
#include <include/core/SkFontMetrics.h>
#include <include/ports/SkFontMgr_empty.h>
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>
#include <pybind11/iostream.h>
Expand Down Expand Up @@ -538,6 +539,7 @@ typeface
)docstring")
// .def("filterRec", &SkTypeface::filterRec)
// .def("getFontDescriptor", &SkTypeface::getFontDescriptor)
/*
.def_static("UniqueID", &SkTypeface::UniqueID,
R"docstring(
Return the uniqueID for the specified typeface.
Expand All @@ -546,6 +548,7 @@ typeface
uniqueID. Will never return 0.
)docstring",
py::arg("typeface"))
*/
.def_static("Equal", &SkTypeface::Equal,
R"docstring(
Returns true if the two typefaces reference the same underlying font,
Expand Down Expand Up @@ -638,6 +641,7 @@ py::class_<SkFontMgr, sk_sp<SkFontMgr>, SkRefCnt>(m, "FontMgr",
)docstring")
.def(py::init([] () { return SkFontMgr::RefDefault(); }))
.def_static("New_Custom_Empty", &SkFontMgr_New_Custom_Empty)
.def("__getitem__", &SkFontMgr_getFamilyName, py::arg("index"))
.def("__len__", &SkFontMgr::countFamilies)
.def("countFamilies", &SkFontMgr::countFamilies)
Expand Down Expand Up @@ -775,12 +779,14 @@ py::enum_<SkFont::Edging>(font, "Edging", R"docstring(
.export_values();

font
/*
.def("__repr__",
[] (const SkFont& self) {
return py::str("Font({}, {}, {}, {})").format(
self.getTypefaceOrDefault(), self.getSize(), self.getScaleX(),
self.getSkewX());
})
*/
.def(py::init<>(),
R"docstring(
Constructs :py:class:`Font` with default values.
Expand Down Expand Up @@ -990,6 +996,7 @@ font
:return: :py:class:`Typeface` if previously set, nullptr otherwise
)docstring",
py::return_value_policy::reference)
/*
.def("getTypefaceOrDefault", &SkFont::getTypefaceOrDefault,
R"docstring(
Returns :py:class:`Typeface` if set, or the default typeface.
Expand All @@ -998,6 +1005,7 @@ font
default typeface if not previously set.
)docstring",
py::return_value_policy::reference)
*/
.def("getSize", &SkFont::getSize,
R"docstring(
Returns text size in points.
Expand Down Expand Up @@ -1026,13 +1034,15 @@ font
:return: :py:class:`Typeface` if previously set, nullptr otherwise
)docstring")
/*
.def("refTypefaceOrDefault", &SkFont::refTypefaceOrDefault,
R"docstring(
Increases :py:class:`Typeface` :py:class:`RefCnt` by one.
:return: :py:class:`Typeface` if previously set or, a pointer to the
default typeface if not previously set.
)docstring")
*/
.def("setTypeface", &SkFont::setTypeface,
R"docstring(
Sets :py:class:`Typeface` to typeface, decreasing :py:class:`RefCnt` of
Expand Down
Loading

0 comments on commit 8025331

Please sign in to comment.