aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2023-12-16 01:17:04 +0000
committerPdfium LUCI CQ <pdfium-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-12-16 01:17:04 +0000
commitb2d4f1104c43ccd42df2e48902ae857f0d5a188a (patch)
tree447c3c11a92079360dfc6953cd8bf318a45d2d83
parent2cc859137ac46c83c0c18b9e9e909cb616c0e74d (diff)
downloadpdfium-b2d4f1104c43ccd42df2e48902ae857f0d5a188a.tar.gz
Add pdf_enable_fontations GN flag
Set up a pdf_enable_fontations GN flag for future use. - Define PDF_ENABLE_FONTATIONS for use in C++ code when enabled. - Add the override hook, so PDFium embedders that use GN can choose the default via the override mechanism. - Add GN assertion to make sure Rust and Skia are enabled. Bug: pdfium:2107 Change-Id: I9ed504ebd5cbeaf922fe1da280cd20a08c260803 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/114834 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--BUILD.gn4
-rw-r--r--README.md3
-rw-r--r--build_overrides/pdfium.gni8
-rw-r--r--pdfium.gni11
4 files changed, 25 insertions, 1 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 06956154c..2b1f97f4f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -42,6 +42,10 @@ config("pdfium_common_config") {
if (pdf_use_skia) {
defines += [ "PDF_USE_SKIA" ]
+
+ if (pdf_enable_fontations) {
+ defines += [ "PDF_ENABLE_FONTATIONS" ]
+ }
}
if (pdf_use_partition_alloc) {
diff --git a/README.md b/README.md
index 10cef8b44..9434470c8 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,9 @@ is_debug = true # Enable debugging features.
# Set true to enable experimental Skia backend.
pdf_use_skia = false
+# Set true to enable experimental Fontations backend.
+pdf_enable_fontations = false
+
pdf_enable_xfa = true # Set false to remove XFA support (implies JS support).
pdf_enable_v8 = true # Set false to remove Javascript support.
pdf_is_standalone = true # Set for a non-embedded build.
diff --git a/build_overrides/pdfium.gni b/build_overrides/pdfium.gni
index b7dc9e0c5..aae45b165 100644
--- a/build_overrides/pdfium.gni
+++ b/build_overrides/pdfium.gni
@@ -25,5 +25,11 @@ pdf_use_partition_alloc_override = is_clang
# Build PDFium to use Skia (experimental) for all PDFium graphics.
# If enabled, coexists in build with AGG graphics and the default
# renderer is selectable at runtime.
-# The default is to use AGG only when `pdf_use_skia_override` is false.
+# The default is to use AGG when `pdf_use_skia_override` is false.
pdf_use_skia_override = false
+
+# Build PDFium with experimental Fontations library support.
+# If enabled, coexists in build with FreeType library and the default font
+# library is selectable at runtime.
+# The default is to use FreeType when `pdf_enable_fontations_override` is false.
+pdf_enable_fontations_override = false
diff --git a/pdfium.gni b/pdfium.gni
index ae5c5a53a..693fae756 100644
--- a/pdfium.gni
+++ b/pdfium.gni
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/rust.gni")
import("//build_overrides/pdfium.gni")
# This file contains PDFium-related build flags.
@@ -48,6 +49,12 @@ declare_args() {
# renderer is selectable at runtime.
pdf_use_skia = pdf_use_skia_override
+ # Build PDFium with experimental Fontations library support.
+ # If enabled, coexists in build with FreeType library and the default font
+ # library is selectable at runtime.
+ # Note that Fontations requires Skia and Rust support.
+ pdf_enable_fontations = pdf_enable_fontations_override
+
# Build PDFium standalone. Now only controls whether the test binaries
# are built. Most logic is conditioned by build_with_chromium.
pdf_is_standalone = false
@@ -79,3 +86,7 @@ declare_args() {
assert(!pdf_is_complete_lib || !is_component_build,
"pdf_is_complete_lib=true requires is_component_build=false")
+
+assert(
+ !pdf_enable_fontations || (enable_rust && pdf_use_skia),
+ "pdf_enable_fontations=true requires enable_rust=true and pdf_use_skia=true")