aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2014-07-20 18:26:47 -0700
committerBen Murdoch <benm@google.com>2014-07-20 18:26:47 -0700
commit4d6e4ddc4b0db2023b1380236c33aa04a7e9e927 (patch)
treebcb316f743aac99a73e72dc3dadaf190de826f24
parent6719ad4185709fe18da52f538c4ae32ac80f5922 (diff)
parent7aaed37d68bb50bf7f62bf8a3341304dea920fcd (diff)
downloadots-4d6e4ddc4b0db2023b1380236c33aa04a7e9e927.tar.gz
Merge from Chromium at DEPS revision 284076
This commit was generated by merge_to_master.py. Change-Id: I5774336fe7d1c24768a71ade669cc8c39af8b02c
-rw-r--r--BUILD.gn94
-rw-r--r--include/opentype-sanitiser.h4
-rw-r--r--ots-common.gypi4
-rw-r--r--ots-standalone.gyp3
-rw-r--r--ots.target.darwin-arm.mk12
-rw-r--r--ots.target.darwin-arm64.mk12
-rw-r--r--ots.target.darwin-mips.mk12
-rw-r--r--ots.target.darwin-x86.mk12
-rw-r--r--ots.target.darwin-x86_64.mk12
-rw-r--r--ots.target.linux-arm.mk12
-rw-r--r--ots.target.linux-arm64.mk12
-rw-r--r--ots.target.linux-mips.mk12
-rw-r--r--ots.target.linux-x86.mk12
-rw-r--r--ots.target.linux-x86_64.mk12
-rw-r--r--src/cbdt.cc41
-rw-r--r--src/cbdt.h24
-rw-r--r--src/cblc.cc41
-rw-r--r--src/cblc.h24
-rw-r--r--src/cmap.cc7
-rw-r--r--src/ots.cc15
-rw-r--r--src/ots.h2
21 files changed, 362 insertions, 17 deletions
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..b438711
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,94 @@
+# Copyright 2014 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.
+
+config("ots_config") {
+ include_dirs = [ "include" ]
+}
+
+source_set("ots") {
+ sources = [
+ "include/ots-memory-stream.h",
+ "include/opentype-sanitiser.h",
+ "src/cbdt.cc",
+ "src/cbdt.h",
+ "src/cblc.cc",
+ "src/cblc.h",
+ "src/cff.cc",
+ "src/cff.h",
+ "src/cff_type2_charstring.cc",
+ "src/cff_type2_charstring.h",
+ "src/cmap.cc",
+ "src/cmap.h",
+ "src/cvt.cc",
+ "src/cvt.h",
+ "src/fpgm.cc",
+ "src/fpgm.h",
+ "src/gasp.cc",
+ "src/gasp.h",
+ "src/gdef.cc",
+ "src/gdef.h",
+ "src/glyf.cc",
+ "src/glyf.h",
+ "src/gpos.cc",
+ "src/gpos.h",
+ "src/gsub.cc",
+ "src/gsub.h",
+ "src/hdmx.cc",
+ "src/hdmx.h",
+ "src/head.cc",
+ "src/head.h",
+ "src/hhea.cc",
+ "src/hhea.h",
+ "src/hmtx.cc",
+ "src/hmtx.h",
+ "src/kern.cc",
+ "src/kern.h",
+ "src/layout.cc",
+ "src/layout.h",
+ "src/loca.cc",
+ "src/loca.h",
+ "src/ltsh.cc",
+ "src/ltsh.h",
+ "src/maxp.cc",
+ "src/maxp.h",
+ "src/math.cc",
+ "src/math_.h",
+ "src/metrics.cc",
+ "src/metrics.h",
+ "src/name.cc",
+ "src/name.h",
+ "src/os2.cc",
+ "src/os2.h",
+ "src/ots.cc",
+ "src/ots.h",
+ "src/post.cc",
+ "src/post.h",
+ "src/prep.cc",
+ "src/prep.h",
+ "src/vdmx.cc",
+ "src/vdmx.h",
+ "src/vhea.cc",
+ "src/vhea.h",
+ "src/vmtx.cc",
+ "src/vmtx.h",
+ "src/vorg.cc",
+ "src/vorg.h",
+ "src/woff2.cc",
+ "src/woff2.h",
+ ]
+
+ direct_dependent_configs = [ ":ots_config" ]
+
+ deps = [
+ "//third_party/brotli",
+ "//third_party/zlib",
+ ]
+
+ if (is_win) {
+ cflags = [
+ "/wd4267", # Conversion from size_t to 'type'.
+ "/wd4334", # 32-bit shift implicitly converted to 64-bits.
+ ]
+ }
+}
diff --git a/include/opentype-sanitiser.h b/include/opentype-sanitiser.h
index 6a3492f..4952426 100644
--- a/include/opentype-sanitiser.h
+++ b/include/opentype-sanitiser.h
@@ -192,8 +192,12 @@ bool Process(OTSStream *output, const uint8_t *input, size_t length);
void DisableDebugOutput();
// Enable WOFF2 support(experimental).
+// TODO(bashi): Remove WOFF2 from OTS.
void EnableWOFF2();
+// Force to disable dropping CBDT/CBLC tables.
+void DoNotDropColorBitmapTables();
+
} // namespace ots
#endif // OPENTYPE_SANITISER_H_
diff --git a/ots-common.gypi b/ots-common.gypi
index 9cb539c..51f7cec 100644
--- a/ots-common.gypi
+++ b/ots-common.gypi
@@ -7,6 +7,10 @@
'ots_sources': [
'include/ots-memory-stream.h',
'include/opentype-sanitiser.h',
+ 'src/cbdt.cc',
+ 'src/cbdt.h',
+ 'src/cblc.cc',
+ 'src/cblc.h',
'src/cff.cc',
'src/cff.h',
'src/cff_type2_charstring.cc',
diff --git a/ots-standalone.gyp b/ots-standalone.gyp
index c1e2530..90ab4ec 100644
--- a/ots-standalone.gyp
+++ b/ots-standalone.gyp
@@ -83,6 +83,9 @@
'sources': [
'<@(ots_sources)',
],
+ 'defines': [
+ 'OTS_DEBUG',
+ ],
'dependencies': [
'third_party/lzma_sdk/lzma_sdk.gyp:ots_lzma_sdk',
],
diff --git a/ots.target.darwin-arm.mk b/ots.target.darwin-arm.mk
index 2d08b34..9595d64 100644
--- a/ots.target.darwin-arm.mk
+++ b/ots.target.darwin-arm.mk
@@ -24,6 +24,8 @@ LOCAL_GENERATED_SOURCES :=
GYP_COPIED_SOURCE_ORIGIN_DIRS :=
LOCAL_SRC_FILES := \
+ third_party/ots/src/cbdt.cc \
+ third_party/ots/src/cblc.cc \
third_party/ots/src/cff.cc \
third_party/ots/src/cff_type2_charstring.cc \
third_party/ots/src/cmap.cc \
@@ -93,9 +95,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -114,6 +116,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -154,6 +157,9 @@ LOCAL_CPPFLAGS_Debug := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-abi \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -215,6 +221,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -256,6 +263,9 @@ LOCAL_CPPFLAGS_Release := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-abi \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/ots.target.darwin-arm64.mk b/ots.target.darwin-arm64.mk
index e40c8f9..a33d9e7 100644
--- a/ots.target.darwin-arm64.mk
+++ b/ots.target.darwin-arm64.mk
@@ -24,6 +24,8 @@ LOCAL_GENERATED_SOURCES :=
GYP_COPIED_SOURCE_ORIGIN_DIRS :=
LOCAL_SRC_FILES := \
+ third_party/ots/src/cbdt.cc \
+ third_party/ots/src/cblc.cc \
third_party/ots/src/cff.cc \
third_party/ots/src/cff_type2_charstring.cc \
third_party/ots/src/cmap.cc \
@@ -83,7 +85,6 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
-funwind-tables
@@ -104,6 +105,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -143,6 +145,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -175,7 +180,6 @@ MY_CFLAGS_Release := \
-fno-ident \
-fdata-sections \
-ffunction-sections \
- -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Release := \
@@ -194,6 +198,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -234,6 +239,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/ots.target.darwin-mips.mk b/ots.target.darwin-mips.mk
index bd4c2c8..c101579 100644
--- a/ots.target.darwin-mips.mk
+++ b/ots.target.darwin-mips.mk
@@ -24,6 +24,8 @@ LOCAL_GENERATED_SOURCES :=
GYP_COPIED_SOURCE_ORIGIN_DIRS :=
LOCAL_SRC_FILES := \
+ third_party/ots/src/cbdt.cc \
+ third_party/ots/src/cblc.cc \
third_party/ots/src/cff.cc \
third_party/ots/src/cff_type2_charstring.cc \
third_party/ots/src/cmap.cc \
@@ -87,9 +89,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -108,6 +110,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -148,6 +151,9 @@ LOCAL_CPPFLAGS_Debug := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-uninitialized \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -203,6 +209,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -244,6 +251,9 @@ LOCAL_CPPFLAGS_Release := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-uninitialized \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/ots.target.darwin-x86.mk b/ots.target.darwin-x86.mk
index f445a2a..556e66f 100644
--- a/ots.target.darwin-x86.mk
+++ b/ots.target.darwin-x86.mk
@@ -24,6 +24,8 @@ LOCAL_GENERATED_SOURCES :=
GYP_COPIED_SOURCE_ORIGIN_DIRS :=
LOCAL_SRC_FILES := \
+ third_party/ots/src/cbdt.cc \
+ third_party/ots/src/cblc.cc \
third_party/ots/src/cff.cc \
third_party/ots/src/cff_type2_charstring.cc \
third_party/ots/src/cmap.cc \
@@ -88,9 +90,9 @@ MY_CFLAGS_Debug := \
-fno-stack-protector \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -109,6 +111,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -148,6 +151,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -204,6 +210,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -244,6 +251,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/ots.target.darwin-x86_64.mk b/ots.target.darwin-x86_64.mk
index 62bb57a..76693f1 100644
--- a/ots.target.darwin-x86_64.mk
+++ b/ots.target.darwin-x86_64.mk
@@ -24,6 +24,8 @@ LOCAL_GENERATED_SOURCES :=
GYP_COPIED_SOURCE_ORIGIN_DIRS :=
LOCAL_SRC_FILES := \
+ third_party/ots/src/cbdt.cc \
+ third_party/ots/src/cblc.cc \
third_party/ots/src/cff.cc \
third_party/ots/src/cff_type2_charstring.cc \
third_party/ots/src/cmap.cc \
@@ -87,9 +89,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -108,6 +110,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -147,6 +150,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -202,6 +208,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -242,6 +249,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/ots.target.linux-arm.mk b/ots.target.linux-arm.mk
index 2d08b34..9595d64 100644
--- a/ots.target.linux-arm.mk
+++ b/ots.target.linux-arm.mk
@@ -24,6 +24,8 @@ LOCAL_GENERATED_SOURCES :=
GYP_COPIED_SOURCE_ORIGIN_DIRS :=
LOCAL_SRC_FILES := \
+ third_party/ots/src/cbdt.cc \
+ third_party/ots/src/cblc.cc \
third_party/ots/src/cff.cc \
third_party/ots/src/cff_type2_charstring.cc \
third_party/ots/src/cmap.cc \
@@ -93,9 +95,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -114,6 +116,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -154,6 +157,9 @@ LOCAL_CPPFLAGS_Debug := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-abi \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -215,6 +221,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -256,6 +263,9 @@ LOCAL_CPPFLAGS_Release := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-abi \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/ots.target.linux-arm64.mk b/ots.target.linux-arm64.mk
index e40c8f9..a33d9e7 100644
--- a/ots.target.linux-arm64.mk
+++ b/ots.target.linux-arm64.mk
@@ -24,6 +24,8 @@ LOCAL_GENERATED_SOURCES :=
GYP_COPIED_SOURCE_ORIGIN_DIRS :=
LOCAL_SRC_FILES := \
+ third_party/ots/src/cbdt.cc \
+ third_party/ots/src/cblc.cc \
third_party/ots/src/cff.cc \
third_party/ots/src/cff_type2_charstring.cc \
third_party/ots/src/cmap.cc \
@@ -83,7 +85,6 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
-funwind-tables
@@ -104,6 +105,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -143,6 +145,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -175,7 +180,6 @@ MY_CFLAGS_Release := \
-fno-ident \
-fdata-sections \
-ffunction-sections \
- -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Release := \
@@ -194,6 +198,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -234,6 +239,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/ots.target.linux-mips.mk b/ots.target.linux-mips.mk
index bd4c2c8..c101579 100644
--- a/ots.target.linux-mips.mk
+++ b/ots.target.linux-mips.mk
@@ -24,6 +24,8 @@ LOCAL_GENERATED_SOURCES :=
GYP_COPIED_SOURCE_ORIGIN_DIRS :=
LOCAL_SRC_FILES := \
+ third_party/ots/src/cbdt.cc \
+ third_party/ots/src/cblc.cc \
third_party/ots/src/cff.cc \
third_party/ots/src/cff_type2_charstring.cc \
third_party/ots/src/cmap.cc \
@@ -87,9 +89,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -108,6 +110,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -148,6 +151,9 @@ LOCAL_CPPFLAGS_Debug := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-uninitialized \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -203,6 +209,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -244,6 +251,9 @@ LOCAL_CPPFLAGS_Release := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-uninitialized \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/ots.target.linux-x86.mk b/ots.target.linux-x86.mk
index f445a2a..556e66f 100644
--- a/ots.target.linux-x86.mk
+++ b/ots.target.linux-x86.mk
@@ -24,6 +24,8 @@ LOCAL_GENERATED_SOURCES :=
GYP_COPIED_SOURCE_ORIGIN_DIRS :=
LOCAL_SRC_FILES := \
+ third_party/ots/src/cbdt.cc \
+ third_party/ots/src/cblc.cc \
third_party/ots/src/cff.cc \
third_party/ots/src/cff_type2_charstring.cc \
third_party/ots/src/cmap.cc \
@@ -88,9 +90,9 @@ MY_CFLAGS_Debug := \
-fno-stack-protector \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -109,6 +111,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -148,6 +151,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -204,6 +210,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -244,6 +251,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/ots.target.linux-x86_64.mk b/ots.target.linux-x86_64.mk
index 62bb57a..76693f1 100644
--- a/ots.target.linux-x86_64.mk
+++ b/ots.target.linux-x86_64.mk
@@ -24,6 +24,8 @@ LOCAL_GENERATED_SOURCES :=
GYP_COPIED_SOURCE_ORIGIN_DIRS :=
LOCAL_SRC_FILES := \
+ third_party/ots/src/cbdt.cc \
+ third_party/ots/src/cblc.cc \
third_party/ots/src/cff.cc \
third_party/ots/src/cff_type2_charstring.cc \
third_party/ots/src/cmap.cc \
@@ -87,9 +89,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -108,6 +110,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -147,6 +150,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -202,6 +208,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -242,6 +249,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/src/cbdt.cc b/src/cbdt.cc
new file mode 100644
index 0000000..aff74f1
--- /dev/null
+++ b/src/cbdt.cc
@@ -0,0 +1,41 @@
+// Copyright (c) 2014 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.
+
+#include "cbdt.h"
+
+// CBDT
+// https://color-emoji.googlecode.com/git/specification/v1.html
+// We don't support the table, but provide a way not to drop the table.
+
+namespace ots {
+
+extern bool g_drop_color_bitmap_tables;
+
+bool ots_cbdt_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
+ if (g_drop_color_bitmap_tables) {
+ return OTS_FAILURE();
+ }
+
+ file->cbdt = new OpenTypeCBDT;
+ file->cbdt->data = data;
+ file->cbdt->length = length;
+ return true;
+}
+
+bool ots_cbdt_should_serialise(OpenTypeFile *file) {
+ return file->cbdt != NULL && file->cblc != NULL;
+}
+
+bool ots_cbdt_serialise(OTSStream *out, OpenTypeFile *file) {
+ if (!out->Write(file->cbdt->data, file->cbdt->length)) {
+ return OTS_FAILURE();
+ }
+ return true;
+}
+
+void ots_cbdt_free(OpenTypeFile *file) {
+ delete file->cbdt;
+}
+
+} // namespace ots
diff --git a/src/cbdt.h b/src/cbdt.h
new file mode 100644
index 0000000..bda075f
--- /dev/null
+++ b/src/cbdt.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2014 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.
+
+#ifndef OTS_CBDT_H_
+#define OTS_CBDT_H_
+
+#include "ots.h"
+
+namespace ots {
+
+struct OpenTypeCBDT {
+ OpenTypeCBDT()
+ : data(NULL),
+ length(0) {
+ }
+
+ const uint8_t *data;
+ size_t length;
+};
+
+} // namespace ots
+
+#endif // OTS_CBDT_H_
diff --git a/src/cblc.cc b/src/cblc.cc
new file mode 100644
index 0000000..19cfd7d
--- /dev/null
+++ b/src/cblc.cc
@@ -0,0 +1,41 @@
+// Copyright (c) 2014 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.
+
+#include "cblc.h"
+
+// CBLC
+// https://color-emoji.googlecode.com/git/specification/v1.html
+// We don't support the table, but provide a way not to drop the table.
+
+namespace ots {
+
+extern bool g_drop_color_bitmap_tables;
+
+bool ots_cblc_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
+ if (g_drop_color_bitmap_tables) {
+ return OTS_FAILURE();
+ }
+
+ file->cblc = new OpenTypeCBLC;
+ file->cblc->data = data;
+ file->cblc->length = length;
+ return true;
+}
+
+bool ots_cblc_should_serialise(OpenTypeFile *file) {
+ return file->cblc != NULL && file->cbdt != NULL;
+}
+
+bool ots_cblc_serialise(OTSStream *out, OpenTypeFile *file) {
+ if (!out->Write(file->cblc->data, file->cblc->length)) {
+ return OTS_FAILURE();
+ }
+ return true;
+}
+
+void ots_cblc_free(OpenTypeFile *file) {
+ delete file->cblc;
+}
+
+} // namespace ots
diff --git a/src/cblc.h b/src/cblc.h
new file mode 100644
index 0000000..373e442
--- /dev/null
+++ b/src/cblc.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2014 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.
+
+#ifndef OTS_CBLC_H_
+#define OTS_CBLC_H_
+
+#include "ots.h"
+
+namespace ots {
+
+struct OpenTypeCBLC {
+ OpenTypeCBLC()
+ : data(NULL),
+ length(0) {
+ }
+
+ const uint8_t *data;
+ size_t length;
+};
+
+} // namespace ots
+
+#endif // OTS_CBLC_H_
diff --git a/src/cmap.cc b/src/cmap.cc
index 5d52c1e..5f83839 100644
--- a/src/cmap.cc
+++ b/src/cmap.cc
@@ -848,9 +848,12 @@ bool ots_cmap_serialise(OTSStream *out, OpenTypeFile *file) {
const off_t table_start = out->Tell();
// Some fonts don't have 3-0-4 MS Symbol nor 3-1-4 Unicode BMP tables
- // (e.g., old fonts for Mac). We don't support them.
+ // (e.g., old fonts for Mac). We don't support them except for color bitmap
+ // fonts.
if (!have_304 && !have_314 && !have_034) {
- return OTS_FAILURE();
+ if (!(file->cbdt && file->cblc)) {
+ return OTS_FAILURE();
+ }
}
if (!out->WriteU16(0) ||
diff --git a/src/ots.cc b/src/ots.cc
index 9205a26..f364191 100644
--- a/src/ots.cc
+++ b/src/ots.cc
@@ -143,6 +143,10 @@ const struct {
ots::ots_vmtx_should_serialise, ots::ots_vmtx_free, false },
{ "MATH", ots::ots_math_parse, ots::ots_math_serialise,
ots::ots_math_should_serialise, ots::ots_math_free, false },
+ { "CBDT", ots::ots_cbdt_parse, ots::ots_cbdt_serialise,
+ ots::ots_cbdt_should_serialise, ots::ots_cbdt_free, false },
+ { "CBLC", ots::ots_cblc_parse, ots::ots_cblc_serialise,
+ ots::ots_cblc_should_serialise, ots::ots_cblc_free, false },
// TODO(bashi): Support mort, base, and jstf tables.
{ 0, NULL, NULL, NULL, NULL, false },
};
@@ -557,9 +561,8 @@ bool ProcessGeneric(ots::OpenTypeFile *header, uint32_t signature,
return OTS_FAILURE();
}
} else {
- if (!header->glyf || !header->loca) {
- // No TrueType glyph found.
- // Note: bitmap-only fonts are not supported.
+ if ((!header->glyf || !header->loca) && (!header->cbdt || !header->cblc)) {
+ // No TrueType glyph or color bitmap found.
return OTS_FAILURE();
}
}
@@ -685,6 +688,8 @@ bool ProcessGeneric(ots::OpenTypeFile *header, uint32_t signature,
namespace ots {
+bool g_drop_color_bitmap_tables = true;
+
bool IsValidVersionTag(uint32_t tag) {
return tag == Tag("\x00\x01\x00\x00") ||
// OpenType fonts with CFF data have 'OTTO' tag.
@@ -702,6 +707,10 @@ void EnableWOFF2() {
g_enable_woff2 = true;
}
+void DoNotDropColorBitmapTables() {
+ g_drop_color_bitmap_tables = false;
+}
+
bool Process(OTSStream *output, const uint8_t *data, size_t length) {
OpenTypeFile header;
if (length < 4) {
diff --git a/src/ots.h b/src/ots.h
index 4ee9584..1db48d5 100644
--- a/src/ots.h
+++ b/src/ots.h
@@ -183,6 +183,8 @@ template<typename T> T Round2(T value) {
bool IsValidVersionTag(uint32_t tag);
#define FOR_EACH_TABLE_TYPE \
+ F(cbdt, CBDT) \
+ F(cblc, CBLC) \
F(cff, CFF) \
F(cmap, CMAP) \
F(cvt, CVT) \