Upgrade freetype to VER-2-10-1
Exempt-From-Owner-Approval: Upgrade library
Test: None
Change-Id: I2d49bf289d4db461879e023967e1a03cd112a7ad
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..157c8e6
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,91 @@
+cc_library {
+ name: "libft2",
+ host_supported: true,
+
+ // compile in ARM mode, since the glyph loader/renderer is a hotspot
+ // when loading complex pages in the browser
+ //
+ arch: {
+ arm: {
+ instruction_set: "arm",
+ },
+ },
+
+ srcs: [
+ "src/autofit/autofit.c",
+ "src/base/ftbase.c",
+ "src/base/ftbbox.c",
+ "src/base/ftbitmap.c",
+ "src/base/ftdebug.c",
+ "src/base/ftfstype.c",
+ "src/base/ftgasp.c",
+ "src/base/ftglyph.c",
+ "src/base/ftinit.c",
+ "src/base/ftmm.c",
+ "src/base/ftstroke.c",
+ "src/base/fttype1.c",
+ "src/base/ftsystem.c",
+ "src/cid/type1cid.c",
+ "src/cff/cff.c",
+ "src/gzip/ftgzip.c",
+ "src/psaux/psaux.c",
+ "src/pshinter/pshinter.c",
+ "src/psnames/psnames.c",
+ "src/raster/raster.c",
+ "src/sfnt/sfnt.c",
+ "src/smooth/smooth.c",
+ "src/truetype/truetype.c",
+ "src/type1/type1.c",
+ ],
+
+ export_include_dirs: ["include"],
+
+ cflags: [
+ "-W",
+ "-Wall",
+ "-Werror",
+
+ "-DDARWIN_NO_CARBON",
+ "-DFT2_BUILD_LIBRARY",
+
+ "-O2",
+
+ // Upstream ignores unused parameter warning
+ "-Wno-unused-parameter",
+ // Disabling some of modules results in warnings
+ "-Wno-unused-variable",
+ // the following is for testing only, and should not be used in final
+ // builds of the product
+ // "-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER",
+ ],
+
+ shared_libs: [
+ "libpng",
+ "libz",
+ ],
+
+ target: {
+ android: {
+ cflags: [
+ "-fPIC",
+ "-DPIC",
+ ],
+ },
+ not_windows: {
+ cflags: [
+ "-fPIC",
+ "-DPIC",
+ ],
+ },
+ windows: {
+ enabled: true,
+ },
+ },
+}
+
+llndk_library {
+ name: "libft2",
+ vendor_available: false,
+ symbol_file: "libft2.map.txt",
+ export_include_dirs: ["include"],
+}
diff --git a/CleanSpec.mk b/CleanSpec.mk
new file mode 100644
index 0000000..b9cafef
--- /dev/null
+++ b/CleanSpec.mk
@@ -0,0 +1,51 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list. These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list. E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libft2_*)
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..caf325f
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,18 @@
+name: "freetype"
+description: "FreeType is a freely available software library to render fonts."
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "https://www.freetype.org/"
+ }
+ url {
+ type: GIT
+ value: "git://git.sv.nongnu.org/freetype/freetype2.git"
+ }
+ version: "VER-2-10-1"
+ last_upgrade_date {
+ year: 2019
+ month: 7
+ day: 9
+ }
+}
diff --git a/MODULE_LICENSE_BSD_LIKE b/MODULE_LICENSE_BSD_LIKE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_BSD_LIKE
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..4860cca
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,173 @@
+This software is based in part on the work of the FreeType Team.
+
+----------------------
+
+ The FreeType Project LICENSE
+ ----------------------------
+
+ 2006-Jan-27
+
+ Copyright 1996-2002, 2006 by
+ David Turner, Robert Wilhelm, and Werner Lemberg
+
+
+
+Introduction
+============
+
+ The FreeType Project is distributed in several archive packages;
+ some of them may contain, in addition to the FreeType font engine,
+ various tools and contributions which rely on, or relate to, the
+ FreeType Project.
+
+ This license applies to all files found in such packages, and
+ which do not fall under their own explicit license. The license
+ affects thus the FreeType font engine, the test programs,
+ documentation and makefiles, at the very least.
+
+ This license was inspired by the BSD, Artistic, and IJG
+ (Independent JPEG Group) licenses, which all encourage inclusion
+ and use of free software in commercial and freeware products
+ alike. As a consequence, its main points are that:
+
+ o We don't promise that this software works. However, we will be
+ interested in any kind of bug reports. (`as is' distribution)
+
+ o You can use this software for whatever you want, in parts or
+ full form, without having to pay us. (`royalty-free' usage)
+
+ o You may not pretend that you wrote this software. If you use
+ it, or only parts of it, in a program, you must acknowledge
+ somewhere in your documentation that you have used the
+ FreeType code. (`credits')
+
+ We specifically permit and encourage the inclusion of this
+ software, with or without modifications, in commercial products.
+ We disclaim all warranties covering The FreeType Project and
+ assume no liability related to The FreeType Project.
+
+
+ Finally, many people asked us for a preferred form for a
+ credit/disclaimer to use in compliance with this license. We thus
+ encourage you to use the following text:
+
+ """
+ Portions of this software are copyright © <year> The FreeType
+ Project (www.freetype.org). All rights reserved.
+ """
+
+ Please replace <year> with the value from the FreeType version you
+ actually use.
+
+
+Legal Terms
+===========
+
+0. Definitions
+--------------
+
+ Throughout this license, the terms `package', `FreeType Project',
+ and `FreeType archive' refer to the set of files originally
+ distributed by the authors (David Turner, Robert Wilhelm, and
+ Werner Lemberg) as the `FreeType Project', be they named as alpha,
+ beta or final release.
+
+ `You' refers to the licensee, or person using the project, where
+ `using' is a generic term including compiling the project's source
+ code as well as linking it to form a `program' or `executable'.
+ This program is referred to as `a program using the FreeType
+ engine'.
+
+ This license applies to all files distributed in the original
+ FreeType Project, including all source code, binaries and
+ documentation, unless otherwise stated in the file in its
+ original, unmodified form as distributed in the original archive.
+ If you are unsure whether or not a particular file is covered by
+ this license, you must contact us to verify this.
+
+ The FreeType Project is copyright (C) 1996-2000 by David Turner,
+ Robert Wilhelm, and Werner Lemberg. All rights reserved except as
+ specified below.
+
+1. No Warranty
+--------------
+
+ THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
+ BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
+ USE, OF THE FREETYPE PROJECT.
+
+2. Redistribution
+-----------------
+
+ This license grants a worldwide, royalty-free, perpetual and
+ irrevocable right and license to use, execute, perform, compile,
+ display, copy, create derivative works of, distribute and
+ sublicense the FreeType Project (in both source and object code
+ forms) and derivative works thereof for any purpose; and to
+ authorize others to exercise some or all of the rights granted
+ herein, subject to the following conditions:
+
+ o Redistribution of source code must retain this license file
+ (`FTL.TXT') unaltered; any additions, deletions or changes to
+ the original files must be clearly indicated in accompanying
+ documentation. The copyright notices of the unaltered,
+ original files must be preserved in all copies of source
+ files.
+
+ o Redistribution in binary form must provide a disclaimer that
+ states that the software is based in part of the work of the
+ FreeType Team, in the distribution documentation. We also
+ encourage you to put an URL to the FreeType web page in your
+ documentation, though this isn't mandatory.
+
+ These conditions apply to any software derived from or based on
+ the FreeType Project, not just the unmodified files. If you use
+ our work, you must acknowledge us. However, no fee need be paid
+ to us.
+
+3. Advertising
+--------------
+
+ Neither the FreeType authors and contributors nor you shall use
+ the name of the other for commercial, advertising, or promotional
+ purposes without specific prior written permission.
+
+ We suggest, but do not require, that you use one or more of the
+ following phrases to refer to this software in your documentation
+ or advertising materials: `FreeType Project', `FreeType Engine',
+ `FreeType library', or `FreeType Distribution'.
+
+ As you have not signed this license, you are not required to
+ accept it. However, as the FreeType Project is copyrighted
+ material, only this license, or another one contracted with the
+ authors, grants you the right to use, distribute, and modify it.
+ Therefore, by using, distributing, or modifying the FreeType
+ Project, you indicate that you understand and accept all the terms
+ of this license.
+
+4. Contacts
+-----------
+
+ There are two mailing lists related to FreeType:
+
+ o freetype@nongnu.org
+
+ Discusses general use and applications of FreeType, as well as
+ future and wanted additions to the library and distribution.
+ If you are looking for support, start in this list if you
+ haven't found anything to help you in the documentation.
+
+ o freetype-devel@nongnu.org
+
+ Discusses bugs, as well as engine internals, design issues,
+ specific licenses, porting, etc.
+
+ Our home page can be found at
+
+ http://www.freetype.org
+
+
+--- end of FTL.TXT ---
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..436d15e
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,6 @@
+# Default code reviewers picked from top 3 or more developers.
+# Please update this list if you find better candidates.
+jungshik@google.com
+siyamed@google.com
+nona@google.com
+jgaillard@google.com
diff --git a/README.android b/README.android
new file mode 100644
index 0000000..a2f5020
--- /dev/null
+++ b/README.android
@@ -0,0 +1,36 @@
+Freetype
+
+There are the following local modifications:
+
+The following modules are disabled in include/freetype/config/ftmodule.h:
+ pfr
+ t42
+ winfnt
+ pcf
+ bdf
+
+The following options are disabled in include/freetype/config/ftoption.h:
+
+ FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+ FT_CONFIG_OPTION_INCREMENTAL
+ TT_CONFIG_OPTION_SUBPIXEL_HINTING
+
+The following option is enabled to support color fonts.
+
+ FT_CONFIG_OPTION_USE_PNG
+
+HOW TO UPDATE
+* Check out external/freetype to <checkout_dir>
+ ex: git clone https://android.googlesource.com/platform/external/freetype
+* Locate the commit you'd like to move.
+ ex: for 2.8.1: http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?h=VER-2-8-1&id=39ce3ac499d4cd7371031a062f410953c8ecce29
+* In <checkout_dir>, run git merge <commit_sha>
+ i.e. git merge 39ce3ac499d4cd7371031a062f410953c8ecce29
+* Upload the changes.
+ ex: git push origin HEAD:refs/for/master
+* Gerrit will run the text related tests.
+
+NOTE:
+ Since Chromium updates FreeType more frequently, you can check the following URL for their changes
+ and latest merges:
+ https://chromium.googlesource.com/chromium/src/+log/master/third_party/freetype
diff --git a/README.version b/README.version
new file mode 100644
index 0000000..f0f1f78
--- /dev/null
+++ b/README.version
@@ -0,0 +1,3 @@
+URL: http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=96b5e500909cfce39ff78feabefd8063a229b951
+Version: 2.9.1 ..96b5e500909cfce39ff78feabefd8063a229b951
+BugComponent: 75970
diff --git a/include/freetype/config/ftmodule.h b/include/freetype/config/ftmodule.h
index 7c603e5..5ac08c1 100644
--- a/include/freetype/config/ftmodule.h
+++ b/include/freetype/config/ftmodule.h
@@ -9,16 +9,16 @@
* FreeType without GNU make.
*
*/
-
+// ANDROID: commented out ones are not needed for android, previously they were deleted
FT_USE_MODULE( FT_Module_Class, autofit_module_class )
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
-FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
-FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
-FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
-FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
+//FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
+//FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
+//FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
+//FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
@@ -27,6 +27,6 @@
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
-FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
+//FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
/* EOF */
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 12f47a8..6c7eb55 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -110,7 +110,8 @@
* ```
*
*/
-#define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+/* ANDROID: disabled */
+/* #define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES */
/**************************************************************************
@@ -272,7 +273,8 @@
* options set by those programs have precedence, overwriting the value
* here with the configured one.
*/
-/* #define FT_CONFIG_OPTION_USE_PNG */
+ /* ANDROID: enabled */
+#define FT_CONFIG_OPTION_USE_PNG
/**************************************************************************
@@ -376,7 +378,8 @@
* incrementally as the document is parsed, such as the Ghostscript
* interpreter for the PostScript language.
*/
-#define FT_CONFIG_OPTION_INCREMENTAL
+/* ANDROID: disabled */
+/* #define FT_CONFIG_OPTION_INCREMENTAL */
/**************************************************************************
@@ -658,7 +661,10 @@
* https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
*/
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
-#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
+
+/* ANDROID: disabled */
+/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */
+
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */
diff --git a/libft2.map.txt b/libft2.map.txt
new file mode 100644
index 0000000..4671ad6
--- /dev/null
+++ b/libft2.map.txt
@@ -0,0 +1,13 @@
+LIBFT2 {
+ global:
+ FT_Done_Face; # vndk
+ FT_Done_FreeType; # vndk
+ FT_Get_Char_Index; # vndk
+ FT_Init_FreeType; # vndk
+ FT_Load_Glyph; # vndk
+ FT_New_Face; # vndk
+ FT_New_Memory_Face; # vndk
+ FT_Set_Char_Size; # vndk
+ local:
+ *;
+};