diff options
Diffstat (limited to 'Build/source/libs')
131 files changed, 4868 insertions, 1578 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README index aa72b161653..e330fcdc6e0 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -25,7 +25,7 @@ graphite2 1.3.13 - checked 21dec18 http://sourceforge.net/projects/silgraphite/files/graphite2/ (requires C++11) -harfbuzz 2.5.3 - checked 27jun19 +harfbuzz 2.6.0 - checked 15aug19 http://www.freedesktop.org/software/harfbuzz/release/ icu 63.1 - checked 8jan19 diff --git a/Build/source/libs/harfbuzz/ChangeLog b/Build/source/libs/harfbuzz/ChangeLog index bbb2ea47788..2956ddda01f 100644 --- a/Build/source/libs/harfbuzz/ChangeLog +++ b/Build/source/libs/harfbuzz/ChangeLog @@ -1,3 +1,8 @@ +2019-08-15 Akira Kakuto <kakuto@w32tex.org> + + Import harfbuzz-2.6.0. + * version.ac, Makefile.am, include/Makefile.am: Adjusted. + 2019-06-27 Akira Kakuto <kakuto@w32tex.org> Import harfbuzz-2.5.3. diff --git a/Build/source/libs/harfbuzz/Makefile.am b/Build/source/libs/harfbuzz/Makefile.am index 74d78959275..787fcc32d74 100644 --- a/Build/source/libs/harfbuzz/Makefile.am +++ b/Build/source/libs/harfbuzz/Makefile.am @@ -144,6 +144,7 @@ libharfbuzz_a_SOURCES += \ @HARFBUZZ_TREE@/src/hb-aat-layout-kerx-table.hh \ @HARFBUZZ_TREE@/src/hb-aat-layout-lcar-table.hh \ @HARFBUZZ_TREE@/src/hb-aat-layout-morx-table.hh \ + @HARFBUZZ_TREE@/src/hb-aat-layout-opbd-table.hh \ @HARFBUZZ_TREE@/src/hb-aat-layout-trak-table.hh \ @HARFBUZZ_TREE@/src/hb-aat-layout.hh \ @HARFBUZZ_TREE@/src/hb-aat-ltag-table.hh \ @@ -169,6 +170,10 @@ libharfbuzz_a_SOURCES += \ @HARFBUZZ_TREE@/src/hb-ot-map.hh \ @HARFBUZZ_TREE@/src/hb-ot-math.cc \ @HARFBUZZ_TREE@/src/hb-ot-math-table.hh \ + @HARFBUZZ_TREE@/src/hb-ot-meta-table.hh \ + @HARFBUZZ_TREE@/src/hb-ot-meta.cc \ + @HARFBUZZ_TREE@/src/hb-ot-metrics.cc \ + @HARFBUZZ_TREE@/src/hb-ot-metrics.hh \ @HARFBUZZ_TREE@/src/hb-ot-shape.cc \ @HARFBUZZ_TREE@/src/hb-ot-shape-complex-arabic.cc \ @HARFBUZZ_TREE@/src/hb-ot-shape-complex-arabic-fallback.hh \ diff --git a/Build/source/libs/harfbuzz/Makefile.in b/Build/source/libs/harfbuzz/Makefile.in index 1a3f689ffd2..fbcb774ae8b 100644 --- a/Build/source/libs/harfbuzz/Makefile.in +++ b/Build/source/libs/harfbuzz/Makefile.in @@ -150,6 +150,8 @@ am_libharfbuzz_a_OBJECTS = @HARFBUZZ_TREE@/src/hb-blob.$(OBJEXT) \ @HARFBUZZ_TREE@/src/hb-ot-color.$(OBJEXT) \ @HARFBUZZ_TREE@/src/hb-ot-map.$(OBJEXT) \ @HARFBUZZ_TREE@/src/hb-ot-math.$(OBJEXT) \ + @HARFBUZZ_TREE@/src/hb-ot-meta.$(OBJEXT) \ + @HARFBUZZ_TREE@/src/hb-ot-metrics.$(OBJEXT) \ @HARFBUZZ_TREE@/src/hb-ot-shape.$(OBJEXT) \ @HARFBUZZ_TREE@/src/hb-ot-shape-complex-arabic.$(OBJEXT) \ @HARFBUZZ_TREE@/src/hb-ot-shape-complex-default.$(OBJEXT) \ @@ -210,6 +212,8 @@ am__depfiles_remade = ./$(DEPDIR)/hbtest-dummy.Po \ @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-layout.Po \ @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-map.Po \ @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-math.Po \ + @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-meta.Po \ + @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-metrics.Po \ @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-name.Po \ @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-shape-complex-arabic.Po \ @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-shape-complex-default.Po \ @@ -804,6 +808,7 @@ libharfbuzz_a_SOURCES = @HARFBUZZ_TREE@/src/hb-algs.hh \ @HARFBUZZ_TREE@/src/hb-aat-layout-kerx-table.hh \ @HARFBUZZ_TREE@/src/hb-aat-layout-lcar-table.hh \ @HARFBUZZ_TREE@/src/hb-aat-layout-morx-table.hh \ + @HARFBUZZ_TREE@/src/hb-aat-layout-opbd-table.hh \ @HARFBUZZ_TREE@/src/hb-aat-layout-trak-table.hh \ @HARFBUZZ_TREE@/src/hb-aat-layout.hh \ @HARFBUZZ_TREE@/src/hb-aat-ltag-table.hh \ @@ -829,6 +834,10 @@ libharfbuzz_a_SOURCES = @HARFBUZZ_TREE@/src/hb-algs.hh \ @HARFBUZZ_TREE@/src/hb-ot-map.hh \ @HARFBUZZ_TREE@/src/hb-ot-math.cc \ @HARFBUZZ_TREE@/src/hb-ot-math-table.hh \ + @HARFBUZZ_TREE@/src/hb-ot-meta-table.hh \ + @HARFBUZZ_TREE@/src/hb-ot-meta.cc \ + @HARFBUZZ_TREE@/src/hb-ot-metrics.cc \ + @HARFBUZZ_TREE@/src/hb-ot-metrics.hh \ @HARFBUZZ_TREE@/src/hb-ot-shape.cc \ @HARFBUZZ_TREE@/src/hb-ot-shape-complex-arabic.cc \ @HARFBUZZ_TREE@/src/hb-ot-shape-complex-arabic-fallback.hh \ @@ -1046,6 +1055,12 @@ clean-noinstLIBRARIES: @HARFBUZZ_TREE@/src/hb-ot-math.$(OBJEXT): \ @HARFBUZZ_TREE@/src/$(am__dirstamp) \ @HARFBUZZ_TREE@/src/$(DEPDIR)/$(am__dirstamp) +@HARFBUZZ_TREE@/src/hb-ot-meta.$(OBJEXT): \ + @HARFBUZZ_TREE@/src/$(am__dirstamp) \ + @HARFBUZZ_TREE@/src/$(DEPDIR)/$(am__dirstamp) +@HARFBUZZ_TREE@/src/hb-ot-metrics.$(OBJEXT): \ + @HARFBUZZ_TREE@/src/$(am__dirstamp) \ + @HARFBUZZ_TREE@/src/$(DEPDIR)/$(am__dirstamp) @HARFBUZZ_TREE@/src/hb-ot-shape.$(OBJEXT): \ @HARFBUZZ_TREE@/src/$(am__dirstamp) \ @HARFBUZZ_TREE@/src/$(DEPDIR)/$(am__dirstamp) @@ -1135,6 +1150,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@@HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-layout.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@@HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-map.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@@HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-math.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@@HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-meta.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@@HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-metrics.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@@HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-name.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@@HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-shape-complex-arabic.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@@HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-shape-complex-default.Po@am__quote@ # am--include-marker @@ -1776,6 +1793,8 @@ distclean: distclean-recursive -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-layout.Po -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-map.Po -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-math.Po + -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-meta.Po + -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-metrics.Po -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-name.Po -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-shape-complex-arabic.Po -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-shape-complex-default.Po @@ -1873,6 +1892,8 @@ maintainer-clean: maintainer-clean-recursive -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-layout.Po -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-map.Po -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-math.Po + -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-meta.Po + -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-metrics.Po -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-name.Po -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-shape-complex-arabic.Po -rm -f @HARFBUZZ_TREE@/src/$(DEPDIR)/hb-ot-shape-complex-default.Po diff --git a/Build/source/libs/harfbuzz/TLpatches/ChangeLog b/Build/source/libs/harfbuzz/TLpatches/ChangeLog index 5426cade611..13ca5672ea8 100644 --- a/Build/source/libs/harfbuzz/TLpatches/ChangeLog +++ b/Build/source/libs/harfbuzz/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2019-08-15 Akira Kakuto <kakuto@w32tex.org> + + Imported harfbuzz-2.6.0 source tree from: + http://www.freedesktop.org/software/harfbuzz/release/ + 2019-06-27 Akira Kakuto <kakuto@w32tex.org> Imported harfbuzz-2.5.3 source tree from: diff --git a/Build/source/libs/harfbuzz/TLpatches/TL-Changes b/Build/source/libs/harfbuzz/TLpatches/TL-Changes index b05e9ef85b2..d53c27a8905 100644 --- a/Build/source/libs/harfbuzz/TLpatches/TL-Changes +++ b/Build/source/libs/harfbuzz/TLpatches/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the harfbuzz-2.5.3/ tree as obtained from: +Changes applied to the harfbuzz-2.6.0/ tree as obtained from: http://www.freedesktop.org/software/harfbuzz/release/ Removed: diff --git a/Build/source/libs/harfbuzz/configure b/Build/source/libs/harfbuzz/configure index 097947704cf..c503c4be3f0 100755 --- a/Build/source/libs/harfbuzz/configure +++ b/Build/source/libs/harfbuzz/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for harfbuzz (TeX Live) 2.5.3. +# Generated by GNU Autoconf 2.69 for harfbuzz (TeX Live) 2.6.0. # # Report bugs to <tex-k@tug.org>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='harfbuzz (TeX Live)' PACKAGE_TARNAME='harfbuzz--tex-live-' -PACKAGE_VERSION='2.5.3' -PACKAGE_STRING='harfbuzz (TeX Live) 2.5.3' +PACKAGE_VERSION='2.6.0' +PACKAGE_STRING='harfbuzz (TeX Live) 2.6.0' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1311,7 +1311,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures harfbuzz (TeX Live) 2.5.3 to adapt to many kinds of systems. +\`configure' configures harfbuzz (TeX Live) 2.6.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1382,7 +1382,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of harfbuzz (TeX Live) 2.5.3:";; + short | recursive ) echo "Configuration of harfbuzz (TeX Live) 2.6.0:";; esac cat <<\_ACEOF @@ -1487,7 +1487,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -harfbuzz (TeX Live) configure 2.5.3 +harfbuzz (TeX Live) configure 2.6.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2123,7 +2123,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by harfbuzz (TeX Live) $as_me 2.5.3, which was +It was created by harfbuzz (TeX Live) $as_me 2.6.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4047,7 +4047,7 @@ fi # Define the identity of the package. PACKAGE='harfbuzz--tex-live-' - VERSION='2.5.3' + VERSION='2.6.0' # Some tools Automake needs. @@ -4240,9 +4240,9 @@ WARNING_CFLAGS=$kpse_cv_warning_cflags HB_VERSION_MAJOR=2 -HB_VERSION_MINOR=5 -HB_VERSION_MICRO=3 -HB_VERSION=2.5.3 +HB_VERSION_MINOR=6 +HB_VERSION_MICRO=0 +HB_VERSION=2.6.0 ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -7919,7 +7919,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by harfbuzz (TeX Live) $as_me 2.5.3, which was +This file was extended by harfbuzz (TeX Live) $as_me 2.6.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7985,7 +7985,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -harfbuzz (TeX Live) config.status 2.5.3 +harfbuzz (TeX Live) config.status 2.6.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt index c9ba0160c72..66e4a838834 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt +++ b/Build/source/libs/harfbuzz/harfbuzz-src/CMakeLists.txt @@ -43,6 +43,7 @@ if (APPLE) endif () if (WIN32) option(HB_HAVE_UNISCRIBE "Enable Uniscribe shaper backend on Windows" OFF) + option(HB_HAVE_GDI "Enable GDI integration helpers on Windows" OFF) option(HB_HAVE_DIRECTWRITE "Enable DirectWrite shaper backend on Windows" OFF) endif () option(HB_BUILD_UTILS "Build harfbuzz utils, needs cairo, freetype, and glib properly be installed" OFF) @@ -77,6 +78,7 @@ if (HB_CHECK) set (HB_HAVE_GRAPHITE2 ON) if (WIN32) set (HB_HAVE_UNISCRIBE ON) + set (HB_HAVE_GDI ON) set (HB_HAVE_DIRECTWRITE ON) elseif (APPLE) set (HB_HAVE_CORETEXT ON) @@ -140,8 +142,8 @@ endif () ## Extract variables from Makefile files function (extract_make_variable variable makefile_source) - string(REGEX MATCH "${variable} = ([^$]+)\\$" temp ${makefile_source}) - string(REGEX MATCHALL "[^ \n\t\\]+" listVar ${CMAKE_MATCH_1}) + string(REGEX MATCH "${variable} = ([^$]+)\\$" temp "${makefile_source}") + string(REGEX MATCHALL "[^ \n\t\\]+" listVar "${CMAKE_MATCH_1}") set (${variable} ${listVar} PARENT_SCOPE) endfunction () @@ -157,8 +159,6 @@ endfunction () file(READ ${PROJECT_SOURCE_DIR}/src/Makefile.sources SRCSOURCES) file(READ ${PROJECT_SOURCE_DIR}/util/Makefile.sources UTILSOURCES) -extract_make_variable(HB_BASE_sources ${SRCSOURCES}) -add_prefix_to_list(HB_BASE_sources "${PROJECT_SOURCE_DIR}/src/") extract_make_variable(HB_BASE_headers ${SRCSOURCES}) add_prefix_to_list(HB_BASE_headers "${PROJECT_SOURCE_DIR}/src/") @@ -192,59 +192,12 @@ set (HB_VERSION_MAJOR ${CMAKE_MATCH_2}) set (HB_VERSION_MINOR ${CMAKE_MATCH_3}) set (HB_VERSION_MICRO ${CMAKE_MATCH_4}) - -## Define ragel tasks -# if (NOT IN_HB_DIST) -# foreach (ragel_output IN ITEMS ${HB_BASE_RAGEL_GENERATED_sources}) -# string(REGEX MATCH "([^/]+)\\.hh" temp ${ragel_output}) -# set (target_name ${CMAKE_MATCH_1}) -# add_custom_command(OUTPUT ${ragel_output} -# COMMAND ${RAGEL} -G2 -o ${ragel_output} ${PROJECT_SOURCE_DIR}/src/${target_name}.rl -I ${PROJECT_SOURCE_DIR} ${ARGN} -# DEPENDS ${PROJECT_SOURCE_DIR}/src/${target_name}.rl -# ) -# add_custom_target(harfbuzz_${target_name} DEPENDS ${PROJECT_BINARY_DIR}/src/${target_name}) -# endforeach () - -# mark_as_advanced(RAGEL) -# endif () - - -## Generate hb-version.h -# if (NOT IN_HB_DIST) -# set (HB_VERSION_H_IN "${PROJECT_SOURCE_DIR}/src/hb-version.h.in") -# set (HB_VERSION_H "${PROJECT_BINARY_DIR}/src/hb-version.h") -# set_source_files_properties("${HB_VERSION_H}" PROPERTIES GENERATED true) -# configure_file("${HB_VERSION_H_IN}" "${HB_VERSION_H}.tmp" @ONLY) -# execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_if_different -# "${HB_VERSION_H}.tmp" -# "${HB_VERSION_H}" -# ) -# file(REMOVE "${HB_VERSION_H}.tmp") -# endif () - - ## Define sources and headers of the project -set (project_sources - ${HB_BASE_sources} - ${HB_BASE_RAGEL_GENERATED_sources} -) - -set (subset_project_sources - ${HB_SUBSET_sources} -) - +set (project_sources ${PROJECT_SOURCE_DIR}/src/harfbuzz.cc) # use amalgam source +set (subset_project_sources ${HB_SUBSET_sources}) set (project_extra_sources) - -set (project_headers - #${HB_VERSION_H} - - ${HB_BASE_headers} -) - -set (subset_project_headers - ${HB_SUBSET_headers} -) - +set (project_headers ${HB_BASE_headers}) +set (subset_project_headers ${HB_SUBSET_headers}) ## Find and include needed header folders and libraries if (HB_HAVE_FREETYPE) @@ -257,7 +210,6 @@ if (HB_HAVE_FREETYPE) include_directories(AFTER ${FREETYPE_INCLUDE_DIRS}) add_definitions(-DHAVE_FREETYPE=1) - list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-ft.cc) list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-ft.h) # So check_funcs can find its headers @@ -275,7 +227,6 @@ if (HB_HAVE_GRAPHITE2) include_directories(${GRAPHITE2_INCLUDE_DIR}) - list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-graphite2.cc) list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-graphite2.h) list(APPEND THIRD_PARTY_LIBS ${GRAPHITE2_LIBRARY}) @@ -296,7 +247,6 @@ if (HB_HAVE_GLIB) include_directories(${GLIBCONFIG_INCLUDE_DIR} ${GLIB_INCLUDE_DIR}) - list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-glib.cc) list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-glib.h) list(APPEND THIRD_PARTY_LIBS ${GLIB_LIBRARIES}) @@ -316,7 +266,6 @@ if (HB_HAVE_ICU) include_directories(${ICU_INCLUDE_DIR}) - list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-icu.cc) list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-icu.h) list(APPEND THIRD_PARTY_LIBS ${ICU_LIBRARY}) @@ -328,7 +277,6 @@ if (APPLE AND HB_HAVE_CORETEXT) # Apple Advanced Typography add_definitions(-DHAVE_CORETEXT) - list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-coretext.cc) list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-coretext.h) if (HB_IOS) @@ -359,21 +307,21 @@ if (APPLE AND HB_HAVE_CORETEXT) endif () endif () +if (WIN32 AND HB_HAVE_GDI) + add_definitions(-DHAVE_GDI) + list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-gdi.h) + list(APPEND THIRD_PARTY_LIBS gdi32) +endif () + if (WIN32 AND HB_HAVE_UNISCRIBE) add_definitions(-DHAVE_UNISCRIBE) - - list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-uniscribe.cc) list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-uniscribe.h) - list(APPEND THIRD_PARTY_LIBS usp10 gdi32 rpcrt4) endif () if (WIN32 AND HB_HAVE_DIRECTWRITE) add_definitions(-DHAVE_DIRECTWRITE) - - list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-directwrite.cc) list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-directwrite.h) - list(APPEND THIRD_PARTY_LIBS dwrite rpcrt4) endif () @@ -481,7 +429,6 @@ if (HB_HAVE_GOBJECT) ) endif () - ## Atomic ops availability detection file(WRITE "${PROJECT_BINARY_DIR}/try_compile_intel_atomic_primitives.c" " void memory_barrier (void) { __sync_synchronize (); } @@ -590,7 +537,6 @@ if (WIN32) endif () if (HB_HAVE_INTROSPECTION) - find_package(PkgConfig) pkg_check_modules(PC_GI QUIET gobject-introspection-1.0) @@ -824,7 +770,7 @@ endif () if (HB_BUILD_TESTS) ## src/ executables - foreach (prog main test test-gsub-would-substitute test-gpos-size-params test-buffer-serialize hb-ot-tag test-unicode-ranges) + foreach (prog main test test-gsub-would-substitute test-gpos-size-params test-buffer-serialize test-unicode-ranges) # hb-ot-tag set (prog_name ${prog}) if (${prog_name} STREQUAL "test") # test can not be used as a valid executable name on cmake, lets special case it @@ -833,7 +779,7 @@ if (HB_BUILD_TESTS) add_executable(${prog_name} ${PROJECT_SOURCE_DIR}/src/${prog}.cc) target_link_libraries(${prog_name} harfbuzz ${THIRD_PARTY_LIBS}) endforeach () - set_target_properties(hb-ot-tag PROPERTIES COMPILE_FLAGS "-DMAIN") + # set_target_properties(hb-ot-tag PROPERTIES COMPILE_FLAGS "-DMAIN") ## Tests if (UNIX OR MINGW) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/CONFIG.md b/Build/source/libs/harfbuzz/harfbuzz-src/CONFIG.md index 5fb3e7cb455..46971b0f2d9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/CONFIG.md +++ b/Build/source/libs/harfbuzz/harfbuzz-src/CONFIG.md @@ -40,7 +40,11 @@ Finally, if you are making a static library build or otherwise linking the library into your app, make sure your linker removes unused functions. This can be tricky and differ from environment to environment, but you definitely want to make sure this happens. Otherwise, every unused public function will -be adding unneeded bytes to your binary. +be adding unneeded bytes to your binary. The following pointers might come +handy: + + * https://lwn.net/Articles/741494/ (all of the four-part series) + * https://elinux.org/images/2/2d/ELC2010-gc-sections_Denys_Vlasenko.pdf Combining the above three build options should already shrink your library a lot. The rest of this file shows you ways to shrink the library even further at the @@ -86,6 +90,20 @@ In that case, or if you otherwise provide those functions by calling without loss of functionality by defining `HB_NO_OT_FONT`. +## Shapers + +Most HarfBuzz clients use it for the main shaper, called "ot". However, it +is legitimate to want to compile HarfBuzz with only another backend, eg. +CoreText, for example for an iOS app. For that, you want `HB_NO_OT_SHAPE`. +If you are going down that route, check if you want `HB_NO_OT`. + +This is very rarely what you need. Make sure you understand exactly what you +are doing. + +Defining `HB_NO_FALLBACK_SHAPE` however is pretty harmless. That removes the +(unused) "fallback" shaper. + + ## Thread-safety By default HarfBuzz builds as a thread-safe library. The exception is that diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog index 6236f500102..226448d0aed 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog +++ b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog @@ -1,3 +1,1872 @@ +commit 6461143b44f81a4190d3f1cb02238750536f08e4 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Aug 13 22:20:54 2019 -0700 + + 2.6.0 + + NEWS | 23 +++++++++++++++++++++++ + configure.ac | 2 +- + docs/harfbuzz-docs.xml | 4 ++++ + src/hb-font.cc | 2 +- + src/hb-gdi.cc | 2 +- + src/hb-ot-layout.cc | 2 ++ + src/hb-ot-layout.h | 2 +- + src/hb-ot-meta.cc | 4 ++-- + src/hb-ot-meta.h | 2 +- + src/hb-ot-metrics.cc | 8 ++++---- + src/hb-ot-metrics.h | 2 +- + src/hb-version.h | 6 +++--- + 12 files changed, 44 insertions(+), 15 deletions(-) + +commit e56d4ff43b97ca35a8324be2acf1c8644f3b0a24 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Aug 13 21:02:47 2019 -0700 + + Rename hb_ot_meta_get_entries() to +hb_ot_meta_get_entry_tags() + + docs/harfbuzz-sections.txt | 2 +- + src/hb-ot-meta.cc | 8 ++++---- + src/hb-ot-meta.h | 8 ++++---- + src/test-ot-meta.cc | 4 ++-- + test/api/test-ot-face.c | 2 +- + test/api/test-ot-meta.c | 6 +++--- + 6 files changed, 15 insertions(+), 15 deletions(-) + +commit aade9b70aabd8a97dd8a28cda2cf4d0694dd7350 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Aug 13 16:09:20 2019 -0700 + + [pool] Fix alignment assertion + + I *think* it should fix https://github.com/harfbuzz/harfbuzz/issues/1901 + + Ie. if on a system, alignof(void*) < sizeof(void*)... + + src/hb-pool.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit b31d627f151c8eeeb12ed84c3282392d6adbc5b4 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Aug 11 23:34:48 2019 +0430 + + Increase subset fuzzer timeout to 16s + + To satisfy -valgrind and -tsan bots, very ugly + + test/fuzzing/run-subset-fuzzer-tests.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 5b9cf191fe1fb13bd4bf914e0f4c03c3b2795a73 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Aug 11 23:07:29 2019 +0430 + + [ci] Disable vcpkg thus running the test suit in Windows + + vcpkg apparently doesn't like to work the same way used to anymore, lets disable it + + appveyor.yml | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +commit 60d9f0097580a339c7ffe582cc0657698e315cea +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Aug 11 16:15:19 2019 +0430 + + Implement opbd table parsing + + https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6opbd.html + + src/Makefile.sources | 1 + + src/hb-aat-layout-opbd-table.hh | 111 ++++++++++++++++++++++++++++++++++++++++ + src/hb-ot-face-table-list.hh | 1 + + src/hb-ot-layout.cc | 1 + + 4 files changed, 114 insertions(+) + +commit 8762676e34cef13f4b263b377b485b199b66d4d1 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Aug 10 01:26:55 2019 +0430 + + [os2] Replace null pool addr compare by checking vital fields (#1896) + + src/hb-ot-os2-table.hh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 1f926fb2b642094a15e686be6a910e709b15ebd0 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Aug 7 20:22:20 2019 +0430 + + [fvar] Use roundf instead hardcoding round logic + + src/hb-ot-var-fvar-table.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 60485ab0473630c585bb96fcdc14dbe415edf4f2 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Aug 7 23:23:06 2019 +0430 + + [os2] Get defined lower/upper optical size + + src/hb-ot-os2-table.hh | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +commit 321d5588d4fa96bcc4aa558d2f982430031f242e +Author: Qunxin Liu <qxliu@google.com> +Date: Tue Jul 2 16:30:57 2019 -0700 + + [subset] Add subsetting for GPOS Lookup Type 1: Single Adjustment Positioning Subtable + + src/hb-ot-layout-gpos-table.hh | 157 ++++++++++++++++++++- + test/subset/data/Makefile.am | 1 + + test/subset/data/Makefile.sources | 1 + + .../gpos1_2_font.keep-layout-retain-gids.41,43.otf | Bin 0 -> 2068 bytes + .../gpos1_2_font.keep-layout-retain-gids.41,46.otf | Bin 0 -> 2232 bytes + .../gpos1_2_font.keep-layout-retain-gids.43,46.otf | Bin 0 -> 2096 bytes + ...eep-layout-retain-gids.retain-all-codepoint.otf | Bin 0 -> 3668 bytes + test/subset/data/fonts/gpos1_2_font.otf | Bin 0 -> 4564 bytes + test/subset/data/tests/layout.gpos.tests | 11 ++ + 9 files changed, 166 insertions(+), 4 deletions(-) + +commit 37572882e7a685d804384eaf11f0f3e53af38341 +Author: Qunxin Liu <qxliu@google.com> +Date: Tue Jun 25 13:17:30 2019 -0700 + + [subset] cmap table to use _subset2 and new iterator frameworks + + src/hb-ot-cmap-table.hh | 670 +++++++++++------------ + src/hb-subset.cc | 2 +- + test/api/fonts/Roboto-Regular.D7,D8,D9,DA,DE.ttf | Bin 2816 -> 2532 bytes + test/api/fonts/Roboto-Regular.abc.ttf | Bin 2460 -> 2168 bytes + test/api/fonts/Roboto-Regular.ac.ttf | Bin 2268 -> 1988 bytes + 5 files changed, 320 insertions(+), 352 deletions(-) + +commit 06596cf90700ff76f23297141c656dfc317eece6 +Author: Khaled Hosny <khaledhosny@eglug.org> +Date: Sat Aug 3 13:55:34 2019 +0200 + + Some styling + + README.python.md | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +commit 5848c890cf2f8a14c9d9e329c4f8283feac1f0c3 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Aug 3 14:19:28 2019 +0430 + + [metrics] Add metrics tags documentation + + src/hb-ot-metrics.h | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +commit 4d1872b8e019659a92a59b1d7cba6fd81ed3607d +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Aug 3 14:06:46 2019 +0430 + + [base] Add documentation for baseline tags from ot spec + + src/hb-ot-layout.h | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +commit bbeee84a7f048633b0aaa95aa6129871a3a22164 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Aug 3 13:47:55 2019 +0430 + + [meta] Add metadata tags documentation from ot spec + + src/hb-ot-meta.h | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +commit 521c7013abab84a0994fda3977ccd1ba3d496242 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 30 18:10:40 2019 +0430 + + [cpal] revert port to dagger + + It has a different semantic, maybe we should just do a zero memset, + letting Behdad to decide. + + src/hb-ot-color-cpal-table.hh | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +commit 8014ce198a09d20cb947e4a465c7d893a84c55be +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 30 17:31:34 2019 +0430 + + [cpal] port to dagger (#1887) + + src/hb-ot-color-cpal-table.hh | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +commit d67201da5a2142cb9d039a8cb2cb713556d945af +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 30 17:20:18 2019 +0430 + + [colr] minor + + src/hb-ot-color-colr-table.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 8c0a2e68ad91e55a11162da0cddb355810a4c8a0 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 30 13:16:15 2019 +0430 + + [fuzz] Add dummy call of the added APIs (#1886) + + test/api/test-ot-face.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +commit e5cf9718c07c8bf1fc20cd573cef2d125c28281f +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 30 04:44:23 2019 +0430 + + [colr][feat][meta] Port sub_array iteration to dagger (#1868) + + src/hb-aat-layout-feat-table.hh | 37 ++++++++++++++++++------------------- + src/hb-ot-color-colr-table.hh | 14 ++++++-------- + src/hb-ot-meta-table.hh | 8 +++++--- + 3 files changed, 29 insertions(+), 30 deletions(-) + +commit 9f2b4956b484b802eb37f36974c11785c90493ce +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 30 04:42:51 2019 +0430 + + [base] Add hb_ot_layout_get_baseline API + + docs/harfbuzz-sections.txt | 2 + + src/hb-ot-face-table-list.hh | 6 ++- + src/hb-ot-layout.cc | 87 ++++++++++++-------------------------------- + src/hb-ot-layout.h | 32 ++++++++++++++++ + test/api/test-baseline.c | 4 +- + 5 files changed, 63 insertions(+), 68 deletions(-) + +commit 40a4b6ddbdc84a25f76bd4d7ff41b1322fe95b83 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 27 13:33:46 2019 +0430 + + [var] Add a new API, hb_font_set_var_named_instance + + docs/harfbuzz-sections.txt | 1 + + src/hb-font.cc | 28 ++++++++++++++++++++++++++++ + src/hb-font.h | 4 ++++ + test/api/test-ot-extents-cff.c | 32 ++++++++++++++++++++++++++++++++ + 4 files changed, 65 insertions(+) + +commit b6a2281f1a2d29cc5797f4f266800f7141591585 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 30 03:45:45 2019 +0430 + + [meta] Make values match their enum type naming + + src/hb-ot-meta.h | 10 +++++----- + test/api/test-ot-meta.c | 4 ++-- + 2 files changed, 7 insertions(+), 7 deletions(-) + +commit 20072a2eca8943a82e36cbb603ad31481cfc56cd +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 30 03:43:15 2019 +0430 + + [metrics] Make values match their enum type naming + + src/hb-ot-font.cc | 12 +++--- + src/hb-ot-metrics.cc | 100 ++++++++++++++++++++++----------------------- + src/hb-ot-metrics.h | 58 +++++++++++++------------- + test/api/test-ot-metrics.c | 26 ++++++------ + 4 files changed, 98 insertions(+), 98 deletions(-) + +commit ed2965a8527ee89994c8eecf451bf71846b3ca86 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 30 03:34:10 2019 +0430 + + [base] Don't use enum inside the table + + src/hb-ot-layout-base-table.hh | 31 ++++++++++++++----------------- + 1 file changed, 14 insertions(+), 17 deletions(-) + +commit 388fa9b32611a8726b9bbfe7ccf8cdbcd818fd70 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 27 14:56:18 2019 +0430 + + [lcar] flip for and switch position + + src/hb-aat-layout-lcar-table.hh | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +commit 4e1da6bb612b0c6386ab143dbb4ca19ff25bc2ba +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Mon Jul 29 22:03:56 2019 +0430 + + [metrics] Rename hb_ot_metrics_t to hb_ot_metrics_tag_t + + src/hb-ot-metrics.cc | 22 +++++++++++----------- + src/hb-ot-metrics.h | 16 ++++++++-------- + src/hb-ot-metrics.hh | 6 +++--- + 3 files changed, 22 insertions(+), 22 deletions(-) + +commit 2c2a2b97dbe24ae2e09018f435559c97a460bdcb +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Mon Jul 29 22:01:13 2019 +0430 + + [meta] Rename hb_ot_meta_t to hb_ot_meta_tag_t + + src/hb-ot-meta-table.hh | 10 +++++----- + src/hb-ot-meta.cc | 10 +++++----- + src/hb-ot-meta.h | 14 +++++++------- + src/test-ot-meta.cc | 4 ++-- + test/api/test-ot-meta.c | 6 +++--- + 5 files changed, 22 insertions(+), 22 deletions(-) + +commit 7bcc5dfa97a43d9c5f6dfdb87b4f0d5a589ecd48 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Sun Jul 28 20:55:50 2019 -0700 + + [iter] Fix accumulate to accept const types + + src/hb-iter.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit e21bdf500d4ecc3a5fd6f79aabf6232f3967035e +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Jul 28 22:59:09 2019 +0430 + + Increase subset fuzzer timeout to 8s + + Probably we should just remove timeout when running tsan and vaglrind here, the flaky bots + + test/fuzzing/run-subset-fuzzer-tests.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 87454c447d705327a26c1f879e0a4f3002ae2667 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Jul 28 20:46:47 2019 +0430 + + [base] fix logic + + src/hb-ot-layout-base-table.hh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit 69655d5bc3c7b240424545bdef197d9d7251e509 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Jul 28 20:39:20 2019 +0430 + + [base] minor + + src/hb-ot-layout-base-table.hh | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +commit d9c44e7239daf59e283fecd4166c984b43d48e24 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Jul 28 20:35:32 2019 +0430 + + [base] Check if the returned base_coord is valid + + src/hb-ot-layout-base-table.hh | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +commit 53853c044a6382ece51393dfc3a4fe6a5f8a5a23 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Jul 28 20:23:48 2019 +0430 + + [meta] minor + + src/hb-ot-meta-table.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit ed126d8c37c45d8d60eb0368143c6776d1fcfbff +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Jul 28 20:21:59 2019 +0430 + + [base] fix build + + src/hb-ot-layout-base-table.hh | 3 +++ + 1 file changed, 3 insertions(+) + +commit c7b22b96cc64c81248362a70f2d60d93ee520f2d +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Jul 28 19:46:57 2019 +0430 + + [base] minor + + src/hb-ot-layout-base-table.hh | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +commit a157342fce2616141ee62d68ad8e3fb93e52187e +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Jul 28 18:54:13 2019 +0430 + + [base] Fix use of bsearch + + src/hb-ot-layout-base-table.hh | 94 ++++++++++++++---------------------------- + 1 file changed, 31 insertions(+), 63 deletions(-) + +commit eddd45653282ffff8ef002ad2163bcf8bf4f3df1 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Jul 28 02:21:54 2019 +0430 + + [base] minor spacing + + src/hb-ot-layout-base-table.hh | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +commit 0a18efd766b3b6cc987ee18785f7858fe2bd1c67 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jul 26 14:34:26 2019 -0700 + + Minor + + src/hb-ot-layout-gsub-table.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 60d0fe2eda9c0eb67f50d61e905b584b8edc3e95 +Merge: 6d53cda1 658424b2 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 27 01:20:55 2019 +0430 + + Merge pull request #1872 from darktohka/cmake-regex-fix + + [cmake] Fix CMake build on newer CMake versions + +commit 658424b29efbc758541a790193c42171bb7fa965 +Author: Derzsi Dániel <daniel@tohka.us> +Date: Fri Jul 26 22:52:03 2019 +0300 + + [cmake] Fix CMake build on newer CMake versions + + Unfortunately, newer CMake versions die during regex variable extraction, causing the build to fail. + + This is caused by the lack of escaping used around variables in the extract_make_variable function, causing these variables to be automatically unwrapped into empty strings. + + CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 6d53cda1baf130853e5725fe8fea1d1c5f766a79 +Author: Zero King <l2dy@icloud.com> +Date: Fri Jul 26 15:43:51 2019 +0000 + + [util] Fix memory leak + + util/options.cc | 1 + + 1 file changed, 1 insertion(+) + +commit d3d99f8bb6ad77d1ac73901885acfffd3bb3e7f7 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jul 26 16:46:04 2019 +0430 + + [metrics] Expose raw OS2/HHEA asc/dsc values using private tags (#1867) + + src/hb-ot-metrics.cc | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +commit aaffe41094f8ddefad6f33e86cbd04a24dd9bfff +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jul 26 01:14:37 2019 +0430 + + [meta] minor, simplify iterator + + src/hb-ot-meta-table.hh | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit 62932c14bd256f10031380047ededd93a2aacd88 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jul 26 00:30:29 2019 +0430 + + [meta] Rename ot-metadata to ot-meta per review + + docs/harfbuzz-sections.txt | 7 +++--- + src/Makefile.am | 8 +++---- + src/Makefile.sources | 4 ++-- + src/harfbuzz.cc | 2 +- + src/hb-ot-meta-table.hh | 8 +++---- + src/{hb-ot-metadata.cc => hb-ot-meta.cc} | 22 +++++++++--------- + src/{hb-ot-metadata.h => hb-ot-meta.h} | 30 ++++++++++++------------- + src/hb-ot.h | 2 +- + src/{test-ot-metadata.cc => test-ot-meta.cc} | 10 ++++----- + test/api/Makefile.am | 2 +- + test/api/{test-ot-metadata.c => test-ot-meta.c} | 26 ++++++++++----------- + 11 files changed, 61 insertions(+), 60 deletions(-) + +commit 821d9e9034c57c5c593741284b134c76cc3c7c0f +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jul 26 00:08:58 2019 +0430 + + Use .sub_array for DataMap tags iteration + + src/hb-ot-meta-table.hh | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +commit a250af98ae74c94ac3aa069e6e5958a937586bfc +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 24 03:10:41 2019 +0430 + + [meta] Add max value to hb_ot_metadata_t + + src/hb-ot-metadata.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +commit 80e246a1f2b3c4e3c25a4a3ec042e7610944abd4 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 24 03:08:34 2019 +0430 + + [meta] Add a test program for metadata + + src/Makefile.am | 5 ++++ + src/test-ot-metadata.cc | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 75 insertions(+) + +commit bc65ebbce765545bc4455d8ae5ba4a6a99201e41 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 24 02:28:09 2019 +0430 + + [meta] hb_ot_metadata_get_entries, tags iteration API + + src/hb-ot-meta-table.hh | 17 +++++++++++++++++ + src/hb-ot-metadata.cc | 28 ++++++++++++++++++++++++---- + src/hb-ot-metadata.h | 8 +++++++- + test/api/test-ot-metadata.c | 26 ++++++++++++++++++++++++++ + 4 files changed, 74 insertions(+), 5 deletions(-) + +commit 3ac03bd67cb9f4a72e636bf56bc4a79e04bcba62 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Mon Jul 22 23:35:08 2019 +0430 + + [meta] New API, hb_ot_metadata_reference_entry for fetching meta entries + + docs/harfbuzz-sections.txt | 6 +++++ + src/Makefile.sources | 2 ++ + src/harfbuzz.cc | 1 + + src/hb-config.hh | 1 + + src/hb-ot-face-table-list.hh | 4 ++- + src/hb-ot-face.cc | 1 + + src/hb-ot-layout.cc | 1 - + src/hb-ot-meta-table.hh | 20 +++++++++++++++ + src/hb-ot-metadata.cc | 57 ++++++++++++++++++++++++++++++++++++++++++ + src/hb-ot-metadata.h | 57 ++++++++++++++++++++++++++++++++++++++++++ + src/hb-ot.h | 1 + + test/api/Makefile.am | 1 + + test/api/fonts/meta.ttf | Bin 0 -> 320 bytes + test/api/test-ot-metadata.c | 58 +++++++++++++++++++++++++++++++++++++++++++ + 14 files changed, 208 insertions(+), 2 deletions(-) + +commit aab8e084873eb098c55ed2569c15bb308c59e436 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jul 26 02:19:22 2019 +0430 + + minor spacing fix (#1869) + + src/hb-open-type.hh | 16 ++++++++-------- + src/hb-ot-vorg-table.hh | 2 +- + src/hb-vector.hh | 8 ++++---- + 3 files changed, 13 insertions(+), 13 deletions(-) + +commit d791446a930f8e2009c5ab5ea389da98d1ed9b95 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jul 26 02:12:06 2019 +0430 + + [feat] minor + + src/hb-aat-layout-feat-table.hh | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +commit 356b68a00afaf972908cb2a478170e3933eaf974 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Thu Jul 25 23:22:00 2019 +0430 + + [metrics] Add a test that actually practices variation (#1858) + + test/api/fonts/TestCFF2VF.otf | Bin 0 -> 3636 bytes + test/api/test-ot-metrics.c | 28 ++++++++++++++++++++++++++-- + 2 files changed, 26 insertions(+), 2 deletions(-) + +commit a744fdc6c8217d0d4bfce30e638ed2e5200cf380 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Thu Jul 25 14:49:02 2019 +0430 + + Add _MAX_VALUE to hb_ot_metrics_t (#1861) + + src/hb-ot-metrics.cc | 4 ++-- + src/hb-ot-metrics.h | 4 +++- + 2 files changed, 5 insertions(+), 3 deletions(-) + +commit 069872c51b31fe1a618e3ca5c3b0ab8ccba0cf81 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Thu Jul 25 14:27:43 2019 +0430 + + minor + + src/hb-ot-layout.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 737eb85a4ec8861791157d83dd170ac48fa2cfc7 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Thu Jul 25 14:26:30 2019 +0430 + + Add _MAX_VALUE to disabled baseline types enum + + src/hb-ot-layout.cc | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +commit dd9a0ed3f0c0a8a94e107689318463d62414cf60 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 24 00:47:19 2019 +0430 + + Replace 0x7FFFFFFFu in enums with HB_TAG_MAX_SIGNED + + src/hb-aat-layout.h | 4 ++-- + src/hb-ot-var.h | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +commit 636ae422372ed7f17b695e78c9c9015188b204e8 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Mon Jul 22 22:50:21 2019 +0430 + + minor, comment out meta table in list till its use + + src/hb-ot-face-table-list.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 04c11a19b75663af35d16c827e295aa2e555d110 +Merge: 41ab56e0 c9796d15 +Author: Khaled Hosny <khaledhosny@eglug.org> +Date: Mon Jul 22 16:44:47 2019 +0200 + + Merge pull request #1851 from khaledhosny/fix-sbix-extents + + Fix sbix glyph extents + +commit 41ab56e09586b675b1c5de745cf5f520a808bba1 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Mon Jul 22 18:46:52 2019 +0430 + + Implement meta table parsing + + src/Makefile.sources | 1 + + src/hb-ot-face-table-list.hh | 1 + + src/hb-ot-layout.cc | 15 ++++---- + src/hb-ot-meta-table.hh | 89 ++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 99 insertions(+), 7 deletions(-) + +commit a51aa951b5ad8da4ac7effc891437345e012a0ac +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Mon Jul 22 18:35:55 2019 +0430 + + [metrics] Fix _get_variation API to works with actual coord values + + src/hb-ot-metrics.cc | 16 ++++++++-------- + src/hb-ot-metrics.h | 2 +- + test/api/test-ot-metrics.c | 2 +- + 3 files changed, 10 insertions(+), 10 deletions(-) + +commit 77141dff7d73fa6290f51c9e1ca56ce51a5deec0 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jul 22 07:48:32 2019 -0400 + + [metrics] _-prefix internal symbol + + src/hb-ot-font.cc | 12 ++++++------ + src/hb-ot-metrics.cc | 8 ++++---- + src/hb-ot-metrics.hh | 6 +++--- + 3 files changed, 13 insertions(+), 13 deletions(-) + +commit 89228ccb9a81b728bc9955082c17c68c848c50c4 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Jul 22 07:07:37 2019 -0400 + + Fix warning on IBM compilers + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1852 + + src/hb.hh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit c9796d15e1ec5f8939f8b1ae368cb3352b6a9cb9 +Author: Khaled Hosny <khaledhosny@eglug.org> +Date: Mon Jul 22 03:57:24 2019 +0200 + + Fix sbix glyph extents + + * The ‘height’ needs to be negated since the API returns “distance from + top to bottom side”. + * Similarly, the ‘y_offset‘ needs to be added to the height to get the + ‘y_bearing’, since sbix’s offset is “the point in the glyph relative + to its lower-left corner which corresponds to the origin” while + ‘y_bearing’ is the “top side of glyph from origin”. + + With these changes the sbix glyph metrics return values similar to other + tables, as they were otherwise unusable. + + src/hb-ot-color-sbix-table.hh | 4 ++-- + test/api/test-ot-color.c | 4 ++-- + .../fonts/fcbaa518d3cce441ed37ae3b1fed6a19e9b54efd.ttf | Bin 0 -> 3128 bytes + test/shaping/data/in-house/tests/color-fonts.tests | 1 + + 4 files changed, 5 insertions(+), 4 deletions(-) + +commit 759f3bd486c99bb09fb9fa5f42e621ec21399df8 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Mon Jul 22 02:06:07 2019 +0430 + + [metrics] Don't use metrics API in _common + + As it is exposed with a different condition + + src/hb-ot-metrics.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit eb8bd2f7eccde483d33406f102c69260fde6fe23 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 16 22:27:01 2019 +0430 + + Add hb_gdi_face_create API + + Based on Konstantin Ritt work posted on mailing list + + CMakeLists.txt | 8 +++++ + appveyor.yml | 2 +- + configure.ac | 23 +++++++++++++++ + docs/harfbuzz-sections.txt | 5 ++++ + src/Makefile.am | 8 +++++ + src/Makefile.sources | 3 ++ + src/harfbuzz.cc | 1 + + src/hb-directwrite.cc | 9 ++---- + src/hb-gdi.cc | 73 ++++++++++++++++++++++++++++++++++++++++++++++ + src/hb-gdi.h | 39 +++++++++++++++++++++++++ + src/hb-uniscribe.cc | 7 ----- + src/hb.hh | 5 ++++ + 12 files changed, 168 insertions(+), 15 deletions(-) + +commit 3d03bb84d44bc9ef8a77e974d0e937a3385ffb92 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sun Jul 21 12:38:04 2019 +0430 + + [metrics] minor, tweak comment + + src/hb-ot-metrics.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit e540d402f6120e8761ff655bdbffb07d91a5f643 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jul 19 11:19:31 2019 -0700 + + [docs] Minor + + docs/harfbuzz-sections.txt | 2 ++ + src/hb-ot-math.h | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +commit 00e13985fbc5291850b8ea3d021e5f83c8a297e3 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 23:03:51 2019 +0430 + + Revert hhea fallback to OS/2 to its reverse way + + As searching number of hhea having fonts beats the number of OS/2 + having ones in macOS 10.14.2 + + src/hb-ot-metrics.cc | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +commit c13ef9cc64a447e74abfed75f4f418bf644be88d +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 15:01:37 2019 +0430 + + Bring back asc/desc abs logic used to be in hmtx table + + src/hb-ot-metrics.cc | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +commit 772e62688cd72c02910f623653d2ec8ef6990928 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 14:50:31 2019 +0430 + + Make HB_TINY builds work again by separating the always needed part + + src/hb-ot-font.cc | 12 +++++----- + src/hb-ot-metrics.cc | 62 ++++++++++++++++++++++++++++++++++++++++------------ + src/hb-ot-metrics.hh | 5 +++++ + 3 files changed, 59 insertions(+), 20 deletions(-) + +commit cb704337407ae9ccb57ae7631567002028b93c84 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 14:33:57 2019 +0430 + + Merge _get_position_internal into _get_position + + src/hb-ot-metrics.cc | 143 ++++++++++++++++++--------------------------------- + src/hb-ot-metrics.hh | 5 -- + 2 files changed, 49 insertions(+), 99 deletions(-) + +commit ac3518af58464b33f1b16b34b8846c302b935208 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 14:03:36 2019 +0430 + + Define post table only when used + + src/hb-ot-face-table-list.hh | 2 ++ + 1 file changed, 2 insertions(+) + +commit 471f798ace08b4551f0c9ead6855a4e49b72ba25 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 14:00:20 2019 +0430 + + Merge ot-metrics-internal.cc with ot-metrics now that isn't needed in subset + + src/Makefile.sources | 3 -- + src/harfbuzz.cc | 1 - + src/hb-ot-metrics-internal.cc | 100 ------------------------------------------ + src/hb-ot-metrics.cc | 71 +++++++++++++++++++++++++++++- + 4 files changed, 70 insertions(+), 105 deletions(-) + +commit 29444d7e9fd5007bf39efa2cf57a0117aabfc770 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 13:52:21 2019 +0430 + + Don't cache ascender/descender metrics + + src/hb-ot-font.cc | 24 ++++++++---------------- + src/hb-ot-hmtx-table.hh | 20 -------------------- + 2 files changed, 8 insertions(+), 36 deletions(-) + +commit 5e28c2654d030655d7b93ec0d6213d2b9fb2956e +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 14:08:11 2019 +0430 + + [doc] minor, improve hb-ot-metrics doc a bit + + src/hb-ot-metrics.cc | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +commit ac8b6e330a443a66c3e0fb83af9794310688d848 +Merge: ec8dde81 08b48e89 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 13:16:16 2019 +0430 + + Merge pull request #1844 from ebraminio/hhea + + Fallback hhea's ascender/descender to OS2 + +commit 08b48e89d3c1bafe252badc7c65a9fc2f166a693 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 12:53:40 2019 +0430 + + [os2] minor spacing tweaks + + src/hb-ot-os2-table.hh | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +commit 54b9ab704dbf62e2916f1d5276ffef2543bcc2a7 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jul 20 12:51:38 2019 +0430 + + Fallback hhea's ascender/descender to OS2 + + src/hb-ot-metrics-internal.cc | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +commit ec8dde8142fbf9e5bc0aee9318a7c4e73d61c758 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jul 19 11:13:50 2019 -0700 + + [metrics] Fall back to hhea if OS2 metrics are empty + + Reinstates previous logic, even if it might be unnecessary. + + src/hb-ot-metrics-internal.cc | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +commit 2e5b49d11d1dbfd44d8c640cb9ce5de7d26ca873 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jul 19 11:41:07 2019 +0430 + + Add HB_NO_METRICS and fix HB_TINY build (#1839) + + src/hb-config.hh | 1 + + src/hb-ot-face-table-list.hh | 2 -- + src/hb-ot-metrics-internal.cc | 8 +++++++- + src/hb-ot-metrics.cc | 6 ++++++ + 4 files changed, 14 insertions(+), 3 deletions(-) + +commit bdfdac0f26aafb3e9ff2db123116f0406fa49efc +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jul 19 10:33:00 2019 +0430 + + [ci][fuzzer] print valgrind failure if an error happened + + test/fuzzing/run-shape-fuzzer-tests.py | 34 +++++++++++++++++----------------- + 1 file changed, 17 insertions(+), 17 deletions(-) + +commit 2bd953ff4f656f042dba2845f0479a7fe7c439a6 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jul 18 14:25:45 2019 -0700 + + [metrics] Fix weird use of xor + + I believe that was a try to use one approach as fallback to other. But + felt wrong. Just believe what's in OS/2 table to be correct. + + src/hb-ot-metrics-internal.cc | 12 ++++++------ + src/hb-ot-os2-table.hh | 2 +- + 2 files changed, 7 insertions(+), 7 deletions(-) + +commit 9675a067bf1cc0e5d4707c1345736fda4be75b82 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jul 18 14:15:08 2019 -0700 + + [ot-metrics] Touch up + + src/harfbuzz.cc | 2 ++ + src/hb-ot-hmtx-table.hh | 19 +++++++++---------- + 2 files changed, 11 insertions(+), 10 deletions(-) + +commit 87e628436e32786635796fbb07ed200f8c0da68f +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Nov 20 23:26:46 2018 +0330 + + Implement a simple API for fetching opentype metrics + + Fixes https://github.com/harfbuzz/harfbuzz/pull/1432 + + docs/harfbuzz-sections.txt | 9 +++ + src/Makefile.sources | 6 ++ + src/hb-ot-face-table-list.hh | 2 + + src/hb-ot-hhea-table.hh | 2 + + src/hb-ot-hmtx-table.hh | 62 +++++++++---------- + src/hb-ot-layout.cc | 1 - + src/hb-ot-metrics-internal.cc | 94 +++++++++++++++++++++++++++++ + src/hb-ot-metrics.cc | 135 ++++++++++++++++++++++++++++++++++++++++++ + src/hb-ot-metrics.h | 92 ++++++++++++++++++++++++++++ + src/hb-ot-metrics.hh | 35 +++++++++++ + src/hb-ot-os2-table.hh | 4 ++ + src/hb-ot-post-table.hh | 5 +- + src/hb-ot.h | 1 + + test/api/Makefile.am | 1 + + test/api/test-ot-metrics.c | 54 +++++++++++++++++ + 15 files changed, 467 insertions(+), 36 deletions(-) + +commit ed67efcc8c3638c625b2904833af3f27ef51db14 +Author: David Corbett <corbett.dav@husky.neu.edu> +Date: Mon Jun 17 10:16:24 2019 -0400 + + Revert "[Myanmar] Prevent reordering between Asat and Dot below" + + This reverts commit 1c8654ead41ca746d577549c92d2a41c594ab639. + + src/hb-unicode.hh | 3 --- + 1 file changed, 3 deletions(-) + +commit 504bb17287c978d60a4a515555852465319f74ed +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 17 22:57:46 2019 +0430 + + [ci] Bring back -linux-arm64 bot + + Let's see if 576065b has fixed it + + .circleci/config.yml | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +commit 6157bbe5127bbcbd17348622601976cffcd11c63 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jul 17 11:20:08 2019 -0700 + + Revert "Revert previous change" + + This reverts commit b8e90ca1a10fbd472eda1aa8cc3797011da52356. + + Works now. + + src/hb-subset-plan.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 576065b4429109359c3af491b34b9ab0c6b149ee +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jul 17 11:19:34 2019 -0700 + + [iter] Fix reduce type deduction + + src/hb-iter.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 4552864c82c876da738ec3bf772cc089216f2fd2 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 17 22:08:39 2019 +0430 + + [ci] Disable -linux-arm64 bot + + This is its failure https://circleci.com/gh/harfbuzz/harfbuzz/99864 + + Trying to fix like ee05627, interestingly, makes the bot and the + others to fail like this https://circleci.com/gh/harfbuzz/harfbuzz/99841 + + .circleci/config.yml | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +commit b8e90ca1a10fbd472eda1aa8cc3797011da52356 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 17 21:38:19 2019 +0430 + + Revert previous change + + Interestingly all of the bots disagreed with the change and the complain is... weird. + + src/hb-subset-plan.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit ee05627aff2993c51ed8a4bff3170450c000a28a +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 17 21:28:25 2019 +0430 + + Improve syntax to make out linux-arm64 a little happy + + Decided to apply is we did the same on other places however this won't + fix all of its complains + + src/hb-subset-plan.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 6a6bf7b7bc4a0b375fcf04ff7c674bf76e6d51aa +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 17 21:22:38 2019 +0430 + + Downgrade -Wdeprecated-declarations to warning + + Fixes #1834 at least till fix of #1829 + + src/hb.hh | 1 + + 1 file changed, 1 insertion(+) + +commit 25e2562fdff6c14a9cb70999a1ad71ee1bdff494 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jul 17 09:35:56 2019 -0700 + + [amalgam] Fix redundant-declaration warning/error + + src/hb-unicode.cc | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +commit c184180228540c23405aaa03b6b571bb41103b45 +Author: Ali Javadi <ali.djavadi@gmail.com> +Date: Tue Jul 16 22:10:24 2019 +0430 + + Fix C++20 compile warning on implicit capture of this with '=' default capture (#1833) + + Happens when compiled with -std=c++2a, the fix just makes the captures explicit to resolve the issue. Just adding this in addition to = doesn't work in C++11. + + src/hb-ot-layout-gpos-table.hh:737:18: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture] + { return (this+_).intersects (glyphs, valueFormat); }) + ^ + src/hb-ot-layout-gpos-table.hh:736:16: note: add an explicit capture of 'this' to capture '*this' by reference + | hb_map ([=] (const OffsetTo<PairSet> &_) + ^ + , this + + src/hb-ot-layout-gpos-table.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 1f94388516befe137d265c261f687a47ce6f8e69 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Tue Jul 16 11:24:29 2019 +0430 + + [usp] define atfree callback only if used + + src/hb-uniscribe.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 1da1b4dc94c500e4c9c833ab74fced07364d13fb +Author: Qunxin Liu <qxliu@google.com> +Date: Wed Jun 26 13:23:24 2019 -0700 + + [subset] For option "--unicodes", add support for "*" to retain all code points + + ...aa-Regular-new.default.retain-all-codepoint.ttf | Bin 0 -> 97204 bytes + ...drop-hints-retain-gids.retain-all-codepoint.ttf | Bin 0 -> 65976 bytes + ...Regular-new.drop-hints.retain-all-codepoint.ttf | Bin 0 -> 65936 bytes + ...a-Regular-new.name-ids.retain-all-codepoint.ttf | Bin 0 -> 96948 bytes + ...egular-new.retain-gids.retain-all-codepoint.ttf | Bin 0 -> 97244 bytes + ...to-Regular.abc.default.retain-all-codepoint.ttf | Bin 0 -> 2168 bytes + ...drop-hints-retain-gids.retain-all-codepoint.ttf | Bin 0 -> 924 bytes + ...Regular.abc.drop-hints.retain-all-codepoint.ttf | Bin 0 -> 924 bytes + ...o-Regular.abc.name-ids.retain-all-codepoint.ttf | Bin 0 -> 2168 bytes + ...egular.abc.retain-gids.retain-all-codepoint.ttf | Bin 0 -> 2168 bytes + test/subset/data/tests/basics.tests | 1 + + test/subset/subset_test_suite.py | 20 +++++++--- + util/hb-subset.cc | 7 ++++ + util/options.cc | 44 ++++++++++++--------- + 14 files changed, 48 insertions(+), 24 deletions(-) + +commit 4730b350b7ee90338caf3e962343af42412ce3df +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jul 12 15:38:35 2019 -0700 + + Revert "Update Graphite API to latest (#1215)" + + This reverts commit e4e74c2751ac24178086cce2811d34d8019b6f85. + + See https://github.com/harfbuzz/harfbuzz/issues/1829 + + src/hb-graphite2.cc | 28 +--------------------------- + 1 file changed, 1 insertion(+), 27 deletions(-) + +commit f8242b61ab01002e9f7374daa8755e92c6a92eb4 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Thu Jul 11 15:10:36 2019 +0430 + + [fuzz] Increase subset runner timeout for tsan bot + + Now is flaky let's just increase and maybe investigate later + + test/fuzzing/run-subset-fuzzer-tests.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit b65bad18aa527684af999b5808a9087404c0759a +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Thu Jul 11 14:31:55 2019 +0430 + + [fuzz] Don't fail when blob is empty + + And enable more tests able to trig the issue. + + ...zz-testcase-minimized-hb-subset-fuzzer-5738978499624960 | Bin 0 -> 28 bytes + test/fuzzing/hb-subset-fuzzer.cc | 2 +- + test/fuzzing/run-subset-fuzzer-tests.py | 9 +++++---- + 3 files changed, 6 insertions(+), 5 deletions(-) + +commit 7a9d643c297990f9889a2f7b4a470ef933bac131 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Thu Jul 11 01:35:06 2019 +0430 + + Fix unintialized memory read in cmap subset (#1826) + + src/hb-ot-cmap-table.hh | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +commit a6065d05cf38620c06b6dd10b8a841ed236f76c2 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 10 16:41:40 2019 +0430 + + Don't call memcpy when a table is empty + + src/hb-open-file.hh | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +commit c85f624b519df1db141bf55d9452bc2837ef35c4 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Wed Jul 10 14:28:06 2019 +0430 + + Force blob generation and memory check in hb-subset-fuzzer + + test/fuzzing/hb-subset-fuzzer.cc | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +commit 2e7021da7d1726a37822e6a001b9218f82255bc8 +Author: Dominik Röttsches <drott@chromium.org> +Date: Mon Jul 8 10:19:49 2019 +0300 + + Revert "Minor" - revert moving extern "C" definitions in-function + + This reverts commit 62e60322cb9e18b3ee75f1b4a2a6d3069f587407 since it + breaks building HarfBuzz as part of Chromium. + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1821. + + src/hb-unicode.cc | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +commit f18ea1dd3a9961661a383b2966de57ea68a267e7 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jul 5 13:56:45 2019 -0700 + + [font] Remove division when scaling + + Yoohoo. This seems to be precise enough! Let's see if it sticks. + I'm asking Dominik to run this in Chrome test suite and report. + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1801 + + src/hb-font.hh | 23 +++++++++-------------- + src/hb-ot-math-table.hh | 16 ++++++++-------- + 2 files changed, 17 insertions(+), 22 deletions(-) + +commit b847769292aca13345fd1facae35aaf999198ad4 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jul 5 13:52:09 2019 -0700 + + [font] Keep font-space to user-space multiplier + + Part of https://github.com/harfbuzz/harfbuzz/issues/1801 + + src/hb-font.cc | 5 +++++ + src/hb-font.hh | 13 +++++++++++-- + 2 files changed, 16 insertions(+), 2 deletions(-) + +commit df6edcd44ceb63d01d9c0d6d2aa06b6c6cbb914d +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jul 5 13:45:15 2019 -0700 + + Make face immutable in hb_font_set_face() + + src/hb-font.cc | 1 + + 1 file changed, 1 insertion(+) + +commit 0d425e1eeaea97bf5e4fc9ce40e549332bc0cea1 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jul 5 13:18:05 2019 -0700 + + [ot-font] Optimize rounding + + Part of https://github.com/harfbuzz/harfbuzz/issues/1801 + + The assumption that compiler optimizes "upem/2" to a shift only + works if upem is unsigned... Anyway, spoon-feed the compiler. + + src/hb-font.hh | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +commit 144326e215671a42fb3ac9f00ddef779ba354345 +Author: Simon Sapin <simon.sapin@exyr.org> +Date: Fri Jul 5 19:05:11 2019 +0200 + + Clusters are reversed based on the direction, not script + + Fixes https://github.com/harfbuzz/harfbuzz/issues/1818 + + docs/usermanual-clusters.xml | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +commit cf1a782a5ca82a880906cae3d4cb76b10ec2aad2 +Author: Simon Sapin <simon.sapin@exyr.org> +Date: Thu Jul 4 21:06:59 2019 +0200 + + Docs: fix a typo in function name + + docs/usermanual-fonts-and-faces.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit ffa736f151f27adb76fb0bf91e18e1ec5cb8fe8d +Author: Simon Sapin <simon.sapin@exyr.org> +Date: Thu Jul 4 23:05:50 2019 +0200 + + hb_set_previous_range docs: fix presumed copy/paste error + + src/hb-set.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 641f33738089ef7ccbedce09886309edcd2e1718 +Author: Simon Sapin <simon.sapin@exyr.org> +Date: Thu Jul 4 23:03:45 2019 +0200 + + Docs typo fix: slower → lower + + src/hb-set.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 9fea6b4dd41bfe2b85f788523162658a7ab9bd49 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jul 5 18:46:41 2019 +0430 + + [amalgam] Use it in cmake port and fix conflicts (#1812) + + .circleci/config.yml | 8 ++--- + CMakeLists.txt | 74 ++++-------------------------------------- + src/Makefile.am | 2 ++ + src/hb-cff-interp-common.hh | 6 ++-- + src/hb-cff-interp-cs-common.hh | 2 +- + src/hb-coretext.cc | 4 +-- + src/hb-directwrite.cc | 14 ++++---- + src/hb-ft.cc | 4 +-- + 8 files changed, 27 insertions(+), 87 deletions(-) + +commit b240d701fd98efa59a7f772ff39654fc95b8fc8f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jul 3 12:17:57 2019 -0700 + + [amalgam] Include integration source files as well + + Just for those that are normally built into libharfbuzz itself. + + Part of https://github.com/harfbuzz/harfbuzz/issues/1809 + + src/Makefile.am | 12 ++++++++++-- + src/harfbuzz.cc | 6 ++++++ + 2 files changed, 16 insertions(+), 2 deletions(-) + +commit d51524204528b36907ab0f48bf2a48ec124c93d9 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jul 3 12:10:03 2019 -0700 + + [amalgam] Rename hb.cc to harfbuzz.cc + + Part of https://github.com/harfbuzz/harfbuzz/issues/1809 + + src/Makefile.am | 8 ++++---- + src/{hb.cc => harfbuzz.cc} | 0 + 2 files changed, 4 insertions(+), 4 deletions(-) + +commit 4cb180d227c1adc32e921c241a93cd1f50a98d33 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 19:44:18 2019 -0700 + + Revert "Use constexpr to replace passthru_ bools" + + This reverts commit c4aa10ebc8dc28b1f9c90af2ca2092a7535f8395. + + Broke several compilers... Sigh. The version without constexpr + didn't fully optimize out the unreachable code on clang. + So, revert it is... + + src/hb-algs.hh | 8 ++++++++ + src/hb-set.hh | 18 ++++++++---------- + 2 files changed, 16 insertions(+), 10 deletions(-) + +commit c4aa10ebc8dc28b1f9c90af2ca2092a7535f8395 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 19:15:03 2019 -0700 + + Use constexpr to replace passthru_ bools + + src/hb-algs.hh | 8 -------- + src/hb-set.hh | 18 ++++++++++-------- + 2 files changed, 10 insertions(+), 16 deletions(-) + +commit 2e48fd077954410f59156b3100c16bf56a507948 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 17:55:58 2019 -0700 + + Sprinkle constexpr around + + Being conservative. Also not sure it makes any real difference + in our codebase. + + src/hb-algs.hh | 48 ++++++++++++++++++++++++------------------------ + src/hb-meta.hh | 18 +++++++++--------- + 2 files changed, 33 insertions(+), 33 deletions(-) + +commit df4448064e370a410404708a15ce819daf1d9386 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 17:11:09 2019 -0700 + + Remove unused 'inline' specifier + + src/hb-ot-map.hh | 4 ++-- + src/hb-shape-plan.hh | 18 +++++++++--------- + 2 files changed, 11 insertions(+), 11 deletions(-) + +commit 04a4957040380bba58880ff51d529c5cccf1d2c7 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 16:19:18 2019 -0700 + + [amalgam] Add hb.cc to git + + Part of https://github.com/harfbuzz/harfbuzz/issues/1809 + + src/Makefile.am | 1 + + src/hb.cc | 44 ++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 45 insertions(+) + +commit 62e60322cb9e18b3ee75f1b4a2a6d3069f587407 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 16:07:03 2019 -0700 + + Minor + + src/hb-unicode.cc | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +commit ceb4c212dc91a277f646c4a5354e4362f548a9f6 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 16:02:13 2019 -0700 + + [amalgam] Fix UCD issue + + This actually makes it build now! + + Part https://github.com/harfbuzz/harfbuzz/issues/1809 + + Keeping open to add tests, CI, etc. + + src/hb-ucd.cc | 5 +---- + src/hb-unicode.cc | 2 -- + src/hb-unicode.hh | 3 +++ + 3 files changed, 4 insertions(+), 6 deletions(-) + +commit 7ca54811f471a28163de6b3c561990c85aa39880 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 16:00:58 2019 -0700 + + [amalgam] Fix CFF + + Part of https://github.com/harfbuzz/harfbuzz/issues/1809 + + src/hb-ot-cff1-table.cc | 18 +++++++++--------- + src/hb-ot-cff2-table.cc | 16 ++++++++-------- + 2 files changed, 17 insertions(+), 17 deletions(-) + +commit 3724f13ba0292055197efdbfcacfe3d7b067175c +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 15:23:00 2019 -0700 + + [amalgam] Finish fixing Indic-like shapers + + Part of https://github.com/harfbuzz/harfbuzz/issues/1809 + + src/hb-ot-shape-complex-indic.cc | 34 +++++++++++++++++----------------- + src/hb-ot-shape-complex-indic.hh | 9 ++++++++- + src/hb-ot-shape-complex-khmer.cc | 18 +++++++++--------- + src/hb-ot-shape-complex-khmer.hh | 17 ++++++++--------- + src/hb-ot-shape-complex-myanmar.cc | 8 ++++---- + src/hb-ot-shape-complex-myanmar.hh | 16 ++++++++-------- + src/hb-ot-shape-complex-use.cc | 14 +++++++------- + 7 files changed, 61 insertions(+), 55 deletions(-) + +commit eb37bc9d93b3abebee24390708940510fe37477a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 15:19:39 2019 -0700 + + [use] Remove Syriac features + + This was non-standard, and unused anyway. + + src/hb-ot-shape-complex-use.cc | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +commit dc480fc4717937d53cf38860a5c5d48211e8cbc8 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 15:17:56 2019 -0700 + + [amalgam] More Indic-like issues + + Part of https://github.com/harfbuzz/harfbuzz/issues/1809 + + src/hb-ot-shape-complex-indic.cc | 76 +++++++++++++++++++++------------------- + src/hb-ot-shape-complex-khmer.cc | 36 ++++++++++--------- + src/hb-ot-shape-complex-use.cc | 32 ++++++++--------- + 3 files changed, 74 insertions(+), 70 deletions(-) + +commit d8b5353e07650cf243ba182dbf52e7f198719762 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 15:09:26 2019 -0700 + + [amalgam] More + + Part of https://github.com/harfbuzz/harfbuzz/issues/1809 + + src/hb-ot-shape-complex-myanmar.cc | 28 ++++++++++++++-------------- + src/hb-ot-shape-complex-use.cc | 28 ++++++++++++++-------------- + 2 files changed, 28 insertions(+), 28 deletions(-) + +commit d115a9e022c0b687fb402cfd2b90d516beded5c0 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 14:42:45 2019 -0700 + + [amalgam] Fix most duplicate-id instances in Indic-like shapers + + Part of https://github.com/harfbuzz/harfbuzz/issues/1809 + + src/hb-ot-layout.hh | 22 +++++ + src/hb-ot-shape-complex-indic-machine.hh | 6 +- + src/hb-ot-shape-complex-indic-machine.rl | 6 +- + src/hb-ot-shape-complex-indic.cc | 130 +++++++++---------------- + src/hb-ot-shape-complex-indic.hh | 26 +++++ + src/hb-ot-shape-complex-khmer-machine.hh | 6 +- + src/hb-ot-shape-complex-khmer-machine.rl | 6 +- + src/hb-ot-shape-complex-khmer.cc | 97 ++++++------------- + src/hb-ot-shape-complex-myanmar-machine.hh | 4 +- + src/hb-ot-shape-complex-myanmar-machine.rl | 4 +- + src/hb-ot-shape-complex-myanmar.cc | 69 ++++++-------- + src/hb-ot-shape-complex-use-machine.hh | 4 +- + src/hb-ot-shape-complex-use-machine.rl | 4 +- + src/hb-ot-shape-complex-use.cc | 148 ++++++++++++----------------- + 14 files changed, 230 insertions(+), 302 deletions(-) + +commit c073233f45da6ad8131dd38cb43b125f48c17432 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 14:26:45 2019 -0700 + + Add make rule to build hb.cc + + Part of https://github.com/harfbuzz/harfbuzz/issues/1809 + + src/Makefile.am | 6 ++++++ + 1 file changed, 6 insertions(+) + +commit f1d20d9b4dcbeead3757650b9286393918b4be8a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Jul 2 14:18:38 2019 -0700 + + Add ucd-table make target + + src/Makefile.am | 23 +++++++++++++++-------- + src/gen-ucd-table.py | 8 +++++--- + 2 files changed, 20 insertions(+), 11 deletions(-) + +commit 040b261deeed8924edcb087e27a61392d1f85023 +Author: Michiharu Ariza <ariza@typekit.com> +Date: Sun Jun 30 16:13:07 2019 -0700 + + add bimap test along with bug fix/tweaks + + src/Makefile.am | 6 ++++- + src/hb-bimap.hh | 4 +++ + src/test-bimap.cc | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 85 insertions(+), 1 deletion(-) + +commit 9c93f5cc2de5c60d5464a65890fc7d8c25aa9702 +Merge: ad341d5f 4ab2d1d6 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Mon Jul 1 20:08:22 2019 +0430 + + Merge pull request #1806 from carlo-bramini/master + + Make harfbuzz working on all existing versions of Windows + +commit 4ab2d1d6767568c45495be515e016805cce0c69a +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Mon Jul 1 19:30:21 2019 +0430 + + [dwrite] Apply minor style improves + + src/hb-directwrite.cc | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +commit 5ebd265e66cbcd167469837dcf8647484310dfb5 +Author: Carlo Bramini <30959007+carlo-bramini@users.noreply.github.com> +Date: Mon Jul 1 16:06:43 2019 +0200 + + Fix error rised by GCC8+ + + src/hb-directwrite.cc | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +commit 693dacbb1c0bc805e3e6aedaca5a57f04eb6ec9c +Author: Carlo Bramini <30959007+carlo-bramini@users.noreply.github.com> +Date: Mon Jul 1 13:31:26 2019 +0200 + + Use lower case file name with #include + + I tried to cross compile harfbuzz for Windows and an error was generated because `DWrite_1.h` was not found. + This happened because the filesystem is case sensitive and for this reason that include file was not found. + The right name of the file to be used is `dwrite_1.h`, with all letters not capitalized: + https://docs.microsoft.com/en-us/windows/desktop/api/dwrite_1/ + I also verified in the installation of VS2017 with Windows Kit v10 and in that place it was also lower case. + So, in my opinion it should be better to change this. + + src/hb-directwrite.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit a4543d408b31376c38bab878b2f72d4323abc564 +Author: Carlo Bramini <30959007+carlo-bramini@users.noreply.github.com> +Date: Sun Jun 30 15:06:30 2019 +0200 + + Empty DIRECTWRITE_LIBS + + Not used anymore since DWRITE is loaded dynamically. + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 601b6825b05f67354b48dd3629b95e0d8bf68a14 +Author: Carlo Bramini <30959007+carlo-bramini@users.noreply.github.com> +Date: Sun Jun 30 15:03:44 2019 +0200 + + Dynamically load DWRITE + + Also checks if DWriteCreateFactory() has been executed successfully. + + src/hb-directwrite.cc | 41 +++++++++++++++++++++++++++++++++-------- + 1 file changed, 33 insertions(+), 8 deletions(-) + +commit ad341d5f1624f4e30b2d0eb2a171054a973053b5 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Jun 28 16:00:37 2019 -0700 + + [config] Fix CoreText build with NO_AAT + + src/hb-aat-layout.cc | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +commit 3f806673fbeacdbe1b31399394ccc26c773a794b +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Sat Jun 29 00:00:00 2019 +0430 + + Apply some minor improves on CFFIndex + + src/hb-ot-cff-common.hh | 38 +++++++++++++------------------------- + 1 file changed, 13 insertions(+), 25 deletions(-) + +commit ddd29e5594ccc9d0281e6da7373a1f115f6f6f3a +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jun 28 23:44:14 2019 +0430 + + minor, reuse StructAtOffset logic in StructAtOffsetOrNull + + src/hb-ot-cff-common.hh | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +commit 9db7ce73d7ac6566837cdd70d38c45f3aefd7769 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jun 28 23:11:52 2019 +0430 + + minor style improve in hb-cff-interp-common.hh + + src/hb-cff-interp-common.hh | 91 +++++++++++++++------------------------------ + 1 file changed, 30 insertions(+), 61 deletions(-) + +commit 9a7b7bd9fc5bde7796ffdd997ee65cb33cbf6b29 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Fri Jun 28 22:53:51 2019 +0430 + + style fix for pylint complain + + src/gen-emoji-table.py | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +commit 8d36ef50c8712be476572514d73b7bddf43e5951 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jun 27 14:48:10 2019 -0700 + + [config] Add links + + CONFIG.md | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +commit f53590971c5326dd15f4296764bfd1255ec0506a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Thu Jun 27 13:42:51 2019 -0700 + + [test] Make Unicode tests strict against internal UCD + + https://github.com/harfbuzz/harfbuzz/pull/1799 + + test/api/test-unicode.c | 30 ++++++++++++++++++++++-------- + 1 file changed, 22 insertions(+), 8 deletions(-) + +commit d42264f151a61a4a77e5d5712e535fc6e2daf338 +Author: David Corbett <corbett.dav@husky.neu.edu> +Date: Wed Jun 26 21:10:11 2019 -0400 + + Test at least one character per Unicode version + + test/api/test-unicode.c | 142 ++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 138 insertions(+), 4 deletions(-) + +commit 7185bd6ffb4dd8c0efebdab5b930e62c5695e3ab +Merge: cd65305b 8341c0b3 +Author: Ebrahim Byagowi <ebrahim@gnu.org> +Date: Thu Jun 27 22:09:28 2019 +0430 + + Merge pull request #1800 from harfbuzz/harfbuzz/cffnull_fix2 + + [CFF] fix for Subrs null ptr access + +commit 8341c0b304ee3bb0b7d150bcfb42a8b9e6448687 +Author: Michiharu Ariza <ariza@typekit.com> +Date: Thu Jun 27 08:43:31 2019 -0700 + + add test case file + + ...z-testcase-minimized-harfbuzz_fuzzer-5093685255077888 | Bin 0 -> 1160 bytes + 1 file changed, 0 insertions(+), 0 deletions(-) + +commit 01832fd16b605971466fc3b174cb932787ef4bfb +Author: Michiharu Ariza <ariza@typekit.com> +Date: Wed Jun 26 15:58:38 2019 -0700 + + alternate fix for https://crbug.com/971933 + + src/hb-cff-interp-cs-common.hh | 6 +++--- + src/hb-cff1-interp-cs.hh | 2 +- + src/hb-cff2-interp-cs.hh | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +commit cd65305b059e7495f4f993d25cfda4d88781589b +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 14:57:48 2019 -0700 + + [config] Don't disable emoji sequences in HB_TINY + + It makes sense to disable this code these if editing is not needed. + However, this is also necessary to correctly display emoji sequences + in right-to-left direction. For that reason, don't auto-disable it. + + src/hb-config.hh | 1 - + src/hb-ot-shape.cc | 2 +- + src/hb-unicode.cc | 2 +- + 3 files changed, 2 insertions(+), 3 deletions(-) + +commit 7298716a3cfbdabedd15960404623317a64db3ae +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 14:51:17 2019 -0700 + + [config] Compile out modified combining-class if HB_NO_OT_SHAPE + + Part of https://github.com/harfbuzz/harfbuzz/issues/1652 + + src/hb-unicode.cc | 2 ++ + 1 file changed, 2 insertions(+) + +commit 1cdd0fa60d9a6aaddc20e646d294d642e2db9be4 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 14:49:15 2019 -0700 + + [emoji] Port generator to packtab + + src/gen-emoji-table.py | 18 ++++-- + src/hb-unicode-emoji-table.hh | 126 ++++++++++++++++-------------------------- + src/hb-unicode.cc | 5 +- + 3 files changed, 60 insertions(+), 89 deletions(-) + +commit 5130c90ac0173c542b550049c93738ab5de84bb9 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 14:29:39 2019 -0700 + + [config] Add HB_NO_EMOJI + + Part of https://github.com/harfbuzz/harfbuzz/issues/1652 + + src/hb-config.hh | 1 + + src/hb-ot-shape.cc | 2 ++ + src/hb-unicode.cc | 2 ++ + 3 files changed, 5 insertions(+) + +commit 9d5b5348c7ca1e39faa9e197fdebfb8f5d3aeece +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 13:58:40 2019 -0700 + + [config] Add HB_NO_SHAPER + + Don't know who would want when why. But makes sense to have. + + src/hb-shaper-list.hh | 6 ++++++ + src/hb-shaper.cc | 2 ++ + 2 files changed, 8 insertions(+) + +commit 8fe15485cbc2f56adb29d4d5f0c3957869bd0e1a +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 13:49:42 2019 -0700 + + [config] Add HB_NO_OT_TAG + + Part of https://github.com/harfbuzz/harfbuzz/issues/1652 + + src/hb-config.hh | 1 + + src/hb-ot-layout.cc | 4 ++++ + src/hb-ot-tag.cc | 5 +++++ + src/hb-uniscribe.cc | 4 ++++ + 4 files changed, 14 insertions(+) + +commit 7dcf8e126ecf52c67f59745e04d21df68b1a6992 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 13:44:10 2019 -0700 + + [config] Fix build with HB_NO_OT_LAYOUT + + src/hb-ot-face-table-list.hh | 2 ++ + src/hb-ot-layout-gpos-table.hh | 3 ++- + src/hb-ot-layout-gsub-table.hh | 5 +++-- + src/hb-ot-layout-gsubgpos.hh | 8 +++++++- + 4 files changed, 14 insertions(+), 4 deletions(-) + +commit 2804790bceb9398cc9b668ca63f5aa9ffe29beeb +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 13:38:14 2019 -0700 + + [config] Add dependency + + src/hb-ot-shape.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +commit b0fd16eec62dea29d984bab879064ae9d91afdfc +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 13:31:51 2019 -0700 + + [config] Add dependency + + src/hb-config.hh | 4 ++++ + 1 file changed, 4 insertions(+) + +commit 12092a46d8826eec5dcf69e7817921380e4bc507 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 13:31:01 2019 -0700 + + [config] Rename HB_NO_SHAPE_AAT to HB_NO_AAT_SHAPE + + src/hb-aat-map.cc | 2 +- + src/hb-config.hh | 2 +- + src/hb-ot-kern-table.hh | 14 +++++++------- + src/hb-ot-layout.cc | 2 +- + src/hb-ot-shape.cc | 36 ++++++++++++++++++------------------ + src/hb-ot-shape.hh | 8 ++++---- + 6 files changed, 32 insertions(+), 32 deletions(-) + +commit bb4bbe617d3878ca7e5e359ada493c68ec7f0a90 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 13:29:58 2019 -0700 + + [config] Add HB_NO_OT_LAYOUT + + Part of https://github.com/harfbuzz/harfbuzz/issues/1652 + + src/hb-config.hh | 1 + + src/hb-ot-layout.cc | 7 +++++++ + src/hb-ot-map.cc | 7 +++++++ + 3 files changed, 15 insertions(+) + +commit ab40a2feecf53d2ef787b7785132bf57e5bdcff9 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 13:25:02 2019 -0700 + + [config] Enable HB_NO_OT_FONT in HB_NO_OT + + CONFIG.md | 4 ++-- + src/hb-config.hh | 1 + + 2 files changed, 3 insertions(+), 2 deletions(-) + +commit 7aad53657eb23264f658711a71da3e50f2264455 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 13:21:03 2019 -0700 + + [config] Add HB_NO_OT_SHAPE / HB_NO_OT + + Part of https://github.com/harfbuzz/harfbuzz/issues/1652 + + CONFIG.md | 14 ++++++++++++++ + src/gen-indic-table.py | 6 ++++++ + src/gen-use-table.py | 6 ++++++ + src/gen-vowel-constraints.py | 7 +++++++ + src/hb-config.hh | 4 ++++ + src/hb-ot-shape-complex-arabic.cc | 6 ++++++ + src/hb-ot-shape-complex-default.cc | 7 +++++++ + src/hb-ot-shape-complex-hangul.cc | 7 +++++++ + src/hb-ot-shape-complex-hebrew.cc | 7 +++++++ + src/hb-ot-shape-complex-indic-table.cc | 6 ++++++ + src/hb-ot-shape-complex-indic.cc | 7 +++++++ + src/hb-ot-shape-complex-khmer.cc | 7 +++++++ + src/hb-ot-shape-complex-myanmar.cc | 7 +++++++ + src/hb-ot-shape-complex-thai.cc | 7 +++++++ + src/hb-ot-shape-complex-use-table.cc | 6 ++++++ + src/hb-ot-shape-complex-use.cc | 7 +++++++ + src/hb-ot-shape-complex-vowel-constraints.cc | 6 ++++++ + src/hb-ot-shape-fallback.cc | 7 +++++++ + src/hb-ot-shape-normalize.cc | 7 +++++++ + src/hb-ot-shape.cc | 7 +++++++ + src/hb-shape-plan.cc | 10 ++++++++++ + src/hb-shape-plan.hh | 4 ++++ + src/hb-shaper-list.hh | 2 ++ + 23 files changed, 154 insertions(+) + +commit cee9f6e044278b590694f4dff6f22eaad9371385 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 13:01:58 2019 -0700 + + Fail compile if no shapers enabled + + src/hb-shaper.cc | 1 + + 1 file changed, 1 insertion(+) + +commit 8786820a5a7406be95bc4a6b6e2aca736126420c +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Wed Jun 26 12:53:57 2019 -0700 + + [src] Add make targets "tiny" and "tinyz" + + src/Makefile.am | 4 ++++ + 1 file changed, 4 insertions(+) + commit b14e413fae8f14b75c5956e9b38e413c878ded0c Author: Behdad Esfahbod <behdad@behdad.org> Date: Wed Jun 26 10:44:10 2019 -0700 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS index 20bb21ba250..cbec26512aa 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS +++ b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS @@ -1,3 +1,26 @@ +Overview of changes leading to 2.6.0 +Tuesday, August 13, 2019 +==================================== +- New OpenType metrics, baseline, and metadata table access APIs. +- New API to set font variations to a named-instance. +- New hb-gdi.h header and API for creating hb_face_t from HFONT. +- Amalgam: Provide a single-file harfbuzz.cc file for easier alternate building. +- More size-reduction configurable options, enabled by HB_TINY. +- New API: ++hb_font_set_var_named_instance() ++hb_gdi_face_create() ++hb_ot_layout_baseline_tag_t ++hb_ot_layout_get_baseline() ++hb_ot_meta_tag_t ++hb_ot_meta_get_entry_tags() ++hb_ot_meta_reference_entry() ++hb_ot_metrics_tag_t ++hb_ot_metrics_get_position() ++hb_ot_metrics_get_variation() ++hb_ot_metrics_get_x_variation() ++hb_ot_metrics_get_y_variation() + + Overview of changes leading to 2.5.3 Wednesday, June 26, 2019 ==================================== diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/README.python.md b/Build/source/libs/harfbuzz/harfbuzz-src/README.python.md index 7cf091a09b1..d9aaf898717 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/README.python.md +++ b/Build/source/libs/harfbuzz/harfbuzz-src/README.python.md @@ -6,21 +6,21 @@ you can install that this way: sudo apt-get install libgirepository1.0-dev ``` -And then run autogen.sh (if building from git), and then: +And then run `autogen.sh` (if building from git), and then: ```bash ./configure --with-gobject --enable-introspection ``` -Make sure that gobject-introspection is enabled then in the final report. +Make sure that gobject-introspection is reported enabled then in the `configure` script output. Compile and install. -Make sure you have the installation lib dir in LD_LIBRARY_PATH, as needed +Make sure you have the installation lib dir in `LD_LIBRARY_PATH`, as needed for the linker to find the library. -Then make sure you also have GI_TYPELIB_PATH pointing to the resulting -$prefix/lib/girepository-* directory. +Then make sure you also have `GI_TYPELIB_PATH` pointing to the resulting +`$prefix/lib/girepository-*` directory. Make sure you have pygobject installed. Then check that the following import works in your Python interpreter: @@ -30,7 +30,7 @@ from gi.repository import HarfBuzz ``` If it does, you are ready to call HarfBuzz from Python! Congratulations. -See src/sample.py. +See [`src/sample.py`](src/sample.py). The Python API will change. Let us know on the mailing list if you are using it, and send lots of feedback. diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in b/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in index 6e91e2e9f7f..939c8198d84 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in +++ b/Build/source/libs/harfbuzz/harfbuzz-src/config.h.in @@ -42,6 +42,9 @@ /* Define to 1 if you have the `FT_Set_Var_Blend_Coordinates' function. */ #undef HAVE_FT_SET_VAR_BLEND_COORDINATES +/* Have GDI library */ +#undef HAVE_GDI + /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac index 0dc672a8163..95c55c9a048 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac +++ b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.64]) AC_INIT([HarfBuzz], - [2.5.3], + [2.6.0], [https://github.com/harfbuzz/harfbuzz/issues/new], [harfbuzz], [http://harfbuzz.org/]) @@ -361,6 +361,28 @@ AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe) dnl =========================================================================== +AC_ARG_WITH(gdi, + [AS_HELP_STRING([--with-gdi=@<:@yes/no/auto@:>@], + [Provide GDI integration helpers @<:@default=no@:>@])],, + [with_gdi=no]) +have_gdi=false +if test "x$with_gdi" = "xyes" -o "x$with_gdi" = "xauto"; then + AC_CHECK_HEADERS(windows.h, have_gdi=true) +fi +if test "x$with_gdi" = "xyes" -a "x$have_gdi" != "xtrue"; then + AC_MSG_ERROR([gdi support requested but not found]) +fi +if $have_gdi; then + GDI_CFLAGS= + GDI_LIBS="-lgdi32" + AC_SUBST(GDI_CFLAGS) + AC_SUBST(GDI_LIBS) + AC_DEFINE(HAVE_GDI, 1, [Have GDI library]) +fi +AM_CONDITIONAL(HAVE_GDI, $have_gdi) + +dnl =========================================================================== + AC_ARG_WITH(directwrite, [AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@], [Use the DirectWrite library (experimental) @<:@default=no@:>@])],, @@ -376,7 +398,7 @@ if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then fi if $have_directwrite; then DIRECTWRITE_CXXFLAGS= - DIRECTWRITE_LIBS="-ldwrite" + DIRECTWRITE_LIBS= AC_SUBST(DIRECTWRITE_CXXFLAGS) AC_SUBST(DIRECTWRITE_LIBS) AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library]) @@ -510,6 +532,7 @@ Additional shapers (the more the merrier): Platform shapers (not normally needed): CoreText: ${have_coretext} DirectWrite: ${have_directwrite} + GDI: ${have_gdi} Uniscribe: ${have_uniscribe} Other features: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am index 14cafb83365..7173f4b7de5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am @@ -12,9 +12,15 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-introspection TESTS = check_PROGRAMS = +EXTRA_DIST += harfbuzz.cc + # Convenience targets: lib: $(BUILT_SOURCES) libharfbuzz.la libs: $(BUILT_SOURCES) $(lib_LTLIBRARIES) +tiny: + $(MAKE) $(AM_MAKEFLAGS) CPPFLAGS="-Os -DHB_TINY $(CPPFLAGS)" libs +tinyz: + $(MAKE) $(AM_MAKEFLAGS) CPPFLAGS="-Oz -DHB_TINY $(CPPFLAGS)" libs lib_LTLIBRARIES = libharfbuzz.la @@ -76,6 +82,13 @@ HBSOURCES += $(HB_DIRECTWRITE_sources) HBHEADERS += $(HB_DIRECTWRITE_headers) endif +if HAVE_GDI +HBCFLAGS += $(GDI_CXXFLAGS) +HBNONPCLIBS += $(GDI_LIBS) +HBSOURCES += $(HB_GDI_sources) +HBHEADERS += $(HB_GDI_headers) +endif + if HAVE_CORETEXT HBCFLAGS += $(CORETEXT_CFLAGS) HBNONPCLIBS += $(CORETEXT_LIBS) @@ -249,31 +262,38 @@ GENERATORS = \ $(NULL) EXTRA_DIST += $(GENERATORS) -unicode-tables: arabic-table indic-table tag-table use-table emoji-table +unicode-tables: \ + arabic-table \ + emoji-table \ + indic-table \ + tag-table \ + ucd-table \ + use-table \ + emoji-table \ + $(NULL) arabic-table: gen-arabic-table.py ArabicShaping.txt UnicodeData.txt Blocks.txt $(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ot-shape-complex-arabic-table.hh \ || ($(RM) $(srcdir)/hb-ot-shape-complex-arabic-table.hh; false) - +emoji-table: gen-emoji-table.py emoji-data.txt + $(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-unicode-emoji-table.hh \ + || ($(RM) $(srcdir)/hb-unicode-emoji-table.hh; false) indic-table: gen-indic-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt Blocks.txt $(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ot-shape-complex-indic-table.cc \ || ($(RM) $(srcdir)/hb-ot-shape-complex-indic-table.cc; false) - tag-table: gen-tag-table.py languagetags language-subtag-registry $(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ot-tag-table.hh \ || ($(RM) $(srcdir)/hb-ot-tag-table.hh; false) - +ucd-table: gen-ucd-table.py ucd.nounihan.grouped.zip hb-common.h + $(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ucd-table.hh \ + || ($(RM) $(srcdir)/hb-ucd-table.hh; false) use-table: gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt $(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ot-shape-complex-use-table.cc \ || ($(RM) $(srcdir)/hb-ot-shape-complex-use-table.cc; false) - vowel-constraints: gen-vowel-constraints.py HBIndicVowelConstraints.txt Scripts.txt $(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ot-shape-complex-vowel-constraints.cc \ || ($(RM) $(srcdir)/hb-ot-shape-complex-vowel-constraints.cc; false) -emoji-table: gen-emoji-table.py emoji-data.txt - $(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-unicode-emoji-table.hh \ - || ($(RM) $(srcdir)/hb-unicode-emoji-table.hh; false) built-sources: $(BUILT_SOURCES) @@ -292,10 +312,27 @@ $(srcdir)/%.hh: $(srcdir)/%.rl $(AM_V_GEN)(cd $(srcdir) && $(RAGEL) -e -F1 -o "$*.hh" "$*.rl") \ || ($(RM) "$@"; false) +harfbuzz.cc: Makefile.sources + $(AM_V_GEN) \ + for f in \ + $(HB_BASE_sources) \ + $(HB_GLIB_sources) \ + $(HB_FT_sources) \ + $(HB_GRAPHITE2_sources) \ + $(HB_UNISCRIBE_sources) \ + $(HB_GDI_sources) \ + $(HB_DIRECTWRITE_sources) \ + $(HB_CORETEXT_sources) \ + ; do echo '#include "'$$f'"'; done | \ + grep '[.]cc"' > $(srcdir)/harfbuzz.cc \ + || ($(RM) $(srcdir)/harfbuzz.cc; false) +BUILT_SOURCES += harfbuzz.cc + noinst_PROGRAMS = \ main \ test \ test-buffer-serialize \ + test-ot-meta \ test-ot-name \ test-gpos-size-params \ test-gsub-would-substitute \ @@ -314,6 +351,10 @@ test_buffer_serialize_SOURCES = test-buffer-serialize.cc test_buffer_serialize_CPPFLAGS = $(HBCFLAGS) test_buffer_serialize_LDADD = libharfbuzz.la $(HBLIBS) +test_ot_meta_SOURCES = test-ot-meta.cc +test_ot_meta_CPPFLAGS = $(HBCFLAGS) +test_ot_meta_LDADD = libharfbuzz.la $(HBLIBS) + test_ot_name_SOURCES = test-ot-name.cc test_ot_name_CPPFLAGS = $(HBCFLAGS) test_ot_name_LDADD = libharfbuzz.la $(HBLIBS) @@ -370,7 +411,7 @@ dump_use_data_SOURCES = dump-use-data.cc hb-ot-shape-complex-use-table.cc dump_use_data_CPPFLAGS = $(HBCFLAGS) dump_use_data_LDADD = libharfbuzz.la $(HBLIBS) -COMPILED_TESTS = test-algs test-iter test-meta test-ot-tag test-unicode-ranges +COMPILED_TESTS = test-algs test-iter test-meta test-ot-tag test-unicode-ranges test-bimap COMPILED_TESTS_CPPFLAGS = $(HBCFLAGS) -DMAIN -UNDEBUG COMPILED_TESTS_LDADD = libharfbuzz.la $(HBLIBS) check_PROGRAMS += $(COMPILED_TESTS) @@ -396,6 +437,10 @@ test_unicode_ranges_SOURCES = test-unicode-ranges.cc test_unicode_ranges_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) test_unicode_ranges_LDADD = $(COMPILED_TESTS_LDADD) +test_bimap_SOURCES = test-bimap.cc hb-static.cc +test_bimap_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_bimap_LDADD = $(COMPILED_TESTS_LDADD) + TESTS_ENVIRONMENT = \ srcdir="$(srcdir)" \ MAKE="$(MAKE) $(AM_MAKEFLAGS)" \ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources index 6f42ba3dccd..6e29b3f9733 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources @@ -10,6 +10,7 @@ HB_BASE_sources = \ hb-aat-layout-kerx-table.hh \ hb-aat-layout-lcar-table.hh \ hb-aat-layout-morx-table.hh \ + hb-aat-layout-opbd-table.hh \ hb-aat-layout-trak-table.hh \ hb-aat-layout.cc \ hb-aat-layout.hh \ @@ -88,6 +89,10 @@ HB_BASE_sources = \ hb-ot-math-table.hh \ hb-ot-math.cc \ hb-ot-maxp-table.hh \ + hb-ot-meta-table.hh \ + hb-ot-meta.cc \ + hb-ot-metrics.cc \ + hb-ot-metrics.hh \ hb-ot-name-language-static.hh \ hb-ot-name-language.hh \ hb-ot-name-table.hh \ @@ -191,6 +196,8 @@ HB_BASE_headers = \ hb-ot-font.h \ hb-ot-layout.h \ hb-ot-math.h \ + hb-ot-meta.h \ + hb-ot-metrics.h \ hb-ot-name.h \ hb-ot-shape.h \ hb-ot-var.h \ @@ -222,6 +229,9 @@ HB_CORETEXT_headers = hb-coretext.h HB_DIRECTWRITE_sources = hb-directwrite.cc HB_DIRECTWRITE_headers = hb-directwrite.h +HB_GDI_sources = hb-gdi.cc +HB_GDI_headers = hb-gdi.h + HB_UNISCRIBE_sources = hb-uniscribe.cc HB_UNISCRIBE_headers = hb-uniscribe.h diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-emoji-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-emoji-table.py index 9afe747dd7d..49770d4fd8b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-emoji-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-emoji-table.py @@ -4,6 +4,7 @@ from __future__ import print_function, division, absolute_import import sys import os.path from collections import OrderedDict +import packTab if len (sys.argv) != 2: print("usage: ./gen-emoji-table.py emoji-data.txt", file=sys.stderr) @@ -52,14 +53,19 @@ print () print ('#include "hb-unicode.hh"') print () -for typ,s in ranges.items(): +for typ, s in ranges.items(): if typ != "Extended_Pictographic": continue + + arr = dict() + for start,end in s: + for i in range(start,end): + arr[i] = 1 + + sol = packTab.pack_table(arr, 0, compression=3) + code = packTab.Code('_hb_emoji') + sol.genCode(code, 'is_'+typ) + code.print_c(linkage='static inline') print() - print("static const struct hb_unicode_range_t _hb_unicode_emoji_%s_table[] =" % typ) - print("{") - for pair in sorted(s): - print(" {0x%04X, 0x%04X}," % pair) - print("};") print () print ("#endif /* HB_UNICODE_EMOJI_TABLE_HH */") diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py index eedf420b733..cdf81fe7524 100755 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py @@ -98,6 +98,10 @@ for h in headers: print (" * %s" % (l.strip())) print (" */") print () +print ('#include "hb.hh"') +print () +print ('#ifndef HB_NO_OT_SHAPE') +print () print ('#include "hb-ot-shape-complex-indic.hh"') print () @@ -251,6 +255,8 @@ for i in range (2): print ("#undef %s_%s" % (what_short[i], short[i][v])) print () +print () +print ('#endif') print ("/* == End of generated table == */") # Maintain at least 30% occupancy in the table */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ucd-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ucd-table.py index a152375dd78..552c3c675c1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ucd-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ucd-table.py @@ -6,8 +6,8 @@ import io, os.path, sys, re import logging logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) -if len (sys.argv) != 2: - print("usage: ./gen-ucd-table ucd.nounihan.grouped.xml", file=sys.stderr) +if len (sys.argv) not in (2, 3): + print("usage: ./gen-ucd-table ucd.nounihan.grouped.xml [/path/to/hb-common.h]", file=sys.stderr) sys.exit(1) # https://github.com/harfbuzz/packtab @@ -18,6 +18,8 @@ logging.info('Loading UCDXML...') ucdxml = packTab.ucdxml.load_ucdxml(sys.argv[1]) ucd = packTab.ucdxml.ucdxml_get_repertoire(ucdxml) +hb_common_h = 'hb-common.h' if len (sys.argv) < 3 else sys.argv[2] + logging.info('Preparing data tables...') gc = [u['gc'] for u in ucd] @@ -68,7 +70,7 @@ for i,v in enumerate(('Cc', 'Cf', 'Cn', 'Co', 'Cs', 'Ll', 'Lm', 'Lo', 'Lt', 'Lu' sc_order = dict() sc_array = [] sc_re = re.compile(r"\b(HB_SCRIPT_[_A-Z]*).*HB_TAG [(]'(.)','(.)','(.)','(.)'[)]") -for line in open('hb-common.h'): +for line in open(hb_common_h): m = sc_re.search (line) if not m: continue name = m.group(1) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py index 820838cf8eb..a8a03a77b84 100755 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py @@ -419,6 +419,10 @@ for h in headers: print (" * %s" % (l.strip())) print (" */") print () +print ('#include "hb.hh"') +print () +print ('#ifndef HB_NO_OT_SHAPE') +print () print ('#include "hb-ot-shape-complex-use.hh"') print () @@ -533,6 +537,8 @@ for k,v in sorted(use_positions.items()): tag = k + suf print ("#undef %s" % tag) print () +print () +print ('#endif') print ("/* == End of generated table == */") # Maintain at least 50% occupancy in the table */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-vowel-constraints.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-vowel-constraints.py index 1340d97dc77..8ca90c819cb 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-vowel-constraints.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-vowel-constraints.py @@ -157,6 +157,11 @@ print (' *') for line in scripts_header: print (' * %s' % line.strip ()) print (' */') + +print () +print ('#include "hb.hh"') +print () +print ('#ifndef HB_NO_OT_SHAPE') print () print ('#include "hb-ot-shape-complex-vowel-constraints.hh"') print () @@ -223,4 +228,6 @@ print (' }') print ('}') print () +print () +print ('#endif') print ('/* == End of generated functions == */') diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz.cc new file mode 100644 index 00000000000..d338d1735cd --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/harfbuzz.cc @@ -0,0 +1,53 @@ +#include "hb-aat-layout.cc" +#include "hb-aat-map.cc" +#include "hb-blob.cc" +#include "hb-buffer-serialize.cc" +#include "hb-buffer.cc" +#include "hb-common.cc" +#include "hb-face.cc" +#include "hb-fallback-shape.cc" +#include "hb-font.cc" +#include "hb-map.cc" +#include "hb-ot-cff1-table.cc" +#include "hb-ot-cff2-table.cc" +#include "hb-ot-color.cc" +#include "hb-ot-face.cc" +#include "hb-ot-font.cc" +#include "hb-ot-layout.cc" +#include "hb-ot-map.cc" +#include "hb-ot-math.cc" +#include "hb-ot-meta.cc" +#include "hb-ot-metrics.cc" +#include "hb-ot-name.cc" +#include "hb-ot-shape-complex-arabic.cc" +#include "hb-ot-shape-complex-default.cc" +#include "hb-ot-shape-complex-hangul.cc" +#include "hb-ot-shape-complex-hebrew.cc" +#include "hb-ot-shape-complex-indic-table.cc" +#include "hb-ot-shape-complex-indic.cc" +#include "hb-ot-shape-complex-khmer.cc" +#include "hb-ot-shape-complex-myanmar.cc" +#include "hb-ot-shape-complex-thai.cc" +#include "hb-ot-shape-complex-use-table.cc" +#include "hb-ot-shape-complex-use.cc" +#include "hb-ot-shape-complex-vowel-constraints.cc" +#include "hb-ot-shape-fallback.cc" +#include "hb-ot-shape-normalize.cc" +#include "hb-ot-shape.cc" +#include "hb-ot-tag.cc" +#include "hb-ot-var.cc" +#include "hb-set.cc" +#include "hb-shape-plan.cc" +#include "hb-shape.cc" +#include "hb-shaper.cc" +#include "hb-static.cc" +#include "hb-ucd.cc" +#include "hb-unicode.cc" +#include "hb-warning.cc" +#include "hb-glib.cc" +#include "hb-ft.cc" +#include "hb-graphite2.cc" +#include "hb-uniscribe.cc" +#include "hb-gdi.cc" +#include "hb-directwrite.cc" +#include "hb-coretext.cc" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh index a20ef864023..c8229940dc0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh @@ -47,17 +47,16 @@ struct SettingName hb_aat_layout_feature_selector_t get_selector () const { return (hb_aat_layout_feature_selector_t) (unsigned) setting; } - void get_info (hb_aat_layout_feature_selector_info_t *s, - hb_aat_layout_feature_selector_t default_selector) const + hb_aat_layout_feature_selector_info_t get_info (hb_aat_layout_feature_selector_t default_selector) const { - s->name_id = nameIndex; - - s->enable = (hb_aat_layout_feature_selector_t) (unsigned int) setting; - s->disable = default_selector == HB_AAT_LAYOUT_FEATURE_SELECTOR_INVALID ? - (hb_aat_layout_feature_selector_t) (s->enable + 1) : - default_selector; - - s->reserved = 0; + return { + nameIndex, + (hb_aat_layout_feature_selector_t) (unsigned int) setting, + default_selector == HB_AAT_LAYOUT_FEATURE_SELECTOR_INVALID + ? (hb_aat_layout_feature_selector_t) (setting + 1) + : default_selector, + 0 + }; } bool sanitize (hb_sanitize_context_t *c) const @@ -117,9 +116,10 @@ struct FeatureName if (selectors_count) { - hb_array_t<const SettingName> arr = settings_table.sub_array (start_offset, selectors_count); - for (unsigned int i = 0; i < arr.length; i++) - settings_table[start_offset + i].get_info (&selectors[i], default_selector); + + settings_table.sub_array (start_offset, selectors_count) + | hb_map ([=] (const SettingName& setting) { return setting.get_info (default_selector); }) + | hb_sink (hb_array (selectors, *selectors_count)) + ; } return settings_table.length; } @@ -162,21 +162,18 @@ struct feat unsigned int *count, hb_aat_layout_feature_type_t *features) const { - unsigned int feature_count = featureNameCount; - if (count && *count) + if (count) { - unsigned int len = hb_min (feature_count - start_offset, *count); - for (unsigned int i = 0; i < len; i++) - features[i] = namesZ[i + start_offset].get_feature_type (); - *count = len; + + namesZ.as_array (featureNameCount).sub_array (start_offset, count) + | hb_map (&FeatureName::get_feature_type) + | hb_sink (hb_array (features, *count)) + ; } return featureNameCount; } const FeatureName& get_feature (hb_aat_layout_feature_type_t feature_type) const - { - return namesZ.bsearch (featureNameCount, feature_type); - } + { return namesZ.bsearch (featureNameCount, feature_type); } hb_ot_name_id_t get_feature_name_id (hb_aat_layout_feature_type_t feature) const { return get_feature (feature).get_feature_name_id (); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh index cd96d034dd9..2e45fd28b82 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh @@ -55,17 +55,21 @@ struct lcar if (caret_count) { hb_array_t<const HBINT16> arr = array.sub_array (start_offset, caret_count); - unsigned int count = arr.length; - for (unsigned int i = 0; i < count; ++i) - switch (format) + switch (format) + { + case 0: + for (unsigned int i = 0; i < arr.length; ++i) + caret_array[i] = font->em_scale_dir (arr[i], direction); + break; + case 1: + for (unsigned int i = 0; i < arr.length; ++i) { - case 0: caret_array[i] = font->em_scale_dir (arr[i], direction); break; - case 1: hb_position_t x, y; font->get_glyph_contour_point_for_origin (glyph, arr[i], direction, &x, &y); caret_array[i] = HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y; - break; } + break; + } } return array.len; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-opbd-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-opbd-table.hh new file mode 100644 index 00000000000..5b9c3912507 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-opbd-table.hh @@ -0,0 +1,111 @@ +/* + * Copyright © 2019 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HB_AAT_LAYOUT_OPBD_TABLE_HH +#define HB_AAT_LAYOUT_OPBD_TABLE_HH + +#include "hb-aat-layout-common.hh" +#include "hb-open-type.hh" + +/* + * opbd -- Optical Bounds + * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6opbd.html + */ +#define HB_AAT_TAG_opbd HB_TAG('o','p','b','d') + + +namespace AAT { + +struct OpticalBounds +{ + bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (likely (c->check_struct (this))); + } + + HBINT16 leftSide; + HBINT16 topSide; + HBINT16 rightSide; + HBINT16 bottomSide; + public: + DEFINE_SIZE_STATIC (8); +}; + +struct opbd +{ + static constexpr hb_tag_t tableTag = HB_AAT_TAG_opbd; + + bool get_optical_bounds (hb_font_t *font, hb_codepoint_t glyph_id, + hb_position_t *left, hb_position_t *top, + hb_position_t *right, hb_position_t *bottom) const + { + const OffsetTo<OpticalBounds> *bounds_offset = lookupTable.get_value (glyph_id, font->face->get_num_glyphs ()); + if (!bounds_offset) return false; + const OpticalBounds &bounds = this+*bounds_offset; + switch (format) + { + case 0: + *left = font->em_scale_x (bounds.leftSide); + *top = font->em_scale_y (bounds.topSide); + *right = font->em_scale_x (bounds.rightSide); + *bottom = font->em_scale_y (bounds.bottomSide); + return true; + case 1: + hb_position_t ignore; + return font->get_glyph_contour_point (glyph_id, bounds.leftSide, left, &ignore) && + font->get_glyph_contour_point (glyph_id, bounds.topSide, &ignore, top) && + font->get_glyph_contour_point (glyph_id, bounds.rightSide, right, &ignore) && + font->get_glyph_contour_point (glyph_id, bounds.bottomSide, &ignore, bottom); + default: + return false; + } + } + + bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (likely (c->check_struct (this) && + version.major == 1 && + lookupTable.sanitize (c, this))); + } + + protected: + FixedVersion<>version; /* Version number of the optical bounds + * table (0x00010000 for the current version). */ + HBUINT16 format; /* Format of the optical bounds table. + * Format 0 indicates distance and Format 1 indicates + * control point. */ + Lookup<OffsetTo<OpticalBounds>> + lookupTable; /* Lookup table associating glyphs with the four + * int16 values for the left-side, top-side, + * right-side, and bottom-side optical bounds. */ + public: + DEFINE_SIZE_MIN (8); +}; + +} /* namespace AAT */ + + +#endif /* HB_AAT_LAYOUT_OPBD_TABLE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc index c08bb11f460..4e506de16e8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc @@ -75,9 +75,6 @@ AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_) #endif -#ifndef HB_NO_AAT - - /** * SECTION:hb-aat-layout * @title: hb-aat-layout @@ -88,6 +85,8 @@ AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_) **/ +#if !defined(HB_NO_AAT) || defined(HAVE_CORETEXT) + /* Table data courtesy of Apple. Converted from mnemonics to integers * when moving to this file. */ static const hb_aat_feature_mapping_t feature_mappings[] = @@ -179,7 +178,10 @@ hb_aat_layout_find_feature_mapping (hb_tag_t tag) sizeof (feature_mappings[0]), hb_aat_feature_mapping_t::cmp); } +#endif + +#ifndef HB_NO_AAT /* * mort/morx/kerx/trak diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.h index 760aaae40a6..b617e8b703d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.h @@ -85,7 +85,7 @@ typedef enum HB_AAT_LAYOUT_FEATURE_TYPE_LANGUAGE_TAG_TYPE = 39, HB_AAT_LAYOUT_FEATURE_TYPE_CJK_ROMAN_SPACING_TYPE = 103, - _HB_AAT_LAYOUT_FEATURE_TYPE_MAX_VALUE= 0x7FFFFFFFu, /*< skip >*/ + _HB_AAT_LAYOUT_FEATURE_TYPE_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/ } hb_aat_layout_feature_type_t; /** @@ -424,7 +424,7 @@ typedef enum HB_AAT_LAYOUT_FEATURE_SELECTOR_DEFAULT_CJK_ROMAN = 2, HB_AAT_LAYOUT_FEATURE_SELECTOR_FULL_WIDTH_CJK_ROMAN = 3, - _HB_AAT_LAYOUT_FEATURE_SELECTOR_MAX_VALUE= 0x7FFFFFFFu, /*< skip >*/ + _HB_AAT_LAYOUT_FEATURE_SELECTOR_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/ } hb_aat_layout_feature_selector_t; HB_EXTERN unsigned int diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.cc index e16ecfe0420..bc879359aae 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-map.cc @@ -28,7 +28,7 @@ #include "hb.hh" -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE #include "hb-aat-map.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-algs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-algs.hh index c8d83c828ec..788689478d2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-algs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-algs.hh @@ -50,31 +50,31 @@ struct { /* Note. This is dangerous in that if it's passed an rvalue, it returns rvalue-reference. */ - template <typename T> auto + template <typename T> constexpr auto operator () (T&& v) const HB_AUTO_RETURN ( hb_forward<T> (v) ) } HB_FUNCOBJ (hb_identity); struct { /* Like identity(), but only retains lvalue-references. Rvalues are returned as rvalues. */ - template <typename T> T& + template <typename T> constexpr T& operator () (T& v) const { return v; } - template <typename T> hb_remove_reference<T> + template <typename T> constexpr hb_remove_reference<T> operator () (T&& v) const { return v; } } HB_FUNCOBJ (hb_lidentity); struct { /* Like identity(), but always returns rvalue. */ - template <typename T> hb_remove_reference<T> + template <typename T> constexpr hb_remove_reference<T> operator () (T&& v) const { return v; } } HB_FUNCOBJ (hb_ridentity); struct { - template <typename T> bool + template <typename T> constexpr bool operator () (T&& v) const { return bool (hb_forward<T> (v)); } } HB_FUNCOBJ (hb_bool); @@ -82,11 +82,11 @@ HB_FUNCOBJ (hb_bool); struct { private: - template <typename T> auto + template <typename T> constexpr auto impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, hb_deref (v).hash ()) template <typename T, - hb_enable_if (hb_is_integral (T))> auto + hb_enable_if (hb_is_integral (T))> constexpr auto impl (const T& v, hb_priority<0>) const HB_AUTO_RETURN ( /* Knuth's multiplicative method: */ @@ -95,7 +95,7 @@ struct public: - template <typename T> auto + template <typename T> constexpr auto operator () (const T& v) const HB_RETURN (uint32_t, impl (v, hb_prioritize)) } HB_FUNCOBJ (hb_hash); @@ -328,14 +328,14 @@ hb_pair (T1&& a, T2&& b) { return hb_pair_t<T1, T2> (a, b); } struct { - template <typename Pair> typename Pair::first_t + template <typename Pair> constexpr typename Pair::first_t operator () (const Pair& pair) const { return pair.first; } } HB_FUNCOBJ (hb_first); struct { - template <typename Pair> typename Pair::second_t + template <typename Pair> constexpr typename Pair::second_t operator () (const Pair& pair) const { return pair.second; } } HB_FUNCOBJ (hb_second); @@ -346,14 +346,14 @@ HB_FUNCOBJ (hb_second); * comparing integers of different signedness. */ struct { - template <typename T, typename T2> auto + template <typename T, typename T2> constexpr auto operator () (T&& a, T2&& b) const HB_AUTO_RETURN (hb_forward<T> (a) <= hb_forward<T2> (b) ? hb_forward<T> (a) : hb_forward<T2> (b)) } HB_FUNCOBJ (hb_min); struct { - template <typename T, typename T2> auto + template <typename T, typename T2> constexpr auto operator () (T&& a, T2&& b) const HB_AUTO_RETURN (hb_forward<T> (a) >= hb_forward<T2> (b) ? hb_forward<T> (a) : hb_forward<T2> (b)) } @@ -917,7 +917,7 @@ struct hb_bitwise_and { HB_PARTIALIZE(2); static constexpr bool passthru_left = false; static constexpr bool passthru_right = false; - template <typename T> auto + template <typename T> constexpr auto operator () (const T &a, const T &b) const HB_AUTO_RETURN (a & b) } HB_FUNCOBJ (hb_bitwise_and); @@ -925,7 +925,7 @@ struct hb_bitwise_or { HB_PARTIALIZE(2); static constexpr bool passthru_left = true; static constexpr bool passthru_right = true; - template <typename T> auto + template <typename T> constexpr auto operator () (const T &a, const T &b) const HB_AUTO_RETURN (a | b) } HB_FUNCOBJ (hb_bitwise_or); @@ -933,7 +933,7 @@ struct hb_bitwise_xor { HB_PARTIALIZE(2); static constexpr bool passthru_left = true; static constexpr bool passthru_right = true; - template <typename T> auto + template <typename T> constexpr auto operator () (const T &a, const T &b) const HB_AUTO_RETURN (a ^ b) } HB_FUNCOBJ (hb_bitwise_xor); @@ -941,56 +941,56 @@ struct hb_bitwise_sub { HB_PARTIALIZE(2); static constexpr bool passthru_left = true; static constexpr bool passthru_right = false; - template <typename T> auto + template <typename T> constexpr auto operator () (const T &a, const T &b) const HB_AUTO_RETURN (a & ~b) } HB_FUNCOBJ (hb_bitwise_sub); struct { - template <typename T> auto + template <typename T> constexpr auto operator () (const T &a) const HB_AUTO_RETURN (~a) } HB_FUNCOBJ (hb_bitwise_neg); struct { HB_PARTIALIZE(2); - template <typename T, typename T2> auto + template <typename T, typename T2> constexpr auto operator () (const T &a, const T2 &b) const HB_AUTO_RETURN (a + b) } HB_FUNCOBJ (hb_add); struct { HB_PARTIALIZE(2); - template <typename T, typename T2> auto + template <typename T, typename T2> constexpr auto operator () (const T &a, const T2 &b) const HB_AUTO_RETURN (a - b) } HB_FUNCOBJ (hb_sub); struct { HB_PARTIALIZE(2); - template <typename T, typename T2> auto + template <typename T, typename T2> constexpr auto operator () (const T &a, const T2 &b) const HB_AUTO_RETURN (a * b) } HB_FUNCOBJ (hb_mul); struct { HB_PARTIALIZE(2); - template <typename T, typename T2> auto + template <typename T, typename T2> constexpr auto operator () (const T &a, const T2 &b) const HB_AUTO_RETURN (a / b) } HB_FUNCOBJ (hb_div); struct { HB_PARTIALIZE(2); - template <typename T, typename T2> auto + template <typename T, typename T2> constexpr auto operator () (const T &a, const T2 &b) const HB_AUTO_RETURN (a % b) } HB_FUNCOBJ (hb_mod); struct { - template <typename T> auto + template <typename T> constexpr auto operator () (const T &a) const HB_AUTO_RETURN (+a) } HB_FUNCOBJ (hb_pos); struct { - template <typename T> auto + template <typename T> constexpr auto operator () (const T &a) const HB_AUTO_RETURN (-a) } HB_FUNCOBJ (hb_neg); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bimap.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bimap.hh index 29291506ab1..a773951abdf 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bimap.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-bimap.hh @@ -28,6 +28,7 @@ #define HB_BIMAP_HH #include "hb.hh" +#include "hb-map.hh" /* Bi-directional map */ struct hb_bimap_t @@ -57,6 +58,8 @@ struct hb_bimap_t void set (hb_codepoint_t lhs, hb_codepoint_t rhs) { + if (unlikely (lhs == HB_MAP_VALUE_INVALID)) return; + if (unlikely (rhs == HB_MAP_VALUE_INVALID)) { del (lhs); return; } forw_map.set (lhs, rhs); back_map.set (rhs, lhs); } @@ -131,6 +134,7 @@ struct hb_inc_bimap_t : hb_bimap_t work.qsort (cmp_id); + clear (); for (hb_codepoint_t rhs = 0; rhs < count; rhs++) set (work[rhs], rhs); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-common.hh index c5157c78337..fdc5c683ab4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-common.hh @@ -226,7 +226,7 @@ struct number_t void set_fixed (int32_t v) { value = v / 65536.0; } int32_t to_fixed () const { return (int32_t) (value * 65536.0); } - void set_real (double v) { value = v; } + void set_real (double v) { value = v; } double to_real () const { return value; } int ceil () const { return (int) ::ceil (value); } @@ -235,17 +235,10 @@ struct number_t bool in_int_range () const { return ((double) (int16_t) to_int () == value); } - bool operator > (const number_t &n) const - { return value > n.to_real (); } - - bool operator < (const number_t &n) const - { return n > *this; } - - bool operator >= (const number_t &n) const - { return !(*this < n); } - - bool operator <= (const number_t &n) const - { return !(*this > n); } + bool operator > (const number_t &n) const { return value > n.to_real (); } + bool operator < (const number_t &n) const { return n > *this; } + bool operator >= (const number_t &n) const { return !(*this < n); } + bool operator <= (const number_t &n) const { return !(*this > n); } const number_t &operator += (const number_t &n) { @@ -255,7 +248,7 @@ struct number_t } protected: - double value; + double value; }; /* byte string */ @@ -308,7 +301,7 @@ struct byte_str_t : hb_ubytes_t : hb_ubytes_t (s, l) {} byte_str_t (const hb_ubytes_t &ub) /* conversion from hb_ubytes_t */ : hb_ubytes_t (ub) {} - + /* sub-string */ byte_str_t sub_str (unsigned int offset, unsigned int len_) const { return byte_str_t (hb_ubytes_t::sub_array (offset, len_)); } @@ -320,8 +313,7 @@ struct byte_str_t : hb_ubytes_t /* A byte string associated with the current offset and an error condition */ struct byte_str_ref_t { - byte_str_ref_t () - { init (); } + byte_str_ref_t () { init (); } void init () { @@ -343,13 +335,12 @@ struct byte_str_ref_t } const unsigned char& operator [] (int i) { - if (unlikely ((unsigned int)(offset + i) >= str.length)) + if (unlikely ((unsigned int) (offset + i) >= str.length)) { set_error (); - return Null(unsigned char); + return Null (unsigned char); } - else - return str[offset + i]; + return str[offset + i]; } /* Conversion to byte_str_t */ @@ -359,9 +350,7 @@ struct byte_str_ref_t { return str.sub_str (offset_, len_); } bool avail (unsigned int count=1) const - { - return (!in_error () && str.check_limit (offset, count)); - } + { return (!in_error () && str.check_limit (offset, count)); } void inc (unsigned int count=1) { if (likely (!in_error () && (offset <= str.length) && (offset + count <= str.length))) @@ -389,7 +378,7 @@ typedef hb_vector_t<byte_str_t> byte_str_array_t; /* stack */ template <typename ELEM, int LIMIT> -struct stack_t +struct cff_stack_t { void init () { @@ -400,11 +389,7 @@ struct stack_t for (unsigned int i = 0; i < elements.length; i++) elements[i].init (); } - - void fini () - { - elements.fini_deep (); - } + void fini () { elements.fini_deep (); } ELEM& operator [] (unsigned int i) { @@ -419,7 +404,6 @@ struct stack_t else set_error (); } - ELEM &push () { if (likely (count < elements.length)) @@ -441,7 +425,6 @@ struct stack_t return Crap(ELEM); } } - void pop (unsigned int n) { if (likely (count >= n)) @@ -452,13 +435,12 @@ struct stack_t const ELEM& peek () { - if (likely (count > 0)) - return elements[count-1]; - else + if (unlikely (count < 0)) { set_error (); return Null(ELEM); } + return elements[count - 1]; } void unpop () @@ -475,7 +457,7 @@ struct stack_t void set_error () { error = true; } unsigned int get_count () const { return count; } - bool is_empty () const { return count == 0; } + bool is_empty () const { return !count; } static constexpr unsigned kSizeLimit = LIMIT; @@ -487,7 +469,7 @@ struct stack_t /* argument stack */ template <typename ARG=number_t> -struct arg_stack_t : stack_t<ARG, 513> +struct arg_stack_t : cff_stack_t<ARG, 513> { void push_int (int v) { @@ -519,7 +501,7 @@ struct arg_stack_t : stack_t<ARG, 513> i = 0; S::set_error (); } - return (unsigned)i; + return (unsigned) i; } void push_longint_from_substr (byte_str_ref_t& str_ref) @@ -538,12 +520,10 @@ struct arg_stack_t : stack_t<ARG, 513> } hb_array_t<const ARG> get_subarray (unsigned int start) const - { - return S::elements.sub_array (start); - } + { return S::elements.sub_array (start); } private: - typedef stack_t<ARG, 513> S; + typedef cff_stack_t<ARG, 513> S; }; /* an operator prefixed by its operands in a byte string */ @@ -605,7 +585,7 @@ struct parsed_values_t } unsigned get_count () const { return values.length; } - const VAL &get_value (unsigned int i) const { return values[i]; } + const VAL &get_value (unsigned int i) const { return values[i]; } const VAL &operator [] (unsigned int i) const { return get_value (i); } unsigned int opStart; @@ -644,30 +624,19 @@ struct interp_env_t return op; } - const ARG& eval_arg (unsigned int i) - { - return argStack[i]; - } - - ARG& pop_arg () - { - return argStack.pop (); - } + const ARG& eval_arg (unsigned int i) { return argStack[i]; } - void pop_n_args (unsigned int n) - { - argStack.pop (n); - } + ARG& pop_arg () { return argStack.pop (); } + void pop_n_args (unsigned int n) { argStack.pop (n); } - void clear_args () - { - pop_n_args (argStack.get_count ()); - } + void clear_args () { pop_n_args (argStack.get_count ()); } - byte_str_ref_t str_ref; - arg_stack_t<ARG> argStack; + byte_str_ref_t + str_ref; + arg_stack_t<ARG> + argStack; protected: - bool error; + bool error; }; typedef interp_env_t<> num_interp_env_t; @@ -711,8 +680,8 @@ struct opset_t }; template <typename ENV> -struct interpreter_t { - +struct interpreter_t +{ ~interpreter_t() { fini (); } void fini () { env.fini (); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-cs-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-cs-common.hh index 1cfbba6030d..d9ad4d0d69f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-cs-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff-interp-cs-common.hh @@ -57,14 +57,14 @@ struct call_context_t /* call stack */ const unsigned int kMaxCallLimit = 10; -struct call_stack_t : stack_t<call_context_t, kMaxCallLimit> {}; +struct call_stack_t : cff_stack_t<call_context_t, kMaxCallLimit> {}; template <typename SUBRS> struct biased_subrs_t { - void init (const SUBRS &subrs_) + void init (const SUBRS *subrs_) { - subrs = &subrs_; + subrs = subrs_; unsigned int nSubrs = get_count (); if (nSubrs < 1240) bias = 107; @@ -118,7 +118,7 @@ struct point_t template <typename ARG, typename SUBRS> struct cs_interp_env_t : interp_env_t<ARG> { - void init (const byte_str_t &str, const SUBRS &globalSubrs_, const SUBRS &localSubrs_) + void init (const byte_str_t &str, const SUBRS *globalSubrs_, const SUBRS *localSubrs_) { interp_env_t<ARG>::init (str); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff1-interp-cs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff1-interp-cs.hh index cc528564c4a..1c8762c172b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff1-interp-cs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff1-interp-cs.hh @@ -40,7 +40,7 @@ struct cff1_cs_interp_env_t : cs_interp_env_t<number_t, CFF1Subrs> template <typename ACC> void init (const byte_str_t &str, ACC &acc, unsigned int fd) { - SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs); + SUPER::init (str, acc.globalSubrs, acc.privateDicts[fd].localSubrs); processed_width = false; has_width = false; arg_start = 0; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh index 1faf2083100..a72100e1aba 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh @@ -82,7 +82,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs> void init (const byte_str_t &str, ACC &acc, unsigned int fd, const int *coords_=nullptr, unsigned int num_coords_=0) { - SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs); + SUPER::init (str, acc.globalSubrs, acc.privateDicts[fd].localSubrs); coords = coords_; num_coords = num_coords_; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-config.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-config.hh index f9e4699fc51..b6db206a34c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-config.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-config.hh @@ -66,6 +66,8 @@ #define HB_NO_LAYOUT_COLLECT_GLYPHS #define HB_NO_LAYOUT_UNUSED #define HB_NO_MATH +#define HB_NO_META +#define HB_NO_METRICS #define HB_NO_MMAP #define HB_NO_NAME #define HB_NO_OPEN @@ -93,7 +95,7 @@ #ifdef HB_NO_AAT #define HB_NO_OT_NAME_LANGUAGE_AAT -#define HB_NO_SHAPE_AAT +#define HB_NO_AAT_SHAPE #endif #ifdef HB_NO_BITMAP @@ -121,6 +123,17 @@ #define HB_NO_OT_NAME_LANGUAGE #endif +#ifdef HB_NO_OT +#define HB_NO_OT_FONT +#define HB_NO_OT_LAYOUT +#define HB_NO_OT_TAG +#define HB_NO_OT_SHAPE +#endif + +#ifdef HB_NO_OT_SHAPE +#define HB_NO_AAT_SHAPE +#endif + #ifdef HB_NO_OT_SHAPE_FALLBACK #define HB_NO_OT_SHAPE_COMPLEX_ARABIC_FALLBACK #define HB_NO_OT_SHAPE_COMPLEX_HEBREW_FALLBACK diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc index a57b97026b7..e8a4fd51e56 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc @@ -75,7 +75,7 @@ release_table_data (void *user_data) } static hb_blob_t * -reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) +_hb_cg_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) { CGFontRef cg_font = reinterpret_cast<CGFontRef> (user_data); CFDataRef cf_data = CGFontCopyTableForTag (cg_font, tag); @@ -299,7 +299,7 @@ _hb_coretext_shaper_face_data_destroy (hb_coretext_face_data_t *data) hb_face_t * hb_coretext_face_create (CGFontRef cg_font) { - return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), _hb_cg_font_release); + return hb_face_create_for_tables (_hb_cg_reference_table, CGFontRetain (cg_font), _hb_cg_font_release); } /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc index 9b851148b41..c14e9d2be4b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc @@ -28,11 +28,18 @@ #include "hb-shaper-impl.hh" -#include <DWrite_1.h> +#include <dwrite_1.h> #include "hb-directwrite.h" +/* Declare object creator for dynamic support of DWRITE */ +typedef HRESULT (* WINAPI t_DWriteCreateFactory)( + DWRITE_FACTORY_TYPE factoryType, + REFIID iid, + IUnknown **factory +); + /* * hb-directwrite uses new/delete syntatically but as we let users * to override malloc/free, we will redefine new/delete so users @@ -138,6 +145,7 @@ public: struct hb_directwrite_face_data_t { + HMODULE dwrite_dll; IDWriteFactory *dwriteFactory; IDWriteFontFile *fontFile; DWriteFontFileStream *fontFileStream; @@ -153,12 +161,43 @@ _hb_directwrite_shaper_face_data_create (hb_face_t *face) if (unlikely (!data)) return nullptr; +#define FAIL(...) \ + HB_STMT_START { \ + DEBUG_MSG (DIRECTWRITE, nullptr, __VA_ARGS__); \ + return nullptr; \ + } HB_STMT_END + + data->dwrite_dll = LoadLibrary (TEXT ("DWRITE")); + if (unlikely (!data->dwrite_dll)) + FAIL ("Cannot find DWrite.DLL"); + + t_DWriteCreateFactory p_DWriteCreateFactory; + +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + + p_DWriteCreateFactory = (t_DWriteCreateFactory) + GetProcAddress (data->dwrite_dll, "DWriteCreateFactory"); + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + + if (unlikely (!p_DWriteCreateFactory)) + FAIL ("Cannot find DWriteCreateFactory()."); + + HRESULT hr; + // TODO: factory and fontFileLoader should be cached separately IDWriteFactory* dwriteFactory; - DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory), - (IUnknown**) &dwriteFactory); + hr = p_DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory), + (IUnknown**) &dwriteFactory); + + if (unlikely (hr != S_OK)) + FAIL ("Failed to run DWriteCreateFactory()."); - HRESULT hr; hb_blob_t *blob = hb_face_reference_blob (face); DWriteFontFileStream *fontFileStream; fontFileStream = new DWriteFontFileStream ((uint8_t *) hb_blob_get_data (blob, nullptr), @@ -172,12 +211,6 @@ _hb_directwrite_shaper_face_data_create (hb_face_t *face) hr = dwriteFactory->CreateCustomFontFileReference (&fontFileKey, sizeof (fontFileKey), fontFileLoader, &fontFile); -#define FAIL(...) \ - HB_STMT_START { \ - DEBUG_MSG (DIRECTWRITE, nullptr, __VA_ARGS__); \ - return nullptr; \ - } HB_STMT_END - if (FAILED (hr)) FAIL ("Failed to load font file from data!"); @@ -224,6 +257,8 @@ _hb_directwrite_shaper_face_data_destroy (hb_directwrite_face_data_t *data) delete data->fontFileStream; if (data->faceBlob) hb_blob_destroy (data->faceBlob); + if (data->dwrite_dll) + FreeLibrary (data->dwrite_dll); if (data) delete data; } @@ -504,11 +539,6 @@ protected: Run mRunHead; }; -static inline uint16_t hb_uint16_swap (const uint16_t v) -{ return (v >> 8) | (v << 8); } -static inline uint32_t hb_uint32_swap (const uint32_t v) -{ return (hb_uint16_swap (v) << 16) | hb_uint16_swap (v >> 16); } - /* * shaper */ @@ -899,7 +929,7 @@ _hb_directwrite_table_data_release (void *data) } static hb_blob_t * -reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) +_hb_directwrite_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) { IDWriteFontFace *dw_face = ((IDWriteFontFace *) user_data); const void *data; @@ -944,7 +974,7 @@ hb_directwrite_face_create (IDWriteFontFace *font_face) { if (font_face) font_face->AddRef (); - return hb_face_create_for_tables (reference_table, font_face, + return hb_face_create_for_tables (_hb_directwrite_reference_table, font_face, _hb_directwrite_font_release); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc index f450d888945..e6339cdcee8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc @@ -1300,6 +1300,8 @@ DEFINE_NULL_INSTANCE (hb_font_t) = 1000, /* x_scale */ 1000, /* y_scale */ + 1<<16, /* x_mult */ + 1<<16, /* y_mult */ 0, /* x_ppem */ 0, /* y_ppem */ @@ -1330,6 +1332,7 @@ _hb_font_create (hb_face_t *face) font->klass = hb_font_funcs_get_empty (); font->data.init0 (font); font->x_scale = font->y_scale = hb_face_get_upem (face); + font->x_mult = font->y_mult = 1 << 16; return font; } @@ -1601,7 +1604,9 @@ hb_font_set_face (hb_font_t *font, hb_face_t *old = font->face; + hb_face_make_immutable (face); font->face = hb_face_reference (face); + font->mults_changed (); hb_face_destroy (old); } @@ -1711,6 +1716,7 @@ hb_font_set_scale (hb_font_t *font, font->x_scale = x_scale; font->y_scale = y_scale; + font->mults_changed (); } /** @@ -1855,6 +1861,7 @@ hb_font_set_variations (hb_font_t *font, normalized, coords_length); _hb_font_adopt_var_coords_normalized (font, normalized, coords_length); } + /** * hb_font_set_var_coords_design: * @@ -1875,6 +1882,33 @@ hb_font_set_var_coords_design (hb_font_t *font, hb_ot_var_normalize_coords (font->face, coords_length, coords, normalized); _hb_font_adopt_var_coords_normalized (font, normalized, coords_length); } + +/** + * hb_font_set_var_named_instance: + * @font: a font. + * @instance_index: named instance index. + * + * Sets design coords of a font from a named instance index. + * + * Since: 2.6.0 + */ +void +hb_font_set_var_named_instance (hb_font_t *font, + unsigned instance_index) +{ + if (hb_object_is_immutable (font)) + return; + + unsigned int coords_length = hb_ot_var_named_instance_get_design_coords (font->face, instance_index, nullptr, nullptr); + + float *coords = coords_length ? (float *) calloc (coords_length, sizeof (float)) : nullptr; + if (unlikely (coords_length && !coords)) + return; + + hb_ot_var_named_instance_get_design_coords (font->face, instance_index, &coords_length, coords); + hb_font_set_var_coords_design (font, coords, coords_length); + free (coords); +} #endif /** diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.h index 5bd8cbbcfa1..e68fd1813b6 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.h @@ -705,6 +705,10 @@ HB_EXTERN const int * hb_font_get_var_coords_normalized (hb_font_t *font, unsigned int *length); +HB_EXTERN void +hb_font_set_var_named_instance (hb_font_t *font, + unsigned instance_index); + HB_END_DECLS #endif /* HB_FONT_H */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh index 3b917d12930..4adf6ae99a9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh @@ -107,8 +107,10 @@ struct hb_font_t hb_font_t *parent; hb_face_t *face; - int x_scale; - int y_scale; + int32_t x_scale; + int32_t y_scale; + int64_t x_mult; + int64_t y_mult; unsigned int x_ppem; unsigned int y_ppem; @@ -127,16 +129,16 @@ struct hb_font_t /* Convert from font-space to user-space */ - int dir_scale (hb_direction_t direction) - { return HB_DIRECTION_IS_VERTICAL(direction) ? y_scale : x_scale; } - hb_position_t em_scale_x (int16_t v) { return em_scale (v, x_scale); } - hb_position_t em_scale_y (int16_t v) { return em_scale (v, y_scale); } - hb_position_t em_scalef_x (float v) { return em_scalef (v, this->x_scale); } - hb_position_t em_scalef_y (float v) { return em_scalef (v, this->y_scale); } + int64_t dir_mult (hb_direction_t direction) + { return HB_DIRECTION_IS_VERTICAL(direction) ? y_mult : x_mult; } + hb_position_t em_scale_x (int16_t v) { return em_mult (v, x_mult); } + hb_position_t em_scale_y (int16_t v) { return em_mult (v, y_mult); } + hb_position_t em_scalef_x (float v) { return em_scalef (v, x_scale); } + hb_position_t em_scalef_y (float v) { return em_scalef (v, y_scale); } float em_fscale_x (int16_t v) { return em_fscale (v, x_scale); } float em_fscale_y (int16_t v) { return em_fscale (v, y_scale); } hb_position_t em_scale_dir (int16_t v, hb_direction_t direction) - { return em_scale (v, dir_scale (direction)); } + { return em_mult (v, dir_mult (direction)); } /* Convert from parent-font user-space to our user-space */ hb_position_t parent_scale_x_distance (hb_position_t v) @@ -607,12 +609,16 @@ struct hb_font_t return false; } - hb_position_t em_scale (int16_t v, int scale) + void mults_changed () { - int upem = face->get_upem (); - int64_t scaled = v * (int64_t) scale; - scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */ - return (hb_position_t) (scaled / upem); + signed upem = face->get_upem (); + x_mult = ((int64_t) x_scale << 16) / upem; + y_mult = ((int64_t) y_scale << 16) / upem; + } + + hb_position_t em_mult (int16_t v, int64_t mult) + { + return (hb_position_t) ((v * mult) >> 16); } hb_position_t em_scalef (float v, int scale) { return (hb_position_t) roundf (v * scale / face->get_upem ()); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc index c01f02991a7..2d7f2b959b9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc @@ -564,7 +564,7 @@ _hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref) static hb_blob_t * -reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) +_hb_ft_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) { FT_Face ft_face = (FT_Face) user_data; FT_Byte *buffer; @@ -619,7 +619,7 @@ hb_ft_face_create (FT_Face ft_face, face = hb_face_create (blob, ft_face->face_index); hb_blob_destroy (blob); } else { - face = hb_face_create_for_tables (reference_table, ft_face, destroy); + face = hb_face_create_for_tables (_hb_ft_reference_table, ft_face, destroy); } hb_face_set_index (face, ft_face->face_index); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gdi.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gdi.cc new file mode 100644 index 00000000000..d55085cb442 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gdi.cc @@ -0,0 +1,73 @@ +/* + * Copyright © 2019 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "hb.hh" + +#ifdef HAVE_GDI + +#include "hb-gdi.h" + +static hb_blob_t * +_hb_gdi_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) +{ + char *buffer = nullptr; + DWORD length = 0; + + HDC hdc = GetDC (nullptr); + if (unlikely (!SelectObject (hdc, (HFONT) user_data))) goto fail; + + length = GetFontData (hdc, hb_uint32_swap (tag), 0, buffer, length); + if (unlikely (length == GDI_ERROR)) goto fail_with_releasedc; + + buffer = (char *) malloc (length); + if (unlikely (!buffer)) goto fail_with_releasedc; + length = GetFontData (hdc, hb_uint32_swap (tag), 0, buffer, length); + if (unlikely (length == GDI_ERROR)) goto fail_with_releasedc_and_free; + ReleaseDC (nullptr, hdc); + + return hb_blob_create ((const char *) buffer, length, HB_MEMORY_MODE_WRITABLE, buffer, free); + +fail_with_releasedc_and_free: + free (buffer); +fail_with_releasedc: + ReleaseDC (nullptr, hdc); +fail: + return hb_blob_get_empty (); +} + +/** + * hb_gdi_face_create: + * @hdc: a HFONT object. + * + * Return value: #hb_face_t object corresponding to the given input + * + * Since: 2.6.0 + **/ +hb_face_t * +hb_gdi_face_create (HFONT hfont) +{ + return hb_face_create_for_tables (_hb_gdi_reference_table, (void *) hfont, nullptr); +} + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gdi.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gdi.h new file mode 100644 index 00000000000..68cc43917e0 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gdi.h @@ -0,0 +1,39 @@ +/* + * Copyright © 2019 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HB_GDI_H +#define HB_GDI_H + +#include "hb.h" + +#include <windows.h> + +HB_BEGIN_DECLS + +HB_EXTERN hb_face_t * +hb_gdi_face_create (HFONT hfont); + +HB_END_DECLS + +#endif /* HB_GDI_H */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc index 9588fa4d6fe..40ac9061ff2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc @@ -106,32 +106,6 @@ retry: return d; } -static void hb_graphite2_release_table(const void *data, const void *table_buffer) -{ - hb_graphite2_face_data_t *face_data = (hb_graphite2_face_data_t *) data; - hb_graphite2_tablelist_t *tlist = face_data->tlist; - - hb_graphite2_tablelist_t *prev = nullptr; - hb_graphite2_tablelist_t *curr = tlist; - while (curr) - { - if (hb_blob_get_data(curr->blob, nullptr) == table_buffer) - { - if (prev == nullptr) - face_data->tlist.cmpexch(tlist, curr->next); - else - prev->next = curr->next; - hb_blob_destroy(curr->blob); - free(curr); - break; - } - prev = curr; - curr = curr->next; - } -} - -static gr_face_ops hb_graphite2_face_ops = { sizeof(gr_face_ops), hb_graphite2_get_table, hb_graphite2_release_table }; - hb_graphite2_face_data_t * _hb_graphite2_shaper_face_data_create (hb_face_t *face) { @@ -150,7 +124,7 @@ _hb_graphite2_shaper_face_data_create (hb_face_t *face) return nullptr; data->face = face; - data->grface = gr_make_face_with_ops (data, &hb_graphite2_face_ops, gr_face_preloadAll); + data->grface = gr_make_face (data, &hb_graphite2_get_table, gr_face_preloadAll); if (unlikely (!data->grface)) { free (data); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter.hh index 5df433375c8..8d2ff80c218 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter.hh @@ -480,7 +480,7 @@ struct hb_reduce_t template <typename Iter, hb_requires (hb_is_iterator (Iter)), - typename AccuT = decltype (hb_declval (Redu) (hb_declval (InitT), hb_declval (typename Iter::item_t)))> + typename AccuT = hb_decay<decltype (hb_declval (Redu) (hb_declval (InitT), hb_declval (typename Iter::item_t)))>> AccuT operator () (Iter it) { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-meta.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-meta.hh index df8ebd17503..2dfaeb7b464 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-meta.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-meta.hh @@ -80,8 +80,8 @@ template <typename T> using hb_type_identity = typename hb_type_identity_t<T>::t struct { - template <typename T> - T* operator () (T& arg) const + template <typename T> constexpr T* + operator () (T& arg) const { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" @@ -171,29 +171,29 @@ using hb_is_cr_convertible = hb_bool_constant< /* std::move and std::forward */ template <typename T> -static hb_remove_reference<T>&& hb_move (T&& t) { return (hb_remove_reference<T>&&) (t); } +static constexpr hb_remove_reference<T>&& hb_move (T&& t) { return (hb_remove_reference<T>&&) (t); } template <typename T> -static T&& hb_forward (hb_remove_reference<T>& t) { return (T&&) t; } +static constexpr T&& hb_forward (hb_remove_reference<T>& t) { return (T&&) t; } template <typename T> -static T&& hb_forward (hb_remove_reference<T>&& t) { return (T&&) t; } +static constexpr T&& hb_forward (hb_remove_reference<T>&& t) { return (T&&) t; } struct { - template <typename T> auto + template <typename T> constexpr auto operator () (T&& v) const HB_AUTO_RETURN (hb_forward<T> (v)) - template <typename T> auto + template <typename T> constexpr auto operator () (T *v) const HB_AUTO_RETURN (*v) } HB_FUNCOBJ (hb_deref); struct { - template <typename T> auto + template <typename T> constexpr auto operator () (T&& v) const HB_AUTO_RETURN (hb_forward<T> (v)) - template <typename T> auto + template <typename T> constexpr auto operator () (T& v) const HB_AUTO_RETURN (hb_addressof (v)) } HB_FUNCOBJ (hb_ref); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file.hh index 5318c7fca99..f3f4dc07f50 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file.hh @@ -141,14 +141,15 @@ typedef struct OffsetTable TableRecord &rec = tables.arrayZ[i]; hb_blob_t *blob = items[i].blob; rec.tag = items[i].tag; - rec.length = hb_blob_get_length (blob); + rec.length = blob->length; rec.offset.serialize (c, this); /* Allocate room for the table and copy it. */ char *start = (char *) c->allocate_size<void> (rec.length); - if (unlikely (!start)) {return false;} + if (unlikely (!start)) return false; - memcpy (start, hb_blob_get_data (blob, nullptr), rec.length); + if (likely (rec.length)) + memcpy (start, blob->data, rec.length); /* 4-byte alignment. */ c->align (4); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh index e235a97c320..ad995750b84 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh @@ -576,13 +576,13 @@ struct ArrayOf operator writer_t () { return writer (); } hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int count) - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } bool serialize (hb_serialize_context_t *c, unsigned int items_len) { @@ -826,13 +826,13 @@ struct SortedArrayOf : ArrayOf<Type, LenType> operator writer_t () { return writer (); } hb_sorted_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } hb_sorted_array_t<const Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } hb_sorted_array_t<Type> sub_array (unsigned int start_offset, unsigned int count) - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } hb_sorted_array_t<Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } bool serialize (hb_serialize_context_t *c, unsigned int items_len) { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff-common.hh index 8b8e592013a..aced77c83de 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff-common.hh @@ -40,14 +40,14 @@ using namespace OT; /* utility macro */ template<typename Type> -static inline const Type& StructAtOffsetOrNull(const void *P, unsigned int offset) -{ return offset? (* reinterpret_cast<const Type*> ((const char *) P + offset)): Null(Type); } +static inline const Type& StructAtOffsetOrNull (const void *P, unsigned int offset) +{ return offset ? StructAtOffset<Type> (P, offset) : Null (Type); } -inline unsigned int calcOffSize(unsigned int dataSize) +inline unsigned int calcOffSize (unsigned int dataSize) { unsigned int size = 1; unsigned int offset = dataSize + 1; - while ((offset & ~0xFF) != 0) + while (offset & ~0xFF) { size++; offset >>= 8; @@ -58,8 +58,8 @@ inline unsigned int calcOffSize(unsigned int dataSize) struct code_pair_t { - hb_codepoint_t code; - hb_codepoint_t glyph; + hb_codepoint_t code; + hb_codepoint_t glyph; }; typedef hb_vector_t<unsigned char> str_buff_t; @@ -92,10 +92,8 @@ struct CFFIndex static unsigned int calculate_serialized_size (unsigned int offSize_, unsigned int count, unsigned int dataSize) { - if (count == 0) - return COUNT::static_size; - else - return min_size + calculate_offset_array_size (offSize_, count) + dataSize; + if (count == 0) return COUNT::static_size; + return min_size + calculate_offset_array_size (offSize_, count) + dataSize; } bool serialize (hb_serialize_context_t *c, const CFFIndex &src) @@ -159,9 +157,7 @@ struct CFFIndex byteArray.init (); byteArray.resize (buffArray.length); for (unsigned int i = 0; i < byteArray.length; i++) - { byteArray[i] = byte_str_t (buffArray[i].arrayZ, buffArray[i].length); - } bool result = this->serialize (c, offSize_, byteArray); byteArray.fini (); return result; @@ -192,43 +188,35 @@ struct CFFIndex unsigned int length_at (unsigned int index) const { - if (likely ((offset_at (index + 1) >= offset_at (index)) && - (offset_at (index + 1) <= offset_at (count)))) - return offset_at (index + 1) - offset_at (index); - else + if (unlikely ((offset_at (index + 1) < offset_at (index)) || + (offset_at (index + 1) > offset_at (count)))) return 0; + return offset_at (index + 1) - offset_at (index); } const unsigned char *data_base () const - { return (const unsigned char *)this + min_size + offset_array_size (); } + { return (const unsigned char *) this + min_size + offset_array_size (); } unsigned int data_size () const { return HBINT8::static_size; } byte_str_t operator [] (unsigned int index) const { - if (likely (index < count)) - return byte_str_t (data_base () + offset_at (index) - 1, length_at (index)); - else - return Null (byte_str_t); + if (unlikely (index >= count)) return Null (byte_str_t); + return byte_str_t (data_base () + offset_at (index) - 1, length_at (index)); } unsigned int get_size () const { - if (this != &Null (CFFIndex)) - { - if (count > 0) - return min_size + offset_array_size () + (offset_at (count) - 1); - else - return count.static_size; /* empty CFFIndex contains count only */ - } - else - return 0; + if (this == &Null (CFFIndex)) return 0; + if (count > 0) + return min_size + offset_array_size () + (offset_at (count) - 1); + return count.static_size; /* empty CFFIndex contains count only */ } bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (likely ((count.sanitize (c) && count == 0) || /* empty INDEX */ + return_trace (likely ((c->check_struct (this) && count == 0) || /* empty INDEX */ (c->check_struct (this) && offSize >= 1 && offSize <= 4 && c->check_array (offsets, offSize, count + 1) && c->check_array ((const HBUINT8*) data_base (), 1, max_offset () - 1)))); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.cc index 3238ad73a7b..3e4fc204f34 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff1-table.cc @@ -210,7 +210,7 @@ struct bounds_t point_t max; }; -struct extents_param_t +struct cff1_extents_param_t { void init (const OT::cff1::accelerator_t *_cff) { @@ -229,15 +229,15 @@ struct extents_param_t const OT::cff1::accelerator_t *cff; }; -struct cff1_path_procs_extents_t : path_procs_t<cff1_path_procs_extents_t, cff1_cs_interp_env_t, extents_param_t> +struct cff1_path_procs_extents_t : path_procs_t<cff1_path_procs_extents_t, cff1_cs_interp_env_t, cff1_extents_param_t> { - static void moveto (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt) + static void moveto (cff1_cs_interp_env_t &env, cff1_extents_param_t& param, const point_t &pt) { param.end_path (); env.moveto (pt); } - static void line (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1) + static void line (cff1_cs_interp_env_t &env, cff1_extents_param_t& param, const point_t &pt1) { if (!param.is_path_open ()) { @@ -248,7 +248,7 @@ struct cff1_path_procs_extents_t : path_procs_t<cff1_path_procs_extents_t, cff1_ param.bounds.update (env.get_pt ()); } - static void curve (cff1_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1, const point_t &pt2, const point_t &pt3) + static void curve (cff1_cs_interp_env_t &env, cff1_extents_param_t& param, const point_t &pt1, const point_t &pt2, const point_t &pt3) { if (!param.is_path_open ()) { @@ -265,9 +265,9 @@ struct cff1_path_procs_extents_t : path_procs_t<cff1_path_procs_extents_t, cff1_ static bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, bounds_t &bounds, bool in_seac=false); -struct cff1_cs_opset_extents_t : cff1_cs_opset_t<cff1_cs_opset_extents_t, extents_param_t, cff1_path_procs_extents_t> +struct cff1_cs_opset_extents_t : cff1_cs_opset_t<cff1_cs_opset_extents_t, cff1_extents_param_t, cff1_path_procs_extents_t> { - static void process_seac (cff1_cs_interp_env_t &env, extents_param_t& param) + static void process_seac (cff1_cs_interp_env_t &env, cff1_extents_param_t& param) { unsigned int n = env.argStack.get_count (); point_t delta; @@ -296,11 +296,11 @@ bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, boun if (unlikely (!cff->is_valid () || (glyph >= cff->num_glyphs))) return false; unsigned int fd = cff->fdSelect->get_fd (glyph); - cff1_cs_interpreter_t<cff1_cs_opset_extents_t, extents_param_t> interp; + cff1_cs_interpreter_t<cff1_cs_opset_extents_t, cff1_extents_param_t> interp; const byte_str_t str = (*cff->charStrings)[glyph]; interp.env.init (str, *cff, fd); interp.env.set_in_seac (in_seac); - extents_param_t param; + cff1_extents_param_t param; param.init (cff); if (unlikely (!interp.interpret (param))) return false; bounds = param.bounds; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc index 9c9e37bd0c4..33b51fea43b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc @@ -33,7 +33,7 @@ using namespace CFF; -struct extents_param_t +struct cff2_extents_param_t { void init () { @@ -63,15 +63,15 @@ struct extents_param_t number_t max_y; }; -struct cff2_path_procs_extents_t : path_procs_t<cff2_path_procs_extents_t, cff2_cs_interp_env_t, extents_param_t> +struct cff2_path_procs_extents_t : path_procs_t<cff2_path_procs_extents_t, cff2_cs_interp_env_t, cff2_extents_param_t> { - static void moveto (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt) + static void moveto (cff2_cs_interp_env_t &env, cff2_extents_param_t& param, const point_t &pt) { param.end_path (); env.moveto (pt); } - static void line (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1) + static void line (cff2_cs_interp_env_t &env, cff2_extents_param_t& param, const point_t &pt1) { if (!param.is_path_open ()) { @@ -82,7 +82,7 @@ struct cff2_path_procs_extents_t : path_procs_t<cff2_path_procs_extents_t, cff2_ param.update_bounds (env.get_pt ()); } - static void curve (cff2_cs_interp_env_t &env, extents_param_t& param, const point_t &pt1, const point_t &pt2, const point_t &pt3) + static void curve (cff2_cs_interp_env_t &env, cff2_extents_param_t& param, const point_t &pt1, const point_t &pt2, const point_t &pt3) { if (!param.is_path_open ()) { @@ -97,7 +97,7 @@ struct cff2_path_procs_extents_t : path_procs_t<cff2_path_procs_extents_t, cff2_ } }; -struct cff2_cs_opset_extents_t : cff2_cs_opset_t<cff2_cs_opset_extents_t, extents_param_t, cff2_path_procs_extents_t> {}; +struct cff2_cs_opset_extents_t : cff2_cs_opset_t<cff2_cs_opset_extents_t, cff2_extents_param_t, cff2_path_procs_extents_t> {}; bool OT::cff2::accelerator_t::get_extents (hb_font_t *font, hb_codepoint_t glyph, @@ -113,10 +113,10 @@ bool OT::cff2::accelerator_t::get_extents (hb_font_t *font, unsigned int num_coords; const int *coords = hb_font_get_var_coords_normalized (font, &num_coords); unsigned int fd = fdSelect->get_fd (glyph); - cff2_cs_interpreter_t<cff2_cs_opset_extents_t, extents_param_t> interp; + cff2_cs_interpreter_t<cff2_cs_opset_extents_t, cff2_extents_param_t> interp; const byte_str_t str = (*charStrings)[glyph]; interp.env.init (str, *this, fd, coords, num_coords); - extents_param_t param; + cff2_extents_param_t param; param.init (); if (unlikely (!interp.interpret (param))) return false; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh index ac75bd96a43..746e87f48fd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh @@ -74,153 +74,201 @@ struct CmapSubtableFormat0 struct CmapSubtableFormat4 { - struct segment_plan - { - HBUINT16 start_code; - HBUINT16 end_code; - bool use_delta; - }; - bool serialize (hb_serialize_context_t *c, - const hb_subset_plan_t *plan, - const hb_sorted_vector_t<segment_plan> &segments) + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + HBUINT16* serialize_endcode_array (hb_serialize_context_t *c, + Iterator it) { - TRACE_SERIALIZE (this); - - if (unlikely (!c->extend_min (*this))) return_trace (false); - - this->format = 4; - this->length = get_sub_table_size (segments); - - this->segCountX2 = segments.length * 2; - this->entrySelector = hb_max (1u, hb_bit_storage (segments.length)) - 1; - this->searchRange = 2 * (1u << this->entrySelector); - this->rangeShift = segments.length * 2 > this->searchRange - ? 2 * segments.length - this->searchRange - : 0; - - HBUINT16 *end_count = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.length); - c->allocate_size<HBUINT16> (HBUINT16::static_size); // 2 bytes of padding. - HBUINT16 *start_count = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.length); - HBINT16 *id_delta = c->allocate_size<HBINT16> (HBUINT16::static_size * segments.length); - HBUINT16 *id_range_offset = c->allocate_size<HBUINT16> (HBUINT16::static_size * segments.length); - - if (id_range_offset == nullptr) - return_trace (false); + HBUINT16 *endCode = c->start_embed<HBUINT16> (); + hb_codepoint_t prev_endcp = 0xFFFF; + + + it + | hb_apply ([&] (const hb_item_type<Iterator> _) + { + if (prev_endcp != 0xFFFF && prev_endcp + 1u != _.first) + { + HBUINT16 end_code; + end_code = prev_endcp; + c->copy<HBUINT16> (end_code); + } + prev_endcp = _.first; + }) + ; - for (unsigned int i = 0; i < segments.length; i++) { - end_count[i] = segments[i].end_code; - start_count[i] = segments[i].start_code; - if (segments[i].use_delta) + // last endCode + HBUINT16 endcode; + endcode = prev_endcp; + if (unlikely (!c->copy<HBUINT16> (endcode))) return nullptr; + // There must be a final entry with end_code == 0xFFFF. + if (prev_endcp != 0xFFFF) { - hb_codepoint_t cp = segments[i].start_code; - hb_codepoint_t start_gid = 0; - if (unlikely (!plan->new_gid_for_codepoint (cp, &start_gid) && cp != 0xFFFF)) - return_trace (false); - id_delta[i] = start_gid - segments[i].start_code; - } else { - id_delta[i] = 0; - unsigned int num_codepoints = segments[i].end_code - segments[i].start_code + 1; - HBUINT16 *glyph_id_array = c->allocate_size<HBUINT16> (HBUINT16::static_size * num_codepoints); - if (glyph_id_array == nullptr) - return_trace (false); - // From the cmap spec: - // - // id_range_offset[i]/2 - // + (cp - segments[i].start_code) - // + (id_range_offset + i) - // = - // glyph_id_array + (cp - segments[i].start_code) - // - // So, solve for id_range_offset[i]: - // - // id_range_offset[i] - // = - // 2 * (glyph_id_array - id_range_offset - i) - id_range_offset[i] = 2 * (glyph_id_array - id_range_offset - i); - for (unsigned int j = 0; j < num_codepoints; j++) - { - hb_codepoint_t cp = segments[i].start_code + j; - hb_codepoint_t new_gid = 0; - if (unlikely (!plan->new_gid_for_codepoint (cp, &new_gid))) - return_trace (false); - glyph_id_array[j] = new_gid; - } + HBUINT16 finalcode; + finalcode = 0xFFFF; + if (unlikely (!c->copy<HBUINT16> (finalcode))) return nullptr; } } - return_trace (true); + return endCode; } - static size_t get_sub_table_size (const hb_sorted_vector_t<segment_plan> &segments) + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + HBUINT16* serialize_startcode_array (hb_serialize_context_t *c, + Iterator it) { - size_t segment_size = 0; - for (unsigned int i = 0; i < segments.length; i++) + HBUINT16 *startCode = c->start_embed<HBUINT16> (); + hb_codepoint_t prev_cp = 0xFFFF; + + + it + | hb_apply ([&] (const hb_item_type<Iterator> _) + { + if (prev_cp == 0xFFFF || prev_cp + 1u != _.first) + { + HBUINT16 start_code; + start_code = _.first; + c->copy<HBUINT16> (start_code); + } + + prev_cp = _.first; + }) + ; + + // There must be a final entry with end_code == 0xFFFF. + if (it.len () == 0 || prev_cp != 0xFFFF) { - // Parallel array entries - segment_size += - 2 // end count - + 2 // start count - + 2 // delta - + 2; // range offset - - if (!segments[i].use_delta) - // Add bytes for the glyph index array entries for this segment. - segment_size += (segments[i].end_code - segments[i].start_code + 1) * 2; + HBUINT16 finalcode; + finalcode = 0xFFFF; + if (unlikely (!c->copy<HBUINT16> (finalcode))) return nullptr; } - return min_size - + 2 // Padding - + segment_size; + return startCode; } - static bool create_sub_table_plan (const hb_subset_plan_t *plan, - hb_sorted_vector_t<segment_plan> *segments) + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + HBINT16* serialize_idDelta_array (hb_serialize_context_t *c, + Iterator it, + HBUINT16 *endCode, + HBUINT16 *startCode, + unsigned segcount) { - segment_plan *segment = nullptr; - hb_codepoint_t last_gid = 0; + unsigned i = 0; + hb_codepoint_t last_gid = 0, start_gid = 0, last_cp = 0xFFFF; + bool use_delta = true; + + HBINT16 *idDelta = c->start_embed<HBINT16> (); + if ((char *)idDelta - (char *)startCode != (int) segcount * (int) HBINT16::static_size) + return nullptr; - hb_codepoint_t cp = HB_SET_VALUE_INVALID; - while (plan->unicodes->next (&cp)) { - hb_codepoint_t new_gid = 0; - if (unlikely (!plan->new_gid_for_codepoint (cp, &new_gid))) - { - DEBUG_MSG(SUBSET, nullptr, "Unable to find new gid for %04x", cp); - return false; - } + + it + | hb_apply ([&] (const hb_item_type<Iterator> _) + { + if (_.first == startCode[i]) + { + use_delta = true; + start_gid = _.second; + } + else if (_.second != last_gid + 1) use_delta = false; + + if (_.first == endCode[i]) + { + HBINT16 delta; + if (use_delta) delta = (int)start_gid - (int)startCode[i]; + else delta = 0; + c->copy<HBINT16> (delta); + + i++; + } + + last_gid = _.second; + last_cp = _.first; + }) + ; - /* Stop adding to cmap if we are now outside of unicode BMP. */ - if (cp > 0xFFFF) break; + if (it.len () == 0 || last_cp != 0xFFFF) + { + HBINT16 delta; + delta = 1; + if (unlikely (!c->copy<HBINT16> (delta))) return nullptr; + } - if (!segment || - cp != segment->end_code + 1u) - { - segment = segments->push (); - segment->start_code = cp; - segment->end_code = cp; - segment->use_delta = true; - } else { - segment->end_code = cp; - if (last_gid + 1u != new_gid) - // gid's are not consecutive in this segment so delta - // cannot be used. - segment->use_delta = false; - } + return idDelta; + } - last_gid = new_gid; - } + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + HBUINT16* serialize_rangeoffset_glyid (hb_serialize_context_t *c, + Iterator it, + HBUINT16 *endCode, + HBUINT16 *startCode, + HBINT16 *idDelta, + unsigned segcount) + { + HBUINT16 *idRangeOffset = c->allocate_size<HBUINT16> (HBUINT16::static_size * segcount); + if (unlikely (!c->check_success (idRangeOffset))) return nullptr; + if (unlikely ((char *)idRangeOffset - (char *)idDelta != (int) segcount * (int) HBINT16::static_size)) return nullptr; + + + hb_range (segcount) + | hb_filter ([&] (const unsigned _) { return idDelta[_] == 0; }) + | hb_apply ([&] (const unsigned i) + { + idRangeOffset[i] = 2 * (c->start_embed<HBUINT16> () - idRangeOffset - i); + + + it + | hb_filter ([&] (const hb_item_type<Iterator> _) { return _.first >= startCode[i] && _.first <= endCode[i]; }) + | hb_apply ([&] (const hb_item_type<Iterator> _) + { + HBUINT16 glyID; + glyID = _.second; + c->copy<HBUINT16> (glyID); + }) + ; + + + }) + ; - // There must be a final entry with end_code == 0xFFFF. Check if we need to add one. - if (segment == nullptr || segment->end_code != 0xFFFF) - { - segment = segments->push (); - segment->start_code = 0xFFFF; - segment->end_code = 0xFFFF; - segment->use_delta = true; - } + return idRangeOffset; + } - return true; + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + void serialize (hb_serialize_context_t *c, + Iterator it) + { + unsigned table_initpos = c->length (); + if (unlikely (!c->extend_min (*this))) return; + this->format = 4; + + //serialize endCode[] + HBUINT16 *endCode = serialize_endcode_array (c, it); + if (unlikely (!endCode)) return; + + unsigned segcount = (c->length () - min_size) / HBUINT16::static_size; + + // 2 bytes of padding. + if (unlikely (!c->allocate_size<HBUINT16> (HBUINT16::static_size))) return; // 2 bytes of padding. + + // serialize startCode[] + HBUINT16 *startCode = serialize_startcode_array (c, it); + if (unlikely (!startCode)) return; + + //serialize idDelta[] + HBINT16 *idDelta = serialize_idDelta_array (c, it, endCode, startCode, segcount); + if (unlikely (!idDelta)) return; + + HBUINT16 *idRangeOffset = serialize_rangeoffset_glyid (c, it, endCode, startCode, idDelta, segcount); + if (unlikely (!c->check_success (idRangeOffset))) return; + + if (unlikely (!c->check_assign(this->length, c->length () - table_initpos))) return; + this->segCountX2 = segcount * 2; + this->entrySelector = hb_max (1u, hb_bit_storage (segcount)) - 1; + this->searchRange = 2 * (1u << this->entrySelector); + this->rangeShift = segcount * 2 > this->searchRange + ? 2 * segcount - this->searchRange + : 0; } struct accelerator_t @@ -489,15 +537,6 @@ struct CmapSubtableLongSegmented return_trace (c->check_struct (this) && groups.sanitize (c)); } - bool serialize (hb_serialize_context_t *c, - const hb_sorted_vector_t<CmapSubtableLongGroup> &group_data) - { - TRACE_SERIALIZE (this); - if (unlikely (!c->extend_min (*this))) return_trace (false); - if (unlikely (!groups.serialize (c, group_data.as_array ()))) return_trace (false); - return_trace (true); - } - protected: HBUINT16 format; /* Subtable format; set to 12. */ HBUINT16 reserved; /* Reserved; set to 0. */ @@ -517,17 +556,56 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12> group.glyphID + (u - group.startCharCode) : 0; } - bool serialize (hb_serialize_context_t *c, - const hb_sorted_vector_t<CmapSubtableLongGroup> &groups_data) + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + void serialize (hb_serialize_context_t *c, + Iterator it) { - TRACE_SERIALIZE (this); - if (unlikely (!c->extend_min (*this))) return_trace (false); + if (it.len () == 0) return; + unsigned table_initpos = c->length (); + if (unlikely (!c->extend_min (*this))) return; + + hb_codepoint_t startCharCode = 0xFFFF, endCharCode = 0xFFFF; + hb_codepoint_t glyphID = 0; + + + it + | hb_apply ([&] (const hb_item_type<Iterator> _) + { + if (startCharCode == 0xFFFF) + { + startCharCode = _.first; + endCharCode = _.first; + glyphID = _.second; + } + else if (!_is_gid_consecutive (endCharCode, startCharCode, glyphID, _.first, _.second)) + { + CmapSubtableLongGroup grouprecord; + grouprecord.startCharCode = startCharCode; + grouprecord.endCharCode = endCharCode; + grouprecord.glyphID = glyphID; + c->copy<CmapSubtableLongGroup> (grouprecord); + + startCharCode = _.first; + endCharCode = _.first; + glyphID = _.second; + } + else + { + endCharCode = _.first; + } + }) + ; + + CmapSubtableLongGroup record; + record.startCharCode = startCharCode; + record.endCharCode = endCharCode; + record.glyphID = glyphID; + c->copy<CmapSubtableLongGroup> (record); this->format = 12; this->reserved = 0; - this->length = get_sub_table_size (groups_data); - - return_trace (CmapSubtableLongSegmented<CmapSubtableFormat12>::serialize (c, groups_data)); + this->length = c->length () - table_initpos; + this->groups.len = (this->length - min_size)/CmapSubtableLongGroup::static_size; } static size_t get_sub_table_size (const hb_sorted_vector_t<CmapSubtableLongGroup> &groups_data) @@ -535,46 +613,15 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12> return 16 + 12 * groups_data.length; } - static bool create_sub_table_plan (const hb_subset_plan_t *plan, - hb_sorted_vector_t<CmapSubtableLongGroup> *groups_out) - { - CmapSubtableLongGroup *group = nullptr; - - hb_codepoint_t cp = HB_SET_VALUE_INVALID; - while (plan->unicodes->next (&cp)) { - hb_codepoint_t new_gid = 0; - if (unlikely (!plan->new_gid_for_codepoint (cp, &new_gid))) - { - DEBUG_MSG(SUBSET, nullptr, "Unable to find new gid for %04x", cp); - return false; - } - - if (!group || !_is_gid_consecutive (group, cp, new_gid)) - { - group = groups_out->push (); - group->startCharCode = cp; - group->endCharCode = cp; - group->glyphID = new_gid; - } - else group->endCharCode = cp; - } - - DEBUG_MSG(SUBSET, nullptr, "cmap"); - for (unsigned int i = 0; i < groups_out->length; i++) { - CmapSubtableLongGroup& group = (*groups_out)[i]; - DEBUG_MSG(SUBSET, nullptr, " %d: U+%04X-U+%04X, gid %d-%d", i, (uint32_t) group.startCharCode, (uint32_t) group.endCharCode, (uint32_t) group.glyphID, (uint32_t) group.glyphID + ((uint32_t) group.endCharCode - (uint32_t) group.startCharCode)); - } - - return true; - } - private: - static bool _is_gid_consecutive (CmapSubtableLongGroup *group, + static bool _is_gid_consecutive (hb_codepoint_t endCharCode, + hb_codepoint_t startCharCode, + hb_codepoint_t glyphID, hb_codepoint_t cp, hb_codepoint_t new_gid) { - return (cp - 1 == group->endCharCode) && - new_gid == group->glyphID + (cp - group->startCharCode); + return (cp - 1 == endCharCode) && + new_gid == glyphID + (cp - startCharCode); } }; @@ -756,12 +803,10 @@ struct CmapSubtable hb_codepoint_t *glyph) const { switch (u.format) { -#ifndef HB_NO_CMAP_LEGACY_SUBTABLES case 0: return u.format0 .get_glyph (codepoint, glyph); + case 4: return u.format4 .get_glyph (codepoint, glyph); case 6: return u.format6 .get_glyph (codepoint, glyph); case 10: return u.format10.get_glyph (codepoint, glyph); -#endif - case 4: return u.format4 .get_glyph (codepoint, glyph); case 12: return u.format12.get_glyph (codepoint, glyph); case 13: return u.format13.get_glyph (codepoint, glyph); case 14: @@ -771,12 +816,10 @@ struct CmapSubtable void collect_unicodes (hb_set_t *out) const { switch (u.format) { -#ifndef HB_NO_CMAP_LEGACY_SUBTABLES case 0: u.format0 .collect_unicodes (out); return; + case 4: u.format4 .collect_unicodes (out); return; case 6: u.format6 .collect_unicodes (out); return; case 10: u.format10.collect_unicodes (out); return; -#endif - case 4: u.format4 .collect_unicodes (out); return; case 12: u.format12.collect_unicodes (out); return; case 13: u.format13.collect_unicodes (out); return; case 14: @@ -784,17 +827,28 @@ struct CmapSubtable } } + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + void serialize (hb_serialize_context_t *c, + Iterator it, + unsigned format) + { + switch (format) { + case 4: u.format4.serialize (c, it); return; + case 12: u.format12.serialize (c, it); return; + default: return; + } + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); if (!u.format.sanitize (c)) return_trace (false); switch (u.format) { -#ifndef HB_NO_CMAP_LEGACY_SUBTABLES case 0: return_trace (u.format0 .sanitize (c)); + case 4: return_trace (u.format4 .sanitize (c)); case 6: return_trace (u.format6 .sanitize (c)); case 10: return_trace (u.format10.sanitize (c)); -#endif - case 4: return_trace (u.format4 .sanitize (c)); case 12: return_trace (u.format12.sanitize (c)); case 13: return_trace (u.format13.sanitize (c)); case 14: return_trace (u.format14.sanitize (c)); @@ -805,12 +859,10 @@ struct CmapSubtable public: union { HBUINT16 format; /* Format identifier */ -#ifndef HB_NO_CMAP_LEGACY_SUBTABLES CmapSubtableFormat0 format0; + CmapSubtableFormat4 format4; CmapSubtableFormat6 format6; CmapSubtableFormat10 format10; -#endif - CmapSubtableFormat4 format4; CmapSubtableFormat12 format12; CmapSubtableFormat13 format13; CmapSubtableFormat14 format14; @@ -839,6 +891,32 @@ struct EncodingRecord subtable.sanitize (c, base)); } + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + EncodingRecord* copy (hb_serialize_context_t *c, + Iterator it, + unsigned format, + void *base, + /* INOUT */ unsigned *objidx) const + { + TRACE_SERIALIZE (this); + auto *out = c->embed (this); + if (unlikely (!out)) return_trace (nullptr); + out->subtable = 0; + + if (*objidx == 0) + { + CmapSubtable *cmapsubtable = c->push<CmapSubtable> (); + unsigned origin_length = c->length (); + cmapsubtable->serialize (c, it, format); + if (c->length () - origin_length > 0) *objidx = c->pop_pack (); + else c->pop_discard (); + } + + c->add_link (out->subtable, *objidx, base); + return_trace (out); + } + HBUINT16 platformID; /* Platform ID. */ HBUINT16 encodingID; /* Platform-specific encoding ID. */ LOffsetTo<CmapSubtable> @@ -851,174 +929,62 @@ struct cmap { static constexpr hb_tag_t tableTag = HB_OT_TAG_cmap; - struct subset_plan + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + void serialize (hb_serialize_context_t *c, + Iterator it, + const EncodingRecord *unicode_bmp, + const EncodingRecord *unicode_ucs4, + const EncodingRecord *ms_bmp, + const EncodingRecord *ms_ucs4) { - size_t final_size () const - { - return 4 // header - + 8 * num_enc_records - + CmapSubtableFormat4::get_sub_table_size (this->format4_segments) - + CmapSubtableFormat12::get_sub_table_size (this->format12_groups); - } + if (unlikely (!c->extend_min ((*this)))) return; + this->version = 0; - unsigned int num_enc_records; - bool has_unicode_bmp; - bool has_unicode_ucs4; - bool has_ms_bmp; - bool has_ms_ucs4; - hb_sorted_vector_t<CmapSubtableFormat4::segment_plan> format4_segments; - hb_sorted_vector_t<CmapSubtableLongGroup> format12_groups; - }; + unsigned numTables = (unicode_bmp ? 1 : 0) + (unicode_ucs4 ? 1 : 0) + (ms_bmp ? 1 : 0) + (ms_ucs4 ? 1 : 0); + if (unlikely (!c->check_assign(this->encodingRecord.len, numTables))) return; - bool _create_plan (const hb_subset_plan_t *plan, - subset_plan *cmap_plan) const - { - cmap_plan->has_unicode_bmp = find_subtable (0, 3); - cmap_plan->has_unicode_ucs4 = find_subtable (0, 4); - cmap_plan->has_ms_bmp = find_subtable (3, 1); - cmap_plan->has_ms_ucs4 = find_subtable (3, 10); - cmap_plan->num_enc_records = cmap_plan->has_unicode_bmp + cmap_plan->has_unicode_ucs4 + cmap_plan->has_ms_bmp + cmap_plan->has_ms_ucs4; - - if (unlikely (!CmapSubtableFormat4::create_sub_table_plan (plan, &cmap_plan->format4_segments))) - return false; + unsigned format4objidx = 0, format12objidx = 0; + if (unicode_bmp) c->copy (unicode_bmp, it, 4u, this, &format4objidx); + if (unicode_ucs4) c->copy (unicode_ucs4, it, 12u, this, &format12objidx); + if (ms_bmp) c->copy (ms_bmp, it, 4u, this, &format4objidx); + if (ms_ucs4) c->copy (ms_ucs4, it, 12u, this, &format12objidx); - if (!find_subtable (12)) return true; - return CmapSubtableFormat12::create_sub_table_plan (plan, &cmap_plan->format12_groups); } - bool _subset (const hb_subset_plan_t *plan, - const subset_plan &cmap_subset_plan, - size_t dest_sz, - void *dest) const + bool subset (hb_subset_context_t *c) const { - hb_serialize_context_t c (dest, dest_sz); - - cmap *table = c.start_serialize<cmap> (); - if (unlikely (!c.extend_min (*table))) - { - return false; - } - - table->version = 0; - - if (unlikely (!table->encodingRecord.serialize (&c, cmap_subset_plan.num_enc_records))) return false; - - // TODO(grieger): Convert the below to a for loop - int enc_index = 0; - int unicode_bmp_index = 0; - int unicode_ucs4_index = 0; - int ms_bmp_index = 0; - int ms_ucs4_index = 0; - - // Format 4, Plat 0 Encoding Record - if (cmap_subset_plan.has_unicode_bmp) - { - unicode_bmp_index = enc_index; - EncodingRecord &format4_plat0_rec = table->encodingRecord[enc_index++]; - format4_plat0_rec.platformID = 0; // Unicode - format4_plat0_rec.encodingID = 3; - } - - // Format 12, Plat 0 Encoding Record - if (cmap_subset_plan.has_unicode_ucs4) - { - unicode_ucs4_index = enc_index; - EncodingRecord &format12_rec = table->encodingRecord[enc_index++]; - format12_rec.platformID = 0; // Unicode - format12_rec.encodingID = 4; // Unicode UCS-4 - } + TRACE_SUBSET (this); - // Format 4, Plat 3 Encoding Record - if (cmap_subset_plan.has_ms_bmp) - { - ms_bmp_index = enc_index; - EncodingRecord &format4_plat3_rec = table->encodingRecord[enc_index++]; - format4_plat3_rec.platformID = 3; // Windows - format4_plat3_rec.encodingID = 1; // Unicode BMP - } - - // Format 12, Plat 3 Encoding Record - if (cmap_subset_plan.has_ms_ucs4) - { - ms_ucs4_index = enc_index; - EncodingRecord &format12_rec = table->encodingRecord[enc_index++]; - format12_rec.platformID = 3; // Windows - format12_rec.encodingID = 10; // Unicode UCS-4 - } - - // Write out format 4 sub table - { - if (unlikely (!cmap_subset_plan.has_unicode_bmp && !cmap_subset_plan.has_ms_bmp)) return false; - EncodingRecord &format4_rec = cmap_subset_plan.has_unicode_bmp? - table->encodingRecord[unicode_bmp_index]: - table->encodingRecord[ms_bmp_index]; - CmapSubtable &subtable = format4_rec.subtable.serialize (&c, table); - if (cmap_subset_plan.has_unicode_bmp && cmap_subset_plan.has_ms_bmp) - table->encodingRecord[ms_bmp_index].subtable = (unsigned int) format4_rec.subtable; - subtable.u.format = 4; - - CmapSubtableFormat4 &format4 = subtable.u.format4; - if (unlikely (!format4.serialize (&c, plan, cmap_subset_plan.format4_segments))) - return false; - } + cmap *cmap_prime = c->serializer->start_embed<cmap> (); + if (unlikely (!c->serializer->check_success (cmap_prime))) return_trace (false); - // Write out format 12 sub table. - if (cmap_subset_plan.format12_groups) - { - if (unlikely (!cmap_subset_plan.has_unicode_ucs4 && !cmap_subset_plan.has_ms_ucs4)) return false; - EncodingRecord &format12_rec = cmap_subset_plan.has_unicode_ucs4? - table->encodingRecord[unicode_ucs4_index]: - table->encodingRecord[ms_ucs4_index]; - - CmapSubtable &subtable = format12_rec.subtable.serialize (&c, table); - if (cmap_subset_plan.has_unicode_ucs4 && cmap_subset_plan.has_ms_ucs4) - table->encodingRecord[ms_ucs4_index].subtable = (unsigned int) format12_rec.subtable; - subtable.u.format = 12; - - CmapSubtableFormat12 &format12 = subtable.u.format12; - if (unlikely (!format12.serialize (&c, cmap_subset_plan.format12_groups))) - return false; - } - - c.end_serialize (); - - return true; - } - - bool subset (hb_subset_plan_t *plan) const - { - subset_plan cmap_subset_plan; + const EncodingRecord *unicode_bmp = find_encodingrec (0, 3); + const EncodingRecord *unicode_ucs4 = find_encodingrec (0, 4); + const EncodingRecord *ms_bmp = find_encodingrec (3, 1); + const EncodingRecord *ms_ucs4 = find_encodingrec (3, 10); + bool has_format12 = find_subtable (12); - if (unlikely (!_create_plan (plan, &cmap_subset_plan))) - { - DEBUG_MSG(SUBSET, nullptr, "Failed to generate a cmap subsetting plan."); - return false; - } + if (unlikely (!unicode_bmp && !ms_bmp)) return_trace (false); + if (unlikely (has_format12 && (!unicode_ucs4 && !ms_ucs4))) return_trace (false); - // We now know how big our blob needs to be - size_t dest_sz = cmap_subset_plan.final_size (); - void *dest = malloc (dest_sz); - if (unlikely (!dest)) { - DEBUG_MSG(SUBSET, nullptr, "Unable to alloc %lu for cmap subset output", (unsigned long) dest_sz); - return false; - } - if (unlikely (!_subset (plan, cmap_subset_plan, dest_sz, dest))) - { - DEBUG_MSG(SUBSET, nullptr, "Failed to perform subsetting of cmap."); - free (dest); - return false; - } + auto it = + + hb_iter (c->plan->unicodes) + | hb_map ([&] (hb_codepoint_t _) + { + hb_codepoint_t new_gid = HB_MAP_VALUE_INVALID; + c->plan->new_gid_for_codepoint (_, &new_gid); + return hb_pair_t<hb_codepoint_t, hb_codepoint_t> (_, new_gid); + }) + | hb_filter ([&] (const hb_pair_t<hb_codepoint_t, hb_codepoint_t> _) + { + return (_.second != HB_MAP_VALUE_INVALID); + }) + ; - // all done, write the blob into dest - hb_blob_t *cmap_prime = hb_blob_create ((const char *) dest, - dest_sz, - HB_MEMORY_MODE_READONLY, - dest, - free); - bool result = plan->add_table (HB_OT_TAG_cmap, cmap_prime); - hb_blob_destroy (cmap_prime); - return result; + cmap_prime->serialize (c->serializer, it, unicode_bmp, unicode_ucs4, ms_bmp, ms_ucs4); + return_trace (true); } const CmapSubtable *find_best_subtable (bool *symbol = nullptr) const @@ -1212,6 +1178,16 @@ struct cmap return &(this+result.subtable); } + const EncodingRecord *find_encodingrec (unsigned int platform_id, + unsigned int encoding_id) const + { + EncodingRecord key; + key.platformID = platform_id; + key.encodingID = encoding_id; + + return encodingRecord.as_array ().bsearch (key); + } + bool find_subtable (unsigned format) const { auto it = diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh index 90f89d5839b..3447b144dd6 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh @@ -39,13 +39,15 @@ namespace OT { struct LayerRecord { + operator hb_ot_color_layer_t () const { return {glyphId, colorIdx}; } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); return_trace (c->check_struct (this)); } - public: + protected: GlyphID glyphId; /* Glyph ID of layer glyph */ Index colorIdx; /* Index value to use with a * selected color palette. @@ -98,18 +100,14 @@ struct COLR { const BaseGlyphRecord &record = (this+baseGlyphsZ).bsearch (numBaseGlyphs, glyph); - hb_array_t<const LayerRecord> all_layers ((this+layersZ).arrayZ, numLayers); + hb_array_t<const LayerRecord> all_layers = (this+layersZ).as_array (numLayers); hb_array_t<const LayerRecord> glyph_layers = all_layers.sub_array (record.firstLayerIdx, record.numLayers); if (count) { - hb_array_t<const LayerRecord> segment_layers = glyph_layers.sub_array (start_offset, *count); - *count = segment_layers.length; - for (unsigned int i = 0; i < segment_layers.length; i++) - { - layers[i].glyph = segment_layers.arrayZ[i].glyphId; - layers[i].color_index = segment_layers.arrayZ[i].colorIdx; - } + + glyph_layers.sub_array (start_offset, count) + | hb_sink (hb_array (layers, *count)) + ; } return glyph_layers.length; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh index 9b725c46e74..8a915a6619f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh @@ -235,9 +235,9 @@ struct sbix const PNGHeader &png = *blob->as<PNGHeader>(); extents->x_bearing = x_offset; - extents->y_bearing = y_offset; + extents->y_bearing = png.IHDR.height + y_offset; extents->width = png.IHDR.width; - extents->height = png.IHDR.height; + extents->height = -png.IHDR.height; /* Convert to font units. */ if (strike_ppem) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh index d07f53c2bae..30bab5cb54d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh @@ -50,9 +50,10 @@ HB_OT_TABLE (OT, head) #if !defined(HB_NO_FACE_COLLECT_UNICODES) || !defined(HB_NO_OT_FONT) HB_OT_ACCELERATOR (OT, cmap) #endif +HB_OT_TABLE (OT, hhea) HB_OT_ACCELERATOR (OT, hmtx) HB_OT_TABLE (OT, OS2) -#ifndef HB_NO_OT_FONT_GLYPH_NAMES +#if !defined(HB_NO_OT_FONT_GLYPH_NAMES) || !defined(HB_NO_METRICS) HB_OT_ACCELERATOR (OT, post) #endif #ifndef HB_NO_NAME @@ -61,8 +62,12 @@ HB_OT_ACCELERATOR (OT, name) #ifndef HB_NO_STAT HB_OT_TABLE (OT, STAT) #endif +#ifndef HB_NO_META +HB_OT_ACCELERATOR (OT, meta) +#endif /* Vertical layout. */ +HB_OT_TABLE (OT, vhea) HB_OT_ACCELERATOR (OT, vmtx) /* TrueType outlines. */ @@ -88,11 +93,17 @@ HB_OT_TABLE (OT, kern) #endif /* OpenType shaping. */ +#ifndef HB_NO_OT_LAYOUT HB_OT_ACCELERATOR (OT, GDEF) HB_OT_ACCELERATOR (OT, GSUB) HB_OT_ACCELERATOR (OT, GPOS) -//HB_OT_TABLE (OT, BASE) //HB_OT_TABLE (OT, JSTF) +#endif + +/* OpenType baseline. */ +#ifndef HB_NO_BASE +HB_OT_TABLE (OT, BASE) +#endif /* AAT shaping. */ #ifndef HB_NO_AAT @@ -104,6 +115,7 @@ HB_OT_TABLE (AAT, trak) HB_OT_TABLE (AAT, lcar) HB_OT_TABLE (AAT, ltag) HB_OT_TABLE (AAT, feat) +// HB_OT_TABLE (AAT, opbd) #endif /* OpenType color fonts. */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc index f54d0b63939..5ef8df43ce7 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc @@ -32,6 +32,7 @@ #include "hb-ot-cff2-table.hh" #include "hb-ot-hmtx-table.hh" #include "hb-ot-kern-table.hh" +#include "hb-ot-meta-table.hh" #include "hb-ot-name-table.hh" #include "hb-ot-post-table.hh" #include "hb-ot-color-cbdt-table.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc index 999bfac2909..7d6213572b1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc @@ -230,32 +230,24 @@ hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED, static hb_bool_t hb_ot_get_font_h_extents (hb_font_t *font, - void *font_data, + void *font_data HB_UNUSED, hb_font_extents_t *metrics, void *user_data HB_UNUSED) { - const hb_ot_face_t *ot_face = (const hb_ot_face_t *) font_data; - const OT::hmtx_accelerator_t &hmtx = *ot_face->hmtx; - metrics->ascender = font->em_scale_y (hmtx.ascender); - metrics->descender = font->em_scale_y (hmtx.descender); - metrics->line_gap = font->em_scale_y (hmtx.line_gap); - // TODO Hook up variations. - return hmtx.has_font_extents; + return _hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER, &metrics->ascender) && + _hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER, &metrics->descender) && + _hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP, &metrics->line_gap); } static hb_bool_t hb_ot_get_font_v_extents (hb_font_t *font, - void *font_data, + void *font_data HB_UNUSED, hb_font_extents_t *metrics, void *user_data HB_UNUSED) { - const hb_ot_face_t *ot_face = (const hb_ot_face_t *) font_data; - const OT::vmtx_accelerator_t &vmtx = *ot_face->vmtx; - metrics->ascender = font->em_scale_x (vmtx.ascender); - metrics->descender = font->em_scale_x (vmtx.descender); - metrics->line_gap = font->em_scale_x (vmtx.line_gap); - // TODO Hook up variations. - return vmtx.has_font_extents; + return _hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_VERTICAL_ASCENDER, &metrics->ascender) && + _hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_VERTICAL_DESCENDER, &metrics->descender) && + _hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_VERTICAL_LINE_GAP, &metrics->line_gap); } #if HB_USE_ATEXIT diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh index c3155b79eef..778b6c51323 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh @@ -45,6 +45,8 @@ namespace OT { template <typename T> struct _hea { + bool has_data () const { return version.major; } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh index 754a3762832..11a588e3814 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh @@ -29,8 +29,8 @@ #include "hb-open-type.hh" #include "hb-ot-hhea-table.hh" -#include "hb-ot-os2-table.hh" #include "hb-ot-var-hvar-table.hh" +#include "hb-ot-metrics.hh" /* * hmtx -- Horizontal Metrics @@ -88,22 +88,22 @@ struct hmtxvmtx template<typename Iterator, hb_requires (hb_is_iterator (Iterator))> - void serialize (hb_serialize_context_t *c, - Iterator it, + void serialize (hb_serialize_context_t *c, + Iterator it, unsigned num_advances) { unsigned idx = 0; + it | hb_apply ([c, &idx, num_advances] (const hb_item_type<Iterator>& _) { - if (idx < num_advances) + if (idx < num_advances) { LongMetric lm; lm.advance = _.first; lm.sb = _.second; if (unlikely (!c->embed<LongMetric> (&lm))) return; - } - else + } + else { FWORD *sb = c->allocate_size<FWORD> (FWORD::static_size); if (unlikely (!sb)) return; @@ -120,12 +120,12 @@ struct hmtxvmtx T *table_prime = c->serializer->start_embed <T> (); if (unlikely (!table_prime)) return_trace (false); - + accelerator_t _mtx; _mtx.init (c->plan->source); unsigned num_advances = _mtx.num_advances_for_subset (c->plan); - - auto it = + + auto it = + hb_range (c->plan->num_output_glyphs ()) | hb_map ([c, &_mtx] (unsigned _) { @@ -162,28 +162,7 @@ struct hmtxvmtx { default_advance = default_advance_ ? default_advance_ : hb_face_get_upem (face); - bool got_font_extents = false; - if (T::os2Tag != HB_TAG_NONE && face->table.OS2->is_typo_metrics ()) - { - ascender = abs (face->table.OS2->sTypoAscender); - descender = -abs (face->table.OS2->sTypoDescender); - line_gap = face->table.OS2->sTypoLineGap; - got_font_extents = (ascender | descender) != 0; - } - - hb_blob_t *_hea_blob = hb_sanitize_context_t().reference_table<H> (face); - const H *_hea_table = _hea_blob->as<H> (); - num_advances = _hea_table->numberOfLongMetrics; - if (!got_font_extents) - { - ascender = abs (_hea_table->ascender); - descender = -abs (_hea_table->descender); - line_gap = _hea_table->lineGap; - got_font_extents = (ascender | descender) != 0; - } - hb_blob_destroy (_hea_blob); - - has_font_extents = got_font_extents; + num_advances = T::is_horizontal ? face->table.hhea->numberOfLongMetrics : face->table.vhea->numberOfLongMetrics; table = hb_sanitize_context_t().reference_table<hmtxvmtx> (face, T::tableTag); @@ -277,12 +256,6 @@ struct hmtxvmtx return get_advance (old_gid); } - public: - bool has_font_extents; - int ascender; - int descender; - int line_gap; - protected: unsigned int num_metrics; unsigned int num_advances; @@ -322,12 +295,12 @@ struct hmtxvmtx struct hmtx : hmtxvmtx<hmtx, hhea> { static constexpr hb_tag_t tableTag = HB_OT_TAG_hmtx; static constexpr hb_tag_t variationsTag = HB_OT_TAG_HVAR; - static constexpr hb_tag_t os2Tag = HB_OT_TAG_OS2; + static constexpr bool is_horizontal = true; }; struct vmtx : hmtxvmtx<vmtx, vhea> { static constexpr hb_tag_t tableTag = HB_OT_TAG_vmtx; static constexpr hb_tag_t variationsTag = HB_OT_TAG_VVAR; - static constexpr hb_tag_t os2Tag = HB_TAG_NONE; + static constexpr bool is_horizontal = false; }; struct hmtx_accelerator_t : hmtx::accelerator_t {}; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh index ae2bcc92d1b..7dfb207b2dc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh @@ -128,11 +128,11 @@ struct KernSubTable TRACE_DISPATCH (this, subtable_type); switch (subtable_type) { case 0: return_trace (c->dispatch (u.format0)); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE case 1: return_trace (u.header.apple ? c->dispatch (u.format1, hb_forward<Ts> (ds)...) : c->default_return_value ()); #endif case 2: return_trace (c->dispatch (u.format2)); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE case 3: return_trace (u.header.apple ? c->dispatch (u.format3, hb_forward<Ts> (ds)...) : c->default_return_value ()); #endif default: return_trace (c->default_return_value ()); @@ -282,7 +282,7 @@ struct kern { switch (get_type ()) { case 0: return u.ot.has_state_machine (); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE case 1: return u.aat.has_state_machine (); #endif default:return false; @@ -293,7 +293,7 @@ struct kern { switch (get_type ()) { case 0: return u.ot.has_cross_stream (); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE case 1: return u.aat.has_cross_stream (); #endif default:return false; @@ -304,7 +304,7 @@ struct kern { switch (get_type ()) { case 0: return u.ot.get_h_kerning (left, right); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE case 1: return u.aat.get_h_kerning (left, right); #endif default:return 0; @@ -321,7 +321,7 @@ struct kern TRACE_DISPATCH (this, subtable_type); switch (subtable_type) { case 0: return_trace (c->dispatch (u.ot, hb_forward<Ts> (ds)...)); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE case 1: return_trace (c->dispatch (u.aat, hb_forward<Ts> (ds)...)); #endif default: return_trace (c->default_return_value ()); @@ -340,7 +340,7 @@ struct kern HBUINT32 version32; HBUINT16 major; KernOT ot; -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE KernAAT aat; #endif } u; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh index 0912362941a..7c00a1313eb 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh @@ -1,7 +1,7 @@ /* - * Copyright © 2016 Elie Roux <elie.roux@telecom-bretagne.eu> + * Copyright © 2016 Elie Roux <elie.roux@telecom-bretagne.eu> * Copyright © 2018 Google, Inc. - * Copyright © 2018 Ebrahim Byagowi + * Copyright © 2018-2019 Ebrahim Byagowi * * This is part of HarfBuzz, a text shaping library. * @@ -32,9 +32,6 @@ #include "hb-open-type.hh" #include "hb-ot-layout-common.hh" -/* To be removed */ -typedef hb_tag_t hb_ot_layout_baseline_t; - namespace OT { /* @@ -116,9 +113,11 @@ struct BaseCoordFormat3 struct BaseCoord { - hb_position_t get_coord (hb_font_t *font, + bool has_data () const { return u.format; } + + hb_position_t get_coord (hb_font_t *font, const VariationStore &var_store, - hb_direction_t direction) const + hb_direction_t direction) const { switch (u.format) { case 1: return u.format1.get_coord (); @@ -142,10 +141,10 @@ struct BaseCoord protected: union { - HBUINT16 format; - BaseCoordFormat1 format1; - BaseCoordFormat2 format2; - BaseCoordFormat3 format3; + HBUINT16 format; + BaseCoordFormat1 format1; + BaseCoordFormat2 format2; + BaseCoordFormat3 format3; } u; public: DEFINE_SIZE_UNION (2, format); @@ -153,14 +152,9 @@ struct BaseCoord struct FeatMinMaxRecord { - HB_INTERNAL static int cmp (const void *key_, const void *entry_) - { - hb_tag_t key = * (hb_tag_t *) key_; - const FeatMinMaxRecord &entry = * (const FeatMinMaxRecord *) entry_; - return key < (unsigned int) entry.tag ? -1 : - key > (unsigned int) entry.tag ? 1 : - 0; - } + int cmp (hb_tag_t key) const { return tag.cmp (key); } + + bool has_data () const { return tag; } void get_min_max (const BaseCoord **min, const BaseCoord **max) const { @@ -195,17 +189,12 @@ struct FeatMinMaxRecord struct MinMax { void get_min_max (hb_tag_t feature_tag, - const BaseCoord **min, - const BaseCoord **max) const + const BaseCoord **min, + const BaseCoord **max) const { - /* TODO Replace hb_bsearch() with .bsearch(). */ - const FeatMinMaxRecord *minMaxCoord = (const FeatMinMaxRecord *) - hb_bsearch (&feature_tag, featMinMaxRecords.arrayZ, - featMinMaxRecords.len, - FeatMinMaxRecord::static_size, - FeatMinMaxRecord::cmp); - if (minMaxCoord) - minMaxCoord->get_min_max (min, max); + const FeatMinMaxRecord &minMaxCoord = featMinMaxRecords.bsearch (feature_tag); + if (minMaxCoord.has_data ()) + minMaxCoord.get_min_max (min, max); else { if (likely (min)) *min = &(this+minCoord); @@ -271,17 +260,11 @@ struct BaseValues struct BaseLangSysRecord { - HB_INTERNAL static int cmp (const void *key_, const void *entry_) - { - hb_tag_t key = * (hb_tag_t *) key_; - const BaseLangSysRecord &entry = * (const BaseLangSysRecord *) entry_; - return key < (unsigned int) entry.baseLangSysTag ? -1 : - key > (unsigned int) entry.baseLangSysTag ? 1 : - 0; - } + int cmp (hb_tag_t key) const { return baseLangSysTag.cmp (key); } + + bool has_data () const { return baseLangSysTag; } - const MinMax &get_min_max () const - { return this+minMax; } + const MinMax &get_min_max () const { return this+minMax; } bool sanitize (hb_sanitize_context_t *c, const void *base) const { @@ -303,19 +286,14 @@ struct BaseScript { const MinMax &get_min_max (hb_tag_t language_tag) const { - /* TODO Replace hb_bsearch() with .bsearch(). */ - const BaseLangSysRecord* record = (const BaseLangSysRecord *) - hb_bsearch (&language_tag, baseLangSysRecords.arrayZ, - baseLangSysRecords.len, - BaseLangSysRecord::static_size, - BaseLangSysRecord::cmp); - return record ? record->get_min_max () : this+defaultMinMax; + const BaseLangSysRecord& record = baseLangSysRecords.bsearch (language_tag); + return record.has_data () ? record.get_min_max () : this+defaultMinMax; } const BaseCoord &get_base_coord (int baseline_tag_index) const { return (this+baseValues).get_base_coord (baseline_tag_index); } - bool is_empty () const { return !baseValues; } + bool has_data () const { return baseValues; } bool sanitize (hb_sanitize_context_t *c) const { @@ -345,14 +323,9 @@ struct BaseScript struct BaseScriptList; struct BaseScriptRecord { - HB_INTERNAL static int cmp (const void *key_, const void *entry_) - { - hb_tag_t key = * (hb_tag_t *) key_; - const BaseScriptRecord &entry = * (const BaseScriptRecord *) entry_; - return key < (unsigned int) entry.baseScriptTag ? -1 : - key > (unsigned int) entry.baseScriptTag ? 1 : - 0; - } + int cmp (hb_tag_t key) const { return baseScriptTag.cmp (key); } + + bool has_data () const { return baseScriptTag; } const BaseScript &get_base_script (const BaseScriptList *list) const { return list+baseScript; } @@ -376,22 +349,11 @@ struct BaseScriptRecord struct BaseScriptList { - const BaseScriptRecord *find_record (hb_tag_t script) const - { - /* TODO Replace hb_bsearch() with .bsearch(). */ - return (const BaseScriptRecord *) hb_bsearch (&script, baseScriptRecords.arrayZ, - baseScriptRecords.len, - BaseScriptRecord::static_size, - BaseScriptRecord::cmp); - } - - /* TODO: Or client should handle fallback? */ const BaseScript &get_base_script (hb_tag_t script) const { - const BaseScriptRecord *record = find_record (script); - if (!record) record = find_record ((hb_script_t) HB_TAG ('D','F','L','T')); - - return record ? record->get_base_script (this) : Null (BaseScript); + const BaseScriptRecord *record = &baseScriptRecords.bsearch (script); + if (!record->has_data ()) record = &baseScriptRecords.bsearch (HB_TAG ('D','F','L','T')); + return record->has_data () ? record->get_base_script (this) : Null (BaseScript); } bool sanitize (hb_sanitize_context_t *c) const @@ -411,15 +373,20 @@ struct BaseScriptList struct Axis { - bool get_baseline (hb_ot_layout_baseline_t baseline, - hb_tag_t script_tag, - hb_tag_t language_tag, - const BaseCoord **coord) const + bool get_baseline (hb_tag_t baseline_tag, + hb_tag_t script_tag, + hb_tag_t language_tag, + const BaseCoord **coord) const { const BaseScript &base_script = (this+baseScriptList).get_base_script (script_tag); - if (base_script.is_empty ()) return false; + if (!base_script.has_data ()) return false; - if (likely (coord)) *coord = &base_script.get_base_coord ((this+baseTagList).bsearch (baseline)); + if (likely (coord)) + { + unsigned int tag_index = 0; + (this+baseTagList).bfind (baseline_tag, &tag_index); + *coord = &base_script.get_base_coord (tag_index); + } return true; } @@ -431,7 +398,7 @@ struct Axis const BaseCoord **max_coord) const { const BaseScript &base_script = (this+baseScriptList).get_base_script (script_tag); - if (base_script.is_empty ()) return false; + if (!base_script.has_data ()) return false; base_script.get_min_max (language_tag).get_min_max (feature_tag, min_coord, max_coord); @@ -472,20 +439,21 @@ struct BASE const VariationStore &get_var_store () const { return version.to_int () < 0x00010001u ? Null (VariationStore) : this+varStore; } - bool get_baseline (hb_font_t *font, - hb_ot_layout_baseline_t baseline, - hb_direction_t direction, - hb_tag_t script_tag, - hb_tag_t language_tag, - hb_position_t *base) const + bool get_baseline (hb_font_t *font, + hb_tag_t baseline_tag, + hb_direction_t direction, + hb_tag_t script_tag, + hb_tag_t language_tag, + hb_position_t *base) const { - const BaseCoord *base_coord; - if (!get_axis (direction).get_baseline (baseline, script_tag, language_tag, &base_coord)) + const BaseCoord *base_coord = nullptr; + if (unlikely (!get_axis (direction).get_baseline (baseline_tag, script_tag, language_tag, &base_coord) || + !base_coord || !base_coord->has_data ())) return false; - if (likely (base && base_coord)) *base = base_coord->get_coord (font, - get_var_store (), - direction); + if (likely (base)) + *base = base_coord->get_coord (font, get_var_store (), direction); + return true; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh index d371c4b5fca..7d57056d135 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh @@ -236,6 +236,11 @@ struct ValueFormat : HBUINT16 } }; +template<typename Iterator> +static inline void SinglePos_serialize (hb_serialize_context_t *c, + Iterator it, + ValueFormat valFormat); + struct AnchorFormat1 { @@ -496,11 +501,52 @@ struct SinglePosFormat1 return_trace (true); } + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + void serialize (hb_serialize_context_t *c, + Iterator it, + ValueFormat valFormat) + { + if (unlikely (!c->extend_min (*this))) return; + if (unlikely (!c->check_assign (valueFormat, valFormat))) return; + + auto vals = hb_second (*it); + + + vals + | hb_apply ([=] (const Value& _) + { + c->copy (_); + }) + ; + + auto glyphs = + + it + | hb_map_retains_sorting (hb_first) + ; + + coverage.serialize (c, this).serialize (c, glyphs); + } + bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - // TODO(subset) - return_trace (false); + const hb_set_t &glyphset = *c->plan->glyphset_gsub (); + const hb_map_t &glyph_map = *c->plan->glyph_map; + + unsigned length = valueFormat.get_len (); + + auto it = + + hb_iter (this+coverage) + | hb_filter (glyphset) + | hb_map_retains_sorting ([&] (hb_codepoint_t p) + { + return hb_pair (glyph_map[p], values.as_array (length)); + }) + ; + + bool ret = bool (it); + SinglePos_serialize (c->serializer, it, valueFormat); + return_trace (ret); } bool sanitize (hb_sanitize_context_t *c) const @@ -552,11 +598,58 @@ struct SinglePosFormat2 return_trace (true); } + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + void serialize (hb_serialize_context_t *c, + Iterator it, + ValueFormat valFormat) + { + if (unlikely (!c->extend_min (*this))) return; + if (unlikely (!c->check_assign (valueFormat, valFormat))) return; + if (unlikely (!c->check_assign (valueCount, it.len ()))) return; + + + it + | hb_map (hb_second) + | hb_apply ([=] (hb_array_t<const Value> val_iter) + { + + val_iter + | hb_apply ([=] (const Value& _) + { + c->copy (_); + }) + ; + }) + ; + + auto glyphs = + + it + | hb_map_retains_sorting (hb_first) + ; + + coverage.serialize (c, this).serialize (c, glyphs); + } + bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - // TODO(subset) - return_trace (false); + const hb_set_t &glyphset = *c->plan->glyphset_gsub (); + const hb_map_t &glyph_map = *c->plan->glyph_map; + + unsigned sub_length = valueFormat.get_len (); + unsigned total_length = (unsigned)valueCount * sub_length; + + auto it = + + hb_zip (this+coverage, hb_range ((unsigned) valueCount)) + | hb_filter (glyphset, hb_first) + | hb_map_retains_sorting ([&] (const hb_pair_t<hb_codepoint_t, unsigned>& _) + { + return hb_pair (glyph_map[_.first], values.as_array (total_length).sub_array (_.second * sub_length, sub_length)); + }) + ; + + bool ret = bool (it); + SinglePos_serialize (c->serializer, it, valueFormat); + return_trace (ret); } bool sanitize (hb_sanitize_context_t *c) const @@ -583,6 +676,55 @@ struct SinglePosFormat2 struct SinglePos { + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + unsigned get_format (Iterator glyph_val_iter_pairs) + { + unsigned subset_format = 1; + hb_array_t<const Value> first_val_iter = hb_second (*glyph_val_iter_pairs); + + + glyph_val_iter_pairs + | hb_map (hb_second) + | hb_apply ([&] (hb_array_t<const Value> val_iter) + { + + hb_zip (val_iter, first_val_iter) + | hb_apply ([&] (const hb_pair_t<Value, Value>& _) + { + if (_.first != _.second) + { + subset_format = 2; + return; + } + }) + ; + }) + ; + + return subset_format; + } + + + template<typename Iterator, + hb_requires (hb_is_iterator (Iterator))> + void serialize (hb_serialize_context_t *c, + Iterator glyph_val_iter_pairs, + ValueFormat valFormat) + { + if (unlikely (!c->extend_min (u.format))) return; + unsigned format = 2; + + if (glyph_val_iter_pairs) format = get_format (glyph_val_iter_pairs); + + u.format = format; + switch (u.format) { + case 1: u.format1.serialize (c, glyph_val_iter_pairs, valFormat); + return; + case 2: u.format2.serialize (c, glyph_val_iter_pairs, valFormat); + return; + default:return; + } + } + template <typename context_t, typename ...Ts> typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { @@ -603,6 +745,13 @@ struct SinglePos } u; }; +template<typename Iterator> +static inline void +SinglePos_serialize (hb_serialize_context_t *c, + Iterator it, + ValueFormat valFormat) +{ c->start_embed<SinglePos> ()->serialize (c, it, valFormat); } + struct PairValueRecord { @@ -733,7 +882,7 @@ struct PairPosFormat1 + hb_zip (this+coverage, pairSet) | hb_filter (*glyphs, hb_first) | hb_map (hb_second) - | hb_map ([=] (const OffsetTo<PairSet> &_) + | hb_map ([glyphs, this] (const OffsetTo<PairSet> &_) { return (this+_).intersects (glyphs, valueFormat); }) | hb_any ; @@ -1737,13 +1886,13 @@ struct GPOS_accelerator_t : GPOS::accelerator_t {}; /* Out-of-class implementation for methods recursing */ +#ifndef HB_NO_OT_LAYOUT template <typename context_t> /*static*/ inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) { const PosLookup &l = c->face->table.GPOS.get_relaxed ()->table->get_lookup (lookup_index); return l.dispatch (c); } - /*static*/ inline bool PosLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { const PosLookup &l = c->face->table.GPOS.get_relaxed ()->table->get_lookup (lookup_index); @@ -1756,6 +1905,7 @@ template <typename context_t> c->set_lookup_props (saved_lookup_props); return ret; } +#endif } /* namespace OT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh index f532f9dff28..84e1b15786a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh @@ -248,7 +248,7 @@ struct SingleSubst if (unlikely (!c->extend_min (u.format))) return_trace (false); unsigned format = 2; unsigned delta = 0; - if (glyphs.len ()) + if (glyphs) { format = 1; auto get_delta = [=] (hb_codepoint_pair_t _) { @@ -1409,6 +1409,7 @@ struct GSUB_accelerator_t : GSUB::accelerator_t {}; /* Out-of-class implementation for methods recursing */ +#ifndef HB_NO_OT_LAYOUT /*static*/ inline bool ExtensionSubst::is_reverse () const { unsigned int type = get_type (); @@ -1416,14 +1417,12 @@ struct GSUB_accelerator_t : GSUB::accelerator_t {}; return CastR<ExtensionSubst> (get_subtable<SubTable>()).is_reverse (); return SubstLookup::lookup_type_is_reverse (type); } - template <typename context_t> /*static*/ inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) { const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (lookup_index); return l.dispatch (c); } - /*static*/ inline bool SubstLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { const SubstLookup &l = c->face->table.GSUB.get_relaxed ()->table->get_lookup (lookup_index); @@ -1436,6 +1435,8 @@ template <typename context_t> c->set_lookup_props (saved_lookup_props); return ret; } +#endif + } /* namespace OT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh index 9a82a4d6773..c6e6ac9cb40 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh @@ -483,7 +483,13 @@ struct hb_ot_apply_context_t : iter_input (), iter_context (), font (font_), face (font->face), buffer (buffer_), recurse_func (nullptr), - gdef (*face->table.GDEF->table), + gdef ( +#ifndef HB_NO_OT_LAYOUT + *face->table.GDEF->table +#else + Null(GDEF) +#endif + ), var_store (gdef.get_var_store ()), direction (buffer_->props.direction), lookup_mask (1), diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc index 10b9ba092b3..d95e5a0b15c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc @@ -28,6 +28,14 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_LAYOUT + +#ifdef HB_NO_OT_TAG +#error "Cannot compile hb-ot-layout.cc with HB_NO_OT_TAG." +#endif + #include "hb-open-type.hh" #include "hb-ot-layout.hh" #include "hb-ot-face.hh" @@ -35,7 +43,6 @@ #include "hb-map.hh" #include "hb-ot-kern-table.hh" -#include "hb-ot-gasp-table.hh" // Just so we compile it; unused otherwise. #include "hb-ot-layout-gdef-table.hh" #include "hb-ot-layout-gsub-table.hh" #include "hb-ot-layout-gpos-table.hh" @@ -47,6 +54,7 @@ #include "hb-aat-layout-lcar-table.hh" #include "hb-aat-layout-morx-table.hh" +#include "hb-aat-layout-opbd-table.hh" // Just so we compile it; unused otherwise. /** * SECTION:hb-ot-layout @@ -101,7 +109,7 @@ hb_ot_layout_has_machine_kerning (hb_face_t *face) * * Tests whether a face has any cross-stream kerning (i.e., kerns * that make adjustments perpendicular to the direction of the text - * flow: Y adjustments in horizontal text or X adjustments in + * flow: Y adjustments in horizontal text or X adjustments in * vertical text) in the 'kern' table. * * Does NOT examine the GPOS table. @@ -278,7 +286,7 @@ hb_ot_layout_has_glyph_classes (hb_face_t *face) * * Fetches the GDEF class of the requested glyph in the specified face. * - * Return value: The #hb_ot_layout_glyph_class_t glyph class of the given code + * Return value: The #hb_ot_layout_glyph_class_t glyph class of the given code * point in the GDEF table of the face. * * Since: 0.9.7 @@ -322,7 +330,7 @@ hb_ot_layout_get_glyphs_in_class (hb_face_t *face, * @point_array: (out) (array length=point_count): The array of attachment points found for the query * * Fetches a list of all attachment points for the specified glyph in the GDEF - * table of the face. The list returned will begin at the offset provided. + * table of the face. The list returned will begin at the offset provided. * * Useful if the client program wishes to cache the list. * @@ -388,7 +396,7 @@ OT::GSUB::is_blacklisted (hb_blob_t *blob HB_UNUSED, return false; #endif -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE /* Mac OS X prefers morx over GSUB. It also ships with various Indic fonts, * all by 'MUTF' foundry (Tamil MN, Tamil Sangam MN, etc.), that have broken * GSUB/GPOS tables. Some have GSUB with zero scripts, those are ignored by @@ -972,7 +980,7 @@ hb_ot_layout_feature_get_lookups (hb_face_t *face, * @face: #hb_face_t to work upon * @table_tag: HB_OT_TAG_GSUB or HB_OT_TAG_GPOS * - * Fetches the total number of lookups enumerated in the specified + * Fetches the total number of lookups enumerated in the specified * face's GSUB table or GPOS table. * * Since: 0.9.22 @@ -1180,7 +1188,7 @@ hb_ot_layout_collect_features (hb_face_t *face, * table or GPOS table, underneath the specified scripts, languages, and * features. If no list of scripts is provided, all scripts will be queried. * If no list of languages is provided, all languages will be queried. If no - * list of features is provided, all features will be queried. + * list of features is provided, all features will be queried. * * Since: 0.9.8 **/ @@ -1574,7 +1582,7 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer) * as used here are defined as pertaining only to fonts within a font family that differ * specifically in their respective size ranges; other ways to differentiate fonts within * a subfamily are not covered by the `size` feature. - * + * * For more information on this distinction, see the `size` documentation at * https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#tag-39size39 * @@ -1716,7 +1724,7 @@ hb_ot_layout_feature_get_name_ids (hb_face_t *face, * returned. This function can be called with incrementally larger start_offset * until the char_count output value is lower than its input value, or the size * of the characters array can be increased.</note> - * + * * Return value: Number of total sample characters in the cvXX feature. * * Since: 2.0.0 @@ -1933,70 +1941,36 @@ hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c, apply_string<GSUBProxy> (c, lookup, accel); } -#if 0 -hb_bool_t -hb_ot_layout_get_baseline (hb_font_t *font, - hb_ot_layout_baseline_t baseline, - hb_direction_t direction, - hb_tag_t script_tag, - hb_tag_t language_tag, - hb_position_t *coord /* OUT. May be NULL. */) -{ - bool result = font->face->table.BASE->get_baseline (font, baseline, direction, script_tag, - language_tag, coord); - - /* TODO: Simulate https://docs.microsoft.com/en-us/typography/opentype/spec/baselinetags#ideographic-em-box */ - if (!result && coord) *coord = 0; - - if (coord) *coord = font->em_scale_dir (*coord, direction); - - return result; -} - -/* To be moved to public header */ -/* - * BASE - */ - -/** - * hb_ot_layout_baseline_t: - * - * https://docs.microsoft.com/en-us/typography/opentype/spec/baselinetags - * - * Since: DONTREPLACEME - */ -typedef enum { - HB_OT_LAYOUT_BASELINE_HANG = HB_TAG('h','a','n','g'), - HB_OT_LAYOUT_BASELINE_ICFB = HB_TAG('i','c','f','b'), - HB_OT_LAYOUT_BASELINE_ICFT = HB_TAG('i','c','f','t'), - HB_OT_LAYOUT_BASELINE_IDEO = HB_TAG('i','d','e','o'), - HB_OT_LAYOUT_BASELINE_IDTB = HB_TAG('i','d','t','b'), - HB_OT_LAYOUT_BASELINE_MATH = HB_TAG('m','a','t','h'), - HB_OT_LAYOUT_BASELINE_ROMN = HB_TAG('r','o','m','n') -} hb_ot_layout_baseline_t; - - +#ifndef HB_NO_BASE /** * hb_ot_layout_get_baseline: - * @font: The #hb_font_t to work upon - * @baseline: The #hb_ot_layout_baseline_t to query - * @direction: The #hb_direction_t text direction to use (horizontal or vertical) - * @script_tag: #hb_tag_t of the script to use - * @language_tag: #hb_tag_t of the language to use - * @coord: (out): The position of the requested baseline + * @font: a font + * @baseline: a baseline tag + * @direction: text direction. + * @script_tag: script tag. + * @language_tag: language tag. + * @coord: (out): baseline value if found. * - * Fetches the coordinates of the specified baseline in the face, underneath - * the specified script and language and in the specified text direction. + * Fetches a baseline value from the face. * - * Return value: true if the baseline is found for the settings queried, false otherwise + * Return value: if found baseline value in the the font. * + * Since: 2.6.0 **/ -HB_EXTERN hb_bool_t -hb_ot_layout_get_baseline (hb_font_t *font, - hb_ot_layout_baseline_t baseline, - hb_direction_t direction, - hb_tag_t script_tag, - hb_tag_t language_tag, - hb_position_t *coord /* OUT. May be NULL. */); +hb_bool_t +hb_ot_layout_get_baseline (hb_font_t *font, + hb_ot_layout_baseline_tag_t baseline_tag, + hb_direction_t direction, + hb_tag_t script_tag, + hb_tag_t language_tag, + hb_position_t *coord /* OUT. May be NULL. */) +{ + bool result = font->face->table.BASE->get_baseline (font, baseline_tag, direction, script_tag, language_tag, coord); + + if (result && coord) + *coord = HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_y (*coord) : font->em_scale_x (*coord); + return result; +} +#endif #endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.h index 3b9a78eafe4..5124c1e1f40 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.h @@ -402,6 +402,55 @@ hb_ot_layout_feature_get_characters (hb_face_t *face, unsigned int *char_count /* IN/OUT. May be NULL */, hb_codepoint_t *characters /* OUT. May be NULL */); +/* + * BASE + */ + +/** + * hb_ot_layout_baseline_tag_t: + * @HB_OT_LAYOUT_BASELINE_TAG_ROMAN: The baseline used by alphabetic scripts such as Latin, Cyrillic and Greek. + * In vertical writing mode, the alphabetic baseline for characters rotated 90 degrees clockwise. + * (This would not apply to alphabetic characters that remain upright in vertical writing mode, since these + * characters are not rotated.) + * @HB_OT_LAYOUT_BASELINE_TAG_HANGING: The hanging baseline. In horizontal direction, this is the horizontal + * line from which syllables seem, to hang in Tibetan and other similar scripts. In vertical writing mode, + * for Tibetan (or some other similar script) characters rotated 90 degrees clockwise. + * @HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_BOTTOM_OR_LEFT: Ideographic character face bottom or left edge, + * if the direction is horizontal or vertical, respectively. + * @HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_TOP_OR_RIGHT: Ideographic character face top or right edge, + * if the direction is horizontal or vertical, respectively. + * @HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_BOTTOM_OR_LEFT: Ideographic em-box bottom or left edge, + * if the direction is horizontal or vertical, respectively. + * @HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_TOP_OR_RIGHT: Ideographic em-box top or right edge baseline, + * if the direction is horizontal or vertical, respectively. + * @HB_OT_LAYOUT_BASELINE_TAG_MATH: The baseline about which mathematical characters are centered. + * In vertical writing mode when mathematical characters rotated 90 degrees clockwise, are centered. + * + * Baseline tags from https://docs.microsoft.com/en-us/typography/opentype/spec/baselinetags + * + * Since: 2.6.0 + */ +typedef enum { + HB_OT_LAYOUT_BASELINE_TAG_ROMAN = HB_TAG ('r','o','m','n'), + HB_OT_LAYOUT_BASELINE_TAG_HANGING = HB_TAG ('h','a','n','g'), + HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_BOTTOM_OR_LEFT = HB_TAG ('i','c','f','b'), + HB_OT_LAYOUT_BASELINE_TAG_IDEO_FACE_TOP_OR_RIGHT = HB_TAG ('i','c','f','t'), + HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_BOTTOM_OR_LEFT = HB_TAG ('i','d','e','o'), + HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_TOP_OR_RIGHT = HB_TAG ('i','d','t','p'), + HB_OT_LAYOUT_BASELINE_TAG_MATH = HB_TAG ('m','a','t','h'), + + _HB_OT_LAYOUT_BASELINE_TAG_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/ +} hb_ot_layout_baseline_tag_t; + +HB_EXTERN hb_bool_t +hb_ot_layout_get_baseline (hb_font_t *font, + hb_ot_layout_baseline_tag_t baseline_tag, + hb_direction_t direction, + hb_tag_t script_tag, + hb_tag_t language_tag, + hb_position_t *coord /* OUT. May be NULL. */); + + HB_END_DECLS #endif /* HB_OT_LAYOUT_H */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh index be7ef02636b..f3bb15581a1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh @@ -168,6 +168,17 @@ _hb_next_syllable (hb_buffer_t *buffer, unsigned int start) return start; } +static inline void +_hb_clear_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font HB_UNUSED, + hb_buffer_t *buffer) +{ + hb_glyph_info_t *info = buffer->info; + unsigned int count = buffer->len; + for (unsigned int i = 0; i < count; i++) + info[i].syllable() = 0; +} + /* unicode_props */ @@ -551,6 +562,17 @@ _hb_glyph_info_clear_substituted (hb_glyph_info_t *info) info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED); } +static inline void +_hb_clear_substitution_flags (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font HB_UNUSED, + hb_buffer_t *buffer) +{ + hb_glyph_info_t *info = buffer->info; + unsigned int count = buffer->len; + for (unsigned int i = 0; i < count; i++) + _hb_glyph_info_clear_substituted (&info[i]); +} + /* Allocation / deallocation. */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc index 92d70bb415d..b0bc4726b38 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc @@ -26,6 +26,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-map.hh" #include "hb-ot-shape.hh" #include "hb-ot-layout.hh" @@ -332,3 +336,6 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, } } } + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh index dd677863881..0a4827d745a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh @@ -154,8 +154,8 @@ struct hb_ot_map_t HB_INTERNAL void collect_lookups (unsigned int table_index, hb_set_t *lookups) const; template <typename Proxy> - HB_INTERNAL inline void apply (const Proxy &proxy, - const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const; + HB_INTERNAL void apply (const Proxy &proxy, + const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const; HB_INTERNAL void substitute (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const; HB_INTERNAL void position (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh index 0b16e0b9b3e..b4592ccdea2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh @@ -453,14 +453,14 @@ struct MathGlyphPartRecord } void extract (hb_ot_math_glyph_part_t &out, - int scale, + int64_t mult, hb_font_t *font) const { out.glyph = glyph; - out.start_connector_length = font->em_scale (startConnectorLength, scale); - out.end_connector_length = font->em_scale (endConnectorLength, scale); - out.full_advance = font->em_scale (fullAdvance, scale); + out.start_connector_length = font->em_mult (startConnectorLength, mult); + out.end_connector_length = font->em_mult (endConnectorLength, mult); + out.full_advance = font->em_mult (fullAdvance, mult); static_assert ((unsigned int) HB_OT_MATH_GLYPH_PART_FLAG_EXTENDER == (unsigned int) PartFlags::Extender, ""); @@ -508,11 +508,11 @@ struct MathGlyphAssembly { if (parts_count) { - int scale = font->dir_scale (direction); + int64_t mult = font->dir_mult (direction); hb_array_t<const MathGlyphPartRecord> arr = partRecords.sub_array (start_offset, parts_count); unsigned int count = arr.length; for (unsigned int i = 0; i < count; i++) - arr[i].extract (parts[i], scale, font); + arr[i].extract (parts[i], mult, font); } if (italics_correction) @@ -553,13 +553,13 @@ struct MathGlyphConstruction { if (variants_count) { - int scale = font->dir_scale (direction); + int64_t mult = font->dir_mult (direction); hb_array_t<const MathGlyphVariantRecord> arr = mathGlyphVariantRecord.sub_array (start_offset, variants_count); unsigned int count = arr.length; for (unsigned int i = 0; i < count; i++) { variants[i].glyph = arr[i].variantGlyph; - variants[i].advance = font->em_scale (arr[i].advanceMeasurement, scale); + variants[i].advance = font->em_mult (arr[i].advanceMeasurement, mult); } } return mathGlyphVariantRecord.len; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math.h index 7b2befbceea..ad864a762d5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math.h @@ -158,7 +158,7 @@ typedef enum { /*< flags >*/ * hb_ot_math_glyph_part_t: * @glyph: The glyph index of the variant part * @start_connector_length: The length of the connector on the starting side of the variant part - * @end_connection_length: The length of the connector on the ending side of the variant part + * @end_connector_length: The length of the connector on the ending side of the variant part * @full_advance: The total advance of the part * @flags: #hb_ot_math_glyph_part_flags_t flags for the part * diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-meta-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-meta-table.hh new file mode 100644 index 00000000000..43a02d6cec3 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-meta-table.hh @@ -0,0 +1,126 @@ +/* + * Copyright © 2019 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HB_OT_META_TABLE_HH +#define HB_OT_META_TABLE_HH + +#include "hb-open-type.hh" + +/* + * meta -- Metadata Table + * https://docs.microsoft.com/en-us/typography/opentype/spec/meta + * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6meta.html + */ +#define HB_OT_TAG_meta HB_TAG ('m','e','t','a') + + +namespace OT { + + +struct DataMap +{ + int cmp (hb_tag_t a) const { return tag.cmp (a); } + + hb_tag_t get_tag () const { return tag; } + + hb_blob_t *reference_entry (hb_blob_t *meta_blob) const + { return hb_blob_create_sub_blob (meta_blob, dataZ, dataLength); } + + bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + return_trace (likely (c->check_struct (this) && + dataZ.sanitize (c, base, dataLength))); + } + + protected: + Tag tag; /* A tag indicating the type of metadata. */ + LOffsetTo<UnsizedArrayOf<HBUINT8>> + dataZ; /* Offset in bytes from the beginning of the + * metadata table to the data for this tag. */ + HBUINT32 dataLength; /* Length of the data. The data is not required to + * be padded to any byte boundary. */ + public: + DEFINE_SIZE_STATIC (12); +}; + +struct meta +{ + static constexpr hb_tag_t tableTag = HB_OT_TAG_meta; + + struct accelerator_t + { + void init (hb_face_t *face) + { table = hb_sanitize_context_t ().reference_table<meta> (face); } + void fini () { table.destroy (); } + + hb_blob_t *reference_entry (hb_tag_t tag) const + { return table->dataMaps.lsearch (tag).reference_entry (table.get_blob ()); } + + unsigned int get_entries (unsigned int start_offset, + unsigned int *count, + hb_ot_meta_tag_t *entries) const + { + if (count) + { + + table->dataMaps.sub_array (start_offset, count) + | hb_map (&DataMap::get_tag) + | hb_map ([](hb_tag_t tag) { return (hb_ot_meta_tag_t) tag; }) + | hb_sink (hb_array (entries, *count)) + ; + } + return table->dataMaps.len; + } + + private: + hb_blob_ptr_t<meta> table; + }; + + bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (likely (c->check_struct (this) && + version == 1 && + dataMaps.sanitize (c, this))); + } + + protected: + HBUINT32 version; /* Version number of the metadata table — set to 1. */ + HBUINT32 flags; /* Flags — currently unused; set to 0. */ + HBUINT32 dataOffset; /* Per Apple specification: + * Offset from the beginning of the table to the data. + * Per OT specification: + * Reserved. Not used; should be set to 0. */ + LArrayOf<DataMap> + dataMaps; /* Array of data map records. */ + public: + DEFINE_SIZE_ARRAY (16, dataMaps); +}; + +struct meta_accelerator_t : meta::accelerator_t {}; + +} /* namespace OT */ + + +#endif /* HB_OT_META_TABLE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-meta.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-meta.cc new file mode 100644 index 00000000000..a1e081b2452 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-meta.cc @@ -0,0 +1,77 @@ +/* + * Copyright © 2019 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "hb.hh" + +#ifndef HB_NO_META + +#include "hb-ot-meta-table.hh" + +/** + * SECTION:hb-ot-meta + * @title: hb-ot-meta + * @short_description: OpenType Metadata + * @include: hb-ot.h + * + * Functions for fetching metadata from fonts. + **/ + +/** + * hb_ot_meta_reference_entry: + * @face: a face object + * @start_offset: iteration's start offset + * @entries_count:(inout) (allow-none): buffer size as input, filled size as output + * @entries: (out caller-allocates) (array length=entries_count): entries tags buffer + * + * Return value: Number of all available feature types. + * + * Since: 2.6.0 + **/ +unsigned int +hb_ot_meta_get_entry_tags (hb_face_t *face, + unsigned int start_offset, + unsigned int *entries_count, /* IN/OUT. May be NULL. */ + hb_ot_meta_tag_t *entries /* OUT. May be NULL. */) +{ + return face->table.meta->get_entries (start_offset, entries_count, entries); +} + +/** + * hb_ot_meta_reference_entry: + * @face: a #hb_face_t object. + * @meta_tag: tag of metadata you like to have. + * + * It fetches metadata entry of a given tag from a font. + * + * Returns: (transfer full): A blob containing the blob. + * + * Since: 2.6.0 + **/ +hb_blob_t * +hb_ot_meta_reference_entry (hb_face_t *face, hb_ot_meta_tag_t meta_tag) +{ + return face->table.meta->reference_entry (meta_tag); +} + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-meta.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-meta.h new file mode 100644 index 00000000000..0278d841484 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-meta.h @@ -0,0 +1,71 @@ +/* + * Copyright © 2019 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HB_OT_H_IN +#error "Include <hb-ot.h> instead." +#endif + +#ifndef HB_OT_META_H +#define HB_OT_META_H + +#include "hb.h" + +HB_BEGIN_DECLS + +/** + * hb_ot_meta_tag_t: + * @HB_OT_META_TAG_DESIGN_LANGUAGES: Design languages. Text, using only + * Basic Latin (ASCII) characters. Indicates languages and/or scripts + * for the user audiences that the font was primarily designed for. + * @HB_OT_META_TAG_SUPPORTED_LANGUAGES: Supported languages. Text, using + * only Basic Latin (ASCII) characters. Indicates languages and/or scripts + * that the font is declared to be capable of supporting. + * + * Known metadata tags from https://docs.microsoft.com/en-us/typography/opentype/spec/meta + * + * Since: 2.6.0 + **/ +typedef enum { +/* + HB_OT_META_TAG_APPL = HB_TAG ('a','p','p','l'), + HB_OT_META_TAG_BILD = HB_TAG ('b','i','l','d'), +*/ + HB_OT_META_TAG_DESIGN_LANGUAGES = HB_TAG ('d','l','n','g'), + HB_OT_META_TAG_SUPPORTED_LANGUAGES = HB_TAG ('s','l','n','g'), + + _HB_OT_META_TAG_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/ +} hb_ot_meta_tag_t; + +HB_EXTERN unsigned int +hb_ot_meta_get_entry_tags (hb_face_t *face, + unsigned int start_offset, + unsigned int *entries_count, /* IN/OUT. May be NULL. */ + hb_ot_meta_tag_t *entries /* OUT. May be NULL. */); + +HB_EXTERN hb_blob_t * +hb_ot_meta_reference_entry (hb_face_t *face, hb_ot_meta_tag_t meta_tag); + +HB_END_DECLS + +#endif /* HB_OT_META_H */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-metrics.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-metrics.cc new file mode 100644 index 00000000000..181ac4d57e4 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-metrics.cc @@ -0,0 +1,231 @@ +/* + * Copyright © 2018-2019 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "hb.hh" + +#include "hb-ot-var-mvar-table.hh" +#include "hb-ot-gasp-table.hh" // Just so we compile it; unused otherwise. +#include "hb-ot-os2-table.hh" +#include "hb-ot-post-table.hh" +#include "hb-ot-hhea-table.hh" +#include "hb-ot-metrics.hh" +#include "hb-ot-face.hh" + + +static float +_fix_ascender_descender (float value, hb_ot_metrics_tag_t metrics_tag) +{ + if (metrics_tag == HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER || + metrics_tag == HB_OT_METRICS_TAG_VERTICAL_ASCENDER) + return fabs ((double) value); + if (metrics_tag == HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER || + metrics_tag == HB_OT_METRICS_TAG_VERTICAL_DESCENDER) + return -fabs ((double) value); + return value; +} + +/* The common part of _get_position logic needed on hb-ot-font and here + to be able to have slim builds without the not always needed parts */ +bool +_hb_ot_metrics_get_position_common (hb_font_t *font, + hb_ot_metrics_tag_t metrics_tag, + hb_position_t *position /* OUT. May be NULL. */) +{ + hb_face_t *face = font->face; + switch ((unsigned) metrics_tag) + { +#ifndef HB_NO_VAR +#define GET_VAR face->table.MVAR->get_var (metrics_tag, font->coords, font->num_coords) +#else +#define GET_VAR .0f +#endif +#define GET_METRIC_X(TABLE, ATTR) \ + (face->table.TABLE->has_data () && \ + (position && (*position = font->em_scalef_x (_fix_ascender_descender ( \ + face->table.TABLE->ATTR + GET_VAR, metrics_tag))), true)) +#define GET_METRIC_Y(TABLE, ATTR) \ + (face->table.TABLE->has_data () && \ + (position && (*position = font->em_scalef_y (_fix_ascender_descender ( \ + face->table.TABLE->ATTR + GET_VAR, metrics_tag))), true)) + case HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER: + return (face->table.OS2->use_typo_metrics () && GET_METRIC_Y (OS2, sTypoAscender)) || + GET_METRIC_Y (hhea, ascender); + case HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER: + return (face->table.OS2->use_typo_metrics () && GET_METRIC_Y (OS2, sTypoDescender)) || + GET_METRIC_Y (hhea, descender); + case HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP: + return (face->table.OS2->use_typo_metrics () && GET_METRIC_Y (OS2, sTypoLineGap)) || + GET_METRIC_Y (hhea, lineGap); + case HB_OT_METRICS_TAG_VERTICAL_ASCENDER: return GET_METRIC_X (vhea, ascender); + case HB_OT_METRICS_TAG_VERTICAL_DESCENDER: return GET_METRIC_X (vhea, descender); + case HB_OT_METRICS_TAG_VERTICAL_LINE_GAP: return GET_METRIC_X (vhea, lineGap); +#undef GET_METRIC_Y +#undef GET_METRIC_X +#undef GET_VAR + default: assert (0); return false; + } +} + +#ifndef HB_NO_METRICS + +#if 0 +static bool +_get_gasp (hb_face_t *face, float *result, hb_ot_metrics_tag_t metrics_tag) +{ + const OT::GaspRange& range = face->table.gasp->get_gasp_range (metrics_tag - HB_TAG ('g','s','p','0')); + if (&range == &Null (OT::GaspRange)) return false; + if (result) *result = range.rangeMaxPPEM + font->face->table.MVAR->get_var (metrics_tag, font->coords, font->num_coords); + return true; +} +#endif + +/* Private tags for https://github.com/harfbuzz/harfbuzz/issues/1866 */ +#define _HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER_OS2 HB_TAG ('O','a','s','c') +#define _HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER_HHEA HB_TAG ('H','a','s','c') +#define _HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER_OS2 HB_TAG ('O','d','s','c') +#define _HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER_HHEA HB_TAG ('H','d','s','c') +#define _HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP_OS2 HB_TAG ('O','l','g','p') +#define _HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP_HHEA HB_TAG ('H','l','g','p') + +/** + * hb_ot_metrics_get_position: + * @font: a #hb_font_t object. + * @metrics_tag: tag of metrics value you like to fetch. + * @position: (out) (optional): result of metrics value from the font. + * + * It fetches metrics value corresponding to a given tag from a font. + * + * Returns: Whether found the requested metrics in the font. + * Since: 2.6.0 + **/ +hb_bool_t +hb_ot_metrics_get_position (hb_font_t *font, + hb_ot_metrics_tag_t metrics_tag, + hb_position_t *position /* OUT. May be NULL. */) +{ + hb_face_t *face = font->face; + switch ((unsigned) metrics_tag) + { + case HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER: + case HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER: + case HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP: + case HB_OT_METRICS_TAG_VERTICAL_ASCENDER: + case HB_OT_METRICS_TAG_VERTICAL_DESCENDER: + case HB_OT_METRICS_TAG_VERTICAL_LINE_GAP: return _hb_ot_metrics_get_position_common (font, metrics_tag, position); +#ifndef HB_NO_VAR +#define GET_VAR hb_ot_metrics_get_variation (font, metrics_tag) +#else +#define GET_VAR 0 +#endif +#define GET_METRIC_X(TABLE, ATTR) \ + (face->table.TABLE->has_data () && \ + (position && (*position = font->em_scalef_x (face->table.TABLE->ATTR + GET_VAR)), true)) +#define GET_METRIC_Y(TABLE, ATTR) \ + (face->table.TABLE->has_data () && \ + (position && (*position = font->em_scalef_y (face->table.TABLE->ATTR + GET_VAR)), true)) + case HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT: return GET_METRIC_Y (OS2, usWinAscent); + case HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT: return GET_METRIC_Y (OS2, usWinDescent); + case HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE: return GET_METRIC_Y (hhea, caretSlopeRise); + case HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN: return GET_METRIC_X (hhea, caretSlopeRun); + case HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET: return GET_METRIC_X (hhea, caretOffset); + case HB_OT_METRICS_TAG_VERTICAL_CARET_RISE: return GET_METRIC_X (vhea, caretSlopeRise); + case HB_OT_METRICS_TAG_VERTICAL_CARET_RUN: return GET_METRIC_Y (vhea, caretSlopeRun); + case HB_OT_METRICS_TAG_VERTICAL_CARET_OFFSET: return GET_METRIC_Y (vhea, caretOffset); + case HB_OT_METRICS_TAG_X_HEIGHT: return GET_METRIC_Y (OS2->v2 (), sxHeight); + case HB_OT_METRICS_TAG_CAP_HEIGHT: return GET_METRIC_Y (OS2->v2 (), sCapHeight); + case HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_SIZE: return GET_METRIC_X (OS2, ySubscriptXSize); + case HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE: return GET_METRIC_Y (OS2, ySubscriptYSize); + case HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_OFFSET: return GET_METRIC_X (OS2, ySubscriptXOffset); + case HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET: return GET_METRIC_Y (OS2, ySubscriptYOffset); + case HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_SIZE: return GET_METRIC_X (OS2, ySuperscriptXSize); + case HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE: return GET_METRIC_Y (OS2, ySuperscriptYSize); + case HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET: return GET_METRIC_X (OS2, ySuperscriptXOffset); + case HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET: return GET_METRIC_Y (OS2, ySuperscriptYOffset); + case HB_OT_METRICS_TAG_STRIKEOUT_SIZE: return GET_METRIC_Y (OS2, yStrikeoutSize); + case HB_OT_METRICS_TAG_STRIKEOUT_OFFSET: return GET_METRIC_Y (OS2, yStrikeoutPosition); + case HB_OT_METRICS_TAG_UNDERLINE_SIZE: return GET_METRIC_Y (post->table, underlineThickness); + case HB_OT_METRICS_TAG_UNDERLINE_OFFSET: return GET_METRIC_Y (post->table, underlinePosition); + + /* Private tags */ + case _HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER_OS2: return GET_METRIC_Y (OS2, sTypoAscender); + case _HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER_HHEA: return GET_METRIC_Y (hhea, ascender); + case _HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER_OS2: return GET_METRIC_Y (OS2, sTypoDescender); + case _HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER_HHEA: return GET_METRIC_Y (hhea, descender); + case _HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP_OS2: return GET_METRIC_Y (OS2, sTypoLineGap); + case _HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP_HHEA: return GET_METRIC_Y (hhea, lineGap); +#undef GET_METRIC_Y +#undef GET_METRIC_X +#undef GET_VAR + default: return false; + } +} + +#ifndef HB_NO_VAR +/** + * hb_ot_metrics_get_variation: + * @font: + * @metrics_tag: + * + * Returns: + * + * Since: 2.6.0 + **/ +float +hb_ot_metrics_get_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag) +{ + return font->face->table.MVAR->get_var (metrics_tag, font->coords, font->num_coords); +} + +/** + * hb_ot_metrics_get_x_variation: + * @font: + * @metrics_tag: + * + * Returns: + * + * Since: 2.6.0 + **/ +hb_position_t +hb_ot_metrics_get_x_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag) +{ + return font->em_scalef_x (hb_ot_metrics_get_variation (font, metrics_tag)); +} + +/** + * hb_ot_metrics_get_y_variation: + * @font: + * @metrics_tag: + * + * Returns: + * + * Since: 2.6.0 + **/ +hb_position_t +hb_ot_metrics_get_y_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag) +{ + return font->em_scalef_y (hb_ot_metrics_get_variation (font, metrics_tag)); +} +#endif + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-metrics.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-metrics.h new file mode 100644 index 00000000000..42c7363c038 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-metrics.h @@ -0,0 +1,122 @@ +/* + * Copyright © 2018 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HB_OT_H_IN +#error "Include <hb-ot.h> instead." +#endif + +#ifndef HB_OT_METRICS_H +#define HB_OT_METRICS_H + +#include "hb.h" +#include "hb-ot-name.h" + +HB_BEGIN_DECLS + + +/** + * hb_ot_metrics_tag_t: + * @HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER: horizontal ascender. + * @HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER: horizontal descender. + * @HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP: horizontal line gap. + * @HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT: horizontal clipping ascent. + * @HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT: horizontal clipping descent. + * @HB_OT_METRICS_TAG_VERTICAL_ASCENDER: vertical ascender. + * @HB_OT_METRICS_TAG_VERTICAL_DESCENDER: vertical descender. + * @HB_OT_METRICS_TAG_VERTICAL_LINE_GAP: vertical line gap. + * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE: horizontal caret rise. + * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN: horizontal caret run. + * @HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET: horizontal caret offset. + * @HB_OT_METRICS_TAG_VERTICAL_CARET_RISE: vertical caret rise. + * @HB_OT_METRICS_TAG_VERTICAL_CARET_RUN: vertical caret run. + * @HB_OT_METRICS_TAG_VERTICAL_CARET_OFFSET: vertical caret offset. + * @HB_OT_METRICS_TAG_X_HEIGHT: x height. + * @HB_OT_METRICS_TAG_CAP_HEIGHT: cap height. + * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_SIZE: subscript em x size. + * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE: subscript em y size. + * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_OFFSET: subscript em x offset. + * @HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET: subscript em y offset. + * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_SIZE: superscript em x size. + * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE: superscript em y size. + * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET: superscript em x offset. + * @HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET: superscript em y offset. + * @HB_OT_METRICS_TAG_STRIKEOUT_SIZE: strikeout size. + * @HB_OT_METRICS_TAG_STRIKEOUT_OFFSET: strikeout offset. + * @HB_OT_METRICS_TAG_UNDERLINE_SIZE: underline size. + * @HB_OT_METRICS_TAG_UNDERLINE_OFFSET: underline offset. + * + * From https://docs.microsoft.com/en-us/typography/opentype/spec/mvar#value-tags + * + * Since: 2.6.0 + **/ +typedef enum { + HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER = HB_TAG ('h','a','s','c'), + HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER = HB_TAG ('h','d','s','c'), + HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP = HB_TAG ('h','l','g','p'), + HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT = HB_TAG ('h','c','l','a'), + HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT = HB_TAG ('h','c','l','d'), + HB_OT_METRICS_TAG_VERTICAL_ASCENDER = HB_TAG ('v','a','s','c'), + HB_OT_METRICS_TAG_VERTICAL_DESCENDER = HB_TAG ('v','d','s','c'), + HB_OT_METRICS_TAG_VERTICAL_LINE_GAP = HB_TAG ('v','l','g','p'), + HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE = HB_TAG ('h','c','r','s'), + HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN = HB_TAG ('h','c','r','n'), + HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET = HB_TAG ('h','c','o','f'), + HB_OT_METRICS_TAG_VERTICAL_CARET_RISE = HB_TAG ('v','c','r','s'), + HB_OT_METRICS_TAG_VERTICAL_CARET_RUN = HB_TAG ('v','c','r','n'), + HB_OT_METRICS_TAG_VERTICAL_CARET_OFFSET = HB_TAG ('v','c','o','f'), + HB_OT_METRICS_TAG_X_HEIGHT = HB_TAG ('x','h','g','t'), + HB_OT_METRICS_TAG_CAP_HEIGHT = HB_TAG ('c','p','h','t'), + HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_SIZE = HB_TAG ('s','b','x','s'), + HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE = HB_TAG ('s','b','y','s'), + HB_OT_METRICS_TAG_SUBSCRIPT_EM_X_OFFSET = HB_TAG ('s','b','x','o'), + HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET = HB_TAG ('s','b','y','o'), + HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_SIZE = HB_TAG ('s','p','x','s'), + HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE = HB_TAG ('s','p','y','s'), + HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET = HB_TAG ('s','p','x','o'), + HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET = HB_TAG ('s','p','y','o'), + HB_OT_METRICS_TAG_STRIKEOUT_SIZE = HB_TAG ('s','t','r','s'), + HB_OT_METRICS_TAG_STRIKEOUT_OFFSET = HB_TAG ('s','t','r','o'), + HB_OT_METRICS_TAG_UNDERLINE_SIZE = HB_TAG ('u','n','d','s'), + HB_OT_METRICS_TAG_UNDERLINE_OFFSET = HB_TAG ('u','n','d','o'), + + _HB_OT_METRICS_TAG_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/ +} hb_ot_metrics_tag_t; + +HB_EXTERN hb_bool_t +hb_ot_metrics_get_position (hb_font_t *font, + hb_ot_metrics_tag_t metrics_tag, + hb_position_t *position /* OUT. May be NULL. */); + +HB_EXTERN float +hb_ot_metrics_get_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag); + +HB_EXTERN hb_position_t +hb_ot_metrics_get_x_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag); + +HB_EXTERN hb_position_t +hb_ot_metrics_get_y_variation (hb_font_t *font, hb_ot_metrics_tag_t metrics_tag); + +HB_END_DECLS + +#endif /* HB_OT_METRICS_H */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-metrics.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-metrics.hh new file mode 100644 index 00000000000..19a5e9ed41f --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-metrics.hh @@ -0,0 +1,35 @@ +/* + * Copyright © 2018 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HB_OT_METRICS_HH +#define HB_OT_METRICS_HH + +#include "hb.hh" + +HB_INTERNAL bool +_hb_ot_metrics_get_position_common (hb_font_t *font, + hb_ot_metrics_tag_t metrics_tag, + hb_position_t *position /* OUT. May be NULL. */); + +#endif /* HB_OT_METRICS_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh index 16e29caf367..037fcae1e68 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh @@ -59,6 +59,10 @@ struct OS2V1Tail struct OS2V2Tail { + bool has_data () const { return sxHeight || sCapHeight; } + + const OS2V2Tail * operator -> () const { return this; } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -77,6 +81,23 @@ struct OS2V2Tail struct OS2V5Tail { + inline bool get_optical_size (unsigned int *lower, unsigned int *upper) const + { + unsigned int lower_optical_size = usLowerOpticalPointSize; + unsigned int upper_optical_size = usUpperOpticalPointSize; + + /* Per https://docs.microsoft.com/en-us/typography/opentype/spec/os2#lps */ + if (lower_optical_size < upper_optical_size && + lower_optical_size >= 1 && lower_optical_size <= 0xFFFE && + upper_optical_size >= 2 && upper_optical_size <= 0xFFFF) + { + *lower = lower_optical_size; + *upper = upper_optical_size; + return true; + } + return false; + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -94,7 +115,7 @@ struct OS2 { static constexpr hb_tag_t tableTag = HB_OT_TAG_OS2; - bool has_data () const { return this != &Null (OS2); } + bool has_data () const { return usWeightClass || usWidthClass || usFirstCharIndex || usLastCharIndex; } const OS2V1Tail &v1 () const { return version >= 1 ? v1X : Null (OS2V1Tail); } const OS2V2Tail &v2 () const { return version >= 2 ? v2X : Null (OS2V2Tail); } @@ -113,9 +134,9 @@ struct OS2 OBLIQUE = 1u<<9 }; - bool is_italic () const { return fsSelection & ITALIC; } - bool is_oblique () const { return fsSelection & OBLIQUE; } - bool is_typo_metrics () const { return fsSelection & USE_TYPO_METRICS; } + bool is_italic () const { return fsSelection & ITALIC; } + bool is_oblique () const { return fsSelection & OBLIQUE; } + bool use_typo_metrics () const { return fsSelection & USE_TYPO_METRICS; } enum width_class_t { FWIDTH_ULTRA_CONDENSED = 1, /* 50% */ @@ -192,13 +213,14 @@ struct OS2 } static void find_min_and_max_codepoint (const hb_set_t *codepoints, - uint16_t *min_cp, /* OUT */ - uint16_t *max_cp /* OUT */) + uint16_t *min_cp, /* OUT */ + uint16_t *max_cp /* OUT */) { *min_cp = codepoints->get_min (); *max_cp = codepoints->get_max (); } + /* https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681 */ enum font_page_t { HEBREW_FONT_PAGE = 0xB100, // Hebrew Windows 3.1 font page SIMP_ARABIC_FONT_PAGE = 0xB200, // Simplified Arabic Windows 3.1 font page @@ -208,8 +230,6 @@ struct OS2 TRAD_FARSI_FONT_PAGE = 0xBB00, // Traditional Farsi Windows 3.1 font page THAI_FONT_PAGE = 0xDE00 // Thai Windows 3.1 font page }; - - // https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681 font_page_t get_font_page () const { return (font_page_t) (version == 0 ? fsSelection & 0xFF00 : 0); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh index 720e03bac53..fb826cd3511 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh @@ -178,6 +178,8 @@ struct post return false; } + hb_blob_ptr_t<post> table; + protected: unsigned int get_glyph_count () const @@ -237,7 +239,6 @@ struct post } private: - hb_blob_ptr_t<post> table; uint32_t version; const ArrayOf<HBUINT16> *glyphNameIndex; hb_vector_t<uint32_t> index_to_offset; @@ -245,6 +246,8 @@ struct post hb_atomic_ptr_t<uint16_t *> gids_sorted_by_name; }; + bool has_data () const { return version.to_int (); } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc index 3212e0c965b..b24833b71b0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc @@ -25,6 +25,9 @@ */ #include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex-arabic.hh" #include "hb-ot-shape.hh" @@ -710,3 +713,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic = HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ }; + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-default.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-default.cc index 97923ecf692..a921f16fada 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-default.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-default.cc @@ -24,6 +24,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex.hh" @@ -44,3 +48,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default = HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ }; + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hangul.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hangul.cc index f084f6ad6b5..32e0e66123a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hangul.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hangul.cc @@ -24,6 +24,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex.hh" @@ -430,3 +434,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hangul = HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ }; + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc index 14989730f38..334d3ded82f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc @@ -24,6 +24,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex.hh" @@ -176,3 +180,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew = HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ }; + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.hh index ca26ecbaea3..670b6bf4866 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.hh @@ -395,13 +395,13 @@ static const int indic_syllable_machine_en_main = 39; HB_STMT_START { \ if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + info[i].syllable() = (syllable_serial << 4) | indic_##syllable_type; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END static void -find_syllables (hb_buffer_t *buffer) +find_syllables_indic (hb_buffer_t *buffer) { unsigned int p, pe, eof, ts, te, act; int cs; @@ -569,4 +569,6 @@ _again: } +#undef found_syllable + #endif /* HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.rl index a2a88af0d97..5f819bd2964 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.rl @@ -96,13 +96,13 @@ main := |* HB_STMT_START { \ if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + info[i].syllable() = (syllable_serial << 4) | indic_##syllable_type; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END static void -find_syllables (hb_buffer_t *buffer) +find_syllables_indic (hb_buffer_t *buffer) { unsigned int p, pe, eof, ts, te, act; int cs; @@ -121,4 +121,6 @@ find_syllables (hb_buffer_t *buffer) }%% } +#undef found_syllable + #endif /* HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc index d26bbb8f3fd..419aae11e80 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc @@ -14,6 +14,10 @@ * # Date: 2018-07-30, 19:40:00 GMT [KW] */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex-indic.hh" #pragma GCC diagnostic push @@ -487,4 +491,6 @@ hb_indic_get_categories (hb_codepoint_t u) #undef IMC_TR #undef IMC_VOL + +#endif /* == End of generated table == */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc index f8cb5741b88..fd099cac73e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc @@ -24,6 +24,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex-indic.hh" #include "hb-ot-shape-complex-vowel-constraints.hh" #include "hb-ot-layout.hh" @@ -140,49 +144,45 @@ indic_features[] = * Must be in the same order as the indic_features array. */ enum { - _NUKT, - _AKHN, - RPHF, - _RKRF, - PREF, - BLWF, - ABVF, - HALF, - PSTF, - _VATU, - _CJCT, - - INIT, - _PRES, - _ABVS, - _BLWS, - _PSTS, - _HALN, - - _DIST, - _ABVM, - _BLWM, + _INDIC_NUKT, + _INDIC_AKHN, + INDIC_RPHF, + _INDIC_RKRF, + INDIC_PREF, + INDIC_BLWF, + INDIC_ABVF, + INDIC_HALF, + INDIC_PSTF, + _INDIC_VATU, + _INDIC_CJCT, + + INDIC_INIT, + _INDIC_PRES, + _INDIC_ABVS, + _INDIC_BLWS, + _INDIC_PSTS, + _INDIC_HALN, + + _INDIC_DIST, + _INDIC_ABVM, + _INDIC_BLWM, INDIC_NUM_FEATURES, - INDIC_BASIC_FEATURES = INIT, /* Don't forget to update this! */ + INDIC_BASIC_FEATURES = INDIC_INIT, /* Don't forget to update this! */ }; static void -setup_syllables (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); -static void -initial_reordering (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); +setup_syllables_indic (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer); static void -final_reordering (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); +initial_reordering_indic (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer); static void -clear_syllables (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); +final_reordering_indic (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer); static void collect_features_indic (hb_ot_shape_planner_t *plan) @@ -190,7 +190,7 @@ collect_features_indic (hb_ot_shape_planner_t *plan) hb_ot_map_builder_t *map = &plan->map; /* Do this before any lookups have been applied. */ - map->add_gsub_pause (setup_syllables); + map->add_gsub_pause (setup_syllables_indic); map->enable_feature (HB_TAG('l','o','c','l')); /* The Indic specs do not require ccmp, but we apply it here since if @@ -199,14 +199,14 @@ collect_features_indic (hb_ot_shape_planner_t *plan) unsigned int i = 0; - map->add_gsub_pause (initial_reordering); + map->add_gsub_pause (initial_reordering_indic); for (; i < INDIC_BASIC_FEATURES; i++) { map->add_feature (indic_features[i]); map->add_gsub_pause (nullptr); } - map->add_gsub_pause (final_reordering); + map->add_gsub_pause (final_reordering_indic); for (; i < INDIC_NUM_FEATURES; i++) map->add_feature (indic_features[i]); @@ -214,7 +214,7 @@ collect_features_indic (hb_ot_shape_planner_t *plan) map->enable_feature (HB_TAG('c','a','l','t')); map->enable_feature (HB_TAG('c','l','i','g')); - map->add_gsub_pause (clear_syllables); + map->add_gsub_pause (_hb_clear_syllables); } static void @@ -224,32 +224,6 @@ override_features_indic (hb_ot_shape_planner_t *plan) } -struct would_substitute_feature_t -{ - void init (const hb_ot_map_t *map, hb_tag_t feature_tag, bool zero_context_) - { - zero_context = zero_context_; - map->get_stage_lookups (0/*GSUB*/, - map->get_feature_stage (0/*GSUB*/, feature_tag), - &lookups, &count); - } - - bool would_substitute (const hb_codepoint_t *glyphs, - unsigned int glyphs_count, - hb_face_t *face) const - { - for (unsigned int i = 0; i < count; i++) - if (hb_ot_layout_lookup_would_substitute (face, lookups[i].index, glyphs, glyphs_count, zero_context)) - return true; - return false; - } - - private: - const hb_ot_map_t::lookup_map_t *lookups; - unsigned int count; - bool zero_context; -}; - struct indic_shape_plan_t { bool load_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const @@ -281,10 +255,10 @@ struct indic_shape_plan_t #endif mutable hb_atomic_int_t virama_glyph; - would_substitute_feature_t rphf; - would_substitute_feature_t pref; - would_substitute_feature_t blwf; - would_substitute_feature_t pstf; + hb_indic_would_substitute_feature_t rphf; + hb_indic_would_substitute_feature_t pref; + hb_indic_would_substitute_feature_t blwf; + hb_indic_would_substitute_feature_t pstf; hb_mask_t mask_array[INDIC_NUM_FEATURES]; }; @@ -367,13 +341,13 @@ consonant_position_from_face (const indic_shape_plan_t *indic_plan, } -enum syllable_type_t { - consonant_syllable, - vowel_syllable, - standalone_cluster, - symbol_cluster, - broken_cluster, - non_indic_cluster, +enum indic_syllable_type_t { + indic_consonant_syllable, + indic_vowel_syllable, + indic_standalone_cluster, + indic_symbol_cluster, + indic_broken_cluster, + indic_non_indic_cluster, }; #include "hb-ot-shape-complex-indic-machine.hh" @@ -397,11 +371,11 @@ setup_masks_indic (const hb_ot_shape_plan_t *plan HB_UNUSED, } static void -setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) +setup_syllables_indic (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font HB_UNUSED, + hb_buffer_t *buffer) { - find_syllables (buffer); + find_syllables_indic (buffer); foreach_syllable (buffer, start, end) buffer->unsafe_to_break (start, end); } @@ -418,9 +392,9 @@ compare_indic_order (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb) static void -update_consonant_positions (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer) +update_consonant_positions_indic (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer) { const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data; @@ -493,7 +467,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, * and has more than one consonant, Ra is excluded from candidates for * base consonants. */ unsigned int limit = start; - if (indic_plan->mask_array[RPHF] && + if (indic_plan->mask_array[INDIC_RPHF] && start + 3 <= end && ( (indic_plan->config->reph_mode == REPH_MODE_IMPLICIT && !is_joiner (info[start + 2])) || @@ -829,13 +803,13 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, /* Reph */ for (unsigned int i = start; i < end && info[i].indic_position() == POS_RA_TO_BECOME_REPH; i++) - info[i].mask |= indic_plan->mask_array[RPHF]; + info[i].mask |= indic_plan->mask_array[INDIC_RPHF]; /* Pre-base */ - mask = indic_plan->mask_array[HALF]; + mask = indic_plan->mask_array[INDIC_HALF]; if (!indic_plan->is_old_spec && indic_plan->config->blwf_mode == BLWF_MODE_PRE_AND_POST) - mask |= indic_plan->mask_array[BLWF]; + mask |= indic_plan->mask_array[INDIC_BLWF]; for (unsigned int i = start; i < base; i++) info[i].mask |= mask; /* Base */ @@ -843,7 +817,9 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, if (base < end) info[base].mask |= mask; /* Post-base */ - mask = indic_plan->mask_array[BLWF] | indic_plan->mask_array[ABVF] | indic_plan->mask_array[PSTF]; + mask = indic_plan->mask_array[INDIC_BLWF] | + indic_plan->mask_array[INDIC_ABVF] | + indic_plan->mask_array[INDIC_PSTF]; for (unsigned int i = base + 1; i < end; i++) info[i].mask |= mask; } @@ -875,13 +851,13 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, (i + 2 == base || info[i+2].indic_category() != OT_ZWJ)) { - info[i ].mask |= indic_plan->mask_array[BLWF]; - info[i+1].mask |= indic_plan->mask_array[BLWF]; + info[i ].mask |= indic_plan->mask_array[INDIC_BLWF]; + info[i+1].mask |= indic_plan->mask_array[INDIC_BLWF]; } } unsigned int pref_len = 2; - if (indic_plan->mask_array[PREF] && base + pref_len < end) + if (indic_plan->mask_array[INDIC_PREF] && base + pref_len < end) { /* Find a Halant,Ra sequence and mark it for pre-base-reordering processing. */ for (unsigned int i = base + 1; i + pref_len - 1 < end; i++) { @@ -891,7 +867,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, if (indic_plan->pref.would_substitute (glyphs, pref_len, face)) { for (unsigned int j = 0; j < pref_len; j++) - info[i++].mask |= indic_plan->mask_array[PREF]; + info[i++].mask |= indic_plan->mask_array[INDIC_PREF]; break; } } @@ -912,7 +888,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, /* A ZWNJ disables HALF. */ if (non_joiner) - info[j].mask &= ~indic_plan->mask_array[HALF]; + info[j].mask &= ~indic_plan->mask_array[INDIC_HALF]; } while (j > start && !is_consonant (info[j])); } @@ -941,34 +917,34 @@ initial_reordering_standalone_cluster (const hb_ot_shape_plan_t *plan, } static void -initial_reordering_syllable (const hb_ot_shape_plan_t *plan, - hb_face_t *face, - hb_buffer_t *buffer, - unsigned int start, unsigned int end) +initial_reordering_syllable_indic (const hb_ot_shape_plan_t *plan, + hb_face_t *face, + hb_buffer_t *buffer, + unsigned int start, unsigned int end) { - syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F); + indic_syllable_type_t syllable_type = (indic_syllable_type_t) (buffer->info[start].syllable() & 0x0F); switch (syllable_type) { - case vowel_syllable: /* We made the vowels look like consonants. So let's call the consonant logic! */ - case consonant_syllable: + case indic_vowel_syllable: /* We made the vowels look like consonants. So let's call the consonant logic! */ + case indic_consonant_syllable: initial_reordering_consonant_syllable (plan, face, buffer, start, end); break; - case broken_cluster: /* We already inserted dotted-circles, so just call the standalone_cluster. */ - case standalone_cluster: + case indic_broken_cluster: /* We already inserted dotted-circles, so just call the standalone_cluster. */ + case indic_standalone_cluster: initial_reordering_standalone_cluster (plan, face, buffer, start, end); break; - case symbol_cluster: - case non_indic_cluster: + case indic_symbol_cluster: + case indic_non_indic_cluster: break; } } static inline void -insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font, - hb_buffer_t *buffer) +insert_dotted_circles_indic (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font, + hb_buffer_t *buffer) { if (unlikely (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE)) return; @@ -979,7 +955,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; for (unsigned int i = 0; i < count; i++) - if ((info[i].syllable() & 0x0F) == broken_cluster) + if ((info[i].syllable() & 0x0F) == indic_broken_cluster) { has_broken_syllables = true; break; @@ -1004,8 +980,8 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, while (buffer->idx < buffer->len && buffer->successful) { unsigned int syllable = buffer->cur().syllable(); - syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); - if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) + indic_syllable_type_t syllable_type = (indic_syllable_type_t) (syllable & 0x0F); + if (unlikely (last_syllable != syllable && syllable_type == indic_broken_cluster)) { last_syllable = syllable; @@ -1029,21 +1005,21 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, } static void -initial_reordering (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer) +initial_reordering_indic (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer) { - update_consonant_positions (plan, font, buffer); - insert_dotted_circles (plan, font, buffer); + update_consonant_positions_indic (plan, font, buffer); + insert_dotted_circles_indic (plan, font, buffer); foreach_syllable (buffer, start, end) - initial_reordering_syllable (plan, font->face, buffer, start, end); + initial_reordering_syllable_indic (plan, font->face, buffer, start, end); } static void -final_reordering_syllable (const hb_ot_shape_plan_t *plan, - hb_buffer_t *buffer, - unsigned int start, unsigned int end) +final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan, + hb_buffer_t *buffer, + unsigned int start, unsigned int end) { const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data; hb_glyph_info_t *info = buffer->info; @@ -1079,7 +1055,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, * syllable. */ - bool try_pref = !!indic_plan->mask_array[PREF]; + bool try_pref = !!indic_plan->mask_array[INDIC_PREF]; /* Find base again */ unsigned int base; @@ -1089,7 +1065,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, if (try_pref && base + 1 < end) { for (unsigned int i = base + 1; i < end; i++) - if ((info[i].mask & indic_plan->mask_array[PREF]) != 0) + if ((info[i].mask & indic_plan->mask_array[INDIC_PREF]) != 0) { if (!(_hb_glyph_info_substituted (&info[i]) && _hb_glyph_info_ligated_and_didnt_multiply (&info[i]))) @@ -1411,7 +1387,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, if (try_pref && base + 1 < end) /* Otherwise there can't be any pre-base-reordering Ra. */ { for (unsigned int i = base + 1; i < end; i++) - if ((info[i].mask & indic_plan->mask_array[PREF]) != 0) + if ((info[i].mask & indic_plan->mask_array[INDIC_PREF]) != 0) { /* 1. Only reorder a glyph produced by substitution during application * of the <pref> feature. (Note that a font may shape a Ra consonant with @@ -1474,7 +1450,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, if (!start || !(FLAG_UNSAFE (_hb_glyph_info_get_general_category (&info[start - 1])) & FLAG_RANGE (HB_UNICODE_GENERAL_CATEGORY_FORMAT, HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))) - info[start].mask |= indic_plan->mask_array[INIT]; + info[start].mask |= indic_plan->mask_array[INDIC_INIT]; else buffer->unsafe_to_break (start - 1, start + 1); } @@ -1504,15 +1480,15 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, static void -final_reordering (const hb_ot_shape_plan_t *plan, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) +final_reordering_indic (const hb_ot_shape_plan_t *plan, + hb_font_t *font HB_UNUSED, + hb_buffer_t *buffer) { unsigned int count = buffer->len; if (unlikely (!count)) return; foreach_syllable (buffer, start, end) - final_reordering_syllable (plan, buffer, start, end); + final_reordering_syllable_indic (plan, buffer, start, end); HB_BUFFER_DEALLOCATE_VAR (buffer, indic_category); HB_BUFFER_DEALLOCATE_VAR (buffer, indic_position); @@ -1520,18 +1496,6 @@ final_reordering (const hb_ot_shape_plan_t *plan, static void -clear_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) -{ - hb_glyph_info_t *info = buffer->info; - unsigned int count = buffer->len; - for (unsigned int i = 0; i < count; i++) - info[i].syllable() = 0; -} - - -static void preprocess_text_indic (const hb_ot_shape_plan_t *plan, hb_buffer_t *buffer, hb_font_t *font) @@ -1648,3 +1612,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic = HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ }; + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.hh index d207728c418..1eeed68c50e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.hh @@ -64,7 +64,14 @@ enum indic_category_t { OT_Ra = 16, OT_CM = 17, /* Consonant-Medial. */ OT_Symbol = 18, /* Avagraha, etc that take marks (SM,A,VD). */ - OT_CS = 19 + OT_CS = 19, + + /* The following are used by Khmer & Myanmar shapers. Defined + * here for them to share. */ + OT_VAbv = 26, + OT_VBlw = 27, + OT_VPre = 28, + OT_VPst = 29, }; #define MEDIAL_FLAGS (FLAG (OT_CM)) @@ -398,5 +405,31 @@ set_indic_properties (hb_glyph_info_t &info) info.indic_position() = pos; } +struct hb_indic_would_substitute_feature_t +{ + void init (const hb_ot_map_t *map, hb_tag_t feature_tag, bool zero_context_) + { + zero_context = zero_context_; + map->get_stage_lookups (0/*GSUB*/, + map->get_feature_stage (0/*GSUB*/, feature_tag), + &lookups, &count); + } + + bool would_substitute (const hb_codepoint_t *glyphs, + unsigned int glyphs_count, + hb_face_t *face) const + { + for (unsigned int i = 0; i < count; i++) + if (hb_ot_layout_lookup_would_substitute (face, lookups[i].index, glyphs, glyphs_count, zero_context)) + return true; + return false; + } + + private: + const hb_ot_map_t::lookup_map_t *lookups; + unsigned int count; + bool zero_context; +}; + #endif /* HB_OT_SHAPE_COMPLEX_INDIC_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.hh index 65e0ffc851f..a040318d345 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.hh @@ -226,13 +226,13 @@ static const int khmer_syllable_machine_en_main = 20; HB_STMT_START { \ if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + info[i].syllable() = (syllable_serial << 4) | khmer_##syllable_type; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END static void -find_syllables (hb_buffer_t *buffer) +find_syllables_khmer (hb_buffer_t *buffer) { unsigned int p, pe, eof, ts, te, act HB_UNUSED; int cs; @@ -367,4 +367,6 @@ _again: } +#undef found_syllable + #endif /* HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.rl index 1076a08e8b5..e7f14533ddd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.rl @@ -83,13 +83,13 @@ main := |* HB_STMT_START { \ if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + info[i].syllable() = (syllable_serial << 4) | khmer_##syllable_type; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END static void -find_syllables (hb_buffer_t *buffer) +find_syllables_khmer (hb_buffer_t *buffer) { unsigned int p, pe, eof, ts, te, act HB_UNUSED; int cs; @@ -108,4 +108,6 @@ find_syllables (hb_buffer_t *buffer) }%% } +#undef found_syllable + #endif /* HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc index 4c88477621b..b1fa0156aec 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc @@ -24,6 +24,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex-khmer.hh" #include "hb-ot-layout.hh" @@ -65,37 +69,33 @@ khmer_features[] = * Must be in the same order as the khmer_features array. */ enum { - PREF, - BLWF, - ABVF, - PSTF, - CFAR, + KHMER_PREF, + KHMER_BLWF, + KHMER_ABVF, + KHMER_PSTF, + KHMER_CFAR, - _PRES, - _ABVS, - _BLWS, - _PSTS, + _KHMER_PRES, + _KHMER_ABVS, + _KHMER_BLWS, + _KHMER_PSTS, - _DIST, - _ABVM, - _BLWM, + _KHMER_DIST, + _KHMER_ABVM, + _KHMER_BLWM, KHMER_NUM_FEATURES, - KHMER_BASIC_FEATURES = _PRES, /* Don't forget to update this! */ + KHMER_BASIC_FEATURES = _KHMER_PRES, /* Don't forget to update this! */ }; static void -setup_syllables (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); -static void -reorder (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); +setup_syllables_khmer (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer); static void -clear_syllables (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); +reorder_khmer (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer); static void collect_features_khmer (hb_ot_shape_planner_t *plan) @@ -103,8 +103,8 @@ collect_features_khmer (hb_ot_shape_planner_t *plan) hb_ot_map_builder_t *map = &plan->map; /* Do this before any lookups have been applied. */ - map->add_gsub_pause (setup_syllables); - map->add_gsub_pause (reorder); + map->add_gsub_pause (setup_syllables_khmer); + map->add_gsub_pause (reorder_khmer); /* Testing suggests that Uniscribe does NOT pause between basic * features. Test with KhmerUI.ttf and the following three @@ -123,7 +123,7 @@ collect_features_khmer (hb_ot_shape_planner_t *plan) for (; i < KHMER_BASIC_FEATURES; i++) map->add_feature (khmer_features[i]); - map->add_gsub_pause (clear_syllables); + map->add_gsub_pause (_hb_clear_syllables); for (; i < KHMER_NUM_FEATURES; i++) map->add_feature (khmer_features[i]); @@ -149,32 +149,6 @@ override_features_khmer (hb_ot_shape_planner_t *plan) } -struct would_substitute_feature_t -{ - void init (const hb_ot_map_t *map, hb_tag_t feature_tag, bool zero_context_) - { - zero_context = zero_context_; - map->get_stage_lookups (0/*GSUB*/, - map->get_feature_stage (0/*GSUB*/, feature_tag), - &lookups, &count); - } - - bool would_substitute (const hb_codepoint_t *glyphs, - unsigned int glyphs_count, - hb_face_t *face) const - { - for (unsigned int i = 0; i < count; i++) - if (hb_ot_layout_lookup_would_substitute (face, lookups[i].index, glyphs, glyphs_count, zero_context)) - return true; - return false; - } - - private: - const hb_ot_map_t::lookup_map_t *lookups; - unsigned int count; - bool zero_context; -}; - struct khmer_shape_plan_t { bool get_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const @@ -198,7 +172,7 @@ struct khmer_shape_plan_t mutable hb_codepoint_t virama_glyph; - would_substitute_feature_t pref; + hb_indic_would_substitute_feature_t pref; hb_mask_t mask_array[KHMER_NUM_FEATURES]; }; @@ -228,10 +202,10 @@ data_destroy_khmer (void *data) } -enum syllable_type_t { - consonant_syllable, - broken_cluster, - non_khmer_cluster, +enum khmer_syllable_type_t { + khmer_consonant_syllable, + khmer_broken_cluster, + khmer_non_khmer_cluster, }; #include "hb-ot-shape-complex-khmer-machine.hh" @@ -253,11 +227,11 @@ setup_masks_khmer (const hb_ot_shape_plan_t *plan HB_UNUSED, } static void -setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) +setup_syllables_khmer (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font HB_UNUSED, + hb_buffer_t *buffer) { - find_syllables (buffer); + find_syllables_khmer (buffer); foreach_syllable (buffer, start, end) buffer->unsafe_to_break (start, end); } @@ -278,7 +252,9 @@ reorder_consonant_syllable (const hb_ot_shape_plan_t *plan, /* Setup masks. */ { /* Post-base */ - hb_mask_t mask = khmer_plan->mask_array[BLWF] | khmer_plan->mask_array[ABVF] | khmer_plan->mask_array[PSTF]; + hb_mask_t mask = khmer_plan->mask_array[KHMER_BLWF] | + khmer_plan->mask_array[KHMER_ABVF] | + khmer_plan->mask_array[KHMER_PSTF]; for (unsigned int i = start + 1; i < end; i++) info[i].mask |= mask; } @@ -305,7 +281,7 @@ reorder_consonant_syllable (const hb_ot_shape_plan_t *plan, if (info[i + 1].khmer_category() == OT_Ra) { for (unsigned int j = 0; j < 2; j++) - info[i + j].mask |= khmer_plan->mask_array[PREF]; + info[i + j].mask |= khmer_plan->mask_array[KHMER_PREF]; /* Move the Coeng,Ro sequence to the start. */ buffer->merge_clusters (start, i + 2); @@ -321,9 +297,9 @@ reorder_consonant_syllable (const hb_ot_shape_plan_t *plan, * U+1784,U+17D2,U+179A,U+17D2,U+1782 * U+1784,U+17D2,U+1782,U+17D2,U+179A */ - if (khmer_plan->mask_array[CFAR]) + if (khmer_plan->mask_array[KHMER_CFAR]) for (unsigned int j = i + 2; j < end; j++) - info[j].mask |= khmer_plan->mask_array[CFAR]; + info[j].mask |= khmer_plan->mask_array[KHMER_CFAR]; num_coengs = 2; /* Done. */ } @@ -342,28 +318,28 @@ reorder_consonant_syllable (const hb_ot_shape_plan_t *plan, } static void -initial_reordering_syllable (const hb_ot_shape_plan_t *plan, - hb_face_t *face, - hb_buffer_t *buffer, - unsigned int start, unsigned int end) +reorder_syllable_khmer (const hb_ot_shape_plan_t *plan, + hb_face_t *face, + hb_buffer_t *buffer, + unsigned int start, unsigned int end) { - syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F); + khmer_syllable_type_t syllable_type = (khmer_syllable_type_t) (buffer->info[start].syllable() & 0x0F); switch (syllable_type) { - case broken_cluster: /* We already inserted dotted-circles, so just call the consonant_syllable. */ - case consonant_syllable: + case khmer_broken_cluster: /* We already inserted dotted-circles, so just call the consonant_syllable. */ + case khmer_consonant_syllable: reorder_consonant_syllable (plan, face, buffer, start, end); break; - case non_khmer_cluster: + case khmer_non_khmer_cluster: break; } } static inline void -insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font, - hb_buffer_t *buffer) +insert_dotted_circles_khmer (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font, + hb_buffer_t *buffer) { if (unlikely (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE)) return; @@ -374,7 +350,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; for (unsigned int i = 0; i < count; i++) - if ((info[i].syllable() & 0x0F) == broken_cluster) + if ((info[i].syllable() & 0x0F) == khmer_broken_cluster) { has_broken_syllables = true; break; @@ -399,8 +375,8 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, while (buffer->idx < buffer->len && buffer->successful) { unsigned int syllable = buffer->cur().syllable(); - syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); - if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) + khmer_syllable_type_t syllable_type = (khmer_syllable_type_t) (syllable & 0x0F); + if (unlikely (last_syllable != syllable && syllable_type == khmer_broken_cluster)) { last_syllable = syllable; @@ -424,29 +400,18 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, } static void -reorder (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer) +reorder_khmer (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer) { - insert_dotted_circles (plan, font, buffer); + insert_dotted_circles_khmer (plan, font, buffer); foreach_syllable (buffer, start, end) - initial_reordering_syllable (plan, font->face, buffer, start, end); + reorder_syllable_khmer (plan, font->face, buffer, start, end); HB_BUFFER_DEALLOCATE_VAR (buffer, khmer_category); } -static void -clear_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) -{ - hb_glyph_info_t *info = buffer->info; - unsigned int count = buffer->len; - for (unsigned int i = 0; i < count; i++) - info[i].syllable() = 0; -} - static bool decompose_khmer (const hb_ot_shape_normalize_context_t *c, @@ -502,3 +467,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_khmer = HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ }; + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.hh index 21015c7307e..11a77bfd4bc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.hh @@ -43,11 +43,10 @@ enum khmer_category_t OT_Robatic = 20, OT_Xgroup = 21, OT_Ygroup = 22, - - OT_VAbv = 26, - OT_VBlw = 27, - OT_VPre = 28, - OT_VPst = 29, + //OT_VAbv = 26, + //OT_VBlw = 27, + //OT_VPre = 28, + //OT_VPst = 29, }; static inline void @@ -100,10 +99,10 @@ set_khmer_properties (hb_glyph_info_t &info) if (cat == (khmer_category_t) OT_M) switch ((int) pos) { - case POS_PRE_C: cat = OT_VPre; break; - case POS_BELOW_C: cat = OT_VBlw; break; - case POS_ABOVE_C: cat = OT_VAbv; break; - case POS_POST_C: cat = OT_VPst; break; + case POS_PRE_C: cat = (khmer_category_t) OT_VPre; break; + case POS_BELOW_C: cat = (khmer_category_t) OT_VBlw; break; + case POS_ABOVE_C: cat = (khmer_category_t) OT_VAbv; break; + case POS_POST_C: cat = (khmer_category_t) OT_VPst; break; default: assert (0); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh index b7b04cb6d0c..c2f4c0045cc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh @@ -304,13 +304,13 @@ static const int myanmar_syllable_machine_en_main = 0; HB_STMT_START { \ if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + info[i].syllable() = (syllable_serial << 4) | myanmar_##syllable_type; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END static void -find_syllables (hb_buffer_t *buffer) +find_syllables_myanmar (hb_buffer_t *buffer) { unsigned int p, pe, eof, ts, te, act HB_UNUSED; int cs; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl index 66599893853..67133cd7346 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl @@ -97,13 +97,13 @@ main := |* HB_STMT_START { \ if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + info[i].syllable() = (syllable_serial << 4) | myanmar_##syllable_type; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END static void -find_syllables (hb_buffer_t *buffer) +find_syllables_myanmar (hb_buffer_t *buffer) { unsigned int p, pe, eof, ts, te, act HB_UNUSED; int cs; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc index b1f6b65ef52..14d215eac31 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc @@ -24,6 +24,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex-myanmar.hh" @@ -32,7 +36,7 @@ */ static const hb_tag_t -basic_features[] = +myanmar_basic_features[] = { /* * Basic features. @@ -44,7 +48,7 @@ basic_features[] = HB_TAG('p','s','t','f'), }; static const hb_tag_t -other_features[] = +myanmar_other_features[] = { /* * Other features. @@ -56,7 +60,7 @@ other_features[] = HB_TAG('p','s','t','s'), }; static const hb_tag_t -positioning_features[] = +myanmar_positioning_features[] = { /* * Positioning features. @@ -76,15 +80,11 @@ positioning_features[] = }; static void -setup_syllables (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); -static void -reorder (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); +setup_syllables_myanmar (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer); static void -clear_syllables (const hb_ot_shape_plan_t *plan, +reorder_myanmar (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer); @@ -94,7 +94,7 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan) hb_ot_map_builder_t *map = &plan->map; /* Do this before any lookups have been applied. */ - map->add_gsub_pause (setup_syllables); + map->add_gsub_pause (setup_syllables_myanmar); map->enable_feature (HB_TAG('l','o','c','l')); /* The Indic specs do not require ccmp, but we apply it here since if @@ -102,21 +102,21 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan) map->enable_feature (HB_TAG('c','c','m','p')); - map->add_gsub_pause (reorder); + map->add_gsub_pause (reorder_myanmar); - for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) + for (unsigned int i = 0; i < ARRAY_LENGTH (myanmar_basic_features); i++) { - map->enable_feature (basic_features[i], F_MANUAL_ZWJ); + map->enable_feature (myanmar_basic_features[i], F_MANUAL_ZWJ); map->add_gsub_pause (nullptr); } - map->add_gsub_pause (clear_syllables); + map->add_gsub_pause (_hb_clear_syllables); - for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) - map->enable_feature (other_features[i], F_MANUAL_ZWJ); + for (unsigned int i = 0; i < ARRAY_LENGTH (myanmar_other_features); i++) + map->enable_feature (myanmar_other_features[i], F_MANUAL_ZWJ); - for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++) - map->enable_feature (positioning_features[i]); + for (unsigned int i = 0; i < ARRAY_LENGTH (myanmar_positioning_features); i++) + map->enable_feature (myanmar_positioning_features[i]); } static void @@ -126,11 +126,11 @@ override_features_myanmar (hb_ot_shape_planner_t *plan) } -enum syllable_type_t { - consonant_syllable, - punctuation_cluster, - broken_cluster, - non_myanmar_cluster, +enum myanmar_syllable_type_t { + myanmar_consonant_syllable, + myanmar_punctuation_cluster, + myanmar_broken_cluster, + myanmar_non_myanmar_cluster, }; #include "hb-ot-shape-complex-myanmar-machine.hh" @@ -154,11 +154,11 @@ setup_masks_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED, } static void -setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) +setup_syllables_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font HB_UNUSED, + hb_buffer_t *buffer) { - find_syllables (buffer); + find_syllables_myanmar (buffer); foreach_syllable (buffer, start, end) buffer->unsafe_to_break (start, end); } @@ -274,29 +274,29 @@ initial_reordering_consonant_syllable (hb_buffer_t *buffer, } static void -initial_reordering_syllable (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_face_t *face HB_UNUSED, - hb_buffer_t *buffer, - unsigned int start, unsigned int end) +reorder_syllable_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_face_t *face HB_UNUSED, + hb_buffer_t *buffer, + unsigned int start, unsigned int end) { - syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F); + myanmar_syllable_type_t syllable_type = (myanmar_syllable_type_t) (buffer->info[start].syllable() & 0x0F); switch (syllable_type) { - case broken_cluster: /* We already inserted dotted-circles, so just call the consonant_syllable. */ - case consonant_syllable: + case myanmar_broken_cluster: /* We already inserted dotted-circles, so just call the consonant_syllable. */ + case myanmar_consonant_syllable: initial_reordering_consonant_syllable (buffer, start, end); break; - case punctuation_cluster: - case non_myanmar_cluster: + case myanmar_punctuation_cluster: + case myanmar_non_myanmar_cluster: break; } } static inline void -insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font, - hb_buffer_t *buffer) +insert_dotted_circles_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font, + hb_buffer_t *buffer) { if (unlikely (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE)) return; @@ -307,7 +307,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; for (unsigned int i = 0; i < count; i++) - if ((info[i].syllable() & 0x0F) == broken_cluster) + if ((info[i].syllable() & 0x0F) == myanmar_broken_cluster) { has_broken_syllables = true; break; @@ -332,8 +332,8 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, while (buffer->idx < buffer->len && buffer->successful) { unsigned int syllable = buffer->cur().syllable(); - syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); - if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) + myanmar_syllable_type_t syllable_type = (myanmar_syllable_type_t) (syllable & 0x0F); + if (unlikely (last_syllable != syllable && syllable_type == myanmar_broken_cluster)) { last_syllable = syllable; @@ -351,30 +351,19 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, } static void -reorder (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer) +reorder_myanmar (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer) { - insert_dotted_circles (plan, font, buffer); + insert_dotted_circles_myanmar (plan, font, buffer); foreach_syllable (buffer, start, end) - initial_reordering_syllable (plan, font->face, buffer, start, end); + reorder_syllable_myanmar (plan, font->face, buffer, start, end); HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_category); HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_position); } -static void -clear_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) -{ - hb_glyph_info_t *info = buffer->info; - unsigned int count = buffer->len; - for (unsigned int i = 0; i < count; i++) - info[i].syllable() = 0; -} - const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar = { @@ -415,3 +404,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_zawgyi = HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ }; + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.hh index 9ec78ef8968..7b9821e6ba4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.hh @@ -49,10 +49,10 @@ enum myanmar_category_t { OT_MW = 23, /* Various consonant medial types */ OT_MY = 24, /* Various consonant medial types */ OT_PT = 25, /* Pwo and other tones */ - OT_VAbv = 26, - OT_VBlw = 27, - OT_VPre = 28, - OT_VPst = 29, + //OT_VAbv = 26, + //OT_VBlw = 27, + //OT_VPre = 28, + //OT_VPst = 29, OT_VS = 30, /* Variation selectors */ OT_P = 31, /* Punctuation */ OT_D = 32, /* Digits except zero */ @@ -155,11 +155,11 @@ set_myanmar_properties (hb_glyph_info_t &info) { switch ((int) pos) { - case POS_PRE_C: cat = OT_VPre; + case POS_PRE_C: cat = (myanmar_category_t) OT_VPre; pos = POS_PRE_M; break; - case POS_ABOVE_C: cat = OT_VAbv; break; - case POS_BELOW_C: cat = OT_VBlw; break; - case POS_POST_C: cat = OT_VPst; break; + case POS_ABOVE_C: cat = (myanmar_category_t) OT_VAbv; break; + case POS_BELOW_C: cat = (myanmar_category_t) OT_VBlw; break; + case POS_POST_C: cat = (myanmar_category_t) OT_VPst; break; } } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-thai.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-thai.cc index 22d4aa3ab21..347ea2e7acf 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-thai.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-thai.cc @@ -24,6 +24,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex.hh" @@ -385,3 +389,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai = HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, false,/* fallback_position */ }; + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh index 01fe3d788ac..462342c618e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh @@ -380,13 +380,13 @@ static const int use_syllable_machine_en_main = 5; HB_STMT_START { \ if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + info[i].syllable() = (syllable_serial << 4) | use_##syllable_type; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END static void -find_syllables (hb_buffer_t *buffer) +find_syllables_use (hb_buffer_t *buffer) { unsigned int p, pe, eof, ts, te, act; int cs; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl index aca7ea68345..9b75b5c6e24 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl @@ -165,13 +165,13 @@ main := |* HB_STMT_START { \ if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + info[i].syllable() = (syllable_serial << 4) | use_##syllable_type; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END static void -find_syllables (hb_buffer_t *buffer) +find_syllables_use (hb_buffer_t *buffer) { unsigned int p, pe, eof, ts, te, act; int cs; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc index 024746989b7..4c5d687c7b4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc @@ -15,6 +15,10 @@ * UnicodeData.txt does not have a header. */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex-use.hh" #pragma GCC diagnostic push @@ -851,4 +855,6 @@ hb_use_get_category (hb_codepoint_t u) #undef VMPst #undef VMAbv + +#endif /* == End of generated table == */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc index 2cc5ea27861..1ea2957f261 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc @@ -26,6 +26,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex-use.hh" #include "hb-ot-shape-complex-arabic.hh" #include "hb-ot-shape-complex-vowel-constraints.hh" @@ -40,7 +44,7 @@ */ static const hb_tag_t -basic_features[] = +use_basic_features[] = { /* * Basic features. @@ -55,28 +59,23 @@ basic_features[] = HB_TAG('c','j','c','t'), }; static const hb_tag_t -arabic_features[] = +use_topographical_features[] = { HB_TAG('i','s','o','l'), HB_TAG('i','n','i','t'), HB_TAG('m','e','d','i'), HB_TAG('f','i','n','a'), - /* The spec doesn't specify these but we apply anyway, since our Arabic shaper - * does. These are only used in Syriac spec. */ - HB_TAG('m','e','d','2'), - HB_TAG('f','i','n','2'), - HB_TAG('f','i','n','3'), }; -/* Same order as arabic_features. Don't need Syriac stuff.*/ +/* Same order as use_topographical_features. */ enum joining_form_t { - ISOL, - INIT, - MEDI, - FINA, - _NONE + USE_ISOL, + USE_INIT, + USE_MEDI, + USE_FINA, + _USE_NONE }; static const hb_tag_t -other_features[] = +use_other_features[] = { /* * Other features. @@ -90,7 +89,7 @@ other_features[] = HB_TAG('p','s','t','s'), }; static const hb_tag_t -positioning_features[] = +use_positioning_features[] = { /* * Positioning features. @@ -102,29 +101,21 @@ positioning_features[] = }; static void -setup_syllables (const hb_ot_shape_plan_t *plan, +setup_syllables_use (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer); +static void +record_rphf_use (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer); static void -clear_substitution_flags (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); -static void -record_rphf (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); +record_pref_use (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer); static void -record_pref (const hb_ot_shape_plan_t *plan, +reorder_use (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer); -static void -reorder (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); -static void -clear_syllables (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); static void collect_features_use (hb_ot_shape_planner_t *plan) @@ -132,7 +123,7 @@ collect_features_use (hb_ot_shape_planner_t *plan) hb_ot_map_builder_t *map = &plan->map; /* Do this before any lookups have been applied. */ - map->add_gsub_pause (setup_syllables); + map->add_gsub_pause (setup_syllables_use); /* "Default glyph pre-processing group" */ map->enable_feature (HB_TAG('l','o','c','l')); @@ -141,32 +132,32 @@ collect_features_use (hb_ot_shape_planner_t *plan) map->enable_feature (HB_TAG('a','k','h','n'), F_MANUAL_ZWJ); /* "Reordering group" */ - map->add_gsub_pause (clear_substitution_flags); + map->add_gsub_pause (_hb_clear_substitution_flags); map->add_feature (HB_TAG('r','p','h','f'), F_MANUAL_ZWJ); - map->add_gsub_pause (record_rphf); - map->add_gsub_pause (clear_substitution_flags); + map->add_gsub_pause (record_rphf_use); + map->add_gsub_pause (_hb_clear_substitution_flags); map->enable_feature (HB_TAG('p','r','e','f'), F_MANUAL_ZWJ); - map->add_gsub_pause (record_pref); + map->add_gsub_pause (record_pref_use); /* "Orthographic unit shaping group" */ - for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) - map->enable_feature (basic_features[i], F_MANUAL_ZWJ); + for (unsigned int i = 0; i < ARRAY_LENGTH (use_basic_features); i++) + map->enable_feature (use_basic_features[i], F_MANUAL_ZWJ); - map->add_gsub_pause (reorder); - map->add_gsub_pause (clear_syllables); + map->add_gsub_pause (reorder_use); + map->add_gsub_pause (_hb_clear_syllables); /* "Topographical features" */ - for (unsigned int i = 0; i < ARRAY_LENGTH (arabic_features); i++) - map->add_feature (arabic_features[i]); + for (unsigned int i = 0; i < ARRAY_LENGTH (use_topographical_features); i++) + map->add_feature (use_topographical_features[i]); map->add_gsub_pause (nullptr); /* "Standard typographic presentation" */ - for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) - map->enable_feature (other_features[i], F_MANUAL_ZWJ); + for (unsigned int i = 0; i < ARRAY_LENGTH (use_other_features); i++) + map->enable_feature (use_other_features[i], F_MANUAL_ZWJ); /* "Positional feature application" */ - for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++) - map->enable_feature (positioning_features[i]); + for (unsigned int i = 0; i < ARRAY_LENGTH (use_positioning_features); i++) + map->enable_feature (use_positioning_features[i]); } struct use_shape_plan_t @@ -243,16 +234,16 @@ data_destroy_use (void *data) free (data); } -enum syllable_type_t { - independent_cluster, - virama_terminated_cluster, - sakot_terminated_cluster, - standard_cluster, - number_joiner_terminated_cluster, - numeral_cluster, - symbol_cluster, - broken_cluster, - non_cluster, +enum use_syllable_type_t { + use_independent_cluster, + use_virama_terminated_cluster, + use_sakot_terminated_cluster, + use_standard_cluster, + use_number_joiner_terminated_cluster, + use_numeral_cluster, + use_symbol_cluster, + use_broken_cluster, + use_non_cluster, }; #include "hb-ot-shape-complex-use-machine.hh" @@ -309,11 +300,11 @@ setup_topographical_masks (const hb_ot_shape_plan_t *plan, if (use_plan->arabic_plan) return; - static_assert ((INIT < 4 && ISOL < 4 && MEDI < 4 && FINA < 4), ""); + static_assert ((USE_INIT < 4 && USE_ISOL < 4 && USE_MEDI < 4 && USE_FINA < 4), ""); hb_mask_t masks[4], all_masks = 0; for (unsigned int i = 0; i < 4; i++) { - masks[i] = plan->map.get_1_mask (arabic_features[i]); + masks[i] = plan->map.get_1_mask (use_topographical_features[i]); if (masks[i] == plan->map.get_global_mask ()) masks[i] = 0; all_masks |= masks[i]; @@ -323,39 +314,39 @@ setup_topographical_masks (const hb_ot_shape_plan_t *plan, hb_mask_t other_masks = ~all_masks; unsigned int last_start = 0; - joining_form_t last_form = _NONE; + joining_form_t last_form = _USE_NONE; hb_glyph_info_t *info = buffer->info; foreach_syllable (buffer, start, end) { - syllable_type_t syllable_type = (syllable_type_t) (info[start].syllable() & 0x0F); + use_syllable_type_t syllable_type = (use_syllable_type_t) (info[start].syllable() & 0x0F); switch (syllable_type) { - case independent_cluster: - case symbol_cluster: - case non_cluster: + case use_independent_cluster: + case use_symbol_cluster: + case use_non_cluster: /* These don't join. Nothing to do. */ - last_form = _NONE; + last_form = _USE_NONE; break; - case virama_terminated_cluster: - case sakot_terminated_cluster: - case standard_cluster: - case number_joiner_terminated_cluster: - case numeral_cluster: - case broken_cluster: + case use_virama_terminated_cluster: + case use_sakot_terminated_cluster: + case use_standard_cluster: + case use_number_joiner_terminated_cluster: + case use_numeral_cluster: + case use_broken_cluster: - bool join = last_form == FINA || last_form == ISOL; + bool join = last_form == USE_FINA || last_form == USE_ISOL; if (join) { /* Fixup previous syllable's form. */ - last_form = last_form == FINA ? MEDI : INIT; + last_form = last_form == USE_FINA ? USE_MEDI : USE_INIT; for (unsigned int i = last_start; i < start; i++) info[i].mask = (info[i].mask & other_masks) | masks[last_form]; } /* Form for this syllable. */ - last_form = join ? FINA : ISOL; + last_form = join ? USE_FINA : USE_ISOL; for (unsigned int i = start; i < end; i++) info[i].mask = (info[i].mask & other_masks) | masks[last_form]; @@ -367,11 +358,11 @@ setup_topographical_masks (const hb_ot_shape_plan_t *plan, } static void -setup_syllables (const hb_ot_shape_plan_t *plan, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) +setup_syllables_use (const hb_ot_shape_plan_t *plan, + hb_font_t *font HB_UNUSED, + hb_buffer_t *buffer) { - find_syllables (buffer); + find_syllables_use (buffer); foreach_syllable (buffer, start, end) buffer->unsafe_to_break (start, end); setup_rphf_mask (plan, buffer); @@ -379,20 +370,9 @@ setup_syllables (const hb_ot_shape_plan_t *plan, } static void -clear_substitution_flags (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) -{ - hb_glyph_info_t *info = buffer->info; - unsigned int count = buffer->len; - for (unsigned int i = 0; i < count; i++) - _hb_glyph_info_clear_substituted (&info[i]); -} - -static void -record_rphf (const hb_ot_shape_plan_t *plan, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) +record_rphf_use (const hb_ot_shape_plan_t *plan, + hb_font_t *font HB_UNUSED, + hb_buffer_t *buffer) { const use_shape_plan_t *use_plan = (const use_shape_plan_t *) plan->data; @@ -413,9 +393,9 @@ record_rphf (const hb_ot_shape_plan_t *plan, } static void -record_pref (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) +record_pref_use (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font HB_UNUSED, + hb_buffer_t *buffer) { hb_glyph_info_t *info = buffer->info; @@ -432,22 +412,22 @@ record_pref (const hb_ot_shape_plan_t *plan HB_UNUSED, } static inline bool -is_halant (const hb_glyph_info_t &info) +is_halant_use (const hb_glyph_info_t &info) { return (info.use_category() == USE_H || info.use_category() == USE_HVM) && !_hb_glyph_info_ligated (&info); } static void -reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end) +reorder_syllable_use (hb_buffer_t *buffer, unsigned int start, unsigned int end) { - syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F); + use_syllable_type_t syllable_type = (use_syllable_type_t) (buffer->info[start].syllable() & 0x0F); /* Only a few syllable types need reordering. */ if (unlikely (!(FLAG_UNSAFE (syllable_type) & - (FLAG (virama_terminated_cluster) | - FLAG (sakot_terminated_cluster) | - FLAG (standard_cluster) | - FLAG (broken_cluster) | + (FLAG (use_virama_terminated_cluster) | + FLAG (use_sakot_terminated_cluster) | + FLAG (use_standard_cluster) | + FLAG (use_broken_cluster) | 0)))) return; @@ -478,7 +458,7 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end) for (unsigned int i = start + 1; i < end; i++) { bool is_post_base_glyph = (FLAG64_UNSAFE (info[i].use_category()) & POST_BASE_FLAGS64) || - is_halant (info[i]); + is_halant_use (info[i]); if (is_post_base_glyph || i == end - 1) { /* If we hit a post-base glyph, move before it; otherwise move to the @@ -502,7 +482,7 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end) for (unsigned int i = start; i < end; i++) { uint32_t flag = FLAG_UNSAFE (info[i].use_category()); - if (is_halant (info[i])) + if (is_halant_use (info[i])) { /* If we hit a halant, move after it; otherwise move to the beginning, and * shift things in between forward. */ @@ -522,9 +502,9 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end) } static inline void -insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font, - hb_buffer_t *buffer) +insert_dotted_circles_use (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font, + hb_buffer_t *buffer) { if (unlikely (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE)) return; @@ -535,7 +515,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; for (unsigned int i = 0; i < count; i++) - if ((info[i].syllable() & 0x0F) == broken_cluster) + if ((info[i].syllable() & 0x0F) == use_broken_cluster) { has_broken_syllables = true; break; @@ -555,8 +535,8 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, while (buffer->idx < buffer->len && buffer->successful) { unsigned int syllable = buffer->cur().syllable(); - syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); - if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) + use_syllable_type_t syllable_type = (use_syllable_type_t) (syllable & 0x0F); + if (unlikely (last_syllable != syllable && syllable_type == use_broken_cluster)) { last_syllable = syllable; @@ -580,29 +560,18 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, } static void -reorder (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer) +reorder_use (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer) { - insert_dotted_circles (plan, font, buffer); + insert_dotted_circles_use (plan, font, buffer); foreach_syllable (buffer, start, end) - reorder_syllable (buffer, start, end); + reorder_syllable_use (buffer, start, end); HB_BUFFER_DEALLOCATE_VAR (buffer, use_category); } -static void -clear_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) -{ - hb_glyph_info_t *info = buffer->info; - unsigned int count = buffer->len; - for (unsigned int i = 0; i < count; i++) - info[i].syllable() = 0; -} - static void preprocess_text_use (const hb_ot_shape_plan_t *plan, @@ -643,3 +612,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use = HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, false, /* fallback_position */ }; + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-vowel-constraints.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-vowel-constraints.cc index 912ee35b478..2f8041323ab 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-vowel-constraints.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-vowel-constraints.cc @@ -13,6 +13,10 @@ * # Date: 2019-01-28, 22:16:47 GMT */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-complex-vowel-constraints.hh" static void @@ -440,4 +444,6 @@ _hb_preprocess_text_vowel_constraints (const hb_ot_shape_plan_t *plan HB_UNUSED, } } + +#endif /* == End of generated functions == */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc index 573af8ec627..03a42df6f68 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc @@ -24,6 +24,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-fallback.hh" #include "hb-kern.hh" @@ -587,3 +591,6 @@ _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan HB_UNUSED, } } } + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize.cc index 82bb24b7db6..14c5bd4ac0c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize.cc @@ -24,6 +24,10 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + #include "hb-ot-shape-normalize.hh" #include "hb-ot-shape-complex.hh" #include "hb-ot-shape.hh" @@ -469,3 +473,6 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, buffer->swap_buffers (); } } + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc index 7690c22294a..c8bda2aad50 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc @@ -26,6 +26,14 @@ * Google Author(s): Behdad Esfahbod */ +#include "hb.hh" + +#ifndef HB_NO_OT_SHAPE + +#ifdef HB_NO_OT_LAYOUT +#error "Cannot compile 'ot' shaper with HB_NO_OT_LAYOUT." +#endif + #include "hb-shaper-impl.hh" #include "hb-ot-shape.hh" @@ -55,7 +63,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, const hb_feature_t *user_features, unsigned int num_user_features); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE static inline bool _hb_apply_morx (hb_face_t *face) { @@ -78,7 +86,7 @@ hb_ot_shape_planner_t::hb_ot_shape_planner_t (hb_face_t *fac props (*props), map (face, props), aat_map (face, props) -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE , apply_morx (_hb_apply_morx (face)) #endif { @@ -98,7 +106,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, plan.props = props; plan.shaper = shaper; map.compile (plan.map, key); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE if (apply_morx) aat_map.compile (plan.aat_map); #endif @@ -117,7 +125,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, plan.kern_mask = plan.map.get_mask (kern_tag); plan.requested_kerning = !!plan.kern_mask; #endif -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE plan.trak_mask = plan.map.get_mask (HB_TAG ('t','r','a','k')); plan.requested_tracking = !!plan.trak_mask; #endif @@ -137,7 +145,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, * Decide who does substitutions. GSUB, morx, or fallback. */ -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE plan.apply_morx = apply_morx; #endif @@ -147,13 +155,13 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, if (0) ; -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE else if (hb_options ().aat && hb_aat_layout_has_positioning (face)) plan.apply_kerx = true; #endif else if (!apply_morx && !disable_gpos && hb_ot_layout_has_positioning (face)) plan.apply_gpos = true; -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE else if (hb_aat_layout_has_positioning (face)) plan.apply_kerx = true; #endif @@ -161,7 +169,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, if (!plan.apply_kerx && !has_gpos_kern) { /* Apparently Apple applies kerx if GPOS kern was not applied. */ -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE if (hb_aat_layout_has_positioning (face)) plan.apply_kerx = true; else @@ -192,7 +200,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, plan.fallback_mark_positioning = plan.adjust_mark_positioning_when_zeroing && script_fallback_mark_positioning; -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE /* Currently we always apply trak. */ plan.apply_trak = plan.requested_tracking && hb_aat_layout_has_tracking (face); #endif @@ -203,7 +211,7 @@ hb_ot_shape_plan_t::init0 (hb_face_t *face, const hb_shape_plan_key_t *key) { map.init (); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE aat_map.init (); #endif @@ -233,7 +241,7 @@ hb_ot_shape_plan_t::fini () shaper->data_destroy (const_cast<void *> (data)); map.fini (); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE aat_map.fini (); #endif } @@ -242,7 +250,7 @@ void hb_ot_shape_plan_t::substitute (hb_font_t *font, hb_buffer_t *buffer) const { -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE if (unlikely (apply_morx)) hb_aat_layout_substitute (this, font, buffer); else @@ -256,7 +264,7 @@ hb_ot_shape_plan_t::position (hb_font_t *font, { if (this->apply_gpos) map.position (this, font, buffer); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE else if (this->apply_kerx) hb_aat_layout_position (this, font, buffer); #endif @@ -267,7 +275,7 @@ hb_ot_shape_plan_t::position (hb_font_t *font, else _hb_ot_shape_fallback_kern (this, font, buffer); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE if (this->apply_trak) hb_aat_layout_track (this, font, buffer); #endif @@ -332,7 +340,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, /* Random! */ map->enable_feature (HB_TAG ('r','a','n','d'), F_RANDOM, HB_OT_MAP_MAX_VALUE); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE /* Tracking. We enable dummy feature here just to allow disabling * AAT 'trak' table using features. * https://github.com/harfbuzz/harfbuzz/issues/1303 */ @@ -370,7 +378,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, feature->value); } -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE if (planner->apply_morx) { hb_aat_map_builder_t *aat_map = &planner->aat_map; @@ -471,6 +479,7 @@ hb_set_unicode_props (hb_buffer_t *buffer) { _hb_glyph_info_set_continuation (&info[i]); } +#ifndef HB_NO_EMOJI_SEQUENCES else if (unlikely (_hb_glyph_info_is_zwj (&info[i]))) { _hb_glyph_info_set_continuation (&info[i]); @@ -482,6 +491,7 @@ hb_set_unicode_props (hb_buffer_t *buffer) _hb_glyph_info_set_continuation (&info[i]); } } +#endif /* Or part of the Other_Grapheme_Extend that is not marks. * As of Unicode 11 that is just: * @@ -819,7 +829,7 @@ static inline void hb_ot_substitute_post (const hb_ot_shape_context_t *c) { hb_ot_hide_default_ignorables (c->buffer, c->font); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE if (c->plan->apply_morx) hb_aat_layout_remove_deleted_glyphs (c->buffer); #endif @@ -956,7 +966,7 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c) /* Finish off. Has to follow a certain order. */ hb_ot_layout_position_finish_advances (c->font, c->buffer); hb_ot_zero_width_default_ignorables (c->buffer); -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE if (c->plan->apply_morx) hb_aat_layout_zero_width_deleted_glyphs (c->buffer); #endif @@ -1146,3 +1156,6 @@ hb_ot_shape_glyphs_closure (hb_font_t *font, hb_shape_plan_destroy (shape_plan); } + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.hh index fec8983c604..2cde73d854c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.hh @@ -78,7 +78,7 @@ struct hb_ot_shape_plan_t #else static constexpr hb_mask_t kern_mask = 0; #endif -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE hb_mask_t trak_mask; #else static constexpr hb_mask_t trak_mask = 0; @@ -89,7 +89,7 @@ struct hb_ot_shape_plan_t #else static constexpr bool requested_kerning = false; #endif -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE bool requested_tracking : 1; #else static constexpr bool requested_tracking = false; @@ -111,7 +111,7 @@ struct hb_ot_shape_plan_t #else static constexpr bool apply_kern = false; #endif -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE bool apply_kerx : 1; bool apply_morx : 1; bool apply_trak : 1; @@ -149,7 +149,7 @@ struct hb_ot_shape_planner_t hb_segment_properties_t props; hb_ot_map_builder_t map; hb_aat_map_builder_t aat_map; -#ifndef HB_NO_SHAPE_AAT +#ifndef HB_NO_AAT_SHAPE bool apply_morx : 1; #else static constexpr bool apply_morx = false; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc index e630458941b..8ad917ae7fd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc @@ -28,6 +28,8 @@ #include "hb.hh" +#ifndef HB_NO_OT_TAG + /* hb_script_t */ @@ -548,3 +550,6 @@ main () } #endif + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh index 7df81428fcc..18b9518d3a4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh @@ -237,7 +237,7 @@ struct fvar v = (v - axis.default_value) / (axis.default_value - axis.min_value); else v = (v - axis.default_value) / (axis.max_value - axis.default_value); - return (int) (v * 16384.f + (v >= 0.f ? .5f : -.5f)); + return roundf (v * 16384.f); } unsigned int get_instance_count () const { return instanceCount; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var.h index cf6f0c9503f..df89bc5a231 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var.h @@ -68,7 +68,7 @@ hb_ot_var_get_axis_count (hb_face_t *face); typedef enum { /*< flags >*/ HB_OT_VAR_AXIS_FLAG_HIDDEN = 0x00000001u, - _HB_OT_VAR_AXIS_FLAG_MAX_VALUE= 0x7FFFFFFFu /*< skip >*/ + _HB_OT_VAR_AXIS_FLAG_MAX_VALUE= HB_TAG_MAX_SIGNED /*< skip >*/ } hb_ot_var_axis_flags_t; /** diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-vorg-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-vorg-table.hh index 19e08ebb52f..d9002f3d690 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-vorg-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-vorg-table.hh @@ -85,7 +85,7 @@ struct VORG this->vertYOrigins.len = it.len (); + it - | hb_apply ([c] (const VertOriginMetric& _) { c->copy (_);}) + | hb_apply ([c] (const VertOriginMetric& _) { c->copy (_); }) ; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot.h index db784694c6a..f2dbaa1b317 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot.h @@ -35,6 +35,8 @@ #include "hb-ot-font.h" #include "hb-ot-layout.h" #include "hb-ot-math.h" +#include "hb-ot-meta.h" +#include "hb-ot-metrics.h" #include "hb-ot-name.h" #include "hb-ot-shape.h" #include "hb-ot-var.h" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-pool.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-pool.hh index ff0ee194c85..2dd84968e01 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-pool.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-pool.hh @@ -77,7 +77,7 @@ struct hb_pool_t static_assert (ChunkLen > 1, ""); static_assert (sizeof (T) >= sizeof (void *), ""); - static_assert (alignof (T) % sizeof (void *) == 0, ""); + static_assert (alignof (T) % alignof (void *) == 0, ""); struct chunk_t { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc index fa986880968..10638a7e6d5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc @@ -479,7 +479,7 @@ hb_set_next (const hb_set_t *set, * @set: a set. * @codepoint: (inout): * - * Gets the previous number in @set that is slower than current value of @codepoint. + * Gets the previous number in @set that is lower than current value of @codepoint. * * Set @codepoint to %HB_SET_VALUE_INVALID to get started. * @@ -524,7 +524,7 @@ hb_set_next_range (const hb_set_t *set, * @last: (out): output last codepoint in the range. * * Gets the previous consecutive range of numbers in @set that - * are greater than current value of @last. + * are less than current value of @first. * * Set @first to %HB_SET_VALUE_INVALID to get started. * diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc index 61ea8d0e522..2b23dee62ca 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc @@ -79,7 +79,9 @@ hb_shape_plan_key_t::init (bool copy, } this->shaper_func = nullptr; this->shaper_name = nullptr; +#ifndef HB_NO_OT_SHAPE this->ot.init (face, coords, num_coords); +#endif /* * Choose shaper. @@ -148,7 +150,9 @@ hb_shape_plan_key_t::equal (const hb_shape_plan_key_t *other) { return hb_segment_properties_equal (&this->props, &other->props) && this->user_features_match (other) && +#ifndef HB_NO_OT_SHAPE this->ot.equal (&other->ot) && +#endif this->shaper_func == other->shaper_func; } @@ -224,12 +228,16 @@ hb_shape_plan_create2 (hb_face_t *face, num_coords, shaper_list))) goto bail2; +#ifndef HB_NO_OT_SHAPE if (unlikely (!shape_plan->ot.init0 (face, &shape_plan->key))) goto bail3; +#endif return shape_plan; +#ifndef HB_NO_OT_SHAPE bail3: +#endif shape_plan->key.free (); bail2: free (shape_plan); @@ -281,7 +289,9 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan) { if (!hb_object_destroy (shape_plan)) return; +#ifndef HB_NO_OT_SHAPE shape_plan->ot.fini (); +#endif shape_plan->key.free (); free (shape_plan); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.hh index 3a057fd22d1..6da7edb2f87 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.hh @@ -39,21 +39,23 @@ struct hb_shape_plan_key_t const hb_feature_t *user_features; unsigned int num_user_features; +#ifndef HB_NO_OT_SHAPE hb_ot_shape_plan_key_t ot; +#endif hb_shape_func_t *shaper_func; const char *shaper_name; - HB_INTERNAL inline bool init (bool copy, - hb_face_t *face, - const hb_segment_properties_t *props, - const hb_feature_t *user_features, - unsigned int num_user_features, - const int *coords, - unsigned int num_coords, - const char * const *shaper_list); + HB_INTERNAL bool init (bool copy, + hb_face_t *face, + const hb_segment_properties_t *props, + const hb_feature_t *user_features, + unsigned int num_user_features, + const int *coords, + unsigned int num_coords, + const char * const *shaper_list); - HB_INTERNAL inline void free () { ::free ((void *) user_features); } + HB_INTERNAL void free () { ::free ((void *) user_features); } HB_INTERNAL bool user_features_match (const hb_shape_plan_key_t *other); @@ -65,7 +67,9 @@ struct hb_shape_plan_t hb_object_header_t header; hb_face_t *face_unsafe; /* We don't carry a reference to face. */ hb_shape_plan_key_t key; +#ifndef HB_NO_OT_SHAPE hb_ot_shape_plan_t ot; +#endif }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-list.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-list.hh index 4108e7aab73..0d63933a766 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-list.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-list.hh @@ -28,6 +28,9 @@ #define HB_SHAPER_LIST_HH #endif /* HB_SHAPER_LIST_HH */ /* Dummy header guards */ +#ifndef HB_NO_SHAPER + + /* v--- Add new shapers in the right place here. */ #ifdef HAVE_GRAPHITE2 @@ -35,7 +38,9 @@ HB_SHAPER_IMPLEMENT (graphite2) #endif +#ifndef HB_NO_OT_SHAPE HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */ +#endif #ifdef HAVE_UNISCRIBE HB_SHAPER_IMPLEMENT (uniscribe) @@ -50,3 +55,6 @@ HB_SHAPER_IMPLEMENT (coretext) #ifndef HB_NO_FALLBACK_SHAPE HB_SHAPER_IMPLEMENT (fallback) /* <--- This should be last. */ #endif + + +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc index 575ab1f7dd7..0ea68ad1f54 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc @@ -34,6 +34,9 @@ static const hb_shaper_entry_t all_shapers[] = { #include "hb-shaper-list.hh" #undef HB_SHAPER_IMPLEMENT }; +#ifndef HB_NO_SHAPER +static_assert (0 != ARRAY_LENGTH_CONST (all_shapers), "No shaper enabled."); +#endif #if HB_USE_ATEXIT static void free_static_shapers (); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc index 6b33c17b6a2..e244da19994 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc @@ -179,7 +179,7 @@ _create_old_gid_to_new_gid_map (const hb_face_t *face, unsigned max_glyph = + hb_iter (all_gids_to_retain) - | hb_reduce (hb_max, 0) + | hb_reduce (hb_max, 0u) ; *num_glyphs = max_glyph + 1; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc index b117870c88a..6235a5bf531 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc @@ -187,7 +187,7 @@ _subset_table (hb_subset_plan_t *plan, DEBUG_MSG(SUBSET, nullptr, "skip loca handled by glyf"); return true; case HB_OT_TAG_cmap: - result = _subset<const OT::cmap> (plan); + result = _subset2<const OT::cmap> (plan); break; case HB_OT_TAG_OS2: result = _subset2<const OT::OS2> (plan); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucd.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucd.cc index 69949a2883b..b29f2a9c7d1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucd.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucd.cc @@ -15,6 +15,7 @@ */ #include "hb.hh" +#include "hb-unicode.hh" #include "hb-machinery.hh" #include "hb-ucd-table.hh" @@ -235,10 +236,6 @@ void free_static_ucd_funcs () } #endif -extern "C" HB_INTERNAL -hb_unicode_funcs_t * -hb_ucd_get_unicode_funcs (); - hb_unicode_funcs_t * hb_ucd_get_unicode_funcs () { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-emoji-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-emoji-table.hh index aa297fcf94d..1ff79c97785 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-emoji-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-emoji-table.hh @@ -23,88 +23,56 @@ #include "hb-unicode.hh" - -static const struct hb_unicode_range_t _hb_unicode_emoji_Extended_Pictographic_table[] = +static const uint8_t +_hb_emoji_u8[448] = { - {0x00A9, 0x00A9}, - {0x00AE, 0x00AE}, - {0x203C, 0x203C}, - {0x2049, 0x2049}, - {0x2122, 0x2122}, - {0x2139, 0x2139}, - {0x2194, 0x2199}, - {0x21A9, 0x21AA}, - {0x231A, 0x231B}, - {0x2328, 0x2328}, - {0x2388, 0x2388}, - {0x23CF, 0x23CF}, - {0x23E9, 0x23F3}, - {0x23F8, 0x23FA}, - {0x24C2, 0x24C2}, - {0x25AA, 0x25AB}, - {0x25B6, 0x25B6}, - {0x25C0, 0x25C0}, - {0x25FB, 0x25FE}, - {0x2600, 0x2605}, - {0x2607, 0x2612}, - {0x2614, 0x2685}, - {0x2690, 0x2705}, - {0x2708, 0x2712}, - {0x2714, 0x2714}, - {0x2716, 0x2716}, - {0x271D, 0x271D}, - {0x2721, 0x2721}, - {0x2728, 0x2728}, - {0x2733, 0x2734}, - {0x2744, 0x2744}, - {0x2747, 0x2747}, - {0x274C, 0x274C}, - {0x274E, 0x274E}, - {0x2753, 0x2755}, - {0x2757, 0x2757}, - {0x2763, 0x2767}, - {0x2795, 0x2797}, - {0x27A1, 0x27A1}, - {0x27B0, 0x27B0}, - {0x27BF, 0x27BF}, - {0x2934, 0x2935}, - {0x2B05, 0x2B07}, - {0x2B1B, 0x2B1C}, - {0x2B50, 0x2B50}, - {0x2B55, 0x2B55}, - {0x3030, 0x3030}, - {0x303D, 0x303D}, - {0x3297, 0x3297}, - {0x3299, 0x3299}, - {0x1F000, 0x1F0FF}, - {0x1F10D, 0x1F10F}, - {0x1F12F, 0x1F12F}, - {0x1F16C, 0x1F171}, - {0x1F17E, 0x1F17F}, - {0x1F18E, 0x1F18E}, - {0x1F191, 0x1F19A}, - {0x1F1AD, 0x1F1E5}, - {0x1F201, 0x1F20F}, - {0x1F21A, 0x1F21A}, - {0x1F22F, 0x1F22F}, - {0x1F232, 0x1F23A}, - {0x1F23C, 0x1F23F}, - {0x1F249, 0x1F3FA}, - {0x1F400, 0x1F53D}, - {0x1F546, 0x1F64F}, - {0x1F680, 0x1F6FF}, - {0x1F774, 0x1F77F}, - {0x1F7D5, 0x1F7FF}, - {0x1F80C, 0x1F80F}, - {0x1F848, 0x1F84F}, - {0x1F85A, 0x1F85F}, - {0x1F888, 0x1F88F}, - {0x1F8AE, 0x1F8FF}, - {0x1F90C, 0x1F93A}, - {0x1F93C, 0x1F945}, - {0x1F947, 0x1FFFD}, + 0, 0, 0, 0, 33, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84,118, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 8, 7, 9, 10, 11, 0, + 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, + 7, 7, 7, 14, 15, 16, 17, 18, 19, 20, 7, 7, 7, 7, 7, 21, + 7, 7, 7, 7, 22, 23, 7, 7, 7, 24, 7, 14, 0, 25, 0, 26, + 27, 28, 29, 14, 30, 31, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 22, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240, 1, 0, 2, 0, 0, + 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,254, 7, 3, + 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, + 159,255,243,255,255,255,255,255,255,255,255,255,255,255,255,255, + 31, 0,255,255,255,255,255,255, 31,255, 3, 0, 0, 0, 8, 0, + 0, 0, 24, 0,120, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 16, 0, 96, 0, 0, 8, 0, 0, 0, 0, + 255,255,255,255,255,255,255,127, 0, 96, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,240, 1, 64, 0, 0,254, 3, 0,224,255,255, + 255,255,255,255, 31, 0, 0, 0,254,127, 0, 0, 0, 0,252,115, + 0,254,255,255,255,255,255,255,255,255,255,255,255,255,255, 3, + 255,255,255,255,255,255,255, 31,192,255,255,255,255,255,255,255, + 255,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,127, + 0, 0,224,255,255,255,255,127, 0,112, 0, 0, 0, 0, 0, 0, + 0,127, 0,124, 0, 0, 0, 0, 0,127, 0, 0, 0,192,255,255, + 0,240,255,255,255,255,255,243,159,255,255,255,255,255,255,255, }; +static inline unsigned +_hb_emoji_b4 (const uint8_t* a, unsigned i) +{ + return (a[i>>1]>>((i&1u)<<2))&15u; +} +static inline unsigned +_hb_emoji_b1 (const uint8_t* a, unsigned i) +{ + return (a[i>>3]>>((i&7u)<<0))&1u; +} +static inline uint_fast8_t +_hb_emoji_is_Extended_Pictographic (unsigned u) +{ + return u<131069u?_hb_emoji_b1(192+_hb_emoji_u8,((_hb_emoji_u8[64+(((_hb_emoji_b4(_hb_emoji_u8,u>>6>>4))<<4)+((u>>6)&15u))])<<6)+((u)&63u)):0; +} + + #endif /* HB_UNICODE_EMOJI_TABLE_HH */ /* == End of generated table == */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.cc index 9ec2d85634d..9a8184063df 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.cc @@ -126,10 +126,12 @@ hb_unicode_decompose_compatibility_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED } #endif - -extern "C" hb_unicode_funcs_t *hb_ucd_get_unicode_funcs (); -extern "C" hb_unicode_funcs_t *hb_glib_get_unicode_funcs (); -extern "C" hb_unicode_funcs_t *hb_icu_get_unicode_funcs (); +#if !defined(HB_NO_UNICODE_FUNCS) && defined(HAVE_GLIB) +#include "hb-glib.h" +#endif +#if !defined(HB_NO_UNICODE_FUNCS) && defined(HAVE_ICU) && defined(HAVE_ICU_BUILTIN) +#include "hb-icu.h" +#endif hb_unicode_funcs_t * hb_unicode_funcs_get_default () @@ -453,6 +455,7 @@ hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs, #endif +#ifndef HB_NO_OT_SHAPE /* See hb-unicode.hh for details. */ const uint8_t _hb_modified_combining_class[256] = @@ -565,19 +568,19 @@ _hb_modified_combining_class[256] = 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, /* HB_UNICODE_COMBINING_CLASS_INVALID */ }; +#endif /* * Emoji */ +#ifndef HB_NO_EMOJI_SEQUENCES #include "hb-unicode-emoji-table.hh" bool _hb_unicode_is_emoji_Extended_Pictographic (hb_codepoint_t cp) { - return hb_bsearch (&cp, _hb_unicode_emoji_Extended_Pictographic_table, - ARRAY_LENGTH (_hb_unicode_emoji_Extended_Pictographic_table), - sizeof (hb_unicode_range_t), - hb_unicode_range_t::cmp); + return _hb_emoji_is_Extended_Pictographic (cp); } +#endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.hh index 021fa461de8..0c355f1113b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.hh @@ -105,9 +105,6 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE unsigned int modified_combining_class (hb_codepoint_t u) { - /* XXX This hack belongs to the Myanmar shaper. */ - if (unlikely (u == 0x1037u)) u = 0x103Au; - /* XXX This hack belongs to the USE shaper (for Tai Tham): * Reorder SAKOT to ensure it comes after any tone marks. */ if (unlikely (u == 0x1A60u)) return 254; @@ -395,4 +392,7 @@ HB_INTERNAL bool _hb_unicode_is_emoji_Extended_Pictographic (hb_codepoint_t cp); +extern "C" HB_INTERNAL hb_unicode_funcs_t *hb_ucd_get_unicode_funcs (); + + #endif /* HB_UNICODE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc index 88f429401aa..289a3477fe5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc @@ -28,6 +28,10 @@ #ifdef HAVE_UNISCRIBE +#ifdef HB_NO_OT_TAG +#error "Cannot compile 'uniscribe' shaper with HB_NO_OT_TAG." +#endif + #include "hb-shaper-impl.hh" #include <windows.h> @@ -54,13 +58,6 @@ * Functions for using HarfBuzz with the Windows fonts. **/ - -static inline uint16_t hb_uint16_swap (const uint16_t v) -{ return (v >> 8) | (v << 8); } -static inline uint32_t hb_uint32_swap (const uint32_t v) -{ return (hb_uint16_swap (v) << 16) | hb_uint16_swap (v >> 16); } - - typedef HRESULT (WINAPI *SIOT) /*ScriptItemizeOpenType*/( const WCHAR *pwcInChars, int cInChars, @@ -241,8 +238,9 @@ struct hb_uniscribe_shaper_funcs_t } }; - +#if HB_USE_ATEXIT static void free_static_uniscribe_shaper_funcs (); +#endif static struct hb_uniscribe_shaper_funcs_lazy_loader_t : hb_lazy_loader_t<hb_uniscribe_shaper_funcs_t, hb_uniscribe_shaper_funcs_lazy_loader_t> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh index de16c97ddfa..035c6d0a862 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh @@ -143,13 +143,13 @@ struct hb_vector_t operator writer_t () { return writer (); } hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) const - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int count) - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } hb_array_t<Type> sub_array (unsigned int start_offset, unsigned int *count = nullptr /* IN/OUT */) - { return as_array ().sub_array (start_offset, count);} + { return as_array ().sub_array (start_offset, count); } hb_sorted_array_t<Type> as_sorted_array () { return hb_sorted_array (arrayZ, length); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh index bee39cd463b..8dcd5aa88f3 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh @@ -98,6 +98,7 @@ #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING #pragma GCC diagnostic warning "-Wbuiltin-macro-redefined" #pragma GCC diagnostic warning "-Wdeprecated" +#pragma GCC diagnostic warning "-Wdeprecated-declarations" #pragma GCC diagnostic warning "-Wdisabled-optimization" #pragma GCC diagnostic warning "-Wdouble-promotion" #pragma GCC diagnostic warning "-Wformat=2" @@ -317,7 +318,8 @@ extern "C" void hb_free_impl(void *ptr); # define HB_FALLTHROUGH /* FALLTHROUGH */ #endif -#ifdef __clang__ +/* https://github.com/harfbuzz/harfbuzz/issues/1852 */ +#if defined(__clang__) && !(defined(_AIX) && (defined(__IBMCPP__) || defined(__ibmxl__))) /* Disable certain sanitizer errors. */ /* https://github.com/harfbuzz/harfbuzz/issues/1247 */ #define HB_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW __attribute__((no_sanitize("signed-integer-overflow"))) @@ -475,6 +477,11 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); /* Size signifying variable-sized array */ #define VAR 1 +/* Endian swap, used in Windows related backends */ +static inline uint16_t hb_uint16_swap (const uint16_t v) +{ return (v >> 8) | (v << 8); } +static inline uint32_t hb_uint32_swap (const uint32_t v) +{ return (hb_uint16_swap (v) << 16) | hb_uint16_swap (v >> 16); } /* * Big-endian integers. Here because fundamental. diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-bimap.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-bimap.cc new file mode 100644 index 00000000000..1253d0c1df6 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-bimap.cc @@ -0,0 +1,76 @@ +/* + * Copyright © 2019 Adobe, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Adobe Author(s): Michiharu Ariza + */ + +#include "hb.hh" +#include "hb-bimap.hh" + +int +main (int argc, char **argv) +{ + hb_bimap_t bm; + + assert (bm.is_empty () == true); + bm.set (1, 4); + bm.set (2, 5); + bm.set (3, 6); + assert (bm.get_population () == 3); + assert (bm.has (1) == true); + assert (bm.has (4) == false); + assert (bm[2] == 5); + assert (bm.backward (6) == 3); + bm.del (1); + assert (bm.has (1) == false); + assert (bm.has (3) == true); + bm.clear (); + assert (bm.get_population () == 0); + + hb_inc_bimap_t ibm; + + assert (ibm.add (13) == 0); + assert (ibm.add (8) == 1); + assert (ibm.add (10) == 2); + assert (ibm.add (8) == 1); + assert (ibm.add (7) == 3); + assert (ibm.get_population () == 4); + assert (ibm[7] == 3); + + ibm.sort (); + assert (ibm.get_population () == 4); + assert (ibm[7] == 0); + assert (ibm[13] == 3); + + ibm.identity (3); + assert (ibm.get_population () == 3); + assert (ibm[0] == 0); + assert (ibm[1] == 1); + assert (ibm[2] == 2); + assert (ibm.backward (0) == 0); + assert (ibm.backward (1) == 1); + assert (ibm.backward (2) == 2); + assert (ibm.has (4) == false); + + return 0; +} diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-ot-meta.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-ot-meta.cc new file mode 100644 index 00000000000..1045007f7d8 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-ot-meta.cc @@ -0,0 +1,70 @@ +/* + * Copyright © 2019 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#include "hb.hh" +#include "hb-ot.h" + +#include <stdlib.h> +#include <stdio.h> + +#ifdef HB_NO_OPEN +#define hb_blob_create_from_file(x) hb_blob_get_empty () +#endif + +int +main (int argc, char **argv) +{ + if (argc != 2) { + fprintf (stderr, "usage: %s font-file\n", argv[0]); + exit (1); + } + + hb_blob_t *blob = hb_blob_create_from_file (argv[1]); + hb_face_t *face = hb_face_create (blob, 0 /* first face */); + hb_blob_destroy (blob); + blob = nullptr; + + unsigned int count = 0; + +#ifndef HB_NO_META + count = hb_ot_meta_get_entry_tags (face, 0, nullptr, nullptr); + + hb_ot_meta_tag_t *tags = (hb_ot_meta_tag_t *) + malloc (sizeof (hb_ot_meta_tag_t) * count); + hb_ot_meta_get_entry_tags (face, 0, &count, tags); + for (unsigned i = 0; i < count; ++i) + { + hb_blob_t *entry = hb_ot_meta_reference_entry (face, tags[i]); + printf ("%c%c%c%c, size: %d: %.*s\n", + HB_UNTAG (tags[i]), hb_blob_get_length (entry), + hb_blob_get_length (entry), hb_blob_get_data (entry, nullptr)); + hb_blob_destroy (entry); + } + free (tags); +#endif + + hb_face_destroy (face); + + return !count; +} diff --git a/Build/source/libs/harfbuzz/include/Makefile.am b/Build/source/libs/harfbuzz/include/Makefile.am index 8f1c5744e0c..782a0e5a8d7 100644 --- a/Build/source/libs/harfbuzz/include/Makefile.am +++ b/Build/source/libs/harfbuzz/include/Makefile.am @@ -37,6 +37,8 @@ hdr_links += \ $(HARFBUZZ_SRC)/hb-ot-font.h \ $(HARFBUZZ_SRC)/hb-ot-layout.h \ $(HARFBUZZ_SRC)/hb-ot-math.h \ + $(HARFBUZZ_SRC)/hb-ot-meta.h \ + $(HARFBUZZ_SRC)/hb-ot-metrics.h \ $(HARFBUZZ_SRC)/hb-ot-name.h \ $(HARFBUZZ_SRC)/hb-ot-shape.h \ $(HARFBUZZ_SRC)/hb-ot-var.h diff --git a/Build/source/libs/harfbuzz/include/Makefile.in b/Build/source/libs/harfbuzz/include/Makefile.in index 16f546866a6..6e71fd96e22 100644 --- a/Build/source/libs/harfbuzz/include/Makefile.in +++ b/Build/source/libs/harfbuzz/include/Makefile.in @@ -255,7 +255,8 @@ hdr_links = $(HARFBUZZ_SRC)/hb.h $(HARFBUZZ_SRC)/hb-aat-layout.h \ $(HARFBUZZ_SRC)/hb-unicode.h $(HARFBUZZ_BLD)/hb-version.h \ $(HARFBUZZ_SRC)/hb-ot.h $(HARFBUZZ_SRC)/hb-ot-color.h \ $(HARFBUZZ_SRC)/hb-ot-font.h $(HARFBUZZ_SRC)/hb-ot-layout.h \ - $(HARFBUZZ_SRC)/hb-ot-math.h $(HARFBUZZ_SRC)/hb-ot-name.h \ + $(HARFBUZZ_SRC)/hb-ot-math.h $(HARFBUZZ_SRC)/hb-ot-meta.h \ + $(HARFBUZZ_SRC)/hb-ot-metrics.h $(HARFBUZZ_SRC)/hb-ot-name.h \ $(HARFBUZZ_SRC)/hb-ot-shape.h $(HARFBUZZ_SRC)/hb-ot-var.h \ $(HARFBUZZ_SRC)/hb-graphite2.h all: all-am diff --git a/Build/source/libs/harfbuzz/version.ac b/Build/source/libs/harfbuzz/version.ac index 3caeeed1819..4de444be1dd 100644 --- a/Build/source/libs/harfbuzz/version.ac +++ b/Build/source/libs/harfbuzz/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current harfbuzz version -m4_define([harfbuzz_version], [2.5.3]) +m4_define([harfbuzz_version], [2.6.0]) |