Default to using bundled FreeType on Linux.

Add override option for embedders.

BUG=pdfium:143

Change-Id: If8e97fddf46127ba387e4165a973b78a8a642028
Reviewed-on: https://pdfium-review.googlesource.com/3190
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 6e5e7b2..562afff 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -212,7 +212,7 @@
     ]
   }
 
-  if (pdfium_bundle_freetype) {
+  if (pdf_bundle_freetype) {
     deps += [ "third_party:fx_freetype" ]
   } else {
     libs += [ "freetype" ]
diff --git a/build_overrides/pdfium.gni b/build_overrides/pdfium.gni
index 18e6a87..d6bcc85 100644
--- a/build_overrides/pdfium.gni
+++ b/build_overrides/pdfium.gni
@@ -5,16 +5,28 @@
 # This file contains PDFium-related build overrides.
 
 # Build PDFium either with or without v8 support.
+# Default: With V8 support.
 pdf_enable_v8_override = true
 
 # Build PDFium either with or without XFA Forms support.
+# Default: Without XFA support.
 pdf_enable_xfa_override = false
 
-# Build PDFium against skia (experimental) rather than agg, replacing all PDFium graphics.
+# Build PDFium either using the bundled FreeType, or using the system FreeType.
+# System FreeType only exists on Linux.
+# Default: Use the bundled FreeType.
+pdf_bundle_freetype_override = true
+
+# Build PDFium against skia (experimental) rather than agg, replacing all PDFium
+# graphics.
+# Default: Use agg.
 pdf_use_skia_override = false
 
-# Build PDFium against skia (experimental) rather than agg, adding only path support.
+# Build PDFium against skia (experimental) rather than agg, adding only path
+# support.
+# Default: Use agg.
 pdf_use_skia_paths_override = false
 
 # Build PDFium either with or without experimental win32 GDI APIs.
+# Default: Without experimental win32 GDI APIs.
 pdf_use_win32_gdi_override = false
diff --git a/pdfium.gni b/pdfium.gni
index 4548819..3626824 100644
--- a/pdfium.gni
+++ b/pdfium.gni
@@ -7,9 +7,9 @@
 # This file contains PDFium-related build flags.
 
 declare_args() {
-  # On Android there's no system FreeType. On Windows and Mac, only a few
-  # methods are used from it.
-  pdfium_bundle_freetype = !is_linux
+  # Build PDFium either using the bundled FreeType, or using the system
+  # FreeType.
+  pdf_bundle_freetype = pdf_bundle_freetype_override
 
   # Build PDFium either with or without v8 support.
   pdf_enable_v8 = pdf_enable_v8_override
@@ -29,10 +29,12 @@
   # If XFA, also support png codec. Ignored if not XFA.
   pdf_enable_xfa_tiff = true
 
-  # Build PDFium against skia (experimental) rather than agg. Use Skia to draw everything.
+  # Build PDFium against skia (experimental) rather than agg. Use Skia to draw
+  # everything.
   pdf_use_skia = pdf_use_skia_override
 
-  # Build PDFium against skia (experimental) rather than agg. Use Skia to draw paths.
+  # Build PDFium against skia (experimental) rather than agg. Use Skia to draw
+  # paths.
   pdf_use_skia_paths = pdf_use_skia_paths_override
 
   # Build PDFium with or without experimental win32 GDI APIs.
diff --git a/samples/BUILD.gn b/samples/BUILD.gn
index 23f4d0c..d658a33 100644
--- a/samples/BUILD.gn
+++ b/samples/BUILD.gn
@@ -55,11 +55,6 @@
     "../:test_support",
     "//build/config/sanitizers:deps",
     "//build/win:default_exe_manifest",
-
-    # Regardless of whether the library ships against system freetype,
-    # always link this binary against the bundled one for consistency
-    # of results across platforms.
-    "../third_party:fx_freetype",
   ]
   if (!pdf_enable_xfa) {
     deps += [ "../third_party:fx_lpng" ]