Bug 1324739 - patch 2 - Enable use of sfntly in Skia-PDF to subset fonts. r=lsalzman,glandium

This commit is contained in:
Jonathan Kew 2017-01-07 22:20:25 +00:00
Родитель dadc582c30
Коммит 3d478b5e48
6 изменённых файлов: 139 добавлений и 0 удалений

Просмотреть файл

@ -184,6 +184,7 @@ inline bool isIgnoredPathForImplicitCtor(const Decl *Declaration) {
End = llvm::sys::path::rend(FileName);
for (; Begin != End; ++Begin) {
if (Begin->compare_lower(StringRef("skia")) == 0 ||
Begin->compare_lower(StringRef("sfntly")) == 0 ||
Begin->compare_lower(StringRef("angle")) == 0 ||
Begin->compare_lower(StringRef("harfbuzz")) == 0 ||
Begin->compare_lower(StringRef("hunspell")) == 0 ||
@ -241,6 +242,7 @@ inline bool isIgnoredPathForSprintfLiteral(const CallExpr *Call, const SourceMan
Begin->compare_lower(StringRef("mtransport")) == 0 ||
Begin->compare_lower(StringRef("protobuf")) == 0 ||
Begin->compare_lower(StringRef("skia")) == 0 ||
Begin->compare_lower(StringRef("sfntly")) == 0 ||
// Gtest uses snprintf as GTEST_SNPRINTF_ with sizeof
Begin->compare_lower(StringRef("testing")) == 0) {
return true;

Просмотреть файл

@ -27,6 +27,9 @@ DIRS += [
if CONFIG['MOZ_ENABLE_SKIA']:
DIRS += ['skia']
if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY'] and CONFIG['ENABLE_INTL_API']:
DIRS += ['sfntly/cpp/src']
if CONFIG['ENABLE_TESTS']:
DIRS += ['tests/gtest']

Просмотреть файл

@ -0,0 +1,97 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXPORTS += [
'sample/chromium/font_subsetter.h',
]
UNIFIED_SOURCES += [
'sample/chromium/font_subsetter.cc',
'sample/chromium/subsetter_impl.cc',
]
UNIFIED_SOURCES += [
'sfntly/data/byte_array.cc',
'sfntly/data/font_data.cc',
'sfntly/data/font_input_stream.cc',
'sfntly/data/font_output_stream.cc',
'sfntly/data/growable_memory_byte_array.cc',
'sfntly/data/memory_byte_array.cc',
'sfntly/data/readable_font_data.cc',
'sfntly/data/writable_font_data.cc',
]
UNIFIED_SOURCES += [
'sfntly/font.cc',
'sfntly/font_factory.cc',
'sfntly/tag.cc',
]
UNIFIED_SOURCES += [
'sfntly/port/file_input_stream.cc',
'sfntly/port/lock.cc',
'sfntly/port/memory_input_stream.cc',
'sfntly/port/memory_output_stream.cc',
]
UNIFIED_SOURCES += [
'sfntly/table/byte_array_table_builder.cc',
'sfntly/table/font_data_table.cc',
'sfntly/table/generic_table_builder.cc',
'sfntly/table/header.cc',
'sfntly/table/subtable.cc',
'sfntly/table/table.cc',
'sfntly/table/table_based_table_builder.cc',
]
UNIFIED_SOURCES += [
'sfntly/table/bitmap/big_glyph_metrics.cc',
'sfntly/table/bitmap/bitmap_glyph.cc',
'sfntly/table/bitmap/bitmap_glyph_info.cc',
'sfntly/table/bitmap/bitmap_size_table.cc',
'sfntly/table/bitmap/composite_bitmap_glyph.cc',
'sfntly/table/bitmap/ebdt_table.cc',
'sfntly/table/bitmap/eblc_table.cc',
'sfntly/table/bitmap/ebsc_table.cc',
'sfntly/table/bitmap/glyph_metrics.cc',
'sfntly/table/bitmap/index_sub_table.cc',
'sfntly/table/bitmap/index_sub_table_format1.cc',
'sfntly/table/bitmap/index_sub_table_format2.cc',
'sfntly/table/bitmap/index_sub_table_format3.cc',
'sfntly/table/bitmap/index_sub_table_format4.cc',
'sfntly/table/bitmap/index_sub_table_format5.cc',
'sfntly/table/bitmap/simple_bitmap_glyph.cc',
'sfntly/table/bitmap/small_glyph_metrics.cc',
]
UNIFIED_SOURCES += [
'sfntly/table/core/cmap_table.cc',
'sfntly/table/core/font_header_table.cc',
'sfntly/table/core/horizontal_device_metrics_table.cc',
'sfntly/table/core/horizontal_header_table.cc',
'sfntly/table/core/horizontal_metrics_table.cc',
'sfntly/table/core/maximum_profile_table.cc',
'sfntly/table/core/name_table.cc',
'sfntly/table/core/os2_table.cc',
]
UNIFIED_SOURCES += [
'sfntly/table/truetype/glyph_table.cc',
'sfntly/table/truetype/loca_table.cc',
]
UNIFIED_SOURCES += [
'sfntly/tools/subsetter/glyph_table_subsetter.cc',
'sfntly/tools/subsetter/subsetter.cc',
'sfntly/tools/subsetter/table_subsetter_impl.cc',
]
# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True
FINAL_LIBRARY = 'gkmedias'
DEFINES['SFNTLY_NO_EXCEPTION'] = 1

Просмотреть файл

@ -111,6 +111,9 @@ elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC'] and CONFIG['BUILD_ARM_NEON
DEFINES['SKIA_IMPLEMENTATION'] = 1
if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY'] and CONFIG['ENABLE_INTL_API']:
DEFINES['SK_PDF_USE_SFNTLY'] = 1
if not CONFIG['MOZ_ENABLE_SKIA_GPU']:
DEFINES['SK_SUPPORT_GPU'] = 0
@ -146,6 +149,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'):
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY']:
LOCAL_INCLUDES += CONFIG['SFNTLY_INCLUDES']
"""
import json

Просмотреть файл

@ -721,6 +721,9 @@ elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC'] and CONFIG['BUILD_ARM_NEON
DEFINES['SKIA_IMPLEMENTATION'] = 1
if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY'] and CONFIG['ENABLE_INTL_API']:
DEFINES['SK_PDF_USE_SFNTLY'] = 1
if not CONFIG['MOZ_ENABLE_SKIA_GPU']:
DEFINES['SK_SUPPORT_GPU'] = 0
@ -756,3 +759,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'):
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY']:
LOCAL_INCLUDES += CONFIG['SFNTLY_INCLUDES']

Просмотреть файл

@ -823,6 +823,31 @@ def skia_pdf(value, skia, milestone):
set_config('MOZ_ENABLE_SKIA_PDF', skia_pdf)
set_define('MOZ_ENABLE_SKIA_PDF', skia_pdf)
option('--enable-skia-pdf-sfntly', help='Enable SFNTLY font subsetting in Skia PDF')
@depends('--enable-skia-pdf-sfntly', skia_pdf)
def skia_pdf_sfntly(value, skia_pdf):
if value.origin == 'default':
return skia_pdf
if value and not skia_pdf:
die('Cannot enable SFNTLY subsetting without enabling Skia PDF')
if skia_pdf and value:
return True
set_config('MOZ_ENABLE_SKIA_PDF_SFNTLY', skia_pdf_sfntly)
set_define('MOZ_ENABLE_SKIA_PDF_SFNTLY', skia_pdf_sfntly)
@depends(skia_pdf_sfntly)
def sfntly_includes(skia_pdf_sfntly):
includes = []
if skia_pdf_sfntly:
includes += [
'/gfx/sfntly/cpp/src',
]
return includes
set_config('SFNTLY_INCLUDES', sfntly_includes)
@depends(skia, skia_gpu)
def skia_includes(skia, skia_gpu):
includes = []