SkPDF: Add Sfntly to DEPS, gyp

Note: this can be disabled via:
    GYP_DEFINES='skia_pdf_use_sfntly=0

Warning: dm is 34% slower and uses 9% more memory.  This is
okay.

Motivation: We want to test this code path in DM, since it is
always used by Chromium and Android.

BUG=skia:3563

Review URL: https://codereview.chromium.org/1134683006
This commit is contained in:
halcanary 2015-05-18 10:18:58 -07:00 committed by Commit bot
parent 404b3b264b
commit 6a53b04e26
5 changed files with 183 additions and 4 deletions

5
DEPS
View File

@ -30,6 +30,11 @@ deps = {
# The line below is needed for compiling SkV8Example. Do not delete.
#"third_party/externals/v8": "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4",
# sfntly is used by the PDF backend for font subsetting
"third_party/externals/sfntly" : "https://chromium.googlesource.com/external/sfntly/cpp/src.git@1bdaae8fc788a5ac8936d68bf24f37d977a13dac",
# ICU is needed for sfntly.
"third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@ce41627e388fb46ab49671bd16a5db81dcd75a71",
}
recursedeps = [ "common" ]

117
gyp/icu.gyp Normal file
View File

@ -0,0 +1,117 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'common_variables.gypi',
],
'variables': {
'component%': 'static_library',
'icu_directory': '../third_party/externals/icu'
},
'targets': [
{
'target_name': 'icuuc',
'type': '<(component)',
'sources': [
'<!@(python find.py ../third_party/externals/icu/source/common "*.c*")'
],
'defines': [
'U_COMMON_IMPLEMENTATION',
'U_HIDE_DATA_SYMBOL',
'U_USING_ICU_NAMESPACE=0',
'HAVE_DLOPEN=0',
'UCONFIG_NO_NON_HTML5_CONVERSION=1',
],
'include_dirs': [ '<(icu_directory)/source/common', ],
'direct_dependent_settings': {
'defines': [
'U_USING_ICU_NAMESPACE=0',
'U_ENABLE_DYLOAD=0',
],
'include_dirs': [ '<(icu_directory)/source/common', ],
'conditions': [
[
'component=="static_library"', {
'defines': [
'U_STATIC_IMPLEMENTATION',
],
}
],
],
},
'cflags': [ '-w' ],
'cflags_cc': [ '-frtti', ],
'conditions': [
[
'component=="static_library"', {
'defines': [ 'U_STATIC_IMPLEMENTATION', ],
}
],
[
'OS == "win"', {
'sources': [
'<(icu_directory)/source/stubdata/stubdata.c',
],
'copies': [
{
'destination': '<(PRODUCT_DIR)',
'files': [ '<(icu_directory)/windows/icudt.dll', ],
},
],
'msvs_disabled_warnings': [4005, 4068, 4244, 4355, 4996, 4267],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeTypeInfo': 'true',
'AdditionalOptions!': [ '/GR-' ],
'AdditionalOptions': [ '/EHsc', '/GR', '/w', ],
},
},
'all_dependent_settings': {
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'advapi32.lib',
],
},
},
},
}
],
[
'OS == "win" and skia_clang_build', {
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
# See http://bugs.icu-project.org/trac/ticket/11122
'-Wno-inline-new-delete',
'-Wno-implicit-exception-spec-mismatch',
],
},
},
}
],
[
'skia_os == "android"', {
'sources': [ '<(icu_directory)/android/icudtl_dat.S', ],
}
],
[
'skia_os == "linux"', {
'sources': [ '<(icu_directory)/linux/icudtl_dat.S', ],
}
],
[
'skia_os == "mac"', {
'sources': [ '<(icu_directory)/mac/icudtl_dat.S', ],
'xcode_settings': {
'GCC_ENABLE_CPP_RTTI': 'YES', # -frtti
'WARNING_CFLAGS': [ '-w' ],
},
}
],
], # conditions
},
], # targets
}

View File

@ -10,6 +10,7 @@
'product_name': 'skia_pdf',
'type': 'static_library',
'standalone_static_library': 1,
'variables': { 'skia_pdf_use_sfntly%': 1, },
'dependencies': [
'skia_lib.gyp:skia_lib',
'skflate.gyp:skflate',
@ -26,6 +27,9 @@
'pdf.gypi', # Makes the gypi appear in IDEs (but does not modify the build).
],
'conditions': [
[ 'skia_pdf_use_sfntly and not skia_android_framework',
{ 'dependencies': [ 'sfntly.gyp:sfntly' ] }
],
[ 'skia_android_framework', {
# Add SFTNLY support for PDF (which in turns depends on ICU)
'include_dirs': [

55
gyp/sfntly.gyp Normal file
View File

@ -0,0 +1,55 @@
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'sfntly',
'type': 'static_library',
'includes': [
'common_conditions.gypi',
'common_variables.gypi',
],
'variables': {
'sfntly_src_path': '../third_party/externals/sfntly',
},
'direct_dependent_settings': {
'include_dirs': [ '<(sfntly_src_path)/sample/chromium', ],
'defines': [
'SK_SFNTLY_SUBSETTER="font_subsetter.h"',
],
},
'sources': [
'<(sfntly_src_path)/sample/chromium/font_subsetter.cc',
'<(sfntly_src_path)/sample/chromium/subsetter_impl.cc',
'<!@(python find.py ../third_party/externals/sfntly/sfntly "*.c*")'
],
'include_dirs': [
'<(sfntly_src_path)',
],
'defines': [
'SFNTLY_NO_EXCEPTION',
],
'dependencies' : [
'icu.gyp:icuuc',
],
'conditions': [
[ 'skia_os == "win"',
{
'defines': [ 'WIN32', ],
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [ '/EHsc' ],
},
},
}
],
[ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]',
{ 'link_settings': { 'libraries': [ '-lpthread', ], }, },
],
],
# TODO(jschuh): http://crbug.com/167187
'msvs_disabled_warnings': [ 4267, 4244 ],
},
]
}

View File

@ -24,14 +24,12 @@
#include "SkTypes.h"
#include "SkUtils.h"
#if defined (SK_SFNTLY_SUBSETTER)
#include SK_SFNTLY_SUBSETTER
#endif
#if defined (GOOGLE3)
// #including #defines doesn't work in with this build system.
#include "typography/font/sfntly/src/sample/chromium/font_subsetter.h"
#define SK_SFNTLY_SUBSETTER // For the benefit of #ifdefs below.
#elif defined (SK_SFNTLY_SUBSETTER)
#include SK_SFNTLY_SUBSETTER
#endif
// PDF's notion of symbolic vs non-symbolic is related to the character set, not