Fix up mac-related modules
In particular, we will need to break up sdk_frameworks into
ios_frameworks and mac_frameworks for reasons outlined in
http://cl/623825510
These modules will especially be needed in G3 to migrate clients
off the old targets.
Bug: b/40045064
Change-Id: Ic969c30cec87a8ab8f1b521a1a0f39948aab60a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/839456
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
diff --git a/BUILD.bazel b/BUILD.bazel
index cbd4cb4..858c7ed 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -207,12 +207,11 @@
visibility = ["//visibility:public"],
)
-# TODO(kjlubick)
-# alias(
-# name = "fontmgr_coretext",
-# actual = "//src/ports:fontmgr_coretext",
-# visibility = ["//visibility:public"],
-# )
+alias(
+ name = "fontmgr_coretext",
+ actual = "//src/ports:fontmgr_coretext",
+ visibility = ["//visibility:public"],
+)
alias(
name = "fontmgr_data_freetype",
@@ -235,8 +234,8 @@
###
alias(
- name = "skparagraph_harfbuzz_icu",
- actual = "//modules/skparagraph:skparagraph_harfbuzz_icu",
+ name = "skparagraph_harfbuzz_unicode",
+ actual = "//modules/skparagraph:skparagraph_harfbuzz_unicode",
visibility = ["//visibility:public"],
)
@@ -248,12 +247,11 @@
visibility = ["//visibility:public"],
)
-# TODO(kjlubick)
-# alias(
-# name = "skshaper_coretext",
-# actual = "//modules/skshaper:skshaper_coretext",
-# visibility = ["//visibility:public"],
-# )
+alias(
+ name = "skshaper_coretext",
+ actual = "//modules/skshaper:skshaper_coretext",
+ visibility = ["//visibility:public"],
+)
alias(
name = "skshaper_harfbuzz",
diff --git a/bazel/macros.bzl b/bazel/macros.bzl
index 2736799..2afa256 100644
--- a/bazel/macros.bzl
+++ b/bazel/macros.bzl
@@ -23,7 +23,6 @@
_skia_cc_binary_with_flags = "skia_cc_binary_with_flags",
_skia_cc_deps = "skia_cc_deps",
_skia_cc_library = "skia_cc_library",
- _skia_defines = "skia_defines",
_skia_filegroup = "skia_filegroup",
_skia_objc_library = "skia_objc_library",
_split_srcs_and_hdrs = "split_srcs_and_hdrs",
@@ -49,7 +48,6 @@
skia_cc_binary_with_flags = _skia_cc_binary_with_flags
skia_cc_deps = _skia_cc_deps
skia_cc_library = _skia_cc_library
-skia_defines = _skia_defines
skia_filegroup = _skia_filegroup
skia_objc_library = _skia_objc_library
split_srcs_and_hdrs = _split_srcs_and_hdrs
diff --git a/bazel/skia_rules.bzl b/bazel/skia_rules.bzl
index 53dcc9f..6922795 100644
--- a/bazel/skia_rules.bzl
+++ b/bazel/skia_rules.bzl
@@ -202,15 +202,18 @@
testonly = testonly,
)
-def skia_defines(name, visibility, defines):
- """A self-documenting wrapper around cc_library for defines"""
- native.cc_library(name = name, visibility = visibility, defines = defines)
-
def skia_filegroup(**kwargs):
"""A wrapper around filegroup allowing us to customize visibility in G3."""
native.filegroup(**kwargs)
-def skia_objc_library(name, copts = DEFAULT_OBJC_COPTS, **kwargs):
+def skia_objc_library(
+ name,
+ copts = DEFAULT_OBJC_COPTS,
+ deps = [],
+ ios_frameworks = [],
+ mac_frameworks = [],
+ sdk_frameworks = [],
+ **kwargs):
"""A wrapper around objc_library for Skia Objective C libraries.
This lets us provide compiler flags (copts) consistently to the Skia build (e.g. //:skia_public)
@@ -221,18 +224,27 @@
name: the name of the underlying target.
copts: Flags which should be passed to the C++ compiler. By default, we use
DEFAULT_OBJC_COPTS from @skia_user_config//:copts.bzl.
+ deps: https://bazel.build/reference/be/objective-c#objc_library.deps
+ ios_frameworks: A list (not select) of iOS-specific Frameworks.
+ mac_frameworks: A list (not select) of Mac-specific Frameworks.
+ sdk_frameworks: https://bazel.build/reference/be/objective-c#objc_library.sdk_frameworks
+ except this should only be a list, not a select.
**kwargs: Normal arguments to objc_library
"""
+ if len(ios_frameworks) > 0 or len(mac_frameworks) > 0:
+ sdk_frameworks += select({
+ "@platforms//os:ios": ios_frameworks,
+ "@platforms//os:macos": mac_frameworks,
+ "//conditions:default": [],
+ })
- # Internally, we need to combine sdk_frameworks and deps, but we can only
- # do that if both are lists
- # https://github.com/bazelbuild/bazel/issues/14157
- sdks = kwargs.get("sdk_frameworks", None)
- deps = kwargs.get("deps", [])
- if type(sdks) != "NoneType":
- if type(sdks) != "list" or type(deps) != "list":
- fail("sdk_frameworks and deps must both be normal lists, not selects")
- native.objc_library(name = name, copts = copts, **kwargs)
+ native.objc_library(
+ name = name,
+ copts = copts,
+ deps = deps,
+ sdk_frameworks = sdk_frameworks,
+ **kwargs
+ )
# buildifier: disable=unnamed-macro
def exports_files_legacy(label_list = None, visibility = None):
diff --git a/example/external_client/BUILD.bazel b/example/external_client/BUILD.bazel
index 8db892c..167532f 100644
--- a/example/external_client/BUILD.bazel
+++ b/example/external_client/BUILD.bazel
@@ -87,7 +87,8 @@
"@skia//:core",
"@skia//:fontmgr_empty_freetype",
"@skia//:jpeg_encode_codec",
- "@skia//:skparagraph_harfbuzz_icu",
+ "@skia//:skparagraph_harfbuzz_unicode",
+ "@skia//:skunicode_icu",
],
)
diff --git a/example/external_client/src/shape_text.cpp b/example/external_client/src/shape_text.cpp
index bd95e7b..0958ea2 100644
--- a/example/external_client/src/shape_text.cpp
+++ b/example/external_client/src/shape_text.cpp
@@ -25,6 +25,7 @@
#include "modules/skparagraph/include/Paragraph.h"
#include "modules/skparagraph/include/ParagraphBuilder.h"
#include "modules/skparagraph/include/ParagraphStyle.h"
+#include "modules/skunicode/include/SkUnicode_icu.h"
#include <cstdio>
#include <cstdlib>
@@ -159,9 +160,14 @@
paraStyle.setTextStyle(style);
paraStyle.setTextAlign(skia::textlayout::TextAlign::kRight);
+ sk_sp<SkUnicode> unicode = SkUnicodes::ICU::Make();
+ if (!unicode) {
+ printf("Could not load unicode data\n");
+ return 1;
+ }
using skia::textlayout::ParagraphBuilder;
std::unique_ptr<ParagraphBuilder> builder =
- ParagraphBuilder::make(paraStyle, fontCollection);
+ ParagraphBuilder::make(paraStyle, fontCollection, unicode);
builder->addText(story);
std::unique_ptr<skia::textlayout::Paragraph> paragraph = builder->Build();
diff --git a/example/external_client/src/svg_renderer.cpp b/example/external_client/src/svg_renderer.cpp
index 1d665ba..36513ec 100644
--- a/example/external_client/src/svg_renderer.cpp
+++ b/example/external_client/src/svg_renderer.cpp
@@ -24,7 +24,7 @@
#endif
#if defined(SK_FONTMGR_CORETEXT_AVAILABLE)
-#include "include/ports/SkFontMgr_coretext.h"
+#include "include/ports/SkFontMgr_mac_ct.h"
#endif
#include <cstdio>
diff --git a/gn/core.gni b/gn/core.gni
index dbf026f..9e9f962 100644
--- a/gn/core.gni
+++ b/gn/core.gni
@@ -742,10 +742,7 @@
]
# Generated by Bazel rule //include/encode:encode_hdrs
-skia_encode_public = [
- "$_include/encode/SkEncoder.h",
- "$_include/encode/SkICC.h",
-]
+skia_encode_public = [ "$_include/encode/SkEncoder.h" ]
# List generated by Bazel rules:
# //src/encode:srcs
diff --git a/include/encode/BUILD.bazel b/include/encode/BUILD.bazel
index 5534d1f..d5210cb 100644
--- a/include/encode/BUILD.bazel
+++ b/include/encode/BUILD.bazel
@@ -8,6 +8,13 @@
name = "encode_hdrs",
srcs = [
"SkEncoder.h",
+ ],
+ visibility = ["//src/encode:__pkg__"],
+)
+
+skia_filegroup(
+ name = "icc_hdrs",
+ srcs = [
"SkICC.h",
],
visibility = ["//src/encode:__pkg__"],
@@ -41,6 +48,7 @@
name = "public_hdrs",
srcs = [
":encode_hdrs",
+ ":icc_hdrs",
":jpeg_hdrs",
":png_hdrs",
":webp_hdrs",
diff --git a/include/ports/BUILD.bazel b/include/ports/BUILD.bazel
index 5561860..1e7819f 100644
--- a/include/ports/BUILD.bazel
+++ b/include/ports/BUILD.bazel
@@ -11,8 +11,24 @@
)
skia_filegroup(
+ name = "core_foundation_hdrs",
+ srcs = ["SkCFObject.h"],
+ visibility = [
+ "//src/gpu/ganesh/mtl:__pkg__",
+ "//src/ports:__pkg__",
+ ],
+)
+
+skia_filegroup(
+ name = "coretext_fontmgr_hdrs",
+ srcs = ["SkFontMgr_mac_ct.h"],
+ visibility = ["//src/ports:__pkg__"],
+)
+
+skia_filegroup(
name = "directory_fontmgr_hdrs",
srcs = ["SkFontMgr_directory.h"],
+ visibility = ["//src/ports:__pkg__"],
)
skia_filegroup(
@@ -95,16 +111,19 @@
)
skia_filegroup(
- name = "core_hdrs",
+ name = "imagegenerator_cg_hdrs",
srcs = ["SkImageGeneratorCG.h"],
- visibility = ["//src/core:__pkg__"],
+ visibility = [
+ "//src/gpu/ganesh/mtl:__pkg__",
+ "//src/ports:__pkg__",
+ ],
)
skia_filegroup(
- name = "apple_hdrs",
- srcs = [
- "SkCFObject.h",
- "SkImageGeneratorCG.h",
+ name = "mac_typeface",
+ srcs = ["SkTypeface_mac.h"],
+ visibility = [
+ "//src/gpu/ganesh/mtl:__pkg__",
+ "//src/ports:__pkg__",
],
- visibility = ["//src/gpu/ganesh/mtl:__pkg__"],
)
diff --git a/include/private/base/BUILD.bazel b/include/private/base/BUILD.bazel
index 66f1971..1c5bf0e 100644
--- a/include/private/base/BUILD.bazel
+++ b/include/private/base/BUILD.bazel
@@ -54,7 +54,7 @@
headers = SHARED_GPU_HEADERS,
)
-filegroup(
+skia_filegroup(
name = "generated_base_header_cpps",
srcs = [
":generated_base_header_cpps1",
diff --git a/include/utils/BUILD.bazel b/include/utils/BUILD.bazel
index 1a1e7ed..b904f05 100644
--- a/include/utils/BUILD.bazel
+++ b/include/utils/BUILD.bazel
@@ -32,6 +32,7 @@
"SkEventTracer.h",
"SkNWayCanvas.h",
"SkNoDrawCanvas.h",
+ "SkOrderedFontMgr.h",
"SkPaintFilterCanvas.h",
"SkParse.h",
"SkParsePath.h",
diff --git a/include/utils/mac/BUILD.bazel b/include/utils/mac/BUILD.bazel
index b773c38..ab6f498 100644
--- a/include/utils/mac/BUILD.bazel
+++ b/include/utils/mac/BUILD.bazel
@@ -4,11 +4,10 @@
exports_files_legacy()
-# Not yet included in a Bazel build.
-# File group is here for exporting to utils.gni:skia_utils_public.
skia_filegroup(
name = "public_hdrs",
srcs = [
"SkCGUtils.h",
],
+ visibility = ["//src/utils/mac:__pkg__"],
)
diff --git a/modules/skparagraph/BUILD.bazel b/modules/skparagraph/BUILD.bazel
index 8a29221..8289f4b 100644
--- a/modules/skparagraph/BUILD.bazel
+++ b/modules/skparagraph/BUILD.bazel
@@ -38,3 +38,22 @@
"//src/core:core_priv",
],
)
+
+skia_cc_library(
+ name = "skparagraph_harfbuzz_unicode",
+ srcs = ["//modules/skparagraph/src:srcs"],
+ hdrs = ["//modules/skparagraph/include:hdrs"],
+ defines = ["SK_DISABLE_LEGACY_PARAGRAPH_UNICODE"],
+ features = ["layering_check"],
+ visibility = [
+ "//:__subpackages__",
+ ],
+ deps = [
+ "//:core",
+ "//modules/skshaper:skshaper_harfbuzz",
+ "//modules/skshaper:skshaper_unicode",
+ "//modules/skunicode:skunicode_core",
+ "//src/base",
+ "//src/core:core_priv",
+ ],
+)
diff --git a/modules/skshaper/BUILD.bazel b/modules/skshaper/BUILD.bazel
index adf11cd..ceb89dd 100644
--- a/modules/skshaper/BUILD.bazel
+++ b/modules/skshaper/BUILD.bazel
@@ -1,5 +1,5 @@
load("@bazel_skylib//lib:selects.bzl", "selects")
-load("//bazel:skia_rules.bzl", "exports_files_legacy", "skia_cc_library")
+load("//bazel:skia_rules.bzl", "exports_files_legacy", "skia_cc_library", "skia_objc_library")
licenses(["notice"])
@@ -88,6 +88,39 @@
],
)
+skia_objc_library(
+ name = "skshaper_coretext",
+ srcs = [
+ "//modules/skshaper/src:coretext_srcs",
+ ],
+ hdrs = [
+ "//modules/skshaper/include:core_hdrs",
+ "//modules/skshaper/include:coretext_hdrs",
+ "//modules/skshaper/utils:core_hdrs",
+ ],
+ copts = ["-DSKSHAPER_IMPLEMENTATION=1"],
+ defines = [
+ "SK_SHAPER_CORETEXT_AVAILABLE",
+ "SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS",
+ ],
+ features = ["layering_check"],
+ ios_frameworks = [
+ "CoreText",
+ "CoreGraphics",
+ "CoreFoundation",
+ ],
+ mac_frameworks = ["ApplicationServices"],
+ visibility = [
+ "//:__subpackages__",
+ ],
+ deps = [
+ ":skshaper_core",
+ "//:core",
+ "//src/base",
+ "//src/core:core_priv",
+ ],
+)
+
skia_cc_library(
name = "skshaper_harfbuzz",
srcs = [
diff --git a/modules/skshaper/src/BUILD.bazel b/modules/skshaper/src/BUILD.bazel
index 1ecf82c..abb30e4 100644
--- a/modules/skshaper/src/BUILD.bazel
+++ b/modules/skshaper/src/BUILD.bazel
@@ -22,6 +22,7 @@
skia_filegroup(
name = "coretext_srcs",
srcs = ["SkShaper_coretext.cpp"],
+ visibility = ["//modules/skshaper:__pkg__"],
)
skia_filegroup(
diff --git a/modules/skshaper/src/SkShaper_coretext.cpp b/modules/skshaper/src/SkShaper_coretext.cpp
index 8d7f8e5..7b57d60 100644
--- a/modules/skshaper/src/SkShaper_coretext.cpp
+++ b/modules/skshaper/src/SkShaper_coretext.cpp
@@ -81,7 +81,7 @@
}
};
-static void dict_add_double(CFMutableDictionaryRef d, const void* name, double value) {
+[[maybe_unused]] static void dict_add_double(CFMutableDictionaryRef d, const void* name, double value) {
SkUniqueCFRef<CFNumberRef> number(
CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &value));
CFDictionaryAddValue(d, name, number.get());
@@ -222,7 +222,7 @@
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
CFDictionaryAddValue(attr.get(), kCTFontAttributeName, ctfont.get());
- if (false) {
+ if ((false)) {
// trying to see what these affect
dict_add_double(attr.get(), kCTTracking_AttributeName, 1);
dict_add_double(attr.get(), kCTKernAttributeName, 0.0);
diff --git a/src/codec/BUILD.bazel b/src/codec/BUILD.bazel
index 4cba08b..217d162 100644
--- a/src/codec/BUILD.bazel
+++ b/src/codec/BUILD.bazel
@@ -102,7 +102,7 @@
files = DECODE_JPEG_FILES,
)
-filegroup(
+skia_filegroup(
name = "shared_jpeg_hdrs", # needed for both encoding and decoding
srcs = [
"SkJpegConstants.h",
@@ -110,7 +110,7 @@
visibility = ["//src/encode:__pkg__"],
)
-filegroup(
+skia_filegroup(
name = "xmp_srcs",
srcs = [
"SkXmp.cpp",
diff --git a/src/core/BUILD.bazel b/src/core/BUILD.bazel
index 4e1f50c..b2cbb1b 100644
--- a/src/core/BUILD.bazel
+++ b/src/core/BUILD.bazel
@@ -823,7 +823,6 @@
"//include/codec:core_hdrs",
"//include/core:core_hdrs",
"//include/effects:core_hdrs",
- "//include/ports:core_hdrs",
"//include/sksl:core_hdrs",
"//include/utils:core_hdrs",
],
diff --git a/src/encode/BUILD.bazel b/src/encode/BUILD.bazel
index a2c09ca..b2ee2c1 100644
--- a/src/encode/BUILD.bazel
+++ b/src/encode/BUILD.bazel
@@ -110,21 +110,58 @@
),
)
-skia_filegroup(
- name = "any_encoder_srcs",
+skia_cc_library(
+ name = "icc_support",
+ srcs = [
+ "SkICC.cpp",
+ ],
+ hdrs = [
+ "SkICCPriv.h",
+ "//include/encode:icc_hdrs",
+ ],
+ features = ["layering_check"],
+ deps = [
+ "//:core",
+ "//modules/skcms",
+ "//src/base",
+ "//src/core:core_priv",
+ ],
+)
+
+skia_cc_library(
+ name = "encoder_common",
srcs = [
"SkEncoder.cpp",
- "SkICC.cpp",
- "SkICCPriv.h",
+ "//include/encode:encode_hdrs",
+ ],
+ hdrs = [
"SkImageEncoderFns.h",
"SkImageEncoderPriv.h",
],
+ features = ["layering_check"],
+ deps = [
+ ":icc_support",
+ "//:core",
+ "//modules/skcms",
+ "//src/base",
+ "//src/core:core_priv",
+ ],
+)
+
+skia_cc_library(
+ name = "icc_encode",
+ hdrs = [
+ "//include/encode:icc_hdrs",
+ ],
+ visibility = ["//:__subpackages__"],
+ deps = [
+ ":icc_support",
+ ],
)
skia_cc_library(
name = "png_encode",
srcs = [
- ":any_encoder_srcs",
":png_encode_hdrs",
":png_encode_srcs",
"//src/codec:common_png_srcs",
@@ -136,6 +173,7 @@
features = ["layering_check"],
visibility = ["//:__pkg__"],
deps = [
+ ":encoder_common",
"//:core",
"//modules/skcms",
"//src/base",
@@ -147,7 +185,6 @@
skia_cc_library(
name = "jpeg_encode",
srcs = [
- ":any_encoder_srcs",
":jpeg_encode_hdrs",
":jpeg_encode_srcs",
"//src/codec:common_jpeg_srcs",
@@ -159,8 +196,8 @@
features = ["layering_check"],
visibility = ["//:__pkg__"],
deps = [
+ ":encoder_common",
"//:core",
- "//modules/skcms",
"//src/base",
"//src/core:core_priv",
"@libjpeg_turbo",
@@ -170,7 +207,6 @@
skia_cc_library(
name = "webp_encode",
srcs = [
- ":any_encoder_srcs",
":webp_encode_srcs",
],
hdrs = [
@@ -180,8 +216,8 @@
features = ["layering_check"],
visibility = ["//:__pkg__"],
deps = [
+ ":encoder_common",
"//:core",
- "//modules/skcms",
"//src/base",
"//src/core:core_priv",
"@libwebp",
diff --git a/src/gpu/ganesh/mtl/BUILD.bazel b/src/gpu/ganesh/mtl/BUILD.bazel
index 6495b13..8de9f12 100644
--- a/src/gpu/ganesh/mtl/BUILD.bazel
+++ b/src/gpu/ganesh/mtl/BUILD.bazel
@@ -94,10 +94,10 @@
":mtl_cpp_hdrs",
":mtl_hdrs",
":mtl_srcs",
+ "//include/ports:core_foundation_hdrs",
],
hdrs = [
"//include/gpu/ganesh/mtl:public_hdrs",
- "//include/ports:apple_hdrs",
],
copts = ["-fobjc-arc"],
sdk_frameworks = [
diff --git a/src/ports/BUILD.bazel b/src/ports/BUILD.bazel
index 65c8300..19a795c 100644
--- a/src/ports/BUILD.bazel
+++ b/src/ports/BUILD.bazel
@@ -6,6 +6,7 @@
"skia_cc_deps",
"skia_cc_library",
"skia_filegroup",
+ "skia_objc_library",
)
licenses(["notice"])
@@ -148,7 +149,11 @@
name = "osfile_platform",
srcs = select({
"@platforms//os:windows": ["SkOSFile_win.cpp"],
- "@platforms//os:ios": ["SkOSFile_posix.cpp"],
+ "@platforms//os:ios": [
+ "SkOSFile_ios.h",
+ "SkOSFile_posix.cpp",
+ "//include/ports:core_foundation_hdrs",
+ ],
"//conditions:default": ["SkOSFile_posix.cpp"],
}),
)
@@ -311,6 +316,14 @@
visibility = ["//src/core:__pkg__"],
)
+skia_filegroup(
+ name = "fontmgr_custom",
+ srcs = [
+ "SkFontMgr_custom.cpp",
+ "SkFontMgr_custom.h",
+ ],
+)
+
skia_cc_library(
name = "freetype_support",
srcs = [
@@ -326,46 +339,44 @@
)
skia_cc_library(
- name = "fontmgr_fontconfig_freetype",
+ name = "fontmgr_android_freetype",
srcs = [
- "SkFontMgr_fontconfig.cpp",
+ "SkFontMgr_android.cpp",
+ "SkFontMgr_android_parser.cpp",
],
hdrs = [
- "//include/ports:fontconfig_fontmgr_hdrs",
+ "SkFontMgr_android_parser.h",
+ "//include/ports:android_fontmgr_hdrs",
],
- defines = ["SK_FONTMGR_FONTCONFIG_AVAILABLE"],
visibility = ["//:__pkg__"],
deps = [
":freetype_support",
"//:core",
- "//bazel/external/fontconfig",
"//src/base",
"//src/core:core_priv",
+ "@expat",
],
)
-filegroup(
- name = "fontmgr_custom",
+skia_objc_library(
+ name = "fontmgr_coretext",
srcs = [
- "SkFontMgr_custom.cpp",
- "SkFontMgr_custom.h",
- ],
-)
-
-skia_cc_library(
- name = "fontmgr_empty_freetype",
- srcs = [
- "SkFontMgr_custom_empty.cpp",
- ":fontmgr_custom",
+ "SkFontMgr_mac_ct.cpp",
],
hdrs = [
- "//include/ports:empty_fontmgr_hdrs",
+ "//include/ports:coretext_fontmgr_hdrs",
],
- defines = ["SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE"],
+ defines = ["SK_FONTMGR_CORETEXT_AVAILABLE"],
features = ["layering_check"],
+ ios_frameworks = [
+ "CoreText",
+ "CoreGraphics",
+ "CoreFoundation",
+ ],
+ mac_frameworks = ["ApplicationServices"],
visibility = ["//:__pkg__"],
deps = [
- ":freetype_support",
+ ":coretext_typeface",
"//:core",
"//src/base",
"//src/core:core_priv",
@@ -393,6 +404,46 @@
)
skia_cc_library(
+ name = "fontmgr_directory_freetype",
+ srcs = [
+ "SkFontMgr_custom_directory.cpp",
+ ":fontmgr_custom",
+ ],
+ hdrs = [
+ "//include/ports:directory_fontmgr_hdrs",
+ ],
+ defines = ["SK_FONTMGR_FREETYPE_DIRECTORY_AVAILABLE"],
+ features = ["layering_check"],
+ visibility = ["//__pkg__"],
+ deps = [
+ ":freetype_support",
+ "//:core",
+ "//src/base",
+ "//src/core:core_priv",
+ ],
+)
+
+skia_cc_library(
+ name = "fontmgr_empty_freetype",
+ srcs = [
+ "SkFontMgr_custom_empty.cpp",
+ ":fontmgr_custom",
+ ],
+ hdrs = [
+ "//include/ports:empty_fontmgr_hdrs",
+ ],
+ defines = ["SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE"],
+ features = ["layering_check"],
+ visibility = ["//:__pkg__"],
+ deps = [
+ ":freetype_support",
+ "//:core",
+ "//src/base",
+ "//src/core:core_priv",
+ ],
+)
+
+skia_cc_library(
name = "fontmgr_fontations_empty",
srcs = [
"SkFontMgr_fontations_empty.cpp",
@@ -416,21 +467,77 @@
)
skia_cc_library(
- name = "fontmgr_android_freetype",
+ name = "fontmgr_fontconfig_freetype",
srcs = [
- "SkFontMgr_android.cpp",
- "SkFontMgr_android_parser.cpp",
+ "SkFontMgr_fontconfig.cpp",
],
hdrs = [
- "SkFontMgr_android_parser.h",
- "//include/ports:android_fontmgr_hdrs",
+ "//include/ports:fontconfig_fontmgr_hdrs",
],
+ defines = ["SK_FONTMGR_FONTCONFIG_AVAILABLE"],
visibility = ["//:__pkg__"],
deps = [
":freetype_support",
"//:core",
+ "//bazel/external/fontconfig",
"//src/base",
"//src/core:core_priv",
- "@expat",
+ ],
+)
+
+skia_filegroup(
+ name = "typeface_mac_hdrs",
+ srcs = ["SkTypeface_mac_ct.h"],
+ visibility = ["//src/utils/mac:__pkg__"],
+)
+
+skia_objc_library(
+ name = "coretext_typeface",
+ srcs = [
+ "SkScalerContext_mac_ct.cpp",
+ "SkScalerContext_mac_ct.h",
+ "SkTypeface_mac_ct.cpp",
+ ],
+ hdrs = [
+ "SkTypeface_mac_ct.h",
+ "//include/ports:mac_typeface",
+ ],
+ features = ["layering_check"],
+ ios_frameworks = [
+ "CoreFoundation",
+ "CoreGraphics",
+ "CoreText",
+ ],
+ mac_frameworks = ["ApplicationServices"],
+ deps = [
+ "//:core",
+ "//src/base",
+ "//src/core:core_priv",
+ "//src/utils/mac:mac_utils_priv",
+ ],
+)
+
+skia_objc_library(
+ name = "imagegenerator_coregraphics",
+ srcs = [
+ "SkImageGeneratorCG.cpp",
+ ],
+ hdrs = [
+ "//include/ports:imagegenerator_cg_hdrs",
+ ],
+ features = ["layering_check"],
+ ios_frameworks = [
+ "CoreGraphics",
+ "ImageIO",
+ "MobileCoreServices",
+ ],
+ mac_frameworks = ["ApplicationServices"],
+ visibility = ["//:__pkg__"],
+ deps = [
+ "//:core",
+ "//src/base",
+ "//src/codec:any_decoder",
+ "//src/core:core_priv",
+ "//src/utils/mac:mac_utils_priv",
],
)
diff --git a/src/utils/BUILD.bazel b/src/utils/BUILD.bazel
index a9e3cd9..b2f49e1 100644
--- a/src/utils/BUILD.bazel
+++ b/src/utils/BUILD.bazel
@@ -155,6 +155,7 @@
"SkMatrix22.cpp",
"SkNWayCanvas.cpp",
"SkOSPath.cpp",
+ "SkOrderedFontMgr.cpp",
"SkPaintFilterCanvas.cpp",
"SkParse.cpp",
"SkParseColor.cpp",
diff --git a/src/utils/mac/BUILD.bazel b/src/utils/mac/BUILD.bazel
index 7663c7f..2f75e9d 100644
--- a/src/utils/mac/BUILD.bazel
+++ b/src/utils/mac/BUILD.bazel
@@ -1,10 +1,9 @@
-load("//bazel:skia_rules.bzl", "exports_files_legacy", "split_srcs_and_hdrs")
+load("//bazel:skia_rules.bzl", "exports_files_legacy", "skia_objc_library", "split_srcs_and_hdrs")
licenses(["notice"])
exports_files_legacy()
-# Not yet included in a Bazel build.
# File group is here for exporting to utils.gni:skia_utils_sources.
MAC_FILES = [
"SkCGBase.h",
@@ -21,3 +20,52 @@
name = "core",
files = MAC_FILES,
)
+
+skia_objc_library(
+ name = "mac_utils_priv",
+ srcs = [
+ "SkCTFont.cpp",
+ "SkCTFontCreateExactCopy.cpp",
+ "//src/ports:typeface_mac_hdrs",
+ ],
+ hdrs = [
+ "SkCGBase.h",
+ "SkCGGeometry.h",
+ "SkCTFont.h",
+ "SkCTFontCreateExactCopy.h",
+ "SkUniqueCFRef.h",
+ "//include/utils/mac:public_hdrs",
+ ],
+ ios_frameworks = [
+ "CoreFoundation",
+ "CoreGraphics",
+ "CoreText",
+ ],
+ mac_frameworks = [
+ "ApplicationServices",
+ ],
+ visibility = ["//src/ports:__pkg__"],
+ deps = [
+ ":mac_utils",
+ "//:core",
+ "//src/base",
+ ],
+)
+
+skia_objc_library(
+ name = "mac_utils",
+ srcs = [
+ "SkCreateCGImageRef.cpp",
+ "SkUniqueCFRef.h",
+ ],
+ hdrs = [
+ "//include/utils/mac:public_hdrs",
+ ],
+ sdk_frameworks = ["CoreFoundation"],
+ visibility = ["//:__subpackages__"],
+ deps = [
+ "//:core",
+ "//src/base",
+ "//src/encode:icc_encode",
+ ],
+)
diff --git a/src/utils/mac/SkCTFontCreateExactCopy.cpp b/src/utils/mac/SkCTFontCreateExactCopy.cpp
index 1c4cc58..adb9a67 100644
--- a/src/utils/mac/SkCTFontCreateExactCopy.cpp
+++ b/src/utils/mac/SkCTFontCreateExactCopy.cpp
@@ -8,15 +8,11 @@
#include "include/core/SkTypes.h"
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
+#include "src/utils/mac/SkCTFontCreateExactCopy.h"
+
#include "src/ports/SkTypeface_mac_ct.h"
#include "src/utils/mac/SkUniqueCFRef.h"
-#ifdef SK_BUILD_FOR_MAC
-#import <ApplicationServices/ApplicationServices.h>
-#endif
-
-#include "src/utils/mac/SkCTFontCreateExactCopy.h"
-
// In macOS 10.12 and later any variation on the CGFont which has default axis value will be
// dropped when creating the CTFont. Unfortunately, in macOS 10.15 the priority of setting
// the optical size (and opsz variation) is
diff --git a/src/utils/mac/SkCTFontCreateExactCopy.h b/src/utils/mac/SkCTFontCreateExactCopy.h
index 58fede3..f39b15d 100644
--- a/src/utils/mac/SkCTFontCreateExactCopy.h
+++ b/src/utils/mac/SkCTFontCreateExactCopy.h
@@ -17,10 +17,13 @@
#ifdef SK_BUILD_FOR_IOS
#include <CoreGraphics/CoreGraphics.h>
+#include <CoreText/CoreText.h>
#endif
#include "src/utils/mac/SkUniqueCFRef.h"
+struct OpszVariation;
+
/*
* This function attempts to resize a CTFont without inadvertently changing
* unrelated properties, like the optical size, relative glyph metrics,