mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add support for the Fontconfig-based Skia font manager (flutter/engine#8977)
This commit is contained in:
parent
10d92a6b89
commit
5b6dedfc3e
7
DEPS
7
DEPS
@ -121,7 +121,7 @@ allowed_hosts = [
|
||||
]
|
||||
|
||||
deps = {
|
||||
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'c5afcce6d7972b20eded5b090b489b76622e8ff3',
|
||||
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'bc8826aab0fc4f7e17b21f64dec4c8a28ea42e3e',
|
||||
|
||||
# Fuchsia compatibility
|
||||
#
|
||||
@ -364,7 +364,7 @@ deps = {
|
||||
Var('chromium_git') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8',
|
||||
|
||||
'src/third_party/freetype2':
|
||||
Var('fuchsia_git') + '/third_party/freetype2' + '@' + 'a10b062df0c8958d69377aa04ea6554a9961a111',
|
||||
Var('fuchsia_git') + '/third_party/freetype2' + '@' + 'edab12c07ac05d1185616688f338b1ad15936796',
|
||||
|
||||
'src/third_party/root_certificates':
|
||||
Var('dart_git') + '/root_certificates.git' + '@' + Var('dart_root_certificates_rev'),
|
||||
@ -381,6 +381,9 @@ deps = {
|
||||
'src/third_party/wuffs':
|
||||
Var('fuchsia_git') + '/third_party/wuffs' + '@' + 'a71538baa8f1f4053176c0d9f31bc12fd4e8e71b',
|
||||
|
||||
'src/third_party/fontconfig/src':
|
||||
Var('chromium_git') + '/external/fontconfig.git' + '@' + 'c336b8471877371f0190ba06f7547c54e2b890ba',
|
||||
|
||||
'src/third_party/gyp':
|
||||
Var('chromium_git') + '/external/gyp.git' + '@' + '4801a5331ae62da9769a327f11c4213d32fb0dad',
|
||||
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
Signature: 6d315fb6c8e9e949011f57c32b16cb48
|
||||
Signature: ab4f82ed4f38f0d3821073855c220992
|
||||
|
||||
|
||||
15
engine/src/flutter/third_party/txt/BUILD.gn
vendored
15
engine/src/flutter/third_party/txt/BUILD.gn
vendored
@ -12,6 +12,14 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
declare_args() {
|
||||
flutter_use_fontconfig = false
|
||||
}
|
||||
|
||||
if (flutter_use_fontconfig) {
|
||||
assert(is_linux)
|
||||
}
|
||||
|
||||
config("txt_config") {
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [ "src" ]
|
||||
@ -24,6 +32,9 @@ source_set("txt") {
|
||||
if (is_android) {
|
||||
defines = [ "ANDROID_FONT_MANAGER_AVAILABLE" ]
|
||||
}
|
||||
if (flutter_use_fontconfig) {
|
||||
defines = [ "FONTCONFIG_FONT_MANAGER_AVAILABLE" ]
|
||||
}
|
||||
|
||||
sources = [
|
||||
"src/log/log.cc",
|
||||
@ -116,6 +127,10 @@ source_set("txt") {
|
||||
"//third_party/skia",
|
||||
]
|
||||
|
||||
if (flutter_use_fontconfig) {
|
||||
deps += [ "//third_party/fontconfig" ]
|
||||
}
|
||||
|
||||
if (is_mac || is_ios) {
|
||||
sources += [ "src/txt/platform_mac.mm" ]
|
||||
deps += [ "$flutter_root/fml" ]
|
||||
|
||||
@ -4,7 +4,11 @@
|
||||
|
||||
#include "txt/platform.h"
|
||||
|
||||
#ifdef FONTCONFIG_FONT_MANAGER_AVAILABLE
|
||||
#include "third_party/skia/include/ports/SkFontMgr_fontconfig.h"
|
||||
#else
|
||||
#include "third_party/skia/include/ports/SkFontMgr_directory.h"
|
||||
#endif
|
||||
|
||||
namespace txt {
|
||||
|
||||
@ -13,7 +17,11 @@ std::string GetDefaultFontFamily() {
|
||||
}
|
||||
|
||||
sk_sp<SkFontMgr> GetDefaultFontManager() {
|
||||
#ifdef FONTCONFIG_FONT_MANAGER_AVAILABLE
|
||||
return SkFontMgr_New_FontConfig(nullptr);
|
||||
#else
|
||||
return SkFontMgr_New_Custom_Directory("/usr/share/fonts/");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace txt
|
||||
|
||||
@ -90,7 +90,8 @@ def to_gn_args(args):
|
||||
gn_args['skia_enable_pdf'] = False # PDF handling.
|
||||
gn_args['skia_use_x11'] = False # Never add the X11 dependency (only takes effect on Linux).
|
||||
gn_args['skia_use_expat'] = args.target_os == 'android'
|
||||
gn_args['skia_use_fontconfig'] = False # Use the custom font manager instead.
|
||||
gn_args['skia_use_fontconfig'] = args.enable_fontconfig
|
||||
gn_args['flutter_use_fontconfig'] = args.enable_fontconfig
|
||||
gn_args['is_official_build'] = True # Disable Skia test utilities.
|
||||
gn_args['dart_component_kind'] = 'static_library' # Always link Dart in statically.
|
||||
gn_args['is_debug'] = args.unoptimized
|
||||
@ -298,6 +299,8 @@ def parse_args(args):
|
||||
parser.add_argument('--enable-vulkan', action='store_true', default=False)
|
||||
parser.add_argument('--enable-metal', action='store_true', default=False)
|
||||
|
||||
parser.add_argument('--enable-fontconfig', action='store_true', default=False)
|
||||
|
||||
parser.add_argument('--embedder-for-target', dest='embedder_for_target', action='store_true', default=False)
|
||||
|
||||
parser.add_argument('--coverage', default=False, action='store_true')
|
||||
|
||||
@ -1752,6 +1752,7 @@ class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDir
|
||||
&& entry.name != 'android_support' // build-time only
|
||||
&& entry.name != 'googletest' // only used by tests
|
||||
&& entry.name != 'skia' // treated as a separate component
|
||||
&& entry.name != 'fontconfig' // not used in standard configurations
|
||||
&& super.shouldRecurse(entry);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user