diff --git a/gfx/harfbuzz/NEWS b/gfx/harfbuzz/NEWS index 7434bcada03c..9015c4ad2c54 100644 --- a/gfx/harfbuzz/NEWS +++ b/gfx/harfbuzz/NEWS @@ -1,3 +1,12 @@ +Overview of changes leading to 1.7.5 +Tuesday, January 30, 2018 +==================================== + +- Separate Khmer shaper from Indic. +- First stab at AAT morx. Not hooked up. +- Misc bug fixes. + + Overview of changes leading to 1.7.4 Wednesday, December 20, 2017 ==================================== diff --git a/gfx/harfbuzz/README b/gfx/harfbuzz/README index aa055169d5a3..6e2132237fae 100644 --- a/gfx/harfbuzz/README +++ b/gfx/harfbuzz/README @@ -1,6 +1,7 @@ [![Build Status](https://travis-ci.org/harfbuzz/harfbuzz.svg)](https://travis-ci.org/harfbuzz/harfbuzz) [![Build status](https://ci.appveyor.com/api/projects/status/0t0flrxpstj9lb9w?svg=true)](https://ci.appveyor.com/project/harfbuzz/harfbuzz) [![CircleCI](https://circleci.com/gh/harfbuzz/harfbuzz.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz) +[![Coverity](https://img.shields.io/coverity/scan/5450.svg)](https://scan.coverity.com/projects/behdad-harfbuzz) [![Coverage Status](https://img.shields.io/coveralls/harfbuzz/harfbuzz.svg)](https://coveralls.io/r/harfbuzz/harfbuzz) [ABI Tracker](http://abi-laboratory.pro/tracker/timeline/harfbuzz/) diff --git a/gfx/harfbuzz/README-mozilla b/gfx/harfbuzz/README-mozilla index 1cce1c05bcae..7297b61d739d 100644 --- a/gfx/harfbuzz/README-mozilla +++ b/gfx/harfbuzz/README-mozilla @@ -1,9 +1,9 @@ -gfx/harfbuzz status as of 2017-12-20: +gfx/harfbuzz status as of 2018-01-30: This directory contains the HarfBuzz source from the 'master' branch of https://github.com/behdad/harfbuzz. -Current version: 1.7.4 +Current version: 1.7.5 UPDATING: diff --git a/gfx/harfbuzz/autogen.sh b/gfx/harfbuzz/autogen.sh index ff1b0c0c99bb..cbc8627d53eb 100755 --- a/gfx/harfbuzz/autogen.sh +++ b/gfx/harfbuzz/autogen.sh @@ -42,5 +42,7 @@ echo "running autoreconf --force --install --verbose" autoreconf --force --install --verbose || exit $? cd $olddir -echo "running configure $@" -test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" +test -n "$NOCONFIGURE" || { + echo "running configure $@" + "$srcdir/configure" "$@" +} diff --git a/gfx/harfbuzz/configure.ac b/gfx/harfbuzz/configure.ac index 7f24627ffdba..d799cab0a20c 100644 --- a/gfx/harfbuzz/configure.ac +++ b/gfx/harfbuzz/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.64]) AC_INIT([HarfBuzz], - [1.7.4], + [1.7.5], [https://github.com/harfbuzz/harfbuzz/issues/new], [harfbuzz], [http://harfbuzz.org/]) @@ -9,8 +9,7 @@ AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([src/harfbuzz.pc.in]) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([1.11.1 gnits tar-ustar dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability]) -AM_CONDITIONAL(AUTOMAKE_OLDER_THAN_1_13, test $am__api_version = 1.11 -o $am__api_version = 1.12) +AM_INIT_AUTOMAKE([1.13.0 gnits tar-ustar dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability]) AM_SILENT_RULES([yes]) # Initialize libtool @@ -23,7 +22,7 @@ AC_USE_SYSTEM_EXTENSIONS AC_PROG_CC AM_PROG_CC_C_O AC_PROG_CXX -AX_CXX_COMPILE_STDCXX(11, noext, optional) +dnl AX_CXX_COMPILE_STDCXX(11, noext, optional) AC_SYS_LARGEFILE PKG_PROG_PKG_CONFIG([0.20]) AM_MISSING_PROG([RAGEL], [ragel]) @@ -84,6 +83,9 @@ if test "x$GCC" = "xyes"; then # Make sure we don't link to libstdc++ CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions" + # No threadsafe statics and C++ as we do it ourselves + CXXFLAGS="$CXXFLAGS -fno-threadsafe-statics" + # Assorted warnings CXXFLAGS="$CXXFLAGS -Wcast-align" @@ -355,6 +357,7 @@ if $have_freetype; then LIBS="$LIBS $FREETYPE_LIBS" AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates) AC_CHECK_FUNCS(FT_Set_Var_Blend_Coordinates) + AC_CHECK_FUNCS(FT_Done_MM_Var) LIBS=$save_libs fi AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype) @@ -429,7 +432,7 @@ if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then if $have_coretext; then CORETEXT_CFLAGS= - CORETEXT_LIBS="-framework CoreText -framework CoreGraphics" + CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation" AC_SUBST(CORETEXT_CFLAGS) AC_SUBST(CORETEXT_LIBS) fi @@ -494,6 +497,9 @@ test/Makefile test/api/Makefile test/fuzzing/Makefile test/shaping/Makefile +test/shaping/data/Makefile +test/shaping/data/in-house/Makefile +test/shaping/data/text-rendering-tests/Makefile docs/Makefile docs/version.xml ]) diff --git a/gfx/harfbuzz/src/Makefile.am b/gfx/harfbuzz/src/Makefile.am index 685718221f88..833d1f9567d4 100644 --- a/gfx/harfbuzz/src/Makefile.am +++ b/gfx/harfbuzz/src/Makefile.am @@ -1,5 +1,6 @@ # Process this file with automake to produce Makefile.in +NULL = SUBDIRS = DIST_SUBDIRS = BUILT_SOURCES = @@ -134,7 +135,7 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = harfbuzz.pc EXTRA_DIST += harfbuzz.pc.in -FUZZING_CPPFLAGS= \ +FUZZING_CPPFLAGS = \ -DHB_NDEBUG \ -DHB_MAX_NESTING_LEVEL=3 \ -DHB_SANITIZE_MAX_EDITS=3 \ @@ -222,21 +223,14 @@ CLEANFILES += $(pkgconfig_DATA) CLEANFILES += harfbuzz.def harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS) - $(AM_V_GEN) (echo EXPORTS; \ - (cat $^ || echo 'hb_ERROR ()' ) | \ - $(EGREP) '^hb_.* \(' | \ - sed -e 's/ (.*//' | \ - LC_ALL=C sort; \ - echo LIBRARY libharfbuzz-0.dll; \ - ) >"$@" - @ ! grep -q hb_ERROR "$@" \ - || ($(RM) "$@"; false) + $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@ GENERATORS = \ gen-arabic-table.py \ gen-indic-table.py \ gen-use-table.py \ + gen-def.py \ $(NULL) EXTRA_DIST += $(GENERATORS) diff --git a/gfx/harfbuzz/src/check-c-linkage-decls.sh b/gfx/harfbuzz/src/check-c-linkage-decls.sh index cd550867af20..8234abc455a4 100755 --- a/gfx/harfbuzz/src/check-c-linkage-decls.sh +++ b/gfx/harfbuzz/src/check-c-linkage-decls.sh @@ -7,8 +7,7 @@ test -z "$srcdir" && srcdir=. stat=0 test "x$HBHEADERS" = x && HBHEADERS=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.h'` -test "x$HBSOURCES" = x && HBSOURCES=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.h'` - +test "x$HBSOURCES" = x && HBSOURCES=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.cc'` for x in $HBHEADERS; do test -f "$srcdir/$x" -a ! -f "$x" && x="$srcdir/$x" diff --git a/gfx/harfbuzz/src/check-defs.sh b/gfx/harfbuzz/src/check-defs.sh index 480d49992fff..c6697831fe19 100755 --- a/gfx/harfbuzz/src/check-defs.sh +++ b/gfx/harfbuzz/src/check-defs.sh @@ -4,7 +4,7 @@ LC_ALL=C export LC_ALL test -z "$srcdir" && srcdir=. -test -z "$MAKE" && MAKE=make +test -z "$libs" && libs=.libs stat=0 if which nm 2>/dev/null >/dev/null; then @@ -15,26 +15,36 @@ else fi defs="harfbuzz.def" -$MAKE $defs > /dev/null +if ! test -f "$defs"; then + echo "check-defs.sh: '$defs' not found; skipping test" + exit 77 +fi + tested=false for def in $defs; do lib=`echo "$def" | sed 's/[.]def$//;s@.*/@@'` - so=.libs/lib${lib}.so + for suffix in so dylib; do + so=$libs/lib${lib}.$suffix + if ! test -f "$so"; then continue; fi - EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>\| __gcov_flush\>\| llvm_' | cut -d' ' -f3`" + # On mac, C symbols are prefixed with _ + if test $suffix = dylib; then prefix="_"; fi - if test -f "$so"; then + EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v " $prefix"'\(_fini\>\|_init\>\|_fdata\>\|_ftext\>\|_fbss\>\|__bss_start\>\|__bss_start__\>\|__bss_end__\>\|_edata\>\|_end\>\|_bss_end__\>\|__end__\>\|__gcov_flush\>\|llvm_\)' | cut -d' ' -f3`" - echo "Checking that $so has the same symbol list as $def" - { - echo EXPORTS - echo "$EXPORTED_SYMBOLS" - # cheat: copy the last line from the def file! - tail -n1 "$def" - } | diff "$def" - >&2 || stat=1 + if test -f "$so"; then - tested=true - fi + echo "Checking that $so has the same symbol list as $def" + { + echo EXPORTS + echo "$EXPORTED_SYMBOLS" | sed -e "s/^${prefix}hb/hb/g" + # cheat: copy the last line from the def file! + tail -n1 "$def" + } | diff "$def" - >&2 || stat=1 + + tested=true + fi + done done if ! $tested; then echo "check-defs.sh: libharfbuzz shared library not found; skipping test" diff --git a/gfx/harfbuzz/src/check-header-guards.sh b/gfx/harfbuzz/src/check-header-guards.sh index 355d81b525de..b67640fc1975 100755 --- a/gfx/harfbuzz/src/check-header-guards.sh +++ b/gfx/harfbuzz/src/check-header-guards.sh @@ -6,7 +6,7 @@ export LC_ALL test -z "$srcdir" && srcdir=. stat=0 -test "x$HBHEADERS" = x && HBHEADERS=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.h'` +test "x$HBHEADERS" = x && HBHEADERS=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.h' ! -name 'hb-gobject-structs.h'` test "x$HBSOURCES" = x && HBSOURCES=`cd "$srcdir"; find . -maxdepth 1 -name 'hb-*.cc' -or -name 'hb-*.hh'` for x in $HBHEADERS $HBSOURCES; do diff --git a/gfx/harfbuzz/src/check-libstdc++.sh b/gfx/harfbuzz/src/check-libstdc++.sh index b541828bcd9a..e4aaeb2b4a11 100755 --- a/gfx/harfbuzz/src/check-libstdc++.sh +++ b/gfx/harfbuzz/src/check-libstdc++.sh @@ -4,23 +4,29 @@ LC_ALL=C export LC_ALL test -z "$srcdir" && srcdir=. +test -z "$libs" && libs=.libs stat=0 if which ldd 2>/dev/null >/dev/null; then - : + LDD=ldd else - echo "check-libstdc++.sh: 'ldd' not found; skipping test" - exit 77 + # macOS specific tool + if which otool 2>/dev/null >/dev/null; then + LDD="otool -L" + else + echo "check-libstdc++.sh: 'ldd' not found; skipping test" + exit 77 + fi fi tested=false for suffix in so dylib; do - so=.libs/libharfbuzz.$suffix + so=$libs/libharfbuzz.$suffix if ! test -f "$so"; then continue; fi echo "Checking that we are not linking to libstdc++ or libc++" - if ldd $so | grep 'libstdc[+][+]\|libc[+][+]'; then + if $LDD $so | grep 'libstdc[+][+]\|libc[+][+]'; then echo "Ouch, linked to libstdc++ or libc++" stat=1 fi diff --git a/gfx/harfbuzz/src/check-static-inits.sh b/gfx/harfbuzz/src/check-static-inits.sh index 1446fa73405e..71551cbd4c81 100755 --- a/gfx/harfbuzz/src/check-static-inits.sh +++ b/gfx/harfbuzz/src/check-static-inits.sh @@ -4,6 +4,7 @@ LC_ALL=C export LC_ALL test -z "$srcdir" && srcdir=. +test -z "$libs" && libs=.libs stat=0 @@ -14,7 +15,7 @@ else exit 77 fi -OBJS=.libs/*.o +OBJS=$libs/*.o if test "x`echo $OBJS`" = "x$OBJS" 2>/dev/null >/dev/null; then echo "check-static-inits.sh: object files not found; skipping test" exit 77 diff --git a/gfx/harfbuzz/src/check-symbols.sh b/gfx/harfbuzz/src/check-symbols.sh index d4d655d266e2..3adf65f87448 100755 --- a/gfx/harfbuzz/src/check-symbols.sh +++ b/gfx/harfbuzz/src/check-symbols.sh @@ -4,6 +4,7 @@ LC_ALL=C export LC_ALL test -z "$srcdir" && srcdir=. +test -z "$libs" && libs=.libs stat=0 @@ -17,7 +18,7 @@ fi echo "Checking that we are not exposing internal symbols" tested=false for suffix in so dylib; do - so=.libs/libharfbuzz.$suffix + so=$libs/libharfbuzz.$suffix if ! test -f "$so"; then continue; fi EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>\| __gcov_flush\>\| ___gcov_flush\>\| llvm_\| _llvm_' | cut -d' ' -f3`" diff --git a/gfx/harfbuzz/src/gen-def.py b/gfx/harfbuzz/src/gen-def.py new file mode 100755 index 000000000000..ad1606ec3ffe --- /dev/null +++ b/gfx/harfbuzz/src/gen-def.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import io, os, re, sys + +headers_content = [] +for h in os.environ["headers"].split (' '): + if h.endswith (".h"): + with io.open(h, encoding='utf8') as f: headers_content.append (f.read ()) + +result = ("EXPORTS\n" + + "\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))) + + "\nLIBRARY libharfbuzz-0.dll") + +with open (sys.argv[1], "w") as f: f.write (result) diff --git a/gfx/harfbuzz/src/gen-indic-table.py b/gfx/harfbuzz/src/gen-indic-table.py index a849db18e261..735b9015ec76 100755 --- a/gfx/harfbuzz/src/gen-indic-table.py +++ b/gfx/harfbuzz/src/gen-indic-table.py @@ -229,13 +229,13 @@ print " {" pages = set([u>>page_bits for u in starts+ends+singles.keys()]) for p in sorted(pages): print " case 0x%0Xu:" % p + for u,d in singles.items (): + if p != u>>page_bits: continue + print " if (unlikely (u == 0x%04Xu)) return _(%s,%s);" % (u, short[0][d[0]], short[1][d[1]]) for (start,end) in zip (starts, ends): if p not in [start>>page_bits, end>>page_bits]: continue offset = "indic_offset_0x%04xu" % start print " if (hb_in_range (u, 0x%04Xu, 0x%04Xu)) return indic_table[u - 0x%04Xu + %s];" % (start, end-1, start, offset) - for u,d in singles.items (): - if p != u>>page_bits: continue - print " if (unlikely (u == 0x%04Xu)) return _(%s,%s);" % (u, short[0][d[0]], short[1][d[1]]) print " break;" print "" print " default:" diff --git a/gfx/harfbuzz/src/gen-use-table.py b/gfx/harfbuzz/src/gen-use-table.py index 4ded54230e1e..5391f27eb3e1 100755 --- a/gfx/harfbuzz/src/gen-use-table.py +++ b/gfx/harfbuzz/src/gen-use-table.py @@ -297,6 +297,9 @@ def map_to_use(data): if U == 0x17DD: UISC = Vowel_Dependent if 0x1CE2 <= U <= 0x1CE8: UISC = Cantillation_Mark + # TODO: https://github.com/harfbuzz/harfbuzz/pull/627 + if 0x1BF2 <= U <= 0x1BF3: UISC = Nukta; UIPC = Bottom + # TODO: U+1CED should only be allowed after some of # the nasalization marks, maybe only for U+1CE9..U+1CF1. if U == 0x1CED: UISC = Tone_Mark @@ -349,12 +352,6 @@ def map_to_use(data): defaults = ('O', 'No_Block') data = map_to_use(data) -# Remove the outliers -singles = {} -for u in [0x034F, 0x25CC, 0x1107F]: - singles[u] = data[u] - del data[u] - print "/* == Start of generated table == */" print "/*" print " * The following table is generated by running:" @@ -456,16 +453,13 @@ print "hb_use_get_categories (hb_codepoint_t u)" print "{" print " switch (u >> %d)" % page_bits print " {" -pages = set([u>>page_bits for u in starts+ends+singles.keys()]) +pages = set([u>>page_bits for u in starts+ends]) for p in sorted(pages): print " case 0x%0Xu:" % p for (start,end) in zip (starts, ends): if p not in [start>>page_bits, end>>page_bits]: continue offset = "use_offset_0x%04xu" % start print " if (hb_in_range (u, 0x%04Xu, 0x%04Xu)) return use_table[u - 0x%04Xu + %s];" % (start, end-1, start, offset) - for u,d in singles.items (): - if p != u>>page_bits: continue - print " if (unlikely (u == 0x%04Xu)) return %s;" % (u, d[0]) print " break;" print "" print " default:" diff --git a/gfx/harfbuzz/src/harfbuzz-icu.pc b/gfx/harfbuzz/src/harfbuzz-icu.pc index 124b5106a35a..634d9aaa3450 100644 --- a/gfx/harfbuzz/src/harfbuzz-icu.pc +++ b/gfx/harfbuzz/src/harfbuzz-icu.pc @@ -5,7 +5,7 @@ includedir=/usr/local/include Name: harfbuzz Description: HarfBuzz text shaping library ICU integration -Version: 1.7.4 +Version: 1.7.5 Requires: harfbuzz Requires.private: icu-uc diff --git a/gfx/harfbuzz/src/harfbuzz.pc b/gfx/harfbuzz/src/harfbuzz.pc index 0021ce0fd620..445088571b06 100644 --- a/gfx/harfbuzz/src/harfbuzz.pc +++ b/gfx/harfbuzz/src/harfbuzz.pc @@ -5,7 +5,7 @@ includedir=/usr/local/include Name: harfbuzz Description: HarfBuzz text shaping library -Version: 1.7.4 +Version: 1.7.5 Libs: -L${libdir} -lharfbuzz Libs.private: -lm diff --git a/gfx/harfbuzz/src/hb-aat-layout-common-private.hh b/gfx/harfbuzz/src/hb-aat-layout-common-private.hh new file mode 100644 index 000000000000..b5395bba5bb9 --- /dev/null +++ b/gfx/harfbuzz/src/hb-aat-layout-common-private.hh @@ -0,0 +1,708 @@ +/* + * Copyright © 2017 Google, 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. + * + * Google Author(s): Behdad Esfahbod + */ + +#ifndef HB_AAT_LAYOUT_COMMON_PRIVATE_HH +#define HB_AAT_LAYOUT_COMMON_PRIVATE_HH + +#include "hb-aat-layout-private.hh" + + +namespace AAT { + +using namespace OT; + + +/* + * Binary Searching Tables + */ + +struct BinSearchHeader +{ + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this)); + } + + HBUINT16 unitSize; /* Size of a lookup unit for this search in bytes. */ + HBUINT16 nUnits; /* Number of units of the preceding size to be searched. */ + HBUINT16 searchRange; /* The value of unitSize times the largest power of 2 + * that is less than or equal to the value of nUnits. */ + HBUINT16 entrySelector; /* The log base 2 of the largest power of 2 less than + * or equal to the value of nUnits. */ + HBUINT16 rangeShift; /* The value of unitSize times the difference of the + * value of nUnits minus the largest power of 2 less + * than or equal to the value of nUnits. */ + public: + DEFINE_SIZE_STATIC (10); +}; + +template +struct BinSearchArrayOf +{ + inline const Type& operator [] (unsigned int i) const + { + if (unlikely (i >= header.nUnits)) return Null(Type); + return StructAtOffset (bytes, i * header.unitSize); + } + inline Type& operator [] (unsigned int i) + { + return StructAtOffset (bytes, i * header.unitSize); + } + inline unsigned int get_size (void) const + { return header.static_size + header.nUnits * header.unitSize; } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + if (unlikely (!sanitize_shallow (c))) return_trace (false); + + /* Note: for structs that do not reference other structs, + * we do not need to call their sanitize() as we already did + * a bound check on the aggregate array size. We just include + * a small unreachable expression to make sure the structs + * pointed to do have a simple sanitize(), ie. they do not + * reference other structs via offsets. + */ + (void) (false && StructAtOffset (bytes, 0).sanitize (c)); + + return_trace (true); + } + inline bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + if (unlikely (!sanitize_shallow (c))) return_trace (false); + unsigned int count = header.nUnits; + for (unsigned int i = 0; i < count; i++) + if (unlikely (!(*this)[i].sanitize (c, base))) + return_trace (false); + return_trace (true); + } + + template + inline const Type *bsearch (const T &key) const + { + unsigned int size = header.unitSize; + int min = 0, max = (int) header.nUnits - 1; + while (min <= max) + { + int mid = (min + max) / 2; + const Type *p = (const Type *) (((const char *) bytes) + (mid * size)); + int c = p->cmp (key); + if (c < 0) + max = mid - 1; + else if (c > 0) + min = mid + 1; + else + return p; + } + return NULL; + } + + private: + inline bool sanitize_shallow (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (header.sanitize (c) && + Type::static_size >= header.unitSize && + c->check_array (bytes, header.unitSize, header.nUnits)); + } + + protected: + BinSearchHeader header; + HBUINT8 bytes[VAR]; + public: + DEFINE_SIZE_ARRAY (10, bytes); +}; + + +/* TODO Move this to hb-open-type-private.hh and use it in ArrayOf, HeadlessArrayOf, + * and other places around the code base?? */ +template +struct UnsizedArrayOf +{ + inline const Type& operator [] (unsigned int i) const { return arrayZ[i]; } + inline Type& operator [] (unsigned int i) { return arrayZ[i]; } + + inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const + { + TRACE_SANITIZE (this); + if (unlikely (!sanitize_shallow (c, count))) return_trace (false); + + /* Note: for structs that do not reference other structs, + * we do not need to call their sanitize() as we already did + * a bound check on the aggregate array size. We just include + * a small unreachable expression to make sure the structs + * pointed to do have a simple sanitize(), ie. they do not + * reference other structs via offsets. + */ + (void) (false && arrayZ[0].sanitize (c)); + + return_trace (true); + } + inline bool sanitize (hb_sanitize_context_t *c, unsigned int count, const void *base) const + { + TRACE_SANITIZE (this); + if (unlikely (!sanitize_shallow (c, count))) return_trace (false); + for (unsigned int i = 0; i < count; i++) + if (unlikely (!arrayZ[i].sanitize (c, base))) + return_trace (false); + return_trace (true); + } + template + inline bool sanitize (hb_sanitize_context_t *c, unsigned int count, const void *base, T user_data) const + { + TRACE_SANITIZE (this); + if (unlikely (!sanitize_shallow (c, count))) return_trace (false); + for (unsigned int i = 0; i < count; i++) + if (unlikely (!arrayZ[i].sanitize (c, base, user_data))) + return_trace (false); + return_trace (true); + } + + private: + inline bool sanitize_shallow (hb_sanitize_context_t *c, unsigned int count) const + { + TRACE_SANITIZE (this); + return_trace (c->check_array (arrayZ, arrayZ[0].static_size, count)); + } + + public: + Type arrayZ[VAR]; + public: + DEFINE_SIZE_ARRAY (0, arrayZ); +}; + +/* Unsized array of offset's */ +template +struct UnsizedOffsetArrayOf : UnsizedArrayOf > {}; + +/* Unsized array of offsets relative to the beginning of the array itself. */ +template +struct UnsizedOffsetListOf : UnsizedOffsetArrayOf +{ + inline const Type& operator [] (unsigned int i) const + { + return this+this->arrayZ[i]; + } + + inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const + { + TRACE_SANITIZE (this); + return_trace ((UnsizedOffsetArrayOf::sanitize (c, count, this))); + } + template + inline bool sanitize (hb_sanitize_context_t *c, unsigned int count, T user_data) const + { + TRACE_SANITIZE (this); + return_trace ((UnsizedOffsetArrayOf::sanitize (c, count, this, user_data))); + } +}; + + +/* + * Lookup Table + */ + +template struct Lookup; + +template +struct LookupFormat0 +{ + friend struct Lookup; + + private: + inline const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const + { + if (unlikely (glyph_id >= num_glyphs)) return nullptr; + return &arrayZ[glyph_id]; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (arrayZ.sanitize (c, c->num_glyphs)); + } + + protected: + HBUINT16 format; /* Format identifier--format = 0 */ + UnsizedArrayOf + arrayZ; /* Array of lookup values, indexed by glyph index. */ + public: + DEFINE_SIZE_ARRAY (2, arrayZ); +}; + + +template +struct LookupSegmentSingle +{ + inline int cmp (hb_codepoint_t g) const { + return g < first ? -1 : g <= last ? 0 : +1 ; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && value.sanitize (c)); + } + + GlyphID last; /* Last GlyphID in this segment */ + GlyphID first; /* First GlyphID in this segment */ + T value; /* The lookup value (only one) */ + public: + DEFINE_SIZE_STATIC (4 + T::static_size); +}; + +template +struct LookupFormat2 +{ + friend struct Lookup; + + private: + inline const T* get_value (hb_codepoint_t glyph_id) const + { + const LookupSegmentSingle *v = segments.bsearch (glyph_id); + return v ? &v->value : nullptr; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (segments.sanitize (c)); + } + + protected: + HBUINT16 format; /* Format identifier--format = 2 */ + BinSearchArrayOf > + segments; /* The actual segments. These must already be sorted, + * according to the first word in each one (the last + * glyph in each segment). */ + public: + DEFINE_SIZE_ARRAY (8, segments); +}; + +template +struct LookupSegmentArray +{ + inline const T* get_value (hb_codepoint_t glyph_id, const void *base) const + { + return first <= glyph_id && glyph_id <= last ? &(base+valuesZ)[glyph_id - first] : nullptr; + } + + inline int cmp (hb_codepoint_t g) const { + return g < first ? -1 : g <= last ? 0 : +1 ; + } + + inline bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && + first <= last && + valuesZ.sanitize (c, base, last - first + 1)); + } + + GlyphID last; /* Last GlyphID in this segment */ + GlyphID first; /* First GlyphID in this segment */ + OffsetTo > + valuesZ; /* A 16-bit offset from the start of + * the table to the data. */ + public: + DEFINE_SIZE_STATIC (6); +}; + +template +struct LookupFormat4 +{ + friend struct Lookup; + + private: + inline const T* get_value (hb_codepoint_t glyph_id) const + { + const LookupSegmentArray *v = segments.bsearch (glyph_id); + return v ? v->get_value (glyph_id, this) : nullptr; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (segments.sanitize (c, this)); + } + + protected: + HBUINT16 format; /* Format identifier--format = 2 */ + BinSearchArrayOf > + segments; /* The actual segments. These must already be sorted, + * according to the first word in each one (the last + * glyph in each segment). */ + public: + DEFINE_SIZE_ARRAY (8, segments); +}; + +template +struct LookupSingle +{ + inline int cmp (hb_codepoint_t g) const { return glyph.cmp (g); } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && value.sanitize (c)); + } + + GlyphID glyph; /* Last GlyphID */ + T value; /* The lookup value (only one) */ + public: + DEFINE_SIZE_STATIC (4 + T::static_size); +}; + +template +struct LookupFormat6 +{ + friend struct Lookup; + + private: + inline const T* get_value (hb_codepoint_t glyph_id) const + { + const LookupSingle *v = entries.bsearch (glyph_id); + return v ? &v->value : nullptr; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (entries.sanitize (c)); + } + + protected: + HBUINT16 format; /* Format identifier--format = 6 */ + BinSearchArrayOf > + entries; /* The actual entries, sorted by glyph index. */ + public: + DEFINE_SIZE_ARRAY (8, entries); +}; + +template +struct LookupFormat8 +{ + friend struct Lookup; + + private: + inline const T* get_value (hb_codepoint_t glyph_id) const + { + return firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount ? &valueArrayZ[glyph_id - firstGlyph] : nullptr; + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount)); + } + + protected: + HBUINT16 format; /* Format identifier--format = 6 */ + GlyphID firstGlyph; /* First glyph index included in the trimmed array. */ + HBUINT16 glyphCount; /* Total number of glyphs (equivalent to the last + * glyph minus the value of firstGlyph plus 1). */ + UnsizedArrayOf + valueArrayZ; /* The lookup values (indexed by the glyph index + * minus the value of firstGlyph). */ + public: + DEFINE_SIZE_ARRAY (6, valueArrayZ); +}; + +template +struct Lookup +{ + inline const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const + { + switch (u.format) { + case 0: return u.format0.get_value (glyph_id, num_glyphs); + case 2: return u.format2.get_value (glyph_id); + case 4: return u.format4.get_value (glyph_id); + case 6: return u.format6.get_value (glyph_id); + case 8: return u.format8.get_value (glyph_id); + default:return nullptr; + } + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + if (!u.format.sanitize (c)) return_trace (false); + switch (u.format) { + case 0: return_trace (u.format0.sanitize (c)); + case 2: return_trace (u.format2.sanitize (c)); + case 4: return_trace (u.format4.sanitize (c)); + case 6: return_trace (u.format6.sanitize (c)); + case 8: return_trace (u.format8.sanitize (c)); + default:return_trace (true); + } + } + + protected: + union { + HBUINT16 format; /* Format identifier */ + LookupFormat0 format0; + LookupFormat2 format2; + LookupFormat4 format4; + LookupFormat6 format6; + LookupFormat8 format8; + } u; + public: + DEFINE_SIZE_UNION (2, format); +}; + + +/* + * Extended State Table + */ + +template +struct Entry +{ + inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const + { + TRACE_SANITIZE (this); + /* Note, we don't recurse-sanitize data because we don't access it. + * That said, in our DEFINE_SIZE_STATIC we access T::static_size, + * which ensures that data has a simple sanitize(). To be determined + * if I need to remove that as well. */ + return_trace (c->check_struct (this)); + } + + public: + HBUINT16 newState; /* Byte offset from beginning of state table + * to the new state. Really?!?! Or just state + * number? The latter in morx for sure. */ + HBUINT16 flags; /* Table specific. */ + T data; /* Optional offsets to per-glyph tables. */ + public: + DEFINE_SIZE_STATIC (4 + T::static_size); +}; + +template <> +struct Entry +{ + inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this)); + } + + public: + HBUINT16 newState; /* Byte offset from beginning of state table to the new state. */ + HBUINT16 flags; /* Table specific. */ + public: + DEFINE_SIZE_STATIC (4); +}; + +template +struct StateTable +{ + inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const + { + const HBUINT16 *v = (this+classTable).get_value (glyph_id, num_glyphs); + return v ? *v : 1; + } + + inline const Entry *get_entries () const + { + return (this+entryTable).arrayZ; + } + + inline const Entry *get_entryZ (unsigned int state, unsigned int klass) const + { + if (unlikely (klass >= nClasses)) return nullptr; + + const HBUINT16 *states = (this+stateArrayTable).arrayZ; + const Entry *entries = (this+entryTable).arrayZ; + + unsigned int entry = states[state * nClasses + klass]; + + return &entries[entry]; + } + + inline bool sanitize (hb_sanitize_context_t *c, + unsigned int *num_entries_out = nullptr) const + { + TRACE_SANITIZE (this); + if (unlikely (!(c->check_struct (this) && + classTable.sanitize (c, this)))) return_trace (false); + + const HBUINT16 *states = (this+stateArrayTable).arrayZ; + const Entry *entries = (this+entryTable).arrayZ; + + unsigned int num_states = 1; + unsigned int num_entries = 0; + + unsigned int state = 0; + unsigned int entry = 0; + while (state < num_states) + { + if (unlikely (!c->check_array (states + state * nClasses, + states[0].static_size, + nClasses * (num_states - state)))) + return_trace (false); + { /* Sweep new states. */ + const HBUINT16 *stop = &states[num_states * nClasses]; + for (const HBUINT16 *p = &states[state * nClasses]; p < stop; p++) + num_entries = MAX (num_entries, *p + 1); + state = num_states; + } + + if (unlikely (!c->check_array (entries + entry, + entries[0].static_size, + num_entries - entry))) + return_trace (false); + { /* Sweep new entries. */ + const Entry *stop = &entries[num_entries]; + for (const Entry *p = &entries[entry]; p < stop; p++) + num_states = MAX (num_states, p->newState + 1); + entry = num_entries; + } + } + + if (num_entries_out) + *num_entries_out = num_entries; + + return_trace (true); + } + + protected: + HBUINT32 nClasses; /* Number of classes, which is the number of indices + * in a single line in the state array. */ + OffsetTo, HBUINT32> + classTable; /* Offset to the class table. */ + OffsetTo, HBUINT32> + stateArrayTable;/* Offset to the state array. */ + OffsetTo >, HBUINT32> + entryTable; /* Offset to the entry array. */ + + public: + DEFINE_SIZE_STATIC (16); +}; + +template +struct StateTableDriver +{ + inline StateTableDriver (const StateTable &machine_, + hb_buffer_t *buffer_, + hb_face_t *face_) : + machine (machine_), + buffer (buffer_), + num_glyphs (face_->get_num_glyphs ()), + last_zero (0) {} + + template + inline void drive (context_t *c) + { + hb_glyph_info_t *info = buffer->info; + + if (!c->in_place) + buffer->clear_output (); + + unsigned int state = 0; + bool last_was_dont_advance = false; + for (buffer->idx = 0;;) + { + if (!state) + last_zero = buffer->idx; + + unsigned int klass = buffer->idx < buffer->len ? + machine.get_class (info[buffer->idx].codepoint, num_glyphs) : + 0 /* End of text */; + const Entry *entry = machine.get_entryZ (state, klass); + if (unlikely (!entry)) + break; + + if (unlikely (!c->transition (this, entry))) + break; + + last_was_dont_advance = (entry->flags & context_t::DontAdvance) && buffer->max_ops--; + + state = entry->newState; + + if (buffer->idx == buffer->len) + break; + + if (!last_was_dont_advance) + buffer->next_glyph (); + } + + if (!c->in_place) + { + for (; buffer->idx < buffer->len;) + buffer->next_glyph (); + buffer->swap_buffers (); + } + } + + public: + const StateTable &machine; + hb_buffer_t *buffer; + unsigned int num_glyphs; + unsigned int last_zero; +}; + + + +struct hb_aat_apply_context_t : + hb_dispatch_context_t +{ + inline const char *get_name (void) { return "APPLY"; } + template + inline return_t dispatch (const T &obj) { return obj.apply (this); } + static return_t default_return_value (void) { return false; } + bool stop_sublookup_iteration (return_t r) const { return r; } + + hb_font_t *font; + hb_face_t *face; + hb_buffer_t *buffer; + hb_sanitize_context_t sanitizer; + + inline hb_aat_apply_context_t (hb_font_t *font_, + hb_buffer_t *buffer_, + hb_blob_t *table) : + font (font_), face (font->face), buffer (buffer_), + sanitizer () + { + sanitizer.init (table); + sanitizer.num_glyphs = face->get_num_glyphs (); + sanitizer.start_processing (); + } + + inline ~hb_aat_apply_context_t (void) + { + sanitizer.end_processing (); + } +}; + + +} /* namespace AAT */ + + +#endif /* HB_AAT_LAYOUT_COMMON_PRIVATE_HH */ diff --git a/gfx/harfbuzz/src/hb-aat-layout-morx-table.hh b/gfx/harfbuzz/src/hb-aat-layout-morx-table.hh new file mode 100644 index 000000000000..c64dca06670d --- /dev/null +++ b/gfx/harfbuzz/src/hb-aat-layout-morx-table.hh @@ -0,0 +1,694 @@ +/* + * Copyright © 2017 Google, 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. + * + * Google Author(s): Behdad Esfahbod + */ + +#ifndef HB_AAT_LAYOUT_MORX_TABLE_HH +#define HB_AAT_LAYOUT_MORX_TABLE_HH + +#include "hb-open-type-private.hh" +#include "hb-aat-layout-common-private.hh" + +#define HB_AAT_TAG_MORX HB_TAG('m','o','r','x') + + +namespace AAT { + +using namespace OT; + + +struct RearrangementSubtable +{ + struct driver_context_t + { + static const bool in_place = true; + enum Flags { + MarkFirst = 0x8000, /* If set, make the current glyph the first + * glyph to be rearranged. */ + DontAdvance = 0x4000, /* If set, don't advance to the next glyph + * before going to the new state. This means + * that the glyph index doesn't change, even + * if the glyph at that index has changed. */ + MarkLast = 0x2000, /* If set, make the current glyph the last + * glyph to be rearranged. */ + Reserved = 0x1FF0, /* These bits are reserved and should be set to 0. */ + Verb = 0x000F, /* The type of rearrangement specified. */ + }; + + inline driver_context_t (const RearrangementSubtable *table) : + ret (false), + start (0), end (0), + last_zero_before_start (0) {} + + inline bool transition (StateTableDriver *driver, + const Entry *entry) + { + hb_buffer_t *buffer = driver->buffer; + unsigned int flags = entry->flags; + + if (flags & MarkFirst) + { + start = buffer->idx; + last_zero_before_start = driver->last_zero; + } + + if (flags & MarkLast) + end = MIN (buffer->idx + 1, buffer->len); + + if ((flags & Verb) && start < end) + { + /* The following map has two nibbles, for start-side + * and end-side. Values of 0,1,2 mean move that many + * to the other side. Value of 3 means move 2 and + * flip them. */ + const unsigned char map[16] = + { + 0x00, /* 0 no change */ + 0x10, /* 1 Ax => xA */ + 0x01, /* 2 xD => Dx */ + 0x11, /* 3 AxD => DxA */ + 0x20, /* 4 ABx => xAB */ + 0x30, /* 5 ABx => xBA */ + 0x02, /* 6 xCD => CDx */ + 0x03, /* 7 xCD => DCx */ + 0x12, /* 8 AxCD => CDxA */ + 0x13, /* 9 AxCD => DCxA */ + 0x21, /* 10 ABxD => DxAB */ + 0x31, /* 11 ABxD => DxBA */ + 0x22, /* 12 ABxCD => CDxAB */ + 0x32, /* 13 ABxCD => CDxBA */ + 0x23, /* 14 ABxCD => DCxAB */ + 0x33, /* 15 ABxCD => DCxBA */ + }; + + unsigned int m = map[flags & Verb]; + unsigned int l = MIN (2, m >> 4); + unsigned int r = MIN (2, m & 0x0F); + bool reverse_l = 3 == (m >> 4); + bool reverse_r = 3 == (m & 0x0F); + + if (end - start >= l + r) + { + buffer->unsafe_to_break (last_zero_before_start, MIN (buffer->idx + 1, buffer->len)); + buffer->merge_clusters (start, end); + + hb_glyph_info_t *info = buffer->info; + hb_glyph_info_t buf[4]; + + memcpy (buf, info + start, l * sizeof (buf[0])); + memcpy (buf + 2, info + end - r, r * sizeof (buf[0])); + + if (l != r) + memmove (info + start + r, info + start + l, (end - start - l - r) * sizeof (buf[0])); + + memcpy (info + start, buf + 2, r * sizeof (buf[0])); + memcpy (info + end - l, buf, l * sizeof (buf[0])); + if (reverse_l) + { + buf[0] = info[end - 1]; + info[end - 1] = info[end - 2]; + info[end - 2] = buf[0]; + } + if (reverse_r) + { + buf[0] = info[start]; + info[start] = info[start + 1]; + info[start + 1] = buf[0]; + } + } + } + + return true; + } + + public: + bool ret; + private: + unsigned int start; + unsigned int end; + unsigned int last_zero_before_start; + }; + + inline bool apply (hb_aat_apply_context_t *c) const + { + TRACE_APPLY (this); + + driver_context_t dc (this); + + StateTableDriver driver (machine, c->buffer, c->face); + driver.drive (&dc); + + return_trace (dc.ret); + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (machine.sanitize (c)); + } + + protected: + StateTable machine; + public: + DEFINE_SIZE_STATIC (16); +}; + +struct ContextualSubtable +{ + struct EntryData + { + HBUINT16 markIndex; /* Index of the substitution table for the + * marked glyph (use 0xFFFF for none). */ + HBUINT16 currentIndex; /* Index of the substitution table for the + * current glyph (use 0xFFFF for none). */ + public: + DEFINE_SIZE_STATIC (4); + }; + + struct driver_context_t + { + static const bool in_place = true; + enum Flags { + SetMark = 0x8000, /* If set, make the current glyph the marked glyph. */ + DontAdvance = 0x4000, /* If set, don't advance to the next glyph before + * going to the new state. */ + Reserved = 0x3FFF, /* These bits are reserved and should be set to 0. */ + }; + + inline driver_context_t (const ContextualSubtable *table) : + ret (false), + mark (0), + last_zero_before_mark (0), + subs (table+table->substitutionTables) {} + + inline bool transition (StateTableDriver *driver, + const Entry *entry) + { + hb_buffer_t *buffer = driver->buffer; + + if (entry->flags & SetMark) + { + mark = buffer->idx; + last_zero_before_mark = driver->last_zero; + } + + if (entry->data.markIndex != 0xFFFF) + { + const Lookup &lookup = subs[entry->data.markIndex]; + hb_glyph_info_t *info = buffer->info; + const GlyphID *replacement = lookup.get_value (info[mark].codepoint, driver->num_glyphs); + if (replacement) + { + buffer->unsafe_to_break (last_zero_before_mark, MIN (buffer->idx + 1, buffer->len)); + info[mark].codepoint = *replacement; + ret = true; + } + } + if (entry->data.currentIndex != 0xFFFF) + { + const Lookup &lookup = subs[entry->data.currentIndex]; + hb_glyph_info_t *info = buffer->info; + const GlyphID *replacement = lookup.get_value (info[buffer->idx].codepoint, driver->num_glyphs); + if (replacement) + { + buffer->unsafe_to_break (driver->last_zero, MIN (buffer->idx + 1, buffer->len)); + info[buffer->idx].codepoint = *replacement; + ret = true; + } + } + + return true; + } + + public: + bool ret; + private: + unsigned int mark; + unsigned int last_zero_before_mark; + const UnsizedOffsetListOf, HBUINT32> &subs; + }; + + inline bool apply (hb_aat_apply_context_t *c) const + { + TRACE_APPLY (this); + + driver_context_t dc (this); + + StateTableDriver driver (machine, c->buffer, c->face); + driver.drive (&dc); + + return_trace (dc.ret); + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + + unsigned int num_entries; + if (unlikely (!machine.sanitize (c, &num_entries))) return false; + + unsigned int num_lookups = 0; + + const Entry *entries = machine.get_entries (); + for (unsigned int i = 0; i < num_entries; i++) + { + const EntryData &data = entries[i].data; + + num_lookups = MAX (num_lookups, 1 + data.markIndex); + num_lookups = MAX (num_lookups, 1 + data.currentIndex); + } + + return_trace (substitutionTables.sanitize (c, this, num_lookups)); + } + + protected: + StateTable machine; + OffsetTo, HBUINT32>, HBUINT32> + substitutionTables; + public: + DEFINE_SIZE_STATIC (20); +}; + +struct LigatureSubtable +{ + struct EntryData + { + HBUINT16 ligActionIndex; /* Index to the first ligActionTable entry + * for processing this group, if indicated + * by the flags. */ + public: + DEFINE_SIZE_STATIC (2); + }; + + struct driver_context_t + { + static const bool in_place = false; + enum Flags { + SetComponent = 0x8000, /* Push this glyph onto the component stack for + * eventual processing. */ + DontAdvance = 0x4000, /* Leave the glyph pointer at this glyph for the + next iteration. */ + PerformAction = 0x2000, /* Use the ligActionIndex to process a ligature + * group. */ + Reserved = 0x1FFF, /* These bits are reserved and should be set to 0. */ + }; + enum LigActionFlags { + LigActionLast = 0x80000000, /* This is the last action in the list. This also + * implies storage. */ + LigActionStore = 0x40000000, /* Store the ligature at the current cumulated index + * in the ligature table in place of the marked + * (i.e. currently-popped) glyph. */ + LigActionOffset = 0x3FFFFFFF, /* A 30-bit value which is sign-extended to 32-bits + * and added to the glyph ID, resulting in an index + * into the component table. */ + }; + + inline driver_context_t (const LigatureSubtable *table, + hb_aat_apply_context_t *c_) : + ret (false), + c (c_), + ligAction (table+table->ligAction), + component (table+table->component), + ligature (table+table->ligature), + match_length (0) {} + + inline bool transition (StateTableDriver *driver, + const Entry *entry) + { + hb_buffer_t *buffer = driver->buffer; + unsigned int flags = entry->flags; + + if (flags & SetComponent) + { + if (unlikely (match_length >= ARRAY_LENGTH (match_positions))) + return false; + + /* Never mark same index twice, in case DontAdvance was used... */ + if (match_length && match_positions[match_length - 1] == buffer->out_len) + match_length--; + + match_positions[match_length++] = buffer->out_len; + } + + if (flags & PerformAction) + { + unsigned int end = buffer->out_len; + unsigned int action_idx = entry->data.ligActionIndex; + unsigned int action; + unsigned int ligature_idx = 0; + do + { + if (unlikely (!match_length)) + return false; + + buffer->move_to (match_positions[--match_length]); + + const HBUINT32 &actionData = ligAction[action_idx]; + if (unlikely (!actionData.sanitize (&c->sanitizer))) return false; + action = actionData; + + uint32_t uoffset = action & LigActionOffset; + if (uoffset & 0x20000000) + uoffset += 0xC0000000; + int32_t offset = (int32_t) uoffset; + unsigned int component_idx = buffer->cur().codepoint + offset; + + const HBUINT16 &componentData = component[component_idx]; + if (unlikely (!componentData.sanitize (&c->sanitizer))) return false; + ligature_idx += componentData; + + if (action & (LigActionStore | LigActionLast)) + { + const GlyphID &ligatureData = ligature[ligature_idx]; + if (unlikely (!ligatureData.sanitize (&c->sanitizer))) return false; + hb_codepoint_t lig = ligatureData; + + match_positions[match_length++] = buffer->out_len; + buffer->replace_glyph (lig); + + //ligature_idx = 0; // XXX Yes or no? + } + else + { + buffer->skip_glyph (); + end--; + } + /* TODO merge_clusters / unsafe_to_break */ + + action_idx++; + } + while (!(action & LigActionLast)); + buffer->move_to (end); + } + + return true; + } + + public: + bool ret; + private: + hb_aat_apply_context_t *c; + const UnsizedArrayOf &ligAction; + const UnsizedArrayOf &component; + const UnsizedArrayOf &ligature; + unsigned int match_length; + unsigned int match_positions[HB_MAX_CONTEXT_LENGTH]; + }; + + inline bool apply (hb_aat_apply_context_t *c) const + { + TRACE_APPLY (this); + + driver_context_t dc (this, c); + + StateTableDriver driver (machine, c->buffer, c->face); + driver.drive (&dc); + + return_trace (dc.ret); + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + /* The rest of array sanitizations are done at run-time. */ + return c->check_struct (this) && machine.sanitize (c) && + ligAction && component && ligature; + return_trace (true); + } + + protected: + StateTable machine; + OffsetTo, HBUINT32> + ligAction; /* Offset to the ligature action table. */ + OffsetTo, HBUINT32> + component; /* Offset to the component table. */ + OffsetTo, HBUINT32> + ligature; /* Offset to the actual ligature lists. */ + public: + DEFINE_SIZE_STATIC (28); +}; + +struct NoncontextualSubtable +{ + inline bool apply (hb_aat_apply_context_t *c) const + { + TRACE_APPLY (this); + + bool ret = false; + unsigned int num_glyphs = c->face->get_num_glyphs (); + + hb_glyph_info_t *info = c->buffer->info; + unsigned int count = c->buffer->len; + for (unsigned int i = 0; i < count; i++) + { + const GlyphID *replacement = substitute.get_value (info[i].codepoint, num_glyphs); + if (replacement) + { + info[i].codepoint = *replacement; + ret = true; + } + } + + return_trace (ret); + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (substitute.sanitize (c)); + } + + protected: + Lookup substitute; + public: + DEFINE_SIZE_MIN (2); +}; + +struct InsertionSubtable +{ + inline bool apply (hb_aat_apply_context_t *c) const + { + TRACE_APPLY (this); + /* TODO */ + return_trace (false); + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + /* TODO */ + return_trace (true); + } +}; + + +struct Feature +{ + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (c->check_struct (this)); + } + + public: + HBUINT16 featureType; /* The type of feature. */ + HBUINT16 featureSetting; /* The feature's setting (aka selector). */ + HBUINT32 enableFlags; /* Flags for the settings that this feature + * and setting enables. */ + HBUINT32 disableFlags; /* Complement of flags for the settings that this + * feature and setting disable. */ + + public: + DEFINE_SIZE_STATIC (12); +}; + + +struct ChainSubtable +{ + friend struct Chain; + + inline unsigned int get_size (void) const { return length; } + inline unsigned int get_type (void) const { return coverage & 0xFF; } + + enum Type { + Rearrangement = 0, + Contextual = 1, + Ligature = 2, + Noncontextual = 4, + Insertion = 5 + }; + + inline void apply (hb_aat_apply_context_t *c) const + { + dispatch (c); + } + + template + inline typename context_t::return_t dispatch (context_t *c) const + { + unsigned int subtable_type = get_type (); + TRACE_DISPATCH (this, subtable_type); + switch (subtable_type) { + case Rearrangement: return_trace (c->dispatch (u.rearrangement)); + case Contextual: return_trace (c->dispatch (u.contextual)); + case Ligature: return_trace (c->dispatch (u.ligature)); + case Noncontextual: return_trace (c->dispatch (u.noncontextual)); + case Insertion: return_trace (c->dispatch (u.insertion)); + default: return_trace (c->default_return_value ()); + } + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + if (!length.sanitize (c) || + length < min_size || + !c->check_range (this, length)) + return_trace (false); + + return_trace (dispatch (c)); + } + + protected: + HBUINT32 length; /* Total subtable length, including this header. */ + HBUINT32 coverage; /* Coverage flags and subtable type. */ + HBUINT32 subFeatureFlags;/* The 32-bit mask identifying which subtable this is. */ + union { + RearrangementSubtable rearrangement; + ContextualSubtable contextual; + LigatureSubtable ligature; + NoncontextualSubtable noncontextual; + InsertionSubtable insertion; + } u; + public: + DEFINE_SIZE_MIN (12); +}; + +struct Chain +{ + inline void apply (hb_aat_apply_context_t *c) const + { + const ChainSubtable *subtable = &StructAtOffset (featureZ, featureZ[0].static_size * featureCount); + unsigned int count = subtableCount; + for (unsigned int i = 0; i < count; i++) + { + subtable->apply (c); + subtable = &StructAfter (*subtable); + } + } + + inline unsigned int get_size (void) const { return length; } + + inline bool sanitize (hb_sanitize_context_t *c, unsigned int major) const + { + TRACE_SANITIZE (this); + if (!length.sanitize (c) || + length < min_size || + !c->check_range (this, length)) + return_trace (false); + + if (!c->check_array (featureZ, featureZ[0].static_size, featureCount)) + return_trace (false); + + const ChainSubtable *subtable = &StructAtOffset (featureZ, featureZ[0].static_size * featureCount); + unsigned int count = subtableCount; + for (unsigned int i = 0; i < count; i++) + { + if (!subtable->sanitize (c)) + return_trace (false); + subtable = &StructAfter (*subtable); + } + + return_trace (true); + } + + protected: + HBUINT32 defaultFlags; /* The default specification for subtables. */ + HBUINT32 length; /* Total byte count, including this header. */ + HBUINT32 featureCount; /* Number of feature subtable entries. */ + HBUINT32 subtableCount; /* The number of subtables in the chain. */ + + Feature featureZ[VAR]; /* Features. */ + ChainSubtable subtableX[VAR]; /* Subtables. */ + // subtableGlyphCoverageArray if major == 3 + + public: + DEFINE_SIZE_MIN (16); +}; + + +/* + * The 'mort'/'morx' Tables + */ + +struct morx +{ + static const hb_tag_t tableTag = HB_AAT_TAG_MORX; + + inline void apply (hb_aat_apply_context_t *c) const + { + const Chain *chain = chains; + unsigned int count = chainCount; + for (unsigned int i = 0; i < count; i++) + { + chain->apply (c); + chain = &StructAfter (*chain); + } + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + if (!version.sanitize (c) || + (version.major >> (sizeof (HBUINT32) == 4 ? 1 : 0)) != 1 || + !chainCount.sanitize (c)) + return_trace (false); + + const Chain *chain = chains; + unsigned int count = chainCount; + for (unsigned int i = 0; i < count; i++) + { + if (!chain->sanitize (c, version.major)) + return_trace (false); + chain = &StructAfter (*chain); + } + + return_trace (true); + } + + protected: + FixedVersion<>version; /* Version number of the glyph metamorphosis table. + * 1 for mort, 2 or 3 for morx. */ + HBUINT32 chainCount; /* Number of metamorphosis chains contained in this + * table. */ + Chain chains[VAR]; /* Chains. */ + + public: + DEFINE_SIZE_MIN (8); +}; + +} /* namespace AAT */ + + +#endif /* HB_AAT_LAYOUT_MORX_TABLE_HH */ diff --git a/gfx/harfbuzz/src/hb-aat-layout-private.hh b/gfx/harfbuzz/src/hb-aat-layout-private.hh new file mode 100644 index 000000000000..c1c607a2f7a8 --- /dev/null +++ b/gfx/harfbuzz/src/hb-aat-layout-private.hh @@ -0,0 +1,40 @@ +/* + * Copyright © 2017 Google, 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. + * + * Google Author(s): Behdad Esfahbod + */ + +#ifndef HB_AAT_LAYOUT_PRIVATE_HH +#define HB_AAT_LAYOUT_PRIVATE_HH + +#include "hb-private.hh" + +#include "hb-font-private.hh" +#include "hb-buffer-private.hh" +#include "hb-open-type-private.hh" + + +HB_INTERNAL void +hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer); + +#endif /* HB_AAT_LAYOUT_PRIVATE_HH */ diff --git a/gfx/harfbuzz/src/hb-aat-layout.cc b/gfx/harfbuzz/src/hb-aat-layout.cc new file mode 100644 index 000000000000..d882fa166815 --- /dev/null +++ b/gfx/harfbuzz/src/hb-aat-layout.cc @@ -0,0 +1,78 @@ +/* + * Copyright © 2017 Google, 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. + * + * Google Author(s): Behdad Esfahbod + */ + +#include "hb-open-type-private.hh" + +#include "hb-ot-layout-private.hh" +#include "hb-ot-layout-gsubgpos-private.hh" + +#include "hb-aat-layout-private.hh" +#include "hb-aat-layout-morx-table.hh" + +/* + * mort/morx + */ + +static inline const AAT::morx& +_get_morx (hb_face_t *face, hb_blob_t **blob = nullptr) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) + { + if (blob) + *blob = hb_blob_get_empty (); + return OT::Null(AAT::morx); + } + hb_ot_layout_t * layout = hb_ot_layout_from_face (face); + /* XXX this doesn't call set_num_glyphs on sanitizer. */ + const AAT::morx& morx = *(layout->morx.get ()); + if (blob) + *blob = layout->morx.blob; + return morx; +} + +static inline void +_hb_aat_layout_create (hb_face_t *face) +{ + OT::Sanitizer sanitizer; + sanitizer.set_num_glyphs (face->get_num_glyphs ()); + hb_blob_t *morx_blob = sanitizer.sanitize (face->reference_table (HB_AAT_TAG_MORX)); + OT::Sanitizer::lock_instance (morx_blob); + + if (0) + { + OT::Sanitizer >::lock_instance (morx_blob)->get_value (1, face->get_num_glyphs ()); + } +} + +void +hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer) +{ + hb_blob_t *blob; + const AAT::morx& morx = _get_morx (font->face, &blob); + + AAT::hb_aat_apply_context_t c (font, buffer, blob); + morx.apply (&c); +} diff --git a/gfx/harfbuzz/src/hb-atomic-private.hh b/gfx/harfbuzz/src/hb-atomic-private.hh index 93438401400e..a7e9b11af8bc 100644 --- a/gfx/harfbuzz/src/hb-atomic-private.hh +++ b/gfx/harfbuzz/src/hb-atomic-private.hh @@ -70,6 +70,29 @@ typedef LONG hb_atomic_int_impl_t; #define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O)) +#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) + +typedef int hb_atomic_int_impl_t; +#define HB_ATOMIC_INT_IMPL_INIT(V) (V) +#define hb_atomic_int_impl_add(AI, V) __sync_fetch_and_add (&(AI), (V)) + +#define hb_atomic_ptr_impl_get(P) (void *) (__sync_synchronize (), *(P)) +#define hb_atomic_ptr_impl_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N)) + + +#elif !defined(HB_NO_MT) && defined(HAVE_SOLARIS_ATOMIC_OPS) + +#include +#include + +typedef unsigned int hb_atomic_int_impl_t; +#define HB_ATOMIC_INT_IMPL_INIT(V) (V) +#define hb_atomic_int_impl_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V)) + +#define hb_atomic_ptr_impl_get(P) ( ({__machine_rw_barrier ();}), (void *) *(P)) +#define hb_atomic_ptr_impl_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false) + + #elif !defined(HB_NO_MT) && defined(__APPLE__) #include @@ -96,29 +119,6 @@ typedef int32_t hb_atomic_int_impl_t; #endif -#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) - -typedef int hb_atomic_int_impl_t; -#define HB_ATOMIC_INT_IMPL_INIT(V) (V) -#define hb_atomic_int_impl_add(AI, V) __sync_fetch_and_add (&(AI), (V)) - -#define hb_atomic_ptr_impl_get(P) (void *) (__sync_synchronize (), *(P)) -#define hb_atomic_ptr_impl_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N)) - - -#elif !defined(HB_NO_MT) && defined(HAVE_SOLARIS_ATOMIC_OPS) - -#include -#include - -typedef unsigned int hb_atomic_int_impl_t; -#define HB_ATOMIC_INT_IMPL_INIT(V) (V) -#define hb_atomic_int_impl_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V)) - -#define hb_atomic_ptr_impl_get(P) ( ({__machine_rw_barrier ();}), (void *) *(P)) -#define hb_atomic_ptr_impl_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false) - - #elif !defined(HB_NO_MT) && defined(_AIX) && defined(__IBMCPP__) #include diff --git a/gfx/harfbuzz/src/hb-blob.cc b/gfx/harfbuzz/src/hb-blob.cc index 59c83336374a..4cf6d1e54513 100644 --- a/gfx/harfbuzz/src/hb-blob.cc +++ b/gfx/harfbuzz/src/hb-blob.cc @@ -26,7 +26,7 @@ /* http://www.oracle.com/technetwork/articles/servers-storage-dev/standardheaderfiles-453865.html */ #ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 199309L +#define _POSIX_C_SOURCE 200809L #endif #include "hb-private.hh" diff --git a/gfx/harfbuzz/src/hb-blob.h b/gfx/harfbuzz/src/hb-blob.h index ef3fc98c05de..53682d3eb1c9 100644 --- a/gfx/harfbuzz/src/hb-blob.h +++ b/gfx/harfbuzz/src/hb-blob.h @@ -44,7 +44,7 @@ HB_BEGIN_DECLS * any such possibility, MODE_DUPLICATE should be used * such that HarfBuzz makes a copy immediately, * - * - Use MODE_READONLY otherse, unless you really really + * - Use MODE_READONLY otherwise, unless you really really * really know what you are doing, * * - MODE_WRITABLE is appropriate if you really made a diff --git a/gfx/harfbuzz/src/hb-buffer-private.hh b/gfx/harfbuzz/src/hb-buffer-private.hh index 97bdc1be305f..9148ef31b65d 100644 --- a/gfx/harfbuzz/src/hb-buffer-private.hh +++ b/gfx/harfbuzz/src/hb-buffer-private.hh @@ -69,6 +69,7 @@ enum hb_buffer_scratch_flags_t { HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK = 0x00000004u, HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000008u, HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK = 0x00000010u, + HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000020u, /* Reserved for complex shapers' internal use. */ HB_BUFFER_SCRATCH_FLAG_COMPLEX0 = 0x01000000u, @@ -306,37 +307,37 @@ struct hb_buffer_t { HB_INTERNAL bool message_impl (hb_font_t *font, const char *fmt, va_list ap) HB_PRINTF_FUNC(3, 0); static inline void - set_cluster (hb_glyph_info_t &info, unsigned int cluster, unsigned int mask = 0) + set_cluster (hb_glyph_info_t &inf, unsigned int cluster, unsigned int mask = 0) { - if (info.cluster != cluster) + if (inf.cluster != cluster) { if (mask & HB_GLYPH_FLAG_UNSAFE_TO_BREAK) - info.mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK; + inf.mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK; else - info.mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK; + inf.mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK; } - info.cluster = cluster; + inf.cluster = cluster; } inline int - _unsafe_to_break_find_min_cluster (const hb_glyph_info_t *info, + _unsafe_to_break_find_min_cluster (const hb_glyph_info_t *infos, unsigned int start, unsigned int end, unsigned int cluster) const { for (unsigned int i = start; i < end; i++) - cluster = MIN (cluster, info[i].cluster); + cluster = MIN (cluster, infos[i].cluster); return cluster; } inline void - _unsafe_to_break_set_mask (hb_glyph_info_t *info, + _unsafe_to_break_set_mask (hb_glyph_info_t *infos, unsigned int start, unsigned int end, unsigned int cluster) { for (unsigned int i = start; i < end; i++) - if (cluster != info[i].cluster) + if (cluster != infos[i].cluster) { scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK; - info[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK; + infos[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK; } } diff --git a/gfx/harfbuzz/src/hb-buffer-serialize.cc b/gfx/harfbuzz/src/hb-buffer-serialize.cc index ea62e9ffdb21..11471941de8f 100644 --- a/gfx/harfbuzz/src/hb-buffer-serialize.cc +++ b/gfx/harfbuzz/src/hb-buffer-serialize.cc @@ -109,6 +109,7 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, nullptr : hb_buffer_get_glyph_positions (buffer, nullptr); *buf_consumed = 0; + hb_position_t x = 0, y = 0; for (unsigned int i = start; i < end; i++) { char b[1024]; @@ -146,9 +147,10 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS)) { p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"dx\":%d,\"dy\":%d", - pos[i].x_offset, pos[i].y_offset)); - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"ax\":%d,\"ay\":%d", - pos[i].x_advance, pos[i].y_advance)); + x+pos[i].x_offset, y+pos[i].y_offset)); + if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES)) + p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"ax\":%d,\"ay\":%d", + pos[i].x_advance, pos[i].y_advance)); } if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS) @@ -179,6 +181,12 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, *buf = '\0'; } else return i - start; + + if (pos && (flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES)) + { + x += pos[i].x_advance; + y += pos[i].y_advance; + } } return end - start; @@ -199,6 +207,7 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, nullptr : hb_buffer_get_glyph_positions (buffer, nullptr); *buf_consumed = 0; + hb_position_t x = 0, y = 0; for (unsigned int i = start; i < end; i++) { char b[1024]; @@ -223,13 +232,16 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS)) { - if (pos[i].x_offset || pos[i].y_offset) - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "@%d,%d", pos[i].x_offset, pos[i].y_offset)); + if (x+pos[i].x_offset || y+pos[i].y_offset) + p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "@%d,%d", x+pos[i].x_offset, y+pos[i].y_offset)); - *p++ = '+'; - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%d", pos[i].x_advance)); - if (pos[i].y_advance) - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",%d", pos[i].y_advance)); + if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES)) + { + *p++ = '+'; + p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%d", pos[i].x_advance)); + if (pos[i].y_advance) + p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",%d", pos[i].y_advance)); + } } if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS) @@ -255,6 +267,12 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, *buf = '\0'; } else return i - start; + + if (pos && (flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES)) + { + x += pos[i].x_advance; + y += pos[i].y_advance; + } } return end - start; diff --git a/gfx/harfbuzz/src/hb-buffer.h b/gfx/harfbuzz/src/hb-buffer.h index a8a4b84e97b7..b2801ddf546b 100644 --- a/gfx/harfbuzz/src/hb-buffer.h +++ b/gfx/harfbuzz/src/hb-buffer.h @@ -247,13 +247,21 @@ hb_buffer_guess_segment_properties (hb_buffer_t *buffer); * of the text without the full context. * @HB_BUFFER_FLAG_EOT: flag indicating that special handling of the end of text * paragraph can be applied to this buffer, similar to - * @HB_BUFFER_FLAG_EOT. + * @HB_BUFFER_FLAG_BOT. * @HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES: * flag indication that character with Default_Ignorable * Unicode property should use the corresponding glyph - * from the font, instead of hiding them (currently done - * by replacing them with the space glyph and zeroing the - * advance width.) + * from the font, instead of hiding them (done by + * replacing them with the space glyph and zeroing the + * advance width.) This flag takes precedence over + * @HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES. + * @HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES: + * flag indication that character with Default_Ignorable + * Unicode property should be removed from glyph string + * instead of hiding them (done by replacing them with the + * space glyph and zeroing the advance width.) + * @HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES takes + * precedence over this flag. Since: 1.8.0 * * Since: 0.9.20 */ @@ -261,7 +269,8 @@ typedef enum { /*< flags >*/ HB_BUFFER_FLAG_DEFAULT = 0x00000000u, HB_BUFFER_FLAG_BOT = 0x00000001u, /* Beginning-of-text */ HB_BUFFER_FLAG_EOT = 0x00000002u, /* End-of-text */ - HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES = 0x00000004u + HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES = 0x00000004u, + HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES = 0x00000008u } hb_buffer_flags_t; HB_EXTERN void @@ -412,6 +421,9 @@ hb_buffer_normalize_glyphs (hb_buffer_t *buffer); * @HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS: do not serialize glyph position information. * @HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES: do no serialize glyph name. * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS: serialize glyph extents. + * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS: serialize glyph flags. Since: 1.5.0 + * @HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES: do not serialize glyph advances, + * glyph offsets will reflect absolute glyph positions. Since: 1.8.0 * * Flags that control what glyph information are serialized in hb_buffer_serialize_glyphs(). * @@ -423,7 +435,8 @@ typedef enum { /*< flags >*/ HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS = 0x00000002u, HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES = 0x00000004u, HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS = 0x00000008u, - HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS = 0x00000010u + HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS = 0x00000010u, + HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES = 0x00000020u } hb_buffer_serialize_flags_t; /** diff --git a/gfx/harfbuzz/src/hb-common.cc b/gfx/harfbuzz/src/hb-common.cc index cb1fb43ffbba..1d0e7264234b 100644 --- a/gfx/harfbuzz/src/hb-common.cc +++ b/gfx/harfbuzz/src/hb-common.cc @@ -524,6 +524,7 @@ hb_script_get_horizontal_direction (hb_script_t script) case HB_SCRIPT_PSALTER_PAHLAVI: /* Unicode-8.0 additions */ + case HB_SCRIPT_HATRAN: case HB_SCRIPT_OLD_HUNGARIAN: /* Unicode-9.0 additions */ diff --git a/gfx/harfbuzz/src/hb-face.cc b/gfx/harfbuzz/src/hb-face.cc index 26fddbe5292c..d8af8c1f37e8 100644 --- a/gfx/harfbuzz/src/hb-face.cc +++ b/gfx/harfbuzz/src/hb-face.cc @@ -164,7 +164,7 @@ hb_face_create (hb_blob_t *blob, if (unlikely (!blob)) blob = hb_blob_get_empty (); - hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (OT::Sanitizer::sanitize (hb_blob_reference (blob)), index); + hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (OT::Sanitizer().sanitize (hb_blob_reference (blob)), index); if (unlikely (!closure)) return hb_face_get_empty (); @@ -424,7 +424,7 @@ hb_face_get_upem (hb_face_t *face) void hb_face_t::load_upem (void) const { - hb_blob_t *head_blob = OT::Sanitizer::sanitize (reference_table (HB_OT_TAG_head)); + hb_blob_t *head_blob = OT::Sanitizer().sanitize (reference_table (HB_OT_TAG_head)); const OT::head *head_table = OT::Sanitizer::lock_instance (head_blob); upem = head_table->get_upem (); hb_blob_destroy (head_blob); @@ -468,7 +468,7 @@ hb_face_get_glyph_count (hb_face_t *face) void hb_face_t::load_num_glyphs (void) const { - hb_blob_t *maxp_blob = OT::Sanitizer::sanitize (reference_table (HB_OT_TAG_maxp)); + hb_blob_t *maxp_blob = OT::Sanitizer().sanitize (reference_table (HB_OT_TAG_maxp)); const OT::maxp *maxp_table = OT::Sanitizer::lock_instance (maxp_blob); num_glyphs = maxp_table->get_num_glyphs (); hb_blob_destroy (maxp_blob); diff --git a/gfx/harfbuzz/src/hb-font-private.hh b/gfx/harfbuzz/src/hb-font-private.hh index d2801fb86ec1..992152f176c4 100644 --- a/gfx/harfbuzz/src/hb-font-private.hh +++ b/gfx/harfbuzz/src/hb-font-private.hh @@ -128,6 +128,8 @@ struct hb_font_t { inline hb_position_t em_scale_y (int16_t v) { return em_scale (v, y_scale); } inline hb_position_t em_scalef_x (float v) { return em_scalef (v, this->x_scale); } inline hb_position_t em_scalef_y (float v) { return em_scalef (v, this->y_scale); } + inline float em_fscale_x (int16_t v) { return em_fscale (v, x_scale); } + inline float em_fscale_y (int16_t v) { return em_fscale (v, y_scale); } inline hb_position_t em_scale_dir (int16_t v, hb_direction_t direction) { return em_scale (v, dir_scale (direction)); } @@ -541,7 +543,11 @@ struct hb_font_t { } inline hb_position_t em_scalef (float v, int scale) { - return (hb_position_t) (v * scale / face->get_upem ()); + return (hb_position_t) round (v * scale / face->get_upem ()); + } + inline float em_fscale (int16_t v, int scale) + { + return (float) v * scale / face->get_upem (); } }; diff --git a/gfx/harfbuzz/src/hb-font.h b/gfx/harfbuzz/src/hb-font.h index 540cdcab9533..c95b61d2da89 100644 --- a/gfx/harfbuzz/src/hb-font.h +++ b/gfx/harfbuzz/src/hb-font.h @@ -456,7 +456,7 @@ hb_font_get_glyph_from_name (hb_font_t *font, /* high-level funcs, with fallback */ /* Calls either hb_font_get_nominal_glyph() if variation_selector is 0, - * otherwise callse hb_font_get_variation_glyph(). */ + * otherwise calls hb_font_get_variation_glyph(). */ HB_EXTERN hb_bool_t hb_font_get_glyph (hb_font_t *font, hb_codepoint_t unicode, hb_codepoint_t variation_selector, diff --git a/gfx/harfbuzz/src/hb-ft.cc b/gfx/harfbuzz/src/hb-ft.cc index 4f33e114b402..1c526cf37dcc 100644 --- a/gfx/harfbuzz/src/hb-ft.cc +++ b/gfx/harfbuzz/src/hb-ft.cc @@ -635,15 +635,27 @@ hb_ft_font_changed (hb_font_t *font) { if (!FT_Get_Var_Blend_Coordinates (ft_face, mm_var->num_axis, ft_coords)) { - for (unsigned int i = 0; i < mm_var->num_axis; ++i) - coords[i] = ft_coords[i] >>= 2; + bool nonzero = false; - hb_font_set_var_coords_normalized (font, coords, mm_var->num_axis); + for (unsigned int i = 0; i < mm_var->num_axis; ++i) + { + coords[i] = ft_coords[i] >>= 2; + nonzero = nonzero || coords[i]; + } + + if (nonzero) + hb_font_set_var_coords_normalized (font, coords, mm_var->num_axis); + else + hb_font_set_var_coords_normalized (font, nullptr, 0); } } free (coords); free (ft_coords); +#ifdef HAVE_FT_DONE_MM_VAR + FT_Done_MM_Var (ft_face->glyph->library, mm_var); +#else free (mm_var); +#endif } #endif } diff --git a/gfx/harfbuzz/src/hb-open-file-private.hh b/gfx/harfbuzz/src/hb-open-file-private.hh index 644e0b40f6ff..1e5676e82620 100644 --- a/gfx/harfbuzz/src/hb-open-file-private.hh +++ b/gfx/harfbuzz/src/hb-open-file-private.hh @@ -64,9 +64,9 @@ typedef struct TableRecord Tag tag; /* 4-byte identifier. */ CheckSum checkSum; /* CheckSum for this table. */ - UINT32 offset; /* Offset from beginning of TrueType font + HBUINT32 offset; /* Offset from beginning of TrueType font * file. */ - UINT32 length; /* Length of this table. */ + HBUINT32 length; /* Length of this table. */ public: DEFINE_SIZE_STATIC (16); } OpenTypeTable; @@ -154,7 +154,7 @@ struct TTCHeaderVersion1 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ FixedVersion<>version; /* Version of the TTC Header (1.0), * 0x00010000u */ - ArrayOf, UINT32> + ArrayOf, HBUINT32> table; /* Array of offsets to the OffsetTable for each font * from the beginning of the file */ public: diff --git a/gfx/harfbuzz/src/hb-open-type-private.hh b/gfx/harfbuzz/src/hb-open-type-private.hh index 2f4e1b9e9e9b..04e4a4e1ba9d 100644 --- a/gfx/harfbuzz/src/hb-open-type-private.hh +++ b/gfx/harfbuzz/src/hb-open-type-private.hh @@ -187,7 +187,8 @@ struct hb_sanitize_context_t : debug_depth (0), start (nullptr), end (nullptr), writable (false), edit_count (0), - blob (nullptr) {} + blob (nullptr), + num_glyphs (0) {} inline const char *get_name (void) { return "SANITIZE"; } template @@ -298,6 +299,7 @@ struct hb_sanitize_context_t : bool writable; unsigned int edit_count; hb_blob_t *blob; + unsigned int num_glyphs; }; @@ -306,8 +308,9 @@ struct hb_sanitize_context_t : template struct Sanitizer { - static hb_blob_t *sanitize (hb_blob_t *blob) { - hb_sanitize_context_t c[1]; + inline Sanitizer (void) {} + + inline hb_blob_t *sanitize (hb_blob_t *blob) { bool sane; /* TODO is_sane() stuff */ @@ -370,6 +373,11 @@ struct Sanitizer const char *base = hb_blob_get_data (blob, nullptr); return unlikely (!base) ? &Null(Type) : CastP (base); } + + inline void set_num_glyphs (unsigned int num_glyphs) { c->num_glyphs = num_glyphs; } + + private: + hb_sanitize_context_t c[1]; }; @@ -519,8 +527,6 @@ struct Supplier }; - - /* * * The OpenType Font File: Data Types @@ -635,22 +641,22 @@ struct IntType DEFINE_SIZE_STATIC (Size); }; -typedef IntType UINT8; /* 8-bit unsigned integer. */ -typedef IntType INT8; /* 8-bit signed integer. */ -typedef IntType UINT16; /* 16-bit unsigned integer. */ -typedef IntType INT16; /* 16-bit signed integer. */ -typedef IntType UINT32; /* 32-bit unsigned integer. */ -typedef IntType INT32; /* 32-bit signed integer. */ +typedef IntType HBUINT8; /* 8-bit unsigned integer. */ +typedef IntType HBINT8; /* 8-bit signed integer. */ +typedef IntType HBUINT16; /* 16-bit unsigned integer. */ +typedef IntType HBINT16; /* 16-bit signed integer. */ +typedef IntType HBUINT32; /* 32-bit unsigned integer. */ +typedef IntType HBINT32; /* 32-bit signed integer. */ typedef IntType UINT24; /* 24-bit unsigned integer. */ -/* 16-bit signed integer (INT16) that describes a quantity in FUnits. */ -typedef INT16 FWORD; +/* 16-bit signed integer (HBINT16) that describes a quantity in FUnits. */ +typedef HBINT16 FWORD; -/* 16-bit unsigned integer (UINT16) that describes a quantity in FUnits. */ -typedef UINT16 UFWORD; +/* 16-bit unsigned integer (HBUINT16) that describes a quantity in FUnits. */ +typedef HBUINT16 UFWORD; /* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */ -struct F2DOT14 : INT16 +struct F2DOT14 : HBINT16 { //inline float to_float (void) const { return ???; } //inline void set_float (float f) { v.set (f * ???); } @@ -659,7 +665,7 @@ struct F2DOT14 : INT16 }; /* 32-bit signed fixed-point number (16.16). */ -struct Fixed: INT32 +struct Fixed: HBINT32 { //inline float to_float (void) const { return ???; } //inline void set_float (float f) { v.set (f * ???); } @@ -677,15 +683,15 @@ struct LONGDATETIME return_trace (likely (c->check_struct (this))); } protected: - INT32 major; - UINT32 minor; + HBINT32 major; + HBUINT32 minor; public: DEFINE_SIZE_STATIC (8); }; /* Array of four uint8s (length = 32 bits) used to identify a script, language * system, feature, or baseline */ -struct Tag : UINT32 +struct Tag : HBUINT32 { /* What the char* converters return is NOT nul-terminated. Print using "%.4s" */ inline operator const char* (void) const { return reinterpret_cast (&this->v); } @@ -696,10 +702,10 @@ struct Tag : UINT32 DEFINE_NULL_DATA (Tag, " "); /* Glyph index number, same as uint16 (length = 16 bits) */ -typedef UINT16 GlyphID; +typedef HBUINT16 GlyphID; /* Script/language-system/feature index */ -struct Index : UINT16 { +struct Index : HBUINT16 { static const unsigned int NOT_FOUND_INDEX = 0xFFFFu; }; DEFINE_NULL_DATA (Index, "\xff\xff"); @@ -713,18 +719,18 @@ struct Offset : Type DEFINE_SIZE_STATIC (sizeof(Type)); }; -typedef Offset Offset16; -typedef Offset Offset32; +typedef Offset Offset16; +typedef Offset Offset32; /* CheckSum */ -struct CheckSum : UINT32 +struct CheckSum : HBUINT32 { /* This is reference implementation from the spec. */ - static inline uint32_t CalcTableChecksum (const UINT32 *Table, uint32_t Length) + static inline uint32_t CalcTableChecksum (const HBUINT32 *Table, uint32_t Length) { uint32_t Sum = 0L; - const UINT32 *EndPtr = Table+((Length+3) & ~3) / UINT32::static_size; + const HBUINT32 *EndPtr = Table+((Length+3) & ~3) / HBUINT32::static_size; while (Table < EndPtr) Sum += *Table++; @@ -733,7 +739,7 @@ struct CheckSum : UINT32 /* Note: data should be 4byte aligned and have 4byte padding at the end. */ inline void set_for_data (const void *data, unsigned int length) - { set (CalcTableChecksum ((const UINT32 *) data, length)); } + { set (CalcTableChecksum ((const HBUINT32 *) data, length)); } public: DEFINE_SIZE_STATIC (4); @@ -744,7 +750,7 @@ struct CheckSum : UINT32 * Version Numbers */ -template +template struct FixedVersion { inline uint32_t to_int (void) const { return (major << (sizeof(FixedType) * 8)) + minor; } @@ -768,7 +774,7 @@ struct FixedVersion * Use: (base+offset) */ -template +template struct OffsetTo : Offset { inline const Type& operator () (const void *base) const @@ -813,7 +819,7 @@ struct OffsetTo : Offset } DEFINE_SIZE_STATIC (sizeof(OffsetType)); }; -template struct LOffsetTo : OffsetTo {}; +template struct LOffsetTo : OffsetTo {}; template static inline const Type& operator + (const Base &base, const OffsetTo &offset) { return offset (base); } template @@ -825,7 +831,7 @@ static inline Type& operator + (Base &base, OffsetTo &offset) */ /* An array with a number of elements. */ -template +template struct ArrayOf { const Type *sub_array (unsigned int start_offset, unsigned int *pcount /* IN/OUT */) const @@ -935,10 +941,10 @@ struct ArrayOf public: DEFINE_SIZE_ARRAY (sizeof (LenType), array); }; -template struct LArrayOf : ArrayOf {}; +template struct LArrayOf : ArrayOf {}; /* Array of Offset's */ -template +template struct OffsetArrayOf : ArrayOf > {}; /* Array of offsets relative to the beginning of the array itself. */ @@ -966,7 +972,7 @@ struct OffsetListOf : OffsetArrayOf /* An array starting at second element. */ -template +template struct HeadlessArrayOf { inline const Type& operator [] (unsigned int i) const @@ -1028,19 +1034,19 @@ struct HeadlessArrayOf /* * An array with sorted elements. Supports binary searching. */ -template +template struct SortedArrayOf : ArrayOf { template inline int bsearch (const SearchType &x) const { /* Hand-coded bsearch here since this is in the hot inner loop. */ - const Type *array = this->array; + const Type *arr = this->array; int min = 0, max = (int) this->len - 1; while (min <= max) { int mid = (min + max) / 2; - int c = array[mid].cmp (x); + int c = arr[mid].cmp (x); if (c < 0) max = mid - 1; else if (c > 0) @@ -1067,10 +1073,10 @@ struct BinSearchHeader } protected: - UINT16 len; - UINT16 searchRangeZ; - UINT16 entrySelectorZ; - UINT16 rangeShiftZ; + HBUINT16 len; + HBUINT16 searchRangeZ; + HBUINT16 entrySelectorZ; + HBUINT16 rangeShiftZ; public: DEFINE_SIZE_STATIC (8); @@ -1139,8 +1145,8 @@ struct hb_lazy_table_loader_t inline void init (hb_face_t *face_) { face = face_; - instance = nullptr; blob = nullptr; + instance = nullptr; } inline void fini (void) @@ -1154,7 +1160,7 @@ struct hb_lazy_table_loader_t T *p = (T *) hb_atomic_ptr_get (&instance); if (unlikely (!p)) { - hb_blob_t *blob_ = OT::Sanitizer::sanitize (face->reference_table (T::tableTag)); + hb_blob_t *blob_ = OT::Sanitizer().sanitize (face->reference_table (T::tableTag)); p = const_cast(OT::Sanitizer::lock_instance (blob_)); if (!hb_atomic_ptr_cmpexch (const_cast(&instance), nullptr, p)) { @@ -1171,10 +1177,10 @@ struct hb_lazy_table_loader_t return get(); } - private: hb_face_t *face; - T *instance; mutable hb_blob_t *blob; + private: + mutable T *instance; }; diff --git a/gfx/harfbuzz/src/hb-ot-cbdt-table.hh b/gfx/harfbuzz/src/hb-ot-cbdt-table.hh index 415625e5f800..6c2b9a88ee13 100644 --- a/gfx/harfbuzz/src/hb-ot-cbdt-table.hh +++ b/gfx/harfbuzz/src/hb-ot-cbdt-table.hh @@ -47,20 +47,20 @@ struct SmallGlyphMetrics extents->height = -height; } - UINT8 height; - UINT8 width; - INT8 bearingX; - INT8 bearingY; - UINT8 advance; + HBUINT8 height; + HBUINT8 width; + HBINT8 bearingX; + HBINT8 bearingY; + HBUINT8 advance; DEFINE_SIZE_STATIC(5); }; struct BigGlyphMetrics : SmallGlyphMetrics { - INT8 vertBearingX; - INT8 vertBearingY; - UINT8 vertAdvance; + HBINT8 vertBearingX; + HBINT8 vertBearingY; + HBUINT8 vertAdvance; DEFINE_SIZE_STATIC(8); }; @@ -73,18 +73,18 @@ struct SBitLineMetrics return_trace (c->check_struct (this)); } - INT8 ascender; - INT8 decender; - UINT8 widthMax; - INT8 caretSlopeNumerator; - INT8 caretSlopeDenominator; - INT8 caretOffset; - INT8 minOriginSB; - INT8 minAdvanceSB; - INT8 maxBeforeBL; - INT8 minAfterBL; - INT8 padding1; - INT8 padding2; + HBINT8 ascender; + HBINT8 decender; + HBUINT8 widthMax; + HBINT8 caretSlopeNumerator; + HBINT8 caretSlopeDenominator; + HBINT8 caretOffset; + HBINT8 minOriginSB; + HBINT8 minAdvanceSB; + HBINT8 maxBeforeBL; + HBINT8 minAfterBL; + HBINT8 padding1; + HBINT8 padding2; DEFINE_SIZE_STATIC(12); }; @@ -102,9 +102,9 @@ struct IndexSubtableHeader return_trace (c->check_struct (this)); } - UINT16 indexFormat; - UINT16 imageFormat; - UINT32 imageDataOffset; + HBUINT16 indexFormat; + HBUINT16 imageFormat; + HBUINT32 imageDataOffset; DEFINE_SIZE_STATIC(8); }; @@ -137,8 +137,8 @@ struct IndexSubtableFormat1Or3 DEFINE_SIZE_ARRAY(8, offsetArrayZ); }; -struct IndexSubtableFormat1 : IndexSubtableFormat1Or3 {}; -struct IndexSubtableFormat3 : IndexSubtableFormat1Or3 {}; +struct IndexSubtableFormat1 : IndexSubtableFormat1Or3 {}; +struct IndexSubtableFormat3 : IndexSubtableFormat1Or3 {}; struct IndexSubtable { @@ -214,8 +214,8 @@ struct IndexSubtableRecord offset, length, format); } - UINT16 firstGlyphIndex; - UINT16 lastGlyphIndex; + HBUINT16 firstGlyphIndex; + HBUINT16 lastGlyphIndex; LOffsetTo offsetToSubtable; DEFINE_SIZE_STATIC(8); @@ -276,17 +276,17 @@ struct BitmapSizeTable protected: LOffsetTo indexSubtableArrayOffset; - UINT32 indexTablesSize; - UINT32 numberOfIndexSubtables; - UINT32 colorRef; + HBUINT32 indexTablesSize; + HBUINT32 numberOfIndexSubtables; + HBUINT32 colorRef; SBitLineMetrics horizontal; SBitLineMetrics vertical; - UINT16 startGlyphIndex; - UINT16 endGlyphIndex; - UINT8 ppemX; - UINT8 ppemY; - UINT8 bitDepth; - INT8 flags; + HBUINT16 startGlyphIndex; + HBUINT16 endGlyphIndex; + HBUINT8 ppemX; + HBUINT8 ppemY; + HBUINT8 bitDepth; + HBINT8 flags; public: DEFINE_SIZE_STATIC(48); @@ -300,8 +300,8 @@ struct BitmapSizeTable struct GlyphBitmapDataFormat17 { SmallGlyphMetrics glyphMetrics; - UINT32 dataLen; - UINT8 dataZ[VAR]; + HBUINT32 dataLen; + HBUINT8 dataZ[VAR]; DEFINE_SIZE_ARRAY(9, dataZ); }; @@ -379,8 +379,8 @@ struct CBDT { upem = face->get_upem(); - cblc_blob = Sanitizer::sanitize (face->reference_table (HB_OT_TAG_CBLC)); - cbdt_blob = Sanitizer::sanitize (face->reference_table (HB_OT_TAG_CBDT)); + cblc_blob = Sanitizer().sanitize (face->reference_table (HB_OT_TAG_CBLC)); + cbdt_blob = Sanitizer().sanitize (face->reference_table (HB_OT_TAG_CBDT)); cbdt_len = hb_blob_get_length (cbdt_blob); if (hb_blob_get_length (cblc_blob) == 0) { @@ -460,7 +460,7 @@ struct CBDT protected: FixedVersion<>version; - UINT8 dataZ[VAR]; + HBUINT8 dataZ[VAR]; public: DEFINE_SIZE_ARRAY(4, dataZ); diff --git a/gfx/harfbuzz/src/hb-ot-cmap-table.hh b/gfx/harfbuzz/src/hb-ot-cmap-table.hh index 883d7b3f0b22..b9d6e248ae9a 100644 --- a/gfx/harfbuzz/src/hb-ot-cmap-table.hh +++ b/gfx/harfbuzz/src/hb-ot-cmap-table.hh @@ -58,10 +58,10 @@ struct CmapSubtableFormat0 } protected: - UINT16 format; /* Format number is set to 0. */ - UINT16 lengthZ; /* Byte length of this subtable. */ - UINT16 languageZ; /* Ignore. */ - UINT8 glyphIdArray[256];/* An array that maps character + HBUINT16 format; /* Format number is set to 0. */ + HBUINT16 lengthZ; /* Byte length of this subtable. */ + HBUINT16 languageZ; /* Ignore. */ + HBUINT8 glyphIdArray[256];/* An array that maps character * code to glyph index values. */ public: DEFINE_SIZE_STATIC (6 + 256); @@ -88,8 +88,8 @@ struct CmapSubtableFormat4 /* Custom two-array bsearch. */ int min = 0, max = (int) thiz->segCount - 1; - const UINT16 *startCount = thiz->startCount; - const UINT16 *endCount = thiz->endCount; + const HBUINT16 *startCount = thiz->startCount; + const HBUINT16 *endCount = thiz->endCount; unsigned int i; while (min <= max) { @@ -127,11 +127,11 @@ struct CmapSubtableFormat4 return true; } - const UINT16 *endCount; - const UINT16 *startCount; - const UINT16 *idDelta; - const UINT16 *idRangeOffset; - const UINT16 *glyphIdArray; + const HBUINT16 *endCount; + const HBUINT16 *startCount; + const HBUINT16 *idDelta; + const HBUINT16 *idRangeOffset; + const HBUINT16 *glyphIdArray; unsigned int segCount; unsigned int glyphIdArrayLength; }; @@ -165,24 +165,24 @@ struct CmapSubtableFormat4 } protected: - UINT16 format; /* Format number is set to 4. */ - UINT16 length; /* This is the length in bytes of the + HBUINT16 format; /* Format number is set to 4. */ + HBUINT16 length; /* This is the length in bytes of the * subtable. */ - UINT16 languageZ; /* Ignore. */ - UINT16 segCountX2; /* 2 x segCount. */ - UINT16 searchRangeZ; /* 2 * (2**floor(log2(segCount))) */ - UINT16 entrySelectorZ; /* log2(searchRange/2) */ - UINT16 rangeShiftZ; /* 2 x segCount - searchRange */ + HBUINT16 languageZ; /* Ignore. */ + HBUINT16 segCountX2; /* 2 x segCount. */ + HBUINT16 searchRangeZ; /* 2 * (2**floor(log2(segCount))) */ + HBUINT16 entrySelectorZ; /* log2(searchRange/2) */ + HBUINT16 rangeShiftZ; /* 2 x segCount - searchRange */ - UINT16 values[VAR]; + HBUINT16 values[VAR]; #if 0 - UINT16 endCount[segCount]; /* End characterCode for each segment, + HBUINT16 endCount[segCount]; /* End characterCode for each segment, * last=0xFFFFu. */ - UINT16 reservedPad; /* Set to 0. */ - UINT16 startCount[segCount]; /* Start character code for each segment. */ - INT16 idDelta[segCount]; /* Delta for all character codes in segment. */ - UINT16 idRangeOffset[segCount];/* Offsets into glyphIdArray or 0 */ - UINT16 glyphIdArray[VAR]; /* Glyph index array (arbitrary length) */ + HBUINT16 reservedPad; /* Set to 0. */ + HBUINT16 startCount[segCount]; /* Start character code for each segment. */ + HBINT16 idDelta[segCount]; /* Delta for all character codes in segment. */ + HBUINT16 idRangeOffset[segCount];/* Offsets into glyphIdArray or 0 */ + HBUINT16 glyphIdArray[VAR]; /* Glyph index array (arbitrary length) */ #endif public: @@ -208,9 +208,9 @@ struct CmapSubtableLongGroup } private: - UINT32 startCharCode; /* First character code in this group. */ - UINT32 endCharCode; /* Last character code in this group. */ - UINT32 glyphID; /* Glyph index; interpretation depends on + HBUINT32 startCharCode; /* First character code in this group. */ + HBUINT32 endCharCode; /* Last character code in this group. */ + HBUINT32 glyphID; /* Glyph index; interpretation depends on * subtable format. */ public: DEFINE_SIZE_STATIC (12); @@ -247,8 +247,8 @@ struct CmapSubtableTrimmed DEFINE_SIZE_ARRAY (5 * sizeof (UINT), glyphIdArray); }; -struct CmapSubtableFormat6 : CmapSubtableTrimmed {}; -struct CmapSubtableFormat10 : CmapSubtableTrimmed {}; +struct CmapSubtableFormat6 : CmapSubtableTrimmed {}; +struct CmapSubtableFormat10 : CmapSubtableTrimmed {}; template struct CmapSubtableLongSegmented @@ -269,11 +269,11 @@ struct CmapSubtableLongSegmented } protected: - UINT16 format; /* Subtable format; set to 12. */ - UINT16 reservedZ; /* Reserved; set to 0. */ - UINT32 lengthZ; /* Byte length of this subtable. */ - UINT32 languageZ; /* Ignore. */ - SortedArrayOf + HBUINT16 format; /* Subtable format; set to 12. */ + HBUINT16 reservedZ; /* Reserved; set to 0. */ + HBUINT32 lengthZ; /* Byte length of this subtable. */ + HBUINT32 languageZ; /* Ignore. */ + SortedArrayOf groups; /* Groupings. */ public: DEFINE_SIZE_ARRAY (16, groups); @@ -316,13 +316,13 @@ struct UnicodeValueRange } UINT24 startUnicodeValue; /* First value in this range. */ - UINT8 additionalCount; /* Number of additional values in this + HBUINT8 additionalCount; /* Number of additional values in this * range. */ public: DEFINE_SIZE_STATIC (4); }; -typedef SortedArrayOf DefaultUVS; +typedef SortedArrayOf DefaultUVS; struct UVSMapping { @@ -343,7 +343,7 @@ struct UVSMapping DEFINE_SIZE_STATIC (5); }; -typedef SortedArrayOf NonDefaultUVS; +typedef SortedArrayOf NonDefaultUVS; struct VariationSelectorRecord { @@ -405,9 +405,9 @@ struct CmapSubtableFormat14 } protected: - UINT16 format; /* Format number is set to 14. */ - UINT32 lengthZ; /* Byte length of this subtable. */ - SortedArrayOf + HBUINT16 format; /* Format number is set to 14. */ + HBUINT32 lengthZ; /* Byte length of this subtable. */ + SortedArrayOf record; /* Variation selector records; sorted * in increasing order of `varSelector'. */ public: @@ -451,7 +451,7 @@ struct CmapSubtable public: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ CmapSubtableFormat0 format0; CmapSubtableFormat4 format4; CmapSubtableFormat6 format6; @@ -484,8 +484,8 @@ struct EncodingRecord subtable.sanitize (c, base)); } - UINT16 platformID; /* Platform ID. */ - UINT16 encodingID; /* Platform-specific encoding ID. */ + HBUINT16 platformID; /* Platform ID. */ + HBUINT16 encodingID; /* Platform-specific encoding ID. */ LOffsetTo subtable; /* Byte offset from beginning of table to the subtable for this encoding. */ public: @@ -508,7 +508,7 @@ struct cmap { inline void init (hb_face_t *face) { - this->blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_cmap)); + this->blob = OT::Sanitizer().sanitize (face->reference_table (HB_OT_TAG_cmap)); const OT::cmap *cmap = OT::Sanitizer::lock_instance (this->blob); const OT::CmapSubtable *subtable = nullptr; const OT::CmapSubtableFormat14 *subtable_uvs = nullptr; @@ -654,7 +654,7 @@ struct cmap } protected: - UINT16 version; /* Table version number (0). */ + HBUINT16 version; /* Table version number (0). */ SortedArrayOf encodingRecord; /* Encoding tables. */ public: diff --git a/gfx/harfbuzz/src/hb-ot-glyf-table.hh b/gfx/harfbuzz/src/hb-ot-glyf-table.hh index 88d3850b6ef1..67143c6393ab 100644 --- a/gfx/harfbuzz/src/hb-ot-glyf-table.hh +++ b/gfx/harfbuzz/src/hb-ot-glyf-table.hh @@ -54,7 +54,7 @@ struct loca } protected: - UINT8 dataX[VAR]; /* Location data. */ + HBUINT8 dataX[VAR]; /* Location data. */ DEFINE_SIZE_ARRAY (0, dataX); }; @@ -80,7 +80,7 @@ struct glyf struct GlyphHeader { - INT16 numberOfContours; /* If the number of contours is + HBINT16 numberOfContours; /* If the number of contours is * greater than or equal to zero, * this is a simple glyph; if negative, * this is a composite glyph. */ @@ -96,7 +96,7 @@ struct glyf { inline void init (hb_face_t *face) { - hb_blob_t *head_blob = Sanitizer::sanitize (face->reference_table (HB_OT_TAG_head)); + hb_blob_t *head_blob = Sanitizer().sanitize (face->reference_table (HB_OT_TAG_head)); const head *head_table = Sanitizer::lock_instance (head_blob); if ((unsigned int) head_table->indexToLocFormat > 1 || head_table->glyphDataFormat != 0) { @@ -107,9 +107,9 @@ struct glyf short_offset = 0 == head_table->indexToLocFormat; hb_blob_destroy (head_blob); - loca_blob = Sanitizer::sanitize (face->reference_table (HB_OT_TAG_loca)); + loca_blob = Sanitizer().sanitize (face->reference_table (HB_OT_TAG_loca)); loca_table = Sanitizer::lock_instance (loca_blob); - glyf_blob = Sanitizer::sanitize (face->reference_table (HB_OT_TAG_glyf)); + glyf_blob = Sanitizer().sanitize (face->reference_table (HB_OT_TAG_glyf)); glyf_table = Sanitizer::lock_instance (glyf_blob); num_glyphs = MAX (1u, hb_blob_get_length (loca_blob) / (short_offset ? 2 : 4)) - 1; @@ -131,13 +131,13 @@ struct glyf unsigned int start_offset, end_offset; if (short_offset) { - const UINT16 *offsets = (const UINT16 *) loca_table->dataX; + const HBUINT16 *offsets = (const HBUINT16 *) loca_table->dataX; start_offset = 2 * offsets[glyph]; end_offset = 2 * offsets[glyph + 1]; } else { - const UINT32 *offsets = (const UINT32 *) loca_table->dataX; + const HBUINT32 *offsets = (const HBUINT32 *) loca_table->dataX; start_offset = offsets[glyph]; end_offset = offsets[glyph + 1]; } @@ -169,7 +169,7 @@ struct glyf }; protected: - UINT8 dataX[VAR]; /* Glyphs data. */ + HBUINT8 dataX[VAR]; /* Glyphs data. */ DEFINE_SIZE_ARRAY (0, dataX); }; diff --git a/gfx/harfbuzz/src/hb-ot-head-table.hh b/gfx/harfbuzz/src/hb-ot-head-table.hh index dd4349ef85a3..2024cea7e78a 100644 --- a/gfx/harfbuzz/src/hb-ot-head-table.hh +++ b/gfx/harfbuzz/src/hb-ot-head-table.hh @@ -64,11 +64,11 @@ struct head FixedVersion<>version; /* Version of the head table--currently * 0x00010000u for version 1.0. */ FixedVersion<>fontRevision; /* Set by font manufacturer. */ - UINT32 checkSumAdjustment; /* To compute: set it to 0, sum the - * entire font as UINT32, then store + HBUINT32 checkSumAdjustment; /* To compute: set it to 0, sum the + * entire font as HBUINT32, then store * 0xB1B0AFBAu - sum. */ - UINT32 magicNumber; /* Set to 0x5F0F3CF5u. */ - UINT16 flags; /* Bit 0: Baseline for font at y=0; + HBUINT32 magicNumber; /* Set to 0x5F0F3CF5u. */ + HBUINT16 flags; /* Bit 0: Baseline for font at y=0; * Bit 1: Left sidebearing point at x=0; * Bit 2: Instructions may depend on point size; * Bit 3: Force ppem to integer values for all @@ -76,7 +76,6 @@ struct head * ppem sizes if this bit is clear; * Bit 4: Instructions may alter advance width * (the advance widths might not scale linearly); - * Bits 5-10: These should be set according to * Apple's specification. However, they are not * implemented in OpenType. @@ -96,7 +95,6 @@ struct head * contains any strong right-to-left glyphs. * Bit 10: This bit should be set if the font * contains Indic-style rearrangement effects. - * Bit 11: Font data is 'lossless,' as a result * of having been compressed and decompressed * with the Agfa MicroType Express engine. @@ -114,18 +112,18 @@ struct head * encoded in the cmap subtables represent proper * support for those code points. * Bit 15: Reserved, set to 0. */ - UINT16 unitsPerEm; /* Valid range is from 16 to 16384. This value + HBUINT16 unitsPerEm; /* Valid range is from 16 to 16384. This value * should be a power of 2 for fonts that have * TrueType outlines. */ LONGDATETIME created; /* Number of seconds since 12:00 midnight, January 1, 1904. 64-bit integer */ LONGDATETIME modified; /* Number of seconds since 12:00 midnight, January 1, 1904. 64-bit integer */ - INT16 xMin; /* For all glyph bounding boxes. */ - INT16 yMin; /* For all glyph bounding boxes. */ - INT16 xMax; /* For all glyph bounding boxes. */ - INT16 yMax; /* For all glyph bounding boxes. */ - UINT16 macStyle; /* Bit 0: Bold (if set to 1); + HBINT16 xMin; /* For all glyph bounding boxes. */ + HBINT16 yMin; /* For all glyph bounding boxes. */ + HBINT16 xMax; /* For all glyph bounding boxes. */ + HBINT16 yMax; /* For all glyph bounding boxes. */ + HBUINT16 macStyle; /* Bit 0: Bold (if set to 1); * Bit 1: Italic (if set to 1) * Bit 2: Underline (if set to 1) * Bit 3: Outline (if set to 1) @@ -133,16 +131,16 @@ struct head * Bit 5: Condensed (if set to 1) * Bit 6: Extended (if set to 1) * Bits 7-15: Reserved (set to 0). */ - UINT16 lowestRecPPEM; /* Smallest readable size in pixels. */ - INT16 fontDirectionHint; /* Deprecated (Set to 2). + HBUINT16 lowestRecPPEM; /* Smallest readable size in pixels. */ + HBINT16 fontDirectionHint; /* Deprecated (Set to 2). * 0: Fully mixed directional glyphs; * 1: Only strongly left to right; * 2: Like 1 but also contains neutrals; * -1: Only strongly right to left; * -2: Like -1 but also contains neutrals. */ public: - INT16 indexToLocFormat; /* 0 for short offsets, 1 for long. */ - INT16 glyphDataFormat; /* 0 for current format. */ + HBINT16 indexToLocFormat; /* 0 for short offsets, 1 for long. */ + HBINT16 glyphDataFormat; /* 0 for current format. */ DEFINE_SIZE_STATIC (54); }; diff --git a/gfx/harfbuzz/src/hb-ot-hhea-table.hh b/gfx/harfbuzz/src/hb-ot-hhea-table.hh index dca014148ea1..54eb5eb77327 100644 --- a/gfx/harfbuzz/src/hb-ot-hhea-table.hh +++ b/gfx/harfbuzz/src/hb-ot-hhea-table.hh @@ -64,21 +64,21 @@ struct _hea * (xMax - xMin)) for horizontal. */ FWORD maxExtent; /* horizontal: Max(lsb + (xMax - xMin)), * vertical: minLeadingBearing+(yMax-yMin). */ - INT16 caretSlopeRise; /* Used to calculate the slope of the + HBINT16 caretSlopeRise; /* Used to calculate the slope of the * cursor (rise/run); 1 for vertical caret, * 0 for horizontal.*/ - INT16 caretSlopeRun; /* 0 for vertical caret, 1 for horizontal. */ - INT16 caretOffset; /* The amount by which a slanted + HBINT16 caretSlopeRun; /* 0 for vertical caret, 1 for horizontal. */ + HBINT16 caretOffset; /* The amount by which a slanted * highlight on a glyph needs * to be shifted to produce the * best appearance. Set to 0 for * non-slanted fonts. */ - INT16 reserved1; /* Set to 0. */ - INT16 reserved2; /* Set to 0. */ - INT16 reserved3; /* Set to 0. */ - INT16 reserved4; /* Set to 0. */ - INT16 metricDataFormat; /* 0 for current format. */ - UINT16 numberOfLongMetrics; /* Number of LongMetric entries in metric + HBINT16 reserved1; /* Set to 0. */ + HBINT16 reserved2; /* Set to 0. */ + HBINT16 reserved3; /* Set to 0. */ + HBINT16 reserved4; /* Set to 0. */ + HBINT16 metricDataFormat; /* 0 for current format. */ + HBUINT16 numberOfLongMetrics; /* Number of LongMetric entries in metric * table. */ public: DEFINE_SIZE_STATIC (36); diff --git a/gfx/harfbuzz/src/hb-ot-hmtx-table.hh b/gfx/harfbuzz/src/hb-ot-hmtx-table.hh index e710aee42ec6..934acde77924 100644 --- a/gfx/harfbuzz/src/hb-ot-hmtx-table.hh +++ b/gfx/harfbuzz/src/hb-ot-hmtx-table.hh @@ -74,7 +74,7 @@ struct hmtxvmtx bool got_font_extents = false; if (T::os2Tag) { - hb_blob_t *os2_blob = Sanitizer::sanitize (face->reference_table (T::os2Tag)); + hb_blob_t *os2_blob = Sanitizer().sanitize (face->reference_table (T::os2Tag)); const os2 *os2_table = Sanitizer::lock_instance (os2_blob); #define USE_TYPO_METRICS (1u<<7) if (0 != (os2_table->fsSelection & USE_TYPO_METRICS)) @@ -87,7 +87,7 @@ struct hmtxvmtx hb_blob_destroy (os2_blob); } - hb_blob_t *_hea_blob = Sanitizer<_hea>::sanitize (face->reference_table (T::headerTag)); + hb_blob_t *_hea_blob = Sanitizer<_hea>().sanitize (face->reference_table (T::headerTag)); const _hea *_hea_table = Sanitizer<_hea>::lock_instance (_hea_blob); num_advances = _hea_table->numberOfLongMetrics; if (!got_font_extents) @@ -101,7 +101,7 @@ struct hmtxvmtx has_font_extents = got_font_extents; - blob = Sanitizer::sanitize (face->reference_table (T::tableTag)); + blob = Sanitizer().sanitize (face->reference_table (T::tableTag)); /* Cap num_metrics() and num_advances() based on table length. */ unsigned int len = hb_blob_get_length (blob); @@ -119,7 +119,7 @@ struct hmtxvmtx } table = Sanitizer::lock_instance (blob); - var_blob = Sanitizer::sanitize (face->reference_table (T::variationsTag)); + var_blob = Sanitizer().sanitize (face->reference_table (T::variationsTag)); var_table = Sanitizer::lock_instance (var_blob); } @@ -144,7 +144,7 @@ struct hmtxvmtx } return table->longMetric[MIN (glyph, (uint32_t) num_advances - 1)].advance - + var_table->get_advance_var (glyph, font->coords, font->num_coords); // TODO Optimize?! + + (font->num_coords ? var_table->get_advance_var (glyph, font->coords, font->num_coords) : 0); // TODO Optimize?! } public: diff --git a/gfx/harfbuzz/src/hb-ot-kern-table.hh b/gfx/harfbuzz/src/hb-ot-kern-table.hh index e07faca63f3c..368f547a6933 100644 --- a/gfx/harfbuzz/src/hb-ot-kern-table.hh +++ b/gfx/harfbuzz/src/hb-ot-kern-table.hh @@ -104,8 +104,8 @@ struct KernClassTable } protected: - UINT16 firstGlyph; /* First glyph in class range. */ - ArrayOf classes; /* Glyph classes. */ + HBUINT16 firstGlyph; /* First glyph in class range. */ + ArrayOf classes; /* Glyph classes. */ public: DEFINE_SIZE_ARRAY (4, classes); }; @@ -115,7 +115,7 @@ struct KernSubTableFormat2 inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right, const char *end) const { unsigned int l = (this+leftClassTable).get_class (left); - unsigned int r = (this+leftClassTable).get_class (left); + unsigned int r = (this+rightClassTable).get_class (right); unsigned int offset = l * rowWidth + r * sizeof (FWORD); const FWORD *arr = &(this+array); if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end)) @@ -136,7 +136,7 @@ struct KernSubTableFormat2 } protected: - UINT16 rowWidth; /* The width, in bytes, of a row in the table. */ + HBUINT16 rowWidth; /* The width, in bytes, of a row in the table. */ OffsetTo leftClassTable; /* Offset from beginning of this subtable to * left-hand class table. */ @@ -275,19 +275,19 @@ struct KernOT : KernTable }; protected: - UINT16 versionZ; /* Unused. */ - UINT16 length; /* Length of the subtable (including this header). */ - UINT8 format; /* Subtable format. */ - UINT8 coverage; /* Coverage bits. */ + HBUINT16 versionZ; /* Unused. */ + HBUINT16 length; /* Length of the subtable (including this header). */ + HBUINT8 format; /* Subtable format. */ + HBUINT8 coverage; /* Coverage bits. */ KernSubTable subtable; /* Subtable data. */ public: DEFINE_SIZE_MIN (6); }; protected: - UINT16 version; /* Version--0x0000u */ - UINT16 nTables; /* Number of subtables in the kerning table. */ - UINT8 data[VAR]; + HBUINT16 version; /* Version--0x0000u */ + HBUINT16 nTables; /* Number of subtables in the kerning table. */ + HBUINT8 data[VAR]; public: DEFINE_SIZE_ARRAY (4, data); }; @@ -314,10 +314,10 @@ struct KernAAT : KernTable }; protected: - UINT32 length; /* Length of the subtable (including this header). */ - UINT8 coverage; /* Coverage bits. */ - UINT8 format; /* Subtable format. */ - UINT16 tupleIndex; /* The tuple index (used for variations fonts). + HBUINT32 length; /* Length of the subtable (including this header). */ + HBUINT8 coverage; /* Coverage bits. */ + HBUINT8 format; /* Subtable format. */ + HBUINT16 tupleIndex; /* The tuple index (used for variations fonts). * This value specifies which tuple this subtable covers. */ KernSubTable subtable; /* Subtable data. */ public: @@ -325,9 +325,9 @@ struct KernAAT : KernTable }; protected: - UINT32 version; /* Version--0x00010000u */ - UINT32 nTables; /* Number of subtables in the kerning table. */ - UINT8 data[VAR]; + HBUINT32 version; /* Version--0x00010000u */ + HBUINT32 nTables; /* Number of subtables in the kerning table. */ + HBUINT8 data[VAR]; public: DEFINE_SIZE_ARRAY (8, data); }; @@ -360,7 +360,7 @@ struct kern { inline void init (hb_face_t *face) { - blob = Sanitizer::sanitize (face->reference_table (HB_OT_TAG_kern)); + blob = Sanitizer().sanitize (face->reference_table (HB_OT_TAG_kern)); table = Sanitizer::lock_instance (blob); table_length = hb_blob_get_length (blob); } @@ -380,7 +380,7 @@ struct kern protected: union { - UINT16 major; + HBUINT16 major; KernOT ot; KernAAT aat; } u; diff --git a/gfx/harfbuzz/src/hb-ot-layout-common-private.hh b/gfx/harfbuzz/src/hb-ot-layout-common-private.hh index 5e699e1967f6..31c436a09dd8 100644 --- a/gfx/harfbuzz/src/hb-ot-layout-common-private.hh +++ b/gfx/harfbuzz/src/hb-ot-layout-common-private.hh @@ -161,7 +161,7 @@ struct RangeRecord GlyphID start; /* First GlyphID in the range */ GlyphID end; /* Last GlyphID in the range */ - UINT16 value; /* Value */ + HBUINT16 value; /* Value */ public: DEFINE_SIZE_STATIC (6); }; @@ -175,7 +175,7 @@ struct IndexArray : ArrayOf unsigned int *_indexes /* OUT */) const { if (_count) { - const UINT16 *arr = this->sub_array (start_offset, _count); + const HBUINT16 *arr = this->sub_array (start_offset, _count); unsigned int count = *_count; for (unsigned int i = 0; i < count; i++) _indexes[i] = arr[i]; @@ -218,7 +218,7 @@ struct LangSys Offset16 lookupOrderZ; /* = Null (reserved for an offset to a * reordering table) */ - UINT16 reqFeatureIndex;/* Index of a feature required for this + HBUINT16 reqFeatureIndex;/* Index of a feature required for this * language system--if no required features * = 0xFFFFu */ IndexArray featureIndex; /* Array of indices into the FeatureList */ @@ -343,12 +343,12 @@ struct FeatureParamsSize return_trace (true); } - UINT16 designSize; /* Represents the design size in 720/inch + HBUINT16 designSize; /* Represents the design size in 720/inch * units (decipoints). The design size entry * must be non-zero. When there is a design * size but no recommended size range, the * rest of the array will consist of zeros. */ - UINT16 subfamilyID; /* Has no independent meaning, but serves + HBUINT16 subfamilyID; /* Has no independent meaning, but serves * as an identifier that associates fonts * in a subfamily. All fonts which share a * Preferred or Font Family name and which @@ -358,7 +358,7 @@ struct FeatureParamsSize * same subfamily value. If this value is * zero, the remaining fields in the array * will be ignored. */ - UINT16 subfamilyNameID;/* If the preceding value is non-zero, this + HBUINT16 subfamilyNameID;/* If the preceding value is non-zero, this * value must be set in the range 256 - 32767 * (inclusive). It records the value of a * field in the name table, which must @@ -372,10 +372,10 @@ struct FeatureParamsSize * subfamily in a menu. Applications will * choose the appropriate version based on * their selection criteria. */ - UINT16 rangeStart; /* Large end of the recommended usage range + HBUINT16 rangeStart; /* Large end of the recommended usage range * (inclusive), stored in 720/inch units * (decipoints). */ - UINT16 rangeEnd; /* Small end of the recommended usage range + HBUINT16 rangeEnd; /* Small end of the recommended usage range (exclusive), stored in 720/inch units * (decipoints). */ public: @@ -393,12 +393,12 @@ struct FeatureParamsStylisticSet return_trace (c->check_struct (this)); } - UINT16 version; /* (set to 0): This corresponds to a “minor” + HBUINT16 version; /* (set to 0): This corresponds to a “minor” * version number. Additional data may be * added to the end of this Feature Parameters * table in the future. */ - UINT16 uiNameID; /* The 'name' table name ID that specifies a + HBUINT16 uiNameID; /* The 'name' table name ID that specifies a * string (or strings, for multiple languages) * for a user-interface label for this * feature. The values of uiLabelNameId and @@ -426,25 +426,25 @@ struct FeatureParamsCharacterVariants characters.sanitize (c)); } - UINT16 format; /* Format number is set to 0. */ - UINT16 featUILableNameID; /* The ‘name’ table name ID that + HBUINT16 format; /* Format number is set to 0. */ + HBUINT16 featUILableNameID; /* The ‘name’ table name ID that * specifies a string (or strings, * for multiple languages) for a * user-interface label for this * feature. (May be nullptr.) */ - UINT16 featUITooltipTextNameID;/* The ‘name’ table name ID that + HBUINT16 featUITooltipTextNameID;/* The ‘name’ table name ID that * specifies a string (or strings, * for multiple languages) that an * application can use for tooltip * text for this feature. (May be * nullptr.) */ - UINT16 sampleTextNameID; /* The ‘name’ table name ID that + HBUINT16 sampleTextNameID; /* The ‘name’ table name ID that * specifies sample text that * illustrates the effect of this * feature. (May be nullptr.) */ - UINT16 numNamedParameters; /* Number of named parameters. (May + HBUINT16 numNamedParameters; /* Number of named parameters. (May * be zero.) */ - UINT16 firstParamUILabelNameID;/* The first ‘name’ table name ID + HBUINT16 firstParamUILabelNameID;/* The first ‘name’ table name ID * used to specify strings for * user-interface labels for the * feature parameters. (Must be zero @@ -562,7 +562,7 @@ struct Feature typedef RecordListOf FeatureList; -struct LookupFlag : UINT16 +struct LookupFlag : HBUINT16 { enum Flags { RightToLeft = 0x0001u, @@ -608,7 +608,7 @@ struct Lookup unsigned int flag = lookupFlag; if (unlikely (flag & LookupFlag::UseMarkFilteringSet)) { - const UINT16 &markFilteringSet = StructAfter (subTable); + const HBUINT16 &markFilteringSet = StructAfter (subTable); flag += (markFilteringSet << 16); } return flag; @@ -640,7 +640,7 @@ struct Lookup if (unlikely (!subTable.serialize (c, num_subtables))) return_trace (false); if (lookupFlag & LookupFlag::UseMarkFilteringSet) { - UINT16 &markFilteringSet = StructAfter (subTable); + HBUINT16 &markFilteringSet = StructAfter (subTable); markFilteringSet.set (lookup_props >> 16); } return_trace (true); @@ -653,18 +653,18 @@ struct Lookup if (!(c->check_struct (this) && subTable.sanitize (c))) return_trace (false); if (lookupFlag & LookupFlag::UseMarkFilteringSet) { - const UINT16 &markFilteringSet = StructAfter (subTable); + const HBUINT16 &markFilteringSet = StructAfter (subTable); if (!markFilteringSet.sanitize (c)) return_trace (false); } return_trace (true); } private: - UINT16 lookupType; /* Different enumerations for GSUB and GPOS */ - UINT16 lookupFlag; /* Lookup qualifiers */ + HBUINT16 lookupType; /* Different enumerations for GSUB and GPOS */ + HBUINT16 lookupFlag; /* Lookup qualifiers */ ArrayOf subTable; /* Array of SubTables */ - UINT16 markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets + HBUINT16 markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets * structure. This field is only present if bit * UseMarkFilteringSet of lookup flags is set. */ public: @@ -735,7 +735,7 @@ struct CoverageFormat1 private: protected: - UINT16 coverageFormat; /* Format identifier--format = 1 */ + HBUINT16 coverageFormat; /* Format identifier--format = 1 */ SortedArrayOf glyphArray; /* Array of GlyphIDs--in numerical order */ public: @@ -860,7 +860,7 @@ struct CoverageFormat2 private: protected: - UINT16 coverageFormat; /* Format identifier--format = 2 */ + HBUINT16 coverageFormat; /* Format identifier--format = 2 */ SortedArrayOf rangeRecord; /* Array of glyph ranges--ordered by * Start GlyphID. rangeCount entries @@ -874,8 +874,8 @@ struct Coverage inline unsigned int get_coverage (hb_codepoint_t glyph_id) const { switch (u.format) { - case 1: return u.format1.get_coverage(glyph_id); - case 2: return u.format2.get_coverage(glyph_id); + case 1: return u.format1.get_coverage (glyph_id); + case 2: return u.format2.get_coverage (glyph_id); default:return NOT_COVERED; } } @@ -987,7 +987,7 @@ struct Coverage protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ CoverageFormat1 format1; CoverageFormat2 format2; } u; @@ -1074,9 +1074,9 @@ struct ClassDefFormat1 } protected: - UINT16 classFormat; /* Format identifier--format = 1 */ + HBUINT16 classFormat; /* Format identifier--format = 1 */ GlyphID startGlyph; /* First GlyphID of the classValueArray */ - ArrayOf + ArrayOf classValue; /* Array of Class Values--one per GlyphID */ public: DEFINE_SIZE_ARRAY (6, classValue); @@ -1148,7 +1148,7 @@ struct ClassDefFormat2 } protected: - UINT16 classFormat; /* Format identifier--format = 2 */ + HBUINT16 classFormat; /* Format identifier--format = 2 */ SortedArrayOf rangeRecord; /* Array of glyph ranges--ordered by * Start GlyphID */ @@ -1161,8 +1161,8 @@ struct ClassDef inline unsigned int get_class (hb_codepoint_t glyph_id) const { switch (u.format) { - case 1: return u.format1.get_class(glyph_id); - case 2: return u.format2.get_class(glyph_id); + case 1: return u.format1.get_class (glyph_id); + case 2: return u.format2.get_class (glyph_id); default:return 0; } } @@ -1210,7 +1210,7 @@ struct ClassDef protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ ClassDefFormat1 format1; ClassDefFormat2 format2; } u; @@ -1275,10 +1275,11 @@ struct VarRegionList const VarRegionAxis *axes = axesZ + (region_index * axisCount); float v = 1.; - unsigned int count = MIN (coord_len, (unsigned int) axisCount); + unsigned int count = axisCount; for (unsigned int i = 0; i < count; i++) { - float factor = axes[i].evaluate (coords[i]); + int coord = i < coord_len ? coords[i] : 0; + float factor = axes[i].evaluate (coord); if (factor == 0.) return 0.; v *= factor; @@ -1295,8 +1296,8 @@ struct VarRegionList } protected: - UINT16 axisCount; - UINT16 regionCount; + HBUINT16 axisCount; + HBUINT16 regionCount; VarRegionAxis axesZ[VAR]; public: DEFINE_SIZE_ARRAY (4, axesZ); @@ -1320,19 +1321,19 @@ struct VarData unsigned int count = regionIndices.len; unsigned int scount = shortCount; - const UINT8 *bytes = &StructAfter (regionIndices); - const UINT8 *row = bytes + inner * (scount + count); + const HBUINT8 *bytes = &StructAfter (regionIndices); + const HBUINT8 *row = bytes + inner * (scount + count); float delta = 0.; unsigned int i = 0; - const INT16 *scursor = reinterpret_cast (row); + const HBINT16 *scursor = reinterpret_cast (row); for (; i < scount; i++) { float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count); delta += scalar * *scursor++; } - const INT8 *bcursor = reinterpret_cast (scursor); + const HBINT8 *bcursor = reinterpret_cast (scursor); for (; i < count; i++) { float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count); @@ -1348,15 +1349,15 @@ struct VarData return_trace (c->check_struct (this) && regionIndices.sanitize(c) && shortCount <= regionIndices.len && - c->check_array (&StructAfter (regionIndices), + c->check_array (&StructAfter (regionIndices), get_row_size (), itemCount)); } protected: - UINT16 itemCount; - UINT16 shortCount; - ArrayOf regionIndices; - UINT8 bytesX[VAR]; + HBUINT16 itemCount; + HBUINT16 shortCount; + ArrayOf regionIndices; + HBUINT8 bytesX[VAR]; public: DEFINE_SIZE_ARRAY2 (6, regionIndices, bytesX); }; @@ -1392,9 +1393,9 @@ struct VariationStore } protected: - UINT16 format; + HBUINT16 format; LOffsetTo regions; - OffsetArrayOf dataSets; + OffsetArrayOf dataSets; public: DEFINE_SIZE_ARRAY (8, dataSets); }; @@ -1421,8 +1422,8 @@ struct ConditionFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ - UINT16 axisIndex; + HBUINT16 format; /* Format identifier--format = 1 */ + HBUINT16 axisIndex; F2DOT14 filterRangeMinValue; F2DOT14 filterRangeMaxValue; public: @@ -1451,7 +1452,7 @@ struct Condition protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ ConditionFormat1 format1; } u; public: @@ -1476,7 +1477,7 @@ struct ConditionSet } protected: - OffsetArrayOf conditions; + OffsetArrayOf conditions; public: DEFINE_SIZE_ARRAY (2, conditions); }; @@ -1492,7 +1493,7 @@ struct FeatureTableSubstitutionRecord } protected: - UINT16 featureIndex; + HBUINT16 featureIndex; LOffsetTo feature; public: DEFINE_SIZE_STATIC (6); @@ -1612,8 +1613,8 @@ struct HintingDevice inline unsigned int get_size (void) const { unsigned int f = deltaFormat; - if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * UINT16::static_size; - return UINT16::static_size * (4 + ((endSize - startSize) >> (4 - f))); + if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * HBUINT16::static_size; + return HBUINT16::static_size * (4 + ((endSize - startSize) >> (4 - f))); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -1658,14 +1659,14 @@ struct HintingDevice } protected: - UINT16 startSize; /* Smallest size to correct--in ppem */ - UINT16 endSize; /* Largest size to correct--in ppem */ - UINT16 deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3 + HBUINT16 startSize; /* Smallest size to correct--in ppem */ + HBUINT16 endSize; /* Largest size to correct--in ppem */ + HBUINT16 deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3 * 1 Signed 2-bit value, 8 values per uint16 * 2 Signed 4-bit value, 4 values per uint16 * 3 Signed 8-bit value, 2 values per uint16 */ - UINT16 deltaValue[VAR]; /* Array of compressed data */ + HBUINT16 deltaValue[VAR]; /* Array of compressed data */ public: DEFINE_SIZE_ARRAY (6, deltaValue); }; @@ -1696,9 +1697,9 @@ struct VariationDevice } protected: - UINT16 outerIndex; - UINT16 innerIndex; - UINT16 deltaFormat; /* Format identifier for this table: 0x0x8000 */ + HBUINT16 outerIndex; + HBUINT16 innerIndex; + HBUINT16 deltaFormat; /* Format identifier for this table: 0x0x8000 */ public: DEFINE_SIZE_STATIC (6); }; @@ -1706,10 +1707,10 @@ struct VariationDevice struct DeviceHeader { protected: - UINT16 reserved1; - UINT16 reserved2; + HBUINT16 reserved1; + HBUINT16 reserved2; public: - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ public: DEFINE_SIZE_STATIC (6); }; diff --git a/gfx/harfbuzz/src/hb-ot-layout-gdef-table.hh b/gfx/harfbuzz/src/hb-ot-layout-gdef-table.hh index eed46dd67289..aad7d60290d5 100644 --- a/gfx/harfbuzz/src/hb-ot-layout-gdef-table.hh +++ b/gfx/harfbuzz/src/hb-ot-layout-gdef-table.hh @@ -41,7 +41,7 @@ namespace OT { * Attachment List Table */ -typedef ArrayOf AttachPoint; /* Array of contour point indices--in +typedef ArrayOf AttachPoint; /* Array of contour point indices--in * increasing numerical order */ struct AttachList @@ -62,7 +62,7 @@ struct AttachList const AttachPoint &points = this+attachPoint[index]; if (point_count) { - const UINT16 *array = points.sub_array (start_offset, point_count); + const HBUINT16 *array = points.sub_array (start_offset, point_count); unsigned int count = *point_count; for (unsigned int i = 0; i < count; i++) point_array[i] = array[i]; @@ -109,8 +109,8 @@ struct CaretValueFormat1 } protected: - UINT16 caretValueFormat; /* Format identifier--format = 1 */ - INT16 coordinate; /* X or Y value, in design units */ + HBUINT16 caretValueFormat; /* Format identifier--format = 1 */ + HBINT16 coordinate; /* X or Y value, in design units */ public: DEFINE_SIZE_STATIC (4); }; @@ -136,8 +136,8 @@ struct CaretValueFormat2 } protected: - UINT16 caretValueFormat; /* Format identifier--format = 2 */ - UINT16 caretValuePoint; /* Contour point index on glyph */ + HBUINT16 caretValueFormat; /* Format identifier--format = 2 */ + HBUINT16 caretValuePoint; /* Contour point index on glyph */ public: DEFINE_SIZE_STATIC (4); }; @@ -160,8 +160,8 @@ struct CaretValueFormat3 } protected: - UINT16 caretValueFormat; /* Format identifier--format = 3 */ - INT16 coordinate; /* X or Y value, in design units */ + HBUINT16 caretValueFormat; /* Format identifier--format = 3 */ + HBINT16 coordinate; /* X or Y value, in design units */ OffsetTo deviceTable; /* Offset to Device table for X or Y * value--from beginning of CaretValue @@ -199,7 +199,7 @@ struct CaretValue protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ CaretValueFormat1 format1; CaretValueFormat2 format2; CaretValueFormat3 format3; @@ -294,7 +294,7 @@ struct MarkGlyphSetsFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ ArrayOf > coverage; /* Array of long offsets to mark set * coverage tables */ @@ -324,7 +324,7 @@ struct MarkGlyphSets protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ MarkGlyphSetsFormat1 format1; } u; public: diff --git a/gfx/harfbuzz/src/hb-ot-layout-gpos-table.hh b/gfx/harfbuzz/src/hb-ot-layout-gpos-table.hh index b344d793c7c2..3ef3d30b084c 100644 --- a/gfx/harfbuzz/src/hb-ot-layout-gpos-table.hh +++ b/gfx/harfbuzz/src/hb-ot-layout-gpos-table.hh @@ -51,11 +51,11 @@ enum attach_type_t { /* Shared Tables: ValueRecord, Anchor Table, and MarkArray */ -typedef UINT16 Value; +typedef HBUINT16 Value; typedef Value ValueRecord[VAR]; -struct ValueFormat : UINT16 +struct ValueFormat : HBUINT16 { enum Flags { xPlacement = 0x0001u, /* Includes horizontal adjustment for placement */ @@ -74,14 +74,14 @@ struct ValueFormat : UINT16 /* All fields are options. Only those available advance the value pointer. */ #if 0 - INT16 xPlacement; /* Horizontal adjustment for + HBINT16 xPlacement; /* Horizontal adjustment for * placement--in design units */ - INT16 yPlacement; /* Vertical adjustment for + HBINT16 yPlacement; /* Vertical adjustment for * placement--in design units */ - INT16 xAdvance; /* Horizontal adjustment for + HBINT16 xAdvance; /* Horizontal adjustment for * advance--in design units (only used * for horizontal writing) */ - INT16 yAdvance; /* Vertical adjustment for advance--in + HBINT16 yAdvance; /* Vertical adjustment for advance--in * design units (only used for vertical * writing) */ Offset xPlaDevice; /* Offset to Device table for @@ -103,7 +103,7 @@ struct ValueFormat : UINT16 inline unsigned int get_size (void) const { return get_len () * Value::static_size; } - void apply_value (hb_apply_context_t *c, + void apply_value (hb_ot_apply_context_t *c, const void *base, const Value *values, hb_glyph_position_t &glyph_pos) const @@ -178,8 +178,8 @@ struct ValueFormat : UINT16 static inline const OffsetTo& get_device (const Value* value) { return *CastP > (value); } - static inline const INT16& get_short (const Value* value) - { return *CastP (value); } + static inline const HBINT16& get_short (const Value* value) + { return *CastP (value); } public: @@ -232,12 +232,12 @@ struct ValueFormat : UINT16 struct AnchorFormat1 { - inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED, - hb_position_t *x, hb_position_t *y) const + inline void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED, + float *x, float *y) const { hb_font_t *font = c->font; - *x = font->em_scale_x (xCoordinate); - *y = font->em_scale_y (yCoordinate); + *x = font->em_fscale_x (xCoordinate); + *y = font->em_fscale_y (yCoordinate); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -247,17 +247,17 @@ struct AnchorFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ - INT16 xCoordinate; /* Horizontal value--in design units */ - INT16 yCoordinate; /* Vertical value--in design units */ + HBUINT16 format; /* Format identifier--format = 1 */ + HBINT16 xCoordinate; /* Horizontal value--in design units */ + HBINT16 yCoordinate; /* Vertical value--in design units */ public: DEFINE_SIZE_STATIC (6); }; struct AnchorFormat2 { - inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id, - hb_position_t *x, hb_position_t *y) const + inline void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id, + float *x, float *y) const { hb_font_t *font = c->font; unsigned int x_ppem = font->x_ppem; @@ -267,8 +267,8 @@ struct AnchorFormat2 ret = (x_ppem || y_ppem) && font->get_glyph_contour_point_for_origin (glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy); - *x = ret && x_ppem ? cx : font->em_scale_x (xCoordinate); - *y = ret && y_ppem ? cy : font->em_scale_y (yCoordinate); + *x = ret && x_ppem ? cx : font->em_fscale_x (xCoordinate); + *y = ret && y_ppem ? cy : font->em_fscale_y (yCoordinate); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -278,22 +278,22 @@ struct AnchorFormat2 } protected: - UINT16 format; /* Format identifier--format = 2 */ - INT16 xCoordinate; /* Horizontal value--in design units */ - INT16 yCoordinate; /* Vertical value--in design units */ - UINT16 anchorPoint; /* Index to glyph contour point */ + HBUINT16 format; /* Format identifier--format = 2 */ + HBINT16 xCoordinate; /* Horizontal value--in design units */ + HBINT16 yCoordinate; /* Vertical value--in design units */ + HBUINT16 anchorPoint; /* Index to glyph contour point */ public: DEFINE_SIZE_STATIC (8); }; struct AnchorFormat3 { - inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED, - hb_position_t *x, hb_position_t *y) const + inline void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED, + float *x, float *y) const { hb_font_t *font = c->font; - *x = font->em_scale_x (xCoordinate); - *y = font->em_scale_y (yCoordinate); + *x = font->em_fscale_x (xCoordinate); + *y = font->em_fscale_y (yCoordinate); if (font->x_ppem || font->num_coords) *x += (this+xDeviceTable).get_x_delta (font, c->var_store); @@ -308,9 +308,9 @@ struct AnchorFormat3 } protected: - UINT16 format; /* Format identifier--format = 3 */ - INT16 xCoordinate; /* Horizontal value--in design units */ - INT16 yCoordinate; /* Vertical value--in design units */ + HBUINT16 format; /* Format identifier--format = 3 */ + HBINT16 xCoordinate; /* Horizontal value--in design units */ + HBINT16 yCoordinate; /* Vertical value--in design units */ OffsetTo xDeviceTable; /* Offset to Device table for X * coordinate-- from beginning of @@ -325,15 +325,15 @@ struct AnchorFormat3 struct Anchor { - inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id, - hb_position_t *x, hb_position_t *y) const + inline void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id, + float *x, float *y) const { *x = *y = 0; switch (u.format) { case 1: u.format1.get_anchor (c, glyph_id, x, y); return; case 2: u.format2.get_anchor (c, glyph_id, x, y); return; case 3: u.format3.get_anchor (c, glyph_id, x, y); return; - default: return; + default: return; } } @@ -351,7 +351,7 @@ struct Anchor protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ AnchorFormat1 format1; AnchorFormat2 format2; AnchorFormat3 format3; @@ -382,7 +382,7 @@ struct AnchorMatrix return_trace (true); } - UINT16 rows; /* Number of rows */ + HBUINT16 rows; /* Number of rows */ protected: OffsetTo matrixZ[VAR]; /* Matrix of offsets to Anchor tables-- @@ -403,7 +403,7 @@ struct MarkRecord } protected: - UINT16 klass; /* Class defined for this mark */ + HBUINT16 klass; /* Class defined for this mark */ OffsetTo markAnchor; /* Offset to Anchor table--from * beginning of MarkArray table */ @@ -413,7 +413,7 @@ struct MarkRecord struct MarkArray : ArrayOf /* Array of MarkRecords--in Coverage order */ { - inline bool apply (hb_apply_context_t *c, + inline bool apply (hb_ot_apply_context_t *c, unsigned int mark_index, unsigned int glyph_index, const AnchorMatrix &anchors, unsigned int class_count, unsigned int glyph_pos) const @@ -430,15 +430,15 @@ struct MarkArray : ArrayOf /* Array of MarkRecords--in Coverage orde * return false such that the subsequent subtables have a chance at it. */ if (unlikely (!found)) return_trace (false); - hb_position_t mark_x, mark_y, base_x, base_y; + float mark_x, mark_y, base_x, base_y; buffer->unsafe_to_break (glyph_pos, buffer->idx); mark_anchor.get_anchor (c, buffer->cur().codepoint, &mark_x, &mark_y); glyph_anchor.get_anchor (c, buffer->info[glyph_pos].codepoint, &base_x, &base_y); hb_glyph_position_t &o = buffer->cur_pos(); - o.x_offset = base_x - mark_x; - o.y_offset = base_y - mark_y; + o.x_offset = round (base_x - mark_x); + o.y_offset = round (base_y - mark_y); o.attach_type() = ATTACH_TYPE_MARK; o.attach_chain() = (int) glyph_pos - (int) buffer->idx; buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT; @@ -470,7 +470,7 @@ struct SinglePosFormat1 return this+coverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_buffer_t *buffer = c->buffer; @@ -492,7 +492,7 @@ struct SinglePosFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of subtable */ @@ -518,7 +518,7 @@ struct SinglePosFormat2 return this+coverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_buffer_t *buffer = c->buffer; @@ -544,13 +544,13 @@ struct SinglePosFormat2 } protected: - UINT16 format; /* Format identifier--format = 2 */ + HBUINT16 format; /* Format identifier--format = 2 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of subtable */ ValueFormat valueFormat; /* Defines the types of data in the * ValueRecord */ - UINT16 valueCount; /* Number of ValueRecords */ + HBUINT16 valueCount; /* Number of ValueRecords */ ValueRecord values; /* Array of ValueRecords--positioning * values applied to glyphs */ public: @@ -573,7 +573,7 @@ struct SinglePos protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ SinglePosFormat1 format1; SinglePosFormat2 format2; } u; @@ -604,13 +604,13 @@ struct PairSet TRACE_COLLECT_GLYPHS (this); unsigned int len1 = valueFormats[0].get_len (); unsigned int len2 = valueFormats[1].get_len (); - unsigned int record_size = UINT16::static_size * (1 + len1 + len2); + unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2); const PairValueRecord *record = CastP (arrayZ); c->input->add_array (&record->secondGlyph, len, record_size); } - inline bool apply (hb_apply_context_t *c, + inline bool apply (hb_ot_apply_context_t *c, const ValueFormat *valueFormats, unsigned int pos) const { @@ -618,7 +618,7 @@ struct PairSet hb_buffer_t *buffer = c->buffer; unsigned int len1 = valueFormats[0].get_len (); unsigned int len2 = valueFormats[1].get_len (); - unsigned int record_size = UINT16::static_size * (1 + len1 + len2); + unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2); const PairValueRecord *record_array = CastP (arrayZ); unsigned int count = len; @@ -663,7 +663,7 @@ struct PairSet { TRACE_SANITIZE (this); if (!(c->check_struct (this) - && c->check_array (arrayZ, UINT16::static_size * closure->stride, len))) return_trace (false); + && c->check_array (arrayZ, HBUINT16::static_size * closure->stride, len))) return_trace (false); unsigned int count = len; const PairValueRecord *record = CastP (arrayZ); @@ -672,8 +672,8 @@ struct PairSet } protected: - UINT16 len; /* Number of PairValueRecords */ - UINT16 arrayZ[VAR]; /* Array of PairValueRecords--ordered + HBUINT16 len; /* Number of PairValueRecords */ + HBUINT16 arrayZ[VAR]; /* Array of PairValueRecords--ordered * by GlyphID of the second glyph */ public: DEFINE_SIZE_ARRAY (2, arrayZ); @@ -695,14 +695,14 @@ struct PairPosFormat1 return this+coverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_buffer_t *buffer = c->buffer; unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); - hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; + hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; skippy_iter.reset (buffer->idx, 1); if (!skippy_iter.next ()) return_trace (false); @@ -728,7 +728,7 @@ struct PairPosFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of subtable */ @@ -759,14 +759,14 @@ struct PairPosFormat2 return this+coverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_buffer_t *buffer = c->buffer; unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); - hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; + hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; skippy_iter.reset (buffer->idx, 1); if (!skippy_iter.next ()) return_trace (false); @@ -809,7 +809,7 @@ struct PairPosFormat2 } protected: - UINT16 format; /* Format identifier--format = 2 */ + HBUINT16 format; /* Format identifier--format = 2 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of subtable */ @@ -827,9 +827,9 @@ struct PairPosFormat2 classDef2; /* Offset to ClassDef table--from * beginning of PairPos subtable--for * the second glyph of the pair */ - UINT16 class1Count; /* Number of classes in ClassDef1 + HBUINT16 class1Count; /* Number of classes in ClassDef1 * table--includes Class0 */ - UINT16 class2Count; /* Number of classes in ClassDef2 + HBUINT16 class2Count; /* Number of classes in ClassDef2 * table--includes Class0 */ ValueRecord values; /* Matrix of value pairs: * class1-major, class2-minor, @@ -854,7 +854,7 @@ struct PairPos protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ PairPosFormat1 format1; PairPosFormat2 format2; } u; @@ -900,7 +900,7 @@ struct CursivePosFormat1 return this+coverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_buffer_t *buffer = c->buffer; @@ -908,7 +908,7 @@ struct CursivePosFormat1 const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage (buffer->cur().codepoint)]; if (!this_record.exitAnchor) return_trace (false); - hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; + hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; skippy_iter.reset (buffer->idx, 1); if (!skippy_iter.next ()) return_trace (false); @@ -919,7 +919,7 @@ struct CursivePosFormat1 unsigned int j = skippy_iter.idx; buffer->unsafe_to_break (i, j); - hb_position_t entry_x, entry_y, exit_x, exit_y; + float entry_x, entry_y, exit_x, exit_y; (this+this_record.exitAnchor).get_anchor (c, buffer->info[i].codepoint, &exit_x, &exit_y); (this+next_record.entryAnchor).get_anchor (c, buffer->info[j].codepoint, &entry_x, &entry_y); @@ -929,32 +929,32 @@ struct CursivePosFormat1 /* Main-direction adjustment */ switch (c->direction) { case HB_DIRECTION_LTR: - pos[i].x_advance = exit_x + pos[i].x_offset; + pos[i].x_advance = round (exit_x) + pos[i].x_offset; - d = entry_x + pos[j].x_offset; + d = round (entry_x) + pos[j].x_offset; pos[j].x_advance -= d; pos[j].x_offset -= d; break; case HB_DIRECTION_RTL: - d = exit_x + pos[i].x_offset; + d = round (exit_x) + pos[i].x_offset; pos[i].x_advance -= d; pos[i].x_offset -= d; - pos[j].x_advance = entry_x + pos[j].x_offset; + pos[j].x_advance = round (entry_x) + pos[j].x_offset; break; case HB_DIRECTION_TTB: - pos[i].y_advance = exit_y + pos[i].y_offset; + pos[i].y_advance = round (exit_y) + pos[i].y_offset; - d = entry_y + pos[j].y_offset; + d = round (entry_y) + pos[j].y_offset; pos[j].y_advance -= d; pos[j].y_offset -= d; break; case HB_DIRECTION_BTT: - d = exit_y + pos[i].y_offset; + d = round (exit_y) + pos[i].y_offset; pos[i].y_advance -= d; pos[i].y_offset -= d; - pos[j].y_advance = entry_y; + pos[j].y_advance = round (entry_y); break; case HB_DIRECTION_INVALID: default: @@ -1008,7 +1008,7 @@ struct CursivePosFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of subtable */ @@ -1034,7 +1034,7 @@ struct CursivePos protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ CursivePosFormat1 format1; } u; }; @@ -1059,7 +1059,7 @@ struct MarkBasePosFormat1 return this+markCoverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_buffer_t *buffer = c->buffer; @@ -1067,7 +1067,7 @@ struct MarkBasePosFormat1 if (likely (mark_index == NOT_COVERED)) return_trace (false); /* Now we search backwards for a non-mark glyph */ - hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; + hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; skippy_iter.reset (buffer->idx, 1); skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks); do { @@ -1099,14 +1099,14 @@ struct MarkBasePosFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo markCoverage; /* Offset to MarkCoverage table--from * beginning of MarkBasePos subtable */ OffsetTo baseCoverage; /* Offset to BaseCoverage table--from * beginning of MarkBasePos subtable */ - UINT16 classCount; /* Number of classes defined for marks */ + HBUINT16 classCount; /* Number of classes defined for marks */ OffsetTo markArray; /* Offset to MarkArray table--from * beginning of MarkBasePos subtable */ @@ -1132,7 +1132,7 @@ struct MarkBasePos protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ MarkBasePosFormat1 format1; } u; }; @@ -1162,7 +1162,7 @@ struct MarkLigPosFormat1 return this+markCoverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_buffer_t *buffer = c->buffer; @@ -1170,7 +1170,7 @@ struct MarkLigPosFormat1 if (likely (mark_index == NOT_COVERED)) return_trace (false); /* Now we search backwards for a non-mark glyph */ - hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; + hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; skippy_iter.reset (buffer->idx, 1); skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks); if (!skippy_iter.prev ()) return_trace (false); @@ -1216,7 +1216,7 @@ struct MarkLigPosFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo markCoverage; /* Offset to Mark Coverage table--from * beginning of MarkLigPos subtable */ @@ -1224,7 +1224,7 @@ struct MarkLigPosFormat1 ligatureCoverage; /* Offset to Ligature Coverage * table--from beginning of MarkLigPos * subtable */ - UINT16 classCount; /* Number of defined mark classes */ + HBUINT16 classCount; /* Number of defined mark classes */ OffsetTo markArray; /* Offset to MarkArray table--from * beginning of MarkLigPos subtable */ @@ -1250,7 +1250,7 @@ struct MarkLigPos protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ MarkLigPosFormat1 format1; } u; }; @@ -1275,7 +1275,7 @@ struct MarkMarkPosFormat1 return this+mark1Coverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_buffer_t *buffer = c->buffer; @@ -1283,7 +1283,7 @@ struct MarkMarkPosFormat1 if (likely (mark1_index == NOT_COVERED)) return_trace (false); /* now we search backwards for a suitable mark glyph until a non-mark glyph */ - hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; + hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; skippy_iter.reset (buffer->idx, 1); skippy_iter.set_lookup_props (c->lookup_props & ~LookupFlag::IgnoreFlags); if (!skippy_iter.prev ()) return_trace (false); @@ -1330,7 +1330,7 @@ struct MarkMarkPosFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo mark1Coverage; /* Offset to Combining Mark1 Coverage * table--from beginning of MarkMarkPos @@ -1339,7 +1339,7 @@ struct MarkMarkPosFormat1 mark2Coverage; /* Offset to Combining Mark2 Coverage * table--from beginning of MarkMarkPos * subtable */ - UINT16 classCount; /* Number of defined mark classes */ + HBUINT16 classCount; /* Number of defined mark classes */ OffsetTo mark1Array; /* Offset to Mark1Array table--from * beginning of MarkMarkPos subtable */ @@ -1365,7 +1365,7 @@ struct MarkMarkPos protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ MarkMarkPosFormat1 format1; } u; }; @@ -1424,7 +1424,7 @@ struct PosLookupSubTable protected: union { - UINT16 sub_format; + HBUINT16 sub_format; SinglePos single; PairPos pair; CursivePos cursive; @@ -1450,7 +1450,7 @@ struct PosLookup : Lookup return false; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); return_trace (dispatch (c)); @@ -1469,7 +1469,7 @@ struct PosLookup : Lookup dispatch (&c); } - static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index); + static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); template static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); @@ -1621,7 +1621,7 @@ template return l.dispatch (c); } -/*static*/ inline bool PosLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index) +/*static*/ inline bool PosLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos); const PosLookup &l = gpos.get_lookup (lookup_index); diff --git a/gfx/harfbuzz/src/hb-ot-layout-gsub-table.hh b/gfx/harfbuzz/src/hb-ot-layout-gsub-table.hh index 0b09c4e4a1ad..263e0a6e102b 100644 --- a/gfx/harfbuzz/src/hb-ot-layout-gsub-table.hh +++ b/gfx/harfbuzz/src/hb-ot-layout-gsub-table.hh @@ -76,7 +76,7 @@ struct SingleSubstFormat1 return_trace (c->len == 1 && (this+coverage).get_coverage (c->glyphs[0]) != NOT_COVERED); } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_codepoint_t glyph_id = c->buffer->cur().codepoint; @@ -110,11 +110,11 @@ struct SingleSubstFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ - INT16 deltaGlyphID; /* Add to original GlyphID to get + HBINT16 deltaGlyphID; /* Add to original GlyphID to get * substitute GlyphID */ public: DEFINE_SIZE_STATIC (6); @@ -161,7 +161,7 @@ struct SingleSubstFormat2 return_trace (c->len == 1 && (this+coverage).get_coverage (c->glyphs[0]) != NOT_COVERED); } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_codepoint_t glyph_id = c->buffer->cur().codepoint; @@ -195,7 +195,7 @@ struct SingleSubstFormat2 } protected: - UINT16 format; /* Format identifier--format = 2 */ + HBUINT16 format; /* Format identifier--format = 2 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ @@ -249,7 +249,7 @@ struct SingleSubst protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ SingleSubstFormat1 format1; SingleSubstFormat2 format2; } u; @@ -272,7 +272,7 @@ struct Sequence c->output->add_array (substitute.array, substitute.len); } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); unsigned int count = substitute.len; @@ -363,7 +363,7 @@ struct MultipleSubstFormat1 return_trace (c->len == 1 && (this+coverage).get_coverage (c->glyphs[0]) != NOT_COVERED); } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); @@ -398,7 +398,7 @@ struct MultipleSubstFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ @@ -440,7 +440,7 @@ struct MultipleSubst protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ MultipleSubstFormat1 format1; } u; }; @@ -495,7 +495,7 @@ struct AlternateSubstFormat1 return_trace (c->len == 1 && (this+coverage).get_coverage (c->glyphs[0]) != NOT_COVERED); } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_codepoint_t glyph_id = c->buffer->cur().codepoint; @@ -548,7 +548,7 @@ struct AlternateSubstFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ @@ -590,7 +590,7 @@ struct AlternateSubst protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ AlternateSubstFormat1 format1; } u; }; @@ -628,7 +628,7 @@ struct Ligature return_trace (true); } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); unsigned int count = component.len; @@ -730,7 +730,7 @@ struct LigatureSet return_trace (false); } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); unsigned int num_ligs = ligature.len; @@ -821,7 +821,7 @@ struct LigatureSubstFormat1 return_trace (lig_set.would_apply (c)); } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); hb_codepoint_t glyph_id = c->buffer->cur().codepoint; @@ -862,7 +862,7 @@ struct LigatureSubstFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ @@ -912,7 +912,7 @@ struct LigatureSubst protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ LigatureSubstFormat1 format1; } u; }; @@ -993,7 +993,7 @@ struct ReverseChainSingleSubstFormat1 return_trace (c->len == 1 && (this+coverage).get_coverage (c->glyphs[0]) != NOT_COVERED); } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); if (unlikely (c->nesting_level_left != HB_MAX_NESTING_LEVEL)) @@ -1007,11 +1007,11 @@ struct ReverseChainSingleSubstFormat1 unsigned int start_index = 0, end_index = 0; if (match_backtrack (c, - backtrack.len, (UINT16 *) backtrack.array, + backtrack.len, (HBUINT16 *) backtrack.array, match_coverage, this, &start_index) && match_lookahead (c, - lookahead.len, (UINT16 *) lookahead.array, + lookahead.len, (HBUINT16 *) lookahead.array, match_coverage, this, 1, &end_index)) { @@ -1039,7 +1039,7 @@ struct ReverseChainSingleSubstFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of table */ @@ -1073,7 +1073,7 @@ struct ReverseChainSingleSubst protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ ReverseChainSingleSubstFormat1 format1; } u; }; @@ -1119,7 +1119,7 @@ struct SubstLookupSubTable protected: union { - UINT16 sub_format; + HBUINT16 sub_format; SingleSubst single; MultipleSubst multiple; AlternateSubst alternate; @@ -1150,7 +1150,7 @@ struct SubstLookup : Lookup return lookup_type_is_reverse (type); } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); return_trace (dispatch (c)); @@ -1186,7 +1186,7 @@ struct SubstLookup : Lookup return_trace (dispatch (c)); } - static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index); + static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); inline SubstLookupSubTable& serialize_subtable (hb_serialize_context_t *c, unsigned int i) @@ -1272,10 +1272,9 @@ struct SubstLookup : Lookup { /* The spec says all subtables of an Extension lookup should * have the same type, which shall not be the Extension type - * itself. This is specially important if one has a reverse type! */ + * itself (but we already checked for that). + * This is specially important if one has a reverse type! */ unsigned int type = get_subtable (0).u.extension.get_type (); - if (unlikely (type == SubstLookupSubTable::Extension)) - return_trace (false); unsigned int count = get_subtable_count (); for (unsigned int i = 1; i < count; i++) if (get_subtable (i).u.extension.get_type () != type) @@ -1344,7 +1343,7 @@ template return l.dispatch (c); } -/*static*/ inline bool SubstLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index) +/*static*/ inline bool SubstLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub); const SubstLookup &l = gsub.get_lookup (lookup_index); diff --git a/gfx/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh b/gfx/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh index b08a59138e34..8a005f5a27a0 100644 --- a/gfx/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh +++ b/gfx/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh @@ -218,8 +218,8 @@ struct hb_add_coverage_context_t : }; -struct hb_apply_context_t : - hb_dispatch_context_t +struct hb_ot_apply_context_t : + hb_dispatch_context_t { struct matcher_t { @@ -234,7 +234,7 @@ struct hb_apply_context_t : match_func (nullptr), match_data (nullptr) {}; - typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const UINT16 &value, const void *data); + typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const HBUINT16 &value, const void *data); inline void set_ignore_zwnj (bool ignore_zwnj_) { ignore_zwnj = ignore_zwnj_; } inline void set_ignore_zwj (bool ignore_zwj_) { ignore_zwj = ignore_zwj_; } @@ -252,7 +252,7 @@ struct hb_apply_context_t : }; inline may_match_t may_match (const hb_glyph_info_t &info, - const UINT16 *glyph_data) const + const HBUINT16 *glyph_data) const { if (!(info.mask & mask) || (syllable && syllable != info.syllable ())) @@ -271,7 +271,7 @@ struct hb_apply_context_t : }; inline may_skip_t - may_skip (const hb_apply_context_t *c, + may_skip (const hb_ot_apply_context_t *c, const hb_glyph_info_t &info) const { if (!c->check_glyph_property (&info, lookup_props)) @@ -297,7 +297,7 @@ struct hb_apply_context_t : struct skipping_iterator_t { - inline void init (hb_apply_context_t *c_, bool context_match = false) + inline void init (hb_ot_apply_context_t *c_, bool context_match = false) { c = c_; match_glyph_data = nullptr; @@ -315,7 +315,7 @@ struct hb_apply_context_t : } inline void set_match_func (matcher_t::match_func_t match_func_, const void *match_data_, - const UINT16 glyph_data[]) + const HBUINT16 glyph_data[]) { matcher.set_match_func (match_func_, match_data_); match_glyph_data = glyph_data; @@ -333,8 +333,7 @@ struct hb_apply_context_t : inline void reject (void) { num_items++; match_glyph_data--; } inline matcher_t::may_skip_t - may_skip (const hb_apply_context_t *c, - const hb_glyph_info_t &info) const + may_skip (const hb_glyph_info_t &info) const { return matcher.may_skip (c, info); } @@ -396,9 +395,9 @@ struct hb_apply_context_t : unsigned int idx; protected: - hb_apply_context_t *c; + hb_ot_apply_context_t *c; matcher_t matcher; - const UINT16 *match_glyph_data; + const HBUINT16 *match_glyph_data; unsigned int num_items; unsigned int end; @@ -406,18 +405,18 @@ struct hb_apply_context_t : inline const char *get_name (void) { return "APPLY"; } - typedef return_t (*recurse_func_t) (hb_apply_context_t *c, unsigned int lookup_index); + typedef return_t (*recurse_func_t) (hb_ot_apply_context_t *c, unsigned int lookup_index); template inline return_t dispatch (const T &obj) { return obj.apply (this); } static return_t default_return_value (void) { return false; } bool stop_sublookup_iteration (return_t r) const { return r; } - return_t recurse (unsigned int lookup_index) + return_t recurse (unsigned int sub_lookup_index) { if (unlikely (nesting_level_left == 0 || !recurse_func || buffer->max_ops-- <= 0)) return default_return_value (); nesting_level_left--; - bool ret = recurse_func (this, lookup_index); + bool ret = recurse_func (this, sub_lookup_index); nesting_level_left++; return ret; } @@ -444,7 +443,7 @@ struct hb_apply_context_t : bool has_glyph_classes; - hb_apply_context_t (unsigned int table_index_, + hb_ot_apply_context_t (unsigned int table_index_, hb_font_t *font_, hb_buffer_t *buffer_) : iter_input (), iter_context (), @@ -568,9 +567,9 @@ struct hb_apply_context_t : -typedef bool (*intersects_func_t) (hb_set_t *glyphs, const UINT16 &value, const void *data); -typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, const UINT16 &value, const void *data); -typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const UINT16 &value, const void *data); +typedef bool (*intersects_func_t) (hb_set_t *glyphs, const HBUINT16 &value, const void *data); +typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, const HBUINT16 &value, const void *data); +typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const HBUINT16 &value, const void *data); struct ContextClosureFuncs { @@ -586,16 +585,16 @@ struct ContextApplyFuncs }; -static inline bool intersects_glyph (hb_set_t *glyphs, const UINT16 &value, const void *data HB_UNUSED) +static inline bool intersects_glyph (hb_set_t *glyphs, const HBUINT16 &value, const void *data HB_UNUSED) { return glyphs->has (value); } -static inline bool intersects_class (hb_set_t *glyphs, const UINT16 &value, const void *data) +static inline bool intersects_class (hb_set_t *glyphs, const HBUINT16 &value, const void *data) { const ClassDef &class_def = *reinterpret_cast(data); return class_def.intersects_class (glyphs, value); } -static inline bool intersects_coverage (hb_set_t *glyphs, const UINT16 &value, const void *data) +static inline bool intersects_coverage (hb_set_t *glyphs, const HBUINT16 &value, const void *data) { const OffsetTo &coverage = (const OffsetTo&)value; return (data+coverage).intersects (glyphs); @@ -603,7 +602,7 @@ static inline bool intersects_coverage (hb_set_t *glyphs, const UINT16 &value, c static inline bool intersects_array (hb_closure_context_t *c, unsigned int count, - const UINT16 values[], + const HBUINT16 values[], intersects_func_t intersects_func, const void *intersects_data) { @@ -614,16 +613,16 @@ static inline bool intersects_array (hb_closure_context_t *c, } -static inline void collect_glyph (hb_set_t *glyphs, const UINT16 &value, const void *data HB_UNUSED) +static inline void collect_glyph (hb_set_t *glyphs, const HBUINT16 &value, const void *data HB_UNUSED) { glyphs->add (value); } -static inline void collect_class (hb_set_t *glyphs, const UINT16 &value, const void *data) +static inline void collect_class (hb_set_t *glyphs, const HBUINT16 &value, const void *data) { const ClassDef &class_def = *reinterpret_cast(data); class_def.add_class (glyphs, value); } -static inline void collect_coverage (hb_set_t *glyphs, const UINT16 &value, const void *data) +static inline void collect_coverage (hb_set_t *glyphs, const HBUINT16 &value, const void *data) { const OffsetTo &coverage = (const OffsetTo&)value; (data+coverage).add_coverage (glyphs); @@ -631,7 +630,7 @@ static inline void collect_coverage (hb_set_t *glyphs, const UINT16 &value, cons static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED, hb_set_t *glyphs, unsigned int count, - const UINT16 values[], + const HBUINT16 values[], collect_glyphs_func_t collect_func, const void *collect_data) { @@ -640,16 +639,16 @@ static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED, } -static inline bool match_glyph (hb_codepoint_t glyph_id, const UINT16 &value, const void *data HB_UNUSED) +static inline bool match_glyph (hb_codepoint_t glyph_id, const HBUINT16 &value, const void *data HB_UNUSED) { return glyph_id == value; } -static inline bool match_class (hb_codepoint_t glyph_id, const UINT16 &value, const void *data) +static inline bool match_class (hb_codepoint_t glyph_id, const HBUINT16 &value, const void *data) { const ClassDef &class_def = *reinterpret_cast(data); return class_def.get_class (glyph_id) == value; } -static inline bool match_coverage (hb_codepoint_t glyph_id, const UINT16 &value, const void *data) +static inline bool match_coverage (hb_codepoint_t glyph_id, const HBUINT16 &value, const void *data) { const OffsetTo &coverage = (const OffsetTo&)value; return (data+coverage).get_coverage (glyph_id) != NOT_COVERED; @@ -657,7 +656,7 @@ static inline bool match_coverage (hb_codepoint_t glyph_id, const UINT16 &value, static inline bool would_match_input (hb_would_apply_context_t *c, unsigned int count, /* Including the first glyph (not matched) */ - const UINT16 input[], /* Array of input values--start with second glyph */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ match_func_t match_func, const void *match_data) { @@ -670,9 +669,9 @@ static inline bool would_match_input (hb_would_apply_context_t *c, return true; } -static inline bool match_input (hb_apply_context_t *c, +static inline bool match_input (hb_ot_apply_context_t *c, unsigned int count, /* Including the first glyph (not matched) */ - const UINT16 input[], /* Array of input values--start with second glyph */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ match_func_t match_func, const void *match_data, unsigned int *end_offset, @@ -686,7 +685,7 @@ static inline bool match_input (hb_apply_context_t *c, hb_buffer_t *buffer = c->buffer; - hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; + hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; skippy_iter.reset (buffer->idx, count - 1); skippy_iter.set_match_func (match_func, match_data, input); @@ -763,7 +762,7 @@ static inline bool match_input (hb_apply_context_t *c, j--; } - if (found && skippy_iter.may_skip (c, out[j]) == hb_apply_context_t::matcher_t::SKIP_YES) + if (found && skippy_iter.may_skip (out[j]) == hb_ot_apply_context_t::matcher_t::SKIP_YES) ligbase = LIGBASE_MAY_SKIP; else ligbase = LIGBASE_MAY_NOT_SKIP; @@ -796,7 +795,7 @@ static inline bool match_input (hb_apply_context_t *c, return_trace (true); } -static inline bool ligate_input (hb_apply_context_t *c, +static inline bool ligate_input (hb_ot_apply_context_t *c, unsigned int count, /* Including the first glyph */ unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */ unsigned int match_length, @@ -894,16 +893,16 @@ static inline bool ligate_input (hb_apply_context_t *c, return_trace (true); } -static inline bool match_backtrack (hb_apply_context_t *c, +static inline bool match_backtrack (hb_ot_apply_context_t *c, unsigned int count, - const UINT16 backtrack[], + const HBUINT16 backtrack[], match_func_t match_func, const void *match_data, unsigned int *match_start) { TRACE_APPLY (nullptr); - hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context; + hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context; skippy_iter.reset (c->buffer->backtrack_len (), count); skippy_iter.set_match_func (match_func, match_data, backtrack); @@ -916,9 +915,9 @@ static inline bool match_backtrack (hb_apply_context_t *c, return_trace (true); } -static inline bool match_lookahead (hb_apply_context_t *c, +static inline bool match_lookahead (hb_ot_apply_context_t *c, unsigned int count, - const UINT16 lookahead[], + const HBUINT16 lookahead[], match_func_t match_func, const void *match_data, unsigned int offset, @@ -926,7 +925,7 @@ static inline bool match_lookahead (hb_apply_context_t *c, { TRACE_APPLY (nullptr); - hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context; + hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context; skippy_iter.reset (c->buffer->idx + offset - 1, count); skippy_iter.set_match_func (match_func, match_data, lookahead); @@ -949,9 +948,9 @@ struct LookupRecord return_trace (c->check_struct (this)); } - UINT16 sequenceIndex; /* Index into current glyph + HBUINT16 sequenceIndex; /* Index into current glyph * sequence--first glyph = 0 */ - UINT16 lookupListIndex; /* Lookup to apply to that + HBUINT16 lookupListIndex; /* Lookup to apply to that * position--zero--based */ public: DEFINE_SIZE_STATIC (4); @@ -967,7 +966,7 @@ static inline void recurse_lookups (context_t *c, c->recurse (lookupRecord[i].lookupListIndex); } -static inline bool apply_lookup (hb_apply_context_t *c, +static inline bool apply_lookup (hb_ot_apply_context_t *c, unsigned int count, /* Including the first glyph */ unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */ unsigned int lookupCount, @@ -1112,7 +1111,7 @@ struct ContextApplyLookupContext static inline void context_closure_lookup (hb_closure_context_t *c, unsigned int inputCount, /* Including the first glyph (not matched) */ - const UINT16 input[], /* Array of input values--start with second glyph */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookupCount, const LookupRecord lookupRecord[], ContextClosureLookupContext &lookup_context) @@ -1126,7 +1125,7 @@ static inline void context_closure_lookup (hb_closure_context_t *c, static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c, unsigned int inputCount, /* Including the first glyph (not matched) */ - const UINT16 input[], /* Array of input values--start with second glyph */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookupCount, const LookupRecord lookupRecord[], ContextCollectGlyphsLookupContext &lookup_context) @@ -1140,7 +1139,7 @@ static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c static inline bool context_would_apply_lookup (hb_would_apply_context_t *c, unsigned int inputCount, /* Including the first glyph (not matched) */ - const UINT16 input[], /* Array of input values--start with second glyph */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookupCount HB_UNUSED, const LookupRecord lookupRecord[] HB_UNUSED, ContextApplyLookupContext &lookup_context) @@ -1149,9 +1148,9 @@ static inline bool context_would_apply_lookup (hb_would_apply_context_t *c, inputCount, input, lookup_context.funcs.match, lookup_context.match_data); } -static inline bool context_apply_lookup (hb_apply_context_t *c, +static inline bool context_apply_lookup (hb_ot_apply_context_t *c, unsigned int inputCount, /* Including the first glyph (not matched) */ - const UINT16 input[], /* Array of input values--start with second glyph */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookupCount, const LookupRecord lookupRecord[], ContextApplyLookupContext &lookup_context) @@ -1198,7 +1197,7 @@ struct Rule return_trace (context_would_apply_lookup (c, inputCount, inputZ, lookupCount, lookupRecord, lookup_context)); } - inline bool apply (hb_apply_context_t *c, ContextApplyLookupContext &lookup_context) const + inline bool apply (hb_ot_apply_context_t *c, ContextApplyLookupContext &lookup_context) const { TRACE_APPLY (this); const LookupRecord *lookupRecord = &StructAtOffset (inputZ, inputZ[0].static_size * (inputCount ? inputCount - 1 : 0)); @@ -1217,11 +1216,11 @@ struct Rule } protected: - UINT16 inputCount; /* Total number of glyphs in input + HBUINT16 inputCount; /* Total number of glyphs in input * glyph sequence--includes the first * glyph */ - UINT16 lookupCount; /* Number of LookupRecords */ - UINT16 inputZ[VAR]; /* Array of match inputs--start with + HBUINT16 lookupCount; /* Number of LookupRecords */ + HBUINT16 inputZ[VAR]; /* Array of match inputs--start with * second glyph */ LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in * design order */ @@ -1259,7 +1258,7 @@ struct RuleSet return_trace (false); } - inline bool apply (hb_apply_context_t *c, ContextApplyLookupContext &lookup_context) const + inline bool apply (hb_ot_apply_context_t *c, ContextApplyLookupContext &lookup_context) const { TRACE_APPLY (this); unsigned int num_rules = rule.len; @@ -1339,7 +1338,7 @@ struct ContextFormat1 return this+coverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint); @@ -1361,7 +1360,7 @@ struct ContextFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of table */ @@ -1431,7 +1430,7 @@ struct ContextFormat2 return this+coverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint); @@ -1454,7 +1453,7 @@ struct ContextFormat2 } protected: - UINT16 format; /* Format identifier--format = 2 */ + HBUINT16 format; /* Format identifier--format = 2 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of table */ @@ -1483,7 +1482,7 @@ struct ContextFormat3 this }; context_closure_lookup (c, - glyphCount, (const UINT16 *) (coverageZ + 1), + glyphCount, (const HBUINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context); } @@ -1500,7 +1499,7 @@ struct ContextFormat3 }; context_collect_glyphs_lookup (c, - glyphCount, (const UINT16 *) (coverageZ + 1), + glyphCount, (const HBUINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context); } @@ -1514,7 +1513,7 @@ struct ContextFormat3 {match_coverage}, this }; - return_trace (context_would_apply_lookup (c, glyphCount, (const UINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); + return_trace (context_would_apply_lookup (c, glyphCount, (const HBUINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); } inline const Coverage &get_coverage (void) const @@ -1522,7 +1521,7 @@ struct ContextFormat3 return this+coverageZ[0]; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); unsigned int index = (this+coverageZ[0]).get_coverage (c->buffer->cur().codepoint); @@ -1533,7 +1532,7 @@ struct ContextFormat3 {match_coverage}, this }; - return_trace (context_apply_lookup (c, glyphCount, (const UINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); + return_trace (context_apply_lookup (c, glyphCount, (const HBUINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -1550,10 +1549,10 @@ struct ContextFormat3 } protected: - UINT16 format; /* Format identifier--format = 3 */ - UINT16 glyphCount; /* Number of glyphs in the input glyph + HBUINT16 format; /* Format identifier--format = 3 */ + HBUINT16 glyphCount; /* Number of glyphs in the input glyph * sequence */ - UINT16 lookupCount; /* Number of LookupRecords */ + HBUINT16 lookupCount; /* Number of LookupRecords */ OffsetTo coverageZ[VAR]; /* Array of offsets to Coverage * table in glyph sequence order */ @@ -1580,7 +1579,7 @@ struct Context protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ ContextFormat1 format1; ContextFormat2 format2; ContextFormat3 format3; @@ -1610,11 +1609,11 @@ struct ChainContextApplyLookupContext static inline void chain_context_closure_lookup (hb_closure_context_t *c, unsigned int backtrackCount, - const UINT16 backtrack[], + const HBUINT16 backtrack[], unsigned int inputCount, /* Including the first glyph (not matched) */ - const UINT16 input[], /* Array of input values--start with second glyph */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookaheadCount, - const UINT16 lookahead[], + const HBUINT16 lookahead[], unsigned int lookupCount, const LookupRecord lookupRecord[], ChainContextClosureLookupContext &lookup_context) @@ -1634,11 +1633,11 @@ static inline void chain_context_closure_lookup (hb_closure_context_t *c, static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c, unsigned int backtrackCount, - const UINT16 backtrack[], + const HBUINT16 backtrack[], unsigned int inputCount, /* Including the first glyph (not matched) */ - const UINT16 input[], /* Array of input values--start with second glyph */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookaheadCount, - const UINT16 lookahead[], + const HBUINT16 lookahead[], unsigned int lookupCount, const LookupRecord lookupRecord[], ChainContextCollectGlyphsLookupContext &lookup_context) @@ -1658,11 +1657,11 @@ static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_contex static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c, unsigned int backtrackCount, - const UINT16 backtrack[] HB_UNUSED, + const HBUINT16 backtrack[] HB_UNUSED, unsigned int inputCount, /* Including the first glyph (not matched) */ - const UINT16 input[], /* Array of input values--start with second glyph */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookaheadCount, - const UINT16 lookahead[] HB_UNUSED, + const HBUINT16 lookahead[] HB_UNUSED, unsigned int lookupCount HB_UNUSED, const LookupRecord lookupRecord[] HB_UNUSED, ChainContextApplyLookupContext &lookup_context) @@ -1673,13 +1672,13 @@ static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c lookup_context.funcs.match, lookup_context.match_data[1]); } -static inline bool chain_context_apply_lookup (hb_apply_context_t *c, +static inline bool chain_context_apply_lookup (hb_ot_apply_context_t *c, unsigned int backtrackCount, - const UINT16 backtrack[], + const HBUINT16 backtrack[], unsigned int inputCount, /* Including the first glyph (not matched) */ - const UINT16 input[], /* Array of input values--start with second glyph */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ unsigned int lookaheadCount, - const UINT16 lookahead[], + const HBUINT16 lookahead[], unsigned int lookupCount, const LookupRecord lookupRecord[], ChainContextApplyLookupContext &lookup_context) @@ -1710,8 +1709,8 @@ struct ChainRule inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const { TRACE_CLOSURE (this); - const HeadlessArrayOf &input = StructAfter > (backtrack); - const ArrayOf &lookahead = StructAfter > (input); + const HeadlessArrayOf &input = StructAfter > (backtrack); + const ArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); chain_context_closure_lookup (c, backtrack.len, backtrack.array, @@ -1724,8 +1723,8 @@ struct ChainRule inline void collect_glyphs (hb_collect_glyphs_context_t *c, ChainContextCollectGlyphsLookupContext &lookup_context) const { TRACE_COLLECT_GLYPHS (this); - const HeadlessArrayOf &input = StructAfter > (backtrack); - const ArrayOf &lookahead = StructAfter > (input); + const HeadlessArrayOf &input = StructAfter > (backtrack); + const ArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); chain_context_collect_glyphs_lookup (c, backtrack.len, backtrack.array, @@ -1738,8 +1737,8 @@ struct ChainRule inline bool would_apply (hb_would_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const { TRACE_WOULD_APPLY (this); - const HeadlessArrayOf &input = StructAfter > (backtrack); - const ArrayOf &lookahead = StructAfter > (input); + const HeadlessArrayOf &input = StructAfter > (backtrack); + const ArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); return_trace (chain_context_would_apply_lookup (c, backtrack.len, backtrack.array, @@ -1748,11 +1747,11 @@ struct ChainRule lookup.array, lookup_context)); } - inline bool apply (hb_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const + inline bool apply (hb_ot_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const { TRACE_APPLY (this); - const HeadlessArrayOf &input = StructAfter > (backtrack); - const ArrayOf &lookahead = StructAfter > (input); + const HeadlessArrayOf &input = StructAfter > (backtrack); + const ArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); return_trace (chain_context_apply_lookup (c, backtrack.len, backtrack.array, @@ -1765,23 +1764,23 @@ struct ChainRule { TRACE_SANITIZE (this); if (!backtrack.sanitize (c)) return_trace (false); - const HeadlessArrayOf &input = StructAfter > (backtrack); + const HeadlessArrayOf &input = StructAfter > (backtrack); if (!input.sanitize (c)) return_trace (false); - const ArrayOf &lookahead = StructAfter > (input); + const ArrayOf &lookahead = StructAfter > (input); if (!lookahead.sanitize (c)) return_trace (false); const ArrayOf &lookup = StructAfter > (lookahead); return_trace (lookup.sanitize (c)); } protected: - ArrayOf + ArrayOf backtrack; /* Array of backtracking values * (to be matched before the input * sequence) */ - HeadlessArrayOf + HeadlessArrayOf inputX; /* Array of input values (start with * second glyph) */ - ArrayOf + ArrayOf lookaheadX; /* Array of lookahead values's (to be * matched after the input sequence) */ ArrayOf @@ -1820,7 +1819,7 @@ struct ChainRuleSet return_trace (false); } - inline bool apply (hb_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const + inline bool apply (hb_ot_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const { TRACE_APPLY (this); unsigned int num_rules = rule.len; @@ -1897,7 +1896,7 @@ struct ChainContextFormat1 return this+coverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint); @@ -1918,7 +1917,7 @@ struct ChainContextFormat1 } protected: - UINT16 format; /* Format identifier--format = 1 */ + HBUINT16 format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of table */ @@ -2001,7 +2000,7 @@ struct ChainContextFormat2 return this+coverage; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint); @@ -2033,7 +2032,7 @@ struct ChainContextFormat2 } protected: - UINT16 format; /* Format identifier--format = 2 */ + HBUINT16 format; /* Format identifier--format = 2 */ OffsetTo coverage; /* Offset to Coverage table--from * beginning of table */ @@ -2073,9 +2072,9 @@ struct ChainContextFormat3 {this, this, this} }; chain_context_closure_lookup (c, - backtrack.len, (const UINT16 *) backtrack.array, - input.len, (const UINT16 *) input.array + 1, - lookahead.len, (const UINT16 *) lookahead.array, + backtrack.len, (const HBUINT16 *) backtrack.array, + input.len, (const HBUINT16 *) input.array + 1, + lookahead.len, (const HBUINT16 *) lookahead.array, lookup.len, lookup.array, lookup_context); } @@ -2094,9 +2093,9 @@ struct ChainContextFormat3 {this, this, this} }; chain_context_collect_glyphs_lookup (c, - backtrack.len, (const UINT16 *) backtrack.array, - input.len, (const UINT16 *) input.array + 1, - lookahead.len, (const UINT16 *) lookahead.array, + backtrack.len, (const HBUINT16 *) backtrack.array, + input.len, (const HBUINT16 *) input.array + 1, + lookahead.len, (const HBUINT16 *) lookahead.array, lookup.len, lookup.array, lookup_context); } @@ -2113,9 +2112,9 @@ struct ChainContextFormat3 {this, this, this} }; return_trace (chain_context_would_apply_lookup (c, - backtrack.len, (const UINT16 *) backtrack.array, - input.len, (const UINT16 *) input.array + 1, - lookahead.len, (const UINT16 *) lookahead.array, + backtrack.len, (const HBUINT16 *) backtrack.array, + input.len, (const HBUINT16 *) input.array + 1, + lookahead.len, (const HBUINT16 *) lookahead.array, lookup.len, lookup.array, lookup_context)); } @@ -2125,7 +2124,7 @@ struct ChainContextFormat3 return this+input[0]; } - inline bool apply (hb_apply_context_t *c) const + inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); const OffsetArrayOf &input = StructAfter > (backtrack); @@ -2140,9 +2139,9 @@ struct ChainContextFormat3 {this, this, this} }; return_trace (chain_context_apply_lookup (c, - backtrack.len, (const UINT16 *) backtrack.array, - input.len, (const UINT16 *) input.array + 1, - lookahead.len, (const UINT16 *) lookahead.array, + backtrack.len, (const HBUINT16 *) backtrack.array, + input.len, (const HBUINT16 *) input.array + 1, + lookahead.len, (const HBUINT16 *) lookahead.array, lookup.len, lookup.array, lookup_context)); } @@ -2160,7 +2159,7 @@ struct ChainContextFormat3 } protected: - UINT16 format; /* Format identifier--format = 3 */ + HBUINT16 format; /* Format identifier--format = 3 */ OffsetArrayOf backtrack; /* Array of coverage tables * in backtracking sequence, in glyph @@ -2197,7 +2196,7 @@ struct ChainContext protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ ChainContextFormat1 format1; ChainContextFormat2 format2; ChainContextFormat3 format3; @@ -2230,15 +2229,17 @@ struct ExtensionFormat1 inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (c->check_struct (this) && extensionOffset != 0); + return_trace (c->check_struct (this) && + extensionOffset != 0 && + extensionLookupType != T::LookupSubTable::Extension); } protected: - UINT16 format; /* Format identifier. Set to 1. */ - UINT16 extensionLookupType; /* Lookup type of subtable referenced + HBUINT16 format; /* Format identifier. Set to 1. */ + HBUINT16 extensionLookupType; /* Lookup type of subtable referenced * by ExtensionOffset (i.e. the * extension subtable). */ - UINT32 extensionOffset; /* Offset to the extension subtable, + HBUINT32 extensionOffset; /* Offset to the extension subtable, * of lookup type subtable. */ public: DEFINE_SIZE_STATIC (8); @@ -2276,7 +2277,7 @@ struct Extension protected: union { - UINT16 format; /* Format identifier */ + HBUINT16 format; /* Format identifier */ ExtensionFormat1 format1; } u; }; diff --git a/gfx/harfbuzz/src/hb-ot-layout-private.hh b/gfx/harfbuzz/src/hb-ot-layout-private.hh index 0f0926f89068..60119629cf59 100644 --- a/gfx/harfbuzz/src/hb-ot-layout-private.hh +++ b/gfx/harfbuzz/src/hb-ot-layout-private.hh @@ -90,12 +90,12 @@ hb_ot_layout_substitute_start (hb_font_t *font, struct hb_ot_layout_lookup_accelerator_t; namespace OT { - struct hb_apply_context_t; + struct hb_ot_apply_context_t; struct SubstLookup; } HB_INTERNAL void -hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c, +hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c, const OT::SubstLookup &lookup, const hb_ot_layout_lookup_accelerator_t &accel); @@ -130,6 +130,10 @@ namespace OT { struct avar; } +namespace AAT { + struct morx; +} + struct hb_ot_layout_lookup_accelerator_t { template @@ -165,6 +169,7 @@ struct hb_ot_layout_t OT::hb_lazy_table_loader_t math; OT::hb_lazy_table_loader_t fvar; OT::hb_lazy_table_loader_t avar; + OT::hb_lazy_table_loader_t morx; unsigned int gsub_lookup_count; unsigned int gpos_lookup_count; @@ -280,7 +285,11 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer) else if (unlikely (hb_in_range (u, 0xE0020u, 0xE007Fu))) props |= UPROPS_MASK_HIDDEN; /* COMBINING GRAPHEME JOINER should not be skipped; at least some times. * https://github.com/harfbuzz/harfbuzz/issues/554 */ - else if (unlikely (u == 0x034Fu)) props |= UPROPS_MASK_HIDDEN; + else if (unlikely (u == 0x034Fu)) + { + buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_CGJ; + props |= UPROPS_MASK_HIDDEN; + } } else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat))) { @@ -388,6 +397,11 @@ _hb_glyph_info_is_default_ignorable_and_not_hidden (const hb_glyph_info_t *info) == UPROPS_MASK_IGNORABLE) && !_hb_glyph_info_ligated (info); } +static inline void +_hb_glyph_info_unhide (hb_glyph_info_t *info) +{ + info->unicode_props() &= ~ UPROPS_MASK_HIDDEN; +} static inline bool _hb_glyph_info_is_unicode_format (const hb_glyph_info_t *info) diff --git a/gfx/harfbuzz/src/hb-ot-layout.cc b/gfx/harfbuzz/src/hb-ot-layout.cc index 88458898272d..919ecbb4b570 100644 --- a/gfx/harfbuzz/src/hb-ot-layout.cc +++ b/gfx/harfbuzz/src/hb-ot-layout.cc @@ -50,18 +50,19 @@ _hb_ot_layout_create (hb_face_t *face) if (unlikely (!layout)) return nullptr; - layout->gdef_blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_GDEF)); + layout->gdef_blob = OT::Sanitizer().sanitize (face->reference_table (HB_OT_TAG_GDEF)); layout->gdef = OT::Sanitizer::lock_instance (layout->gdef_blob); - layout->gsub_blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_GSUB)); + layout->gsub_blob = OT::Sanitizer().sanitize (face->reference_table (HB_OT_TAG_GSUB)); layout->gsub = OT::Sanitizer::lock_instance (layout->gsub_blob); - layout->gpos_blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_GPOS)); + layout->gpos_blob = OT::Sanitizer().sanitize (face->reference_table (HB_OT_TAG_GPOS)); layout->gpos = OT::Sanitizer::lock_instance (layout->gpos_blob); layout->math.init (face); layout->fvar.init (face); layout->avar.init (face); + layout->morx.init (face); { /* @@ -209,6 +210,7 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout) layout->math.fini (); layout->fvar.fini (); layout->avar.fini (); + layout->morx.fini (); free (layout); } @@ -1055,13 +1057,13 @@ struct hb_get_subtables_context_t : OT::hb_dispatch_context_t { template - static inline bool apply_to (const void *obj, OT::hb_apply_context_t *c) + static inline bool apply_to (const void *obj, OT::hb_ot_apply_context_t *c) { const Type *typed_obj = (const Type *) obj; return typed_obj->apply (c); } - typedef bool (*hb_apply_func_t) (const void *obj, OT::hb_apply_context_t *c); + typedef bool (*hb_apply_func_t) (const void *obj, OT::hb_ot_apply_context_t *c); struct hb_applicable_t { @@ -1071,7 +1073,7 @@ struct hb_get_subtables_context_t : apply_func = apply_func_; } - inline bool apply (OT::hb_apply_context_t *c) const { return apply_func (obj, c); } + inline bool apply (OT::hb_ot_apply_context_t *c) const { return apply_func (obj, c); } private: const void *obj; @@ -1102,7 +1104,7 @@ struct hb_get_subtables_context_t : }; static inline bool -apply_forward (OT::hb_apply_context_t *c, +apply_forward (OT::hb_ot_apply_context_t *c, const hb_ot_layout_lookup_accelerator_t &accel, const hb_get_subtables_context_t::array_t &subtables) { @@ -1132,7 +1134,7 @@ apply_forward (OT::hb_apply_context_t *c, } static inline bool -apply_backward (OT::hb_apply_context_t *c, +apply_backward (OT::hb_ot_apply_context_t *c, const hb_ot_layout_lookup_accelerator_t &accel, const hb_get_subtables_context_t::array_t &subtables) { @@ -1161,7 +1163,7 @@ apply_backward (OT::hb_apply_context_t *c, template static inline void -apply_string (OT::hb_apply_context_t *c, +apply_string (OT::hb_ot_apply_context_t *c, const typename Proxy::Lookup &lookup, const hb_ot_layout_lookup_accelerator_t &accel) { @@ -1212,7 +1214,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, { const unsigned int table_index = proxy.table_index; unsigned int i = 0; - OT::hb_apply_context_t c (table_index, font, buffer); + OT::hb_ot_apply_context_t c (table_index, font, buffer); c.set_recurse_func (Proxy::Lookup::apply_recurse_func); for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stage_index++) { @@ -1252,7 +1254,7 @@ void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_ } HB_INTERNAL void -hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c, +hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c, const OT::SubstLookup &lookup, const hb_ot_layout_lookup_accelerator_t &accel) { diff --git a/gfx/harfbuzz/src/hb-ot-map-private.hh b/gfx/harfbuzz/src/hb-ot-map-private.hh index 97b92cc9a8c2..a80ac720fe14 100644 --- a/gfx/harfbuzz/src/hb-ot-map-private.hh +++ b/gfx/harfbuzz/src/hb-ot-map-private.hh @@ -198,7 +198,6 @@ struct hb_ot_map_builder_t private: HB_INTERNAL void add_lookups (hb_ot_map_t &m, - hb_face_t *face, unsigned int table_index, unsigned int feature_index, unsigned int variations_index, diff --git a/gfx/harfbuzz/src/hb-ot-map.cc b/gfx/harfbuzz/src/hb-ot-map.cc index ea9bde9a662d..6f07a7e2281f 100644 --- a/gfx/harfbuzz/src/hb-ot-map.cc +++ b/gfx/harfbuzz/src/hb-ot-map.cc @@ -80,7 +80,6 @@ void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value, void hb_ot_map_builder_t::add_lookups (hb_ot_map_t &m, - hb_face_t *face, unsigned int table_index, unsigned int feature_index, unsigned int variations_index, @@ -289,14 +288,14 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, { if (required_feature_index[table_index] != HB_OT_LAYOUT_NO_FEATURE_INDEX && required_feature_stage[table_index] == stage) - add_lookups (m, face, table_index, + add_lookups (m, table_index, required_feature_index[table_index], variations_index, global_bit_mask); for (unsigned i = 0; i < m.features.len; i++) if (m.features[i].stage[table_index] == stage) - add_lookups (m, face, table_index, + add_lookups (m, table_index, m.features[i].index[table_index], variations_index, m.features[i].mask, diff --git a/gfx/harfbuzz/src/hb-ot-math-table.hh b/gfx/harfbuzz/src/hb-ot-math-table.hh index 7dc3283a2895..571ce01b71e1 100644 --- a/gfx/harfbuzz/src/hb-ot-math-table.hh +++ b/gfx/harfbuzz/src/hb-ot-math-table.hh @@ -48,7 +48,7 @@ struct MathValueRecord } protected: - INT16 value; /* The X or Y value in design units */ + HBINT16 value; /* The X or Y value in design units */ OffsetTo deviceTable; /* Offset to the device table - from the * beginning of parent table. May be nullptr. * Suggested format for device table is 1. */ @@ -154,10 +154,10 @@ struct MathConstants } protected: - INT16 percentScaleDown[2]; - UINT16 minHeight[2]; + HBINT16 percentScaleDown[2]; + HBUINT16 minHeight[2]; MathValueRecord mathValueRecords[51]; - INT16 radicalDegreeBottomRaisePercent; + HBINT16 radicalDegreeBottomRaisePercent; public: DEFINE_SIZE_STATIC (214); @@ -279,7 +279,7 @@ struct MathKern } protected: - UINT16 heightCount; + HBUINT16 heightCount; MathValueRecord mathValueRecords[VAR]; /* Array of correction heights at * which the kern value changes. * Sorted by the height value in @@ -425,7 +425,7 @@ struct MathGlyphVariantRecord protected: GlyphID variantGlyph; /* Glyph ID for the variant. */ - UINT16 advanceMeasurement; /* Advance width/height, in design units, of the + HBUINT16 advanceMeasurement; /* Advance width/height, in design units, of the * variant, in the direction of requested * glyph extension. */ @@ -433,7 +433,7 @@ struct MathGlyphVariantRecord DEFINE_SIZE_STATIC (4); }; -struct PartFlags : UINT16 +struct PartFlags : HBUINT16 { enum Flags { Extender = 0x0001u, /* If set, the part can be skipped or repeated. */ @@ -473,15 +473,15 @@ struct MathGlyphPartRecord protected: GlyphID glyph; /* Glyph ID for the part. */ - UINT16 startConnectorLength; /* Advance width/ height of the straight bar + HBUINT16 startConnectorLength; /* Advance width/ height of the straight bar * connector material, in design units, is at * the beginning of the glyph, in the * direction of the extension. */ - UINT16 endConnectorLength; /* Advance width/ height of the straight bar + HBUINT16 endConnectorLength; /* Advance width/ height of the straight bar * connector material, in design units, is at * the end of the glyph, in the direction of * the extension. */ - UINT16 fullAdvance; /* Full advance width/height for this part, + HBUINT16 fullAdvance; /* Full advance width/height for this part, * in the direction of the extension. * In design units. */ PartFlags partFlags; /* Part qualifiers. */ @@ -651,7 +651,7 @@ struct MathVariants } protected: - UINT16 minConnectorOverlap; /* Minimum overlap of connecting + HBUINT16 minConnectorOverlap; /* Minimum overlap of connecting * glyphs during glyph construction, * in design units. */ OffsetTo vertGlyphCoverage; /* Offset to Coverage table - @@ -660,10 +660,10 @@ struct MathVariants OffsetTo horizGlyphCoverage; /* Offset to Coverage table - * from the beginning of MathVariants * table. */ - UINT16 vertGlyphCount; /* Number of glyphs for which + HBUINT16 vertGlyphCount; /* Number of glyphs for which * information is provided for * vertically growing variants. */ - UINT16 horizGlyphCount; /* Number of glyphs for which + HBUINT16 horizGlyphCount; /* Number of glyphs for which * information is provided for * horizontally growing variants. */ diff --git a/gfx/harfbuzz/src/hb-ot-maxp-table.hh b/gfx/harfbuzz/src/hb-ot-maxp-table.hh index f6d283eb14ae..54b4f11ce652 100644 --- a/gfx/harfbuzz/src/hb-ot-maxp-table.hh +++ b/gfx/harfbuzz/src/hb-ot-maxp-table.hh @@ -60,7 +60,7 @@ struct maxp protected: FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0), * 0x00005000u or 0x00010000u. */ - UINT16 numGlyphs; /* The number of glyphs in the font. */ + HBUINT16 numGlyphs; /* The number of glyphs in the font. */ public: DEFINE_SIZE_STATIC (6); }; diff --git a/gfx/harfbuzz/src/hb-ot-name-table.hh b/gfx/harfbuzz/src/hb-ot-name-table.hh index 4c5b3c0f9869..eb0133379813 100644 --- a/gfx/harfbuzz/src/hb-ot-name-table.hh +++ b/gfx/harfbuzz/src/hb-ot-name-table.hh @@ -65,12 +65,12 @@ struct NameRecord return_trace (c->check_struct (this) && c->check_range ((char *) base, (unsigned int) length + offset)); } - UINT16 platformID; /* Platform ID. */ - UINT16 encodingID; /* Platform-specific encoding ID. */ - UINT16 languageID; /* Language ID. */ - UINT16 nameID; /* Name ID. */ - UINT16 length; /* String length (in bytes). */ - UINT16 offset; /* String offset from start of storage area (in bytes). */ + HBUINT16 platformID; /* Platform ID. */ + HBUINT16 encodingID; /* Platform-specific encoding ID. */ + HBUINT16 languageID; /* Language ID. */ + HBUINT16 nameID; /* Name ID. */ + HBUINT16 length; /* String length (in bytes). */ + HBUINT16 offset; /* String offset from start of storage area (in bytes). */ public: DEFINE_SIZE_STATIC (12); }; @@ -123,8 +123,8 @@ struct name } /* We only implement format 0 for now. */ - UINT16 format; /* Format selector (=0/1). */ - UINT16 count; /* Number of name records. */ + HBUINT16 format; /* Format selector (=0/1). */ + HBUINT16 count; /* Number of name records. */ Offset16 stringOffset; /* Offset to start of string storage (from start of table). */ NameRecord nameRecord[VAR]; /* The name records where count is the number of records. */ public: diff --git a/gfx/harfbuzz/src/hb-ot-os2-table.hh b/gfx/harfbuzz/src/hb-ot-os2-table.hh index aa78f1e0a6ba..5bed47013ea3 100644 --- a/gfx/harfbuzz/src/hb-ot-os2-table.hh +++ b/gfx/harfbuzz/src/hb-ot-os2-table.hh @@ -50,50 +50,50 @@ struct os2 } public: - UINT16 version; + HBUINT16 version; /* Version 0 */ - INT16 xAvgCharWidth; - UINT16 usWeightClass; - UINT16 usWidthClass; - UINT16 fsType; - INT16 ySubscriptXSize; - INT16 ySubscriptYSize; - INT16 ySubscriptXOffset; - INT16 ySubscriptYOffset; - INT16 ySuperscriptXSize; - INT16 ySuperscriptYSize; - INT16 ySuperscriptXOffset; - INT16 ySuperscriptYOffset; - INT16 yStrikeoutSize; - INT16 yStrikeoutPosition; - INT16 sFamilyClass; - UINT8 panose[10]; - UINT32 ulUnicodeRange[4]; + HBINT16 xAvgCharWidth; + HBUINT16 usWeightClass; + HBUINT16 usWidthClass; + HBUINT16 fsType; + HBINT16 ySubscriptXSize; + HBINT16 ySubscriptYSize; + HBINT16 ySubscriptXOffset; + HBINT16 ySubscriptYOffset; + HBINT16 ySuperscriptXSize; + HBINT16 ySuperscriptYSize; + HBINT16 ySuperscriptXOffset; + HBINT16 ySuperscriptYOffset; + HBINT16 yStrikeoutSize; + HBINT16 yStrikeoutPosition; + HBINT16 sFamilyClass; + HBUINT8 panose[10]; + HBUINT32 ulUnicodeRange[4]; Tag achVendID; - UINT16 fsSelection; - UINT16 usFirstCharIndex; - UINT16 usLastCharIndex; - INT16 sTypoAscender; - INT16 sTypoDescender; - INT16 sTypoLineGap; - UINT16 usWinAscent; - UINT16 usWinDescent; + HBUINT16 fsSelection; + HBUINT16 usFirstCharIndex; + HBUINT16 usLastCharIndex; + HBINT16 sTypoAscender; + HBINT16 sTypoDescender; + HBINT16 sTypoLineGap; + HBUINT16 usWinAscent; + HBUINT16 usWinDescent; /* Version 1 */ - //UINT32 ulCodePageRange1; - //UINT32 ulCodePageRange2; + //HBUINT32 ulCodePageRange1; + //HBUINT32 ulCodePageRange2; /* Version 2 */ - //INT16 sxHeight; - //INT16 sCapHeight; - //UINT16 usDefaultChar; - //UINT16 usBreakChar; - //UINT16 usMaxContext; + //HBINT16 sxHeight; + //HBINT16 sCapHeight; + //HBUINT16 usDefaultChar; + //HBUINT16 usBreakChar; + //HBUINT16 usMaxContext; /* Version 5 */ - //UINT16 usLowerOpticalPointSize; - //UINT16 usUpperOpticalPointSize; + //HBUINT16 usLowerOpticalPointSize; + //HBUINT16 usUpperOpticalPointSize; public: DEFINE_SIZE_STATIC (78); diff --git a/gfx/harfbuzz/src/hb-ot-post-table.hh b/gfx/harfbuzz/src/hb-ot-post-table.hh index 7f1c2c420f10..9e4792115ea3 100644 --- a/gfx/harfbuzz/src/hb-ot-post-table.hh +++ b/gfx/harfbuzz/src/hb-ot-post-table.hh @@ -56,10 +56,10 @@ struct postV2Tail return_trace (glyphNameIndex.sanitize (c)); } - ArrayOfglyphNameIndex; /* This is not an offset, but is the + ArrayOfglyphNameIndex; /* This is not an offset, but is the * ordinal number of the glyph in 'post' * string tables. */ - UINT8 namesX[VAR]; /* Glyph names with length bytes [variable] + HBUINT8 namesX[VAR]; /* Glyph names with length bytes [variable] * (a Pascal string). */ DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX); @@ -86,7 +86,7 @@ struct post { inline void init (hb_face_t *face) { - blob = Sanitizer::sanitize (face->reference_table (HB_OT_TAG_post)); + blob = Sanitizer().sanitize (face->reference_table (HB_OT_TAG_post)); const post *table = Sanitizer::lock_instance (blob); unsigned int table_length = hb_blob_get_length (blob); @@ -234,7 +234,7 @@ struct post private: hb_blob_t *blob; uint32_t version; - const ArrayOf *glyphNameIndex; + const ArrayOf *glyphNameIndex; hb_prealloced_array_t index_to_offset; const uint8_t *pool; mutable uint16_t *gids_sorted_by_name; @@ -261,16 +261,16 @@ struct post * from the value of this field. */ FWORD underlineThickness; /* Suggested values for the underline thickness. */ - UINT32 isFixedPitch; /* Set to 0 if the font is proportionally + HBUINT32 isFixedPitch; /* Set to 0 if the font is proportionally * spaced, non-zero if the font is not * proportionally spaced (i.e. monospaced). */ - UINT32 minMemType42; /* Minimum memory usage when an OpenType font + HBUINT32 minMemType42; /* Minimum memory usage when an OpenType font * is downloaded. */ - UINT32 maxMemType42; /* Maximum memory usage when an OpenType font + HBUINT32 maxMemType42; /* Maximum memory usage when an OpenType font * is downloaded. */ - UINT32 minMemType1; /* Minimum memory usage when an OpenType font + HBUINT32 minMemType1; /* Minimum memory usage when an OpenType font * is downloaded as a Type 1 font. */ - UINT32 maxMemType1; /* Maximum memory usage when an OpenType font + HBUINT32 maxMemType1; /* Maximum memory usage when an OpenType font * is downloaded as a Type 1 font. */ /*postV2Tail v2[VAR];*/ DEFINE_SIZE_STATIC (32); diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-arabic-fallback.hh b/gfx/harfbuzz/src/hb-ot-shape-complex-arabic-fallback.hh index d98cde121c46..5a257f042d07 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-arabic-fallback.hh +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-arabic-fallback.hh @@ -340,7 +340,7 @@ arabic_fallback_plan_shape (arabic_fallback_plan_t *fallback_plan, hb_font_t *font, hb_buffer_t *buffer) { - OT::hb_apply_context_t c (0, font, buffer); + OT::hb_ot_apply_context_t c (0, font, buffer); for (unsigned int i = 0; i < fallback_plan->num_lookups; i++) if (fallback_plan->lookup_array[i]) { c.set_lookup_mask (fallback_plan->mask_array[i]); diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-arabic.cc b/gfx/harfbuzz/src/hb-ot-shape-complex-arabic.cc index eb9d36ff1d54..47961bfd55f6 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-arabic.cc +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-arabic.cc @@ -644,13 +644,15 @@ reorder_marks_arabic (const hb_ot_shape_plan_t *plan, { hb_glyph_info_t *info = buffer->info; + DEBUG_MSG (ARABIC, buffer, "Reordering marks from %d to %d", start, end); + unsigned int i = start; for (unsigned int cc = 220; cc <= 230; cc += 10) { - DEBUG_MSG (ARABIC, buffer, "Looking for %d's starting at %d\n", cc, i); + DEBUG_MSG (ARABIC, buffer, "Looking for %d's starting at %d", cc, i); while (i < end && info_cc(info[i]) < cc) i++; - DEBUG_MSG (ARABIC, buffer, "Looking for %d's stopped at %d\n", cc, i); + DEBUG_MSG (ARABIC, buffer, "Looking for %d's stopped at %d", cc, i); if (i == end) break; @@ -658,20 +660,17 @@ reorder_marks_arabic (const hb_ot_shape_plan_t *plan, if (info_cc(info[i]) > cc) continue; - /* Technically we should also check "info_cc(info[j]) == cc" - * in the following loop. But not doing it is safe; we might - * end up moving all the 220 MCMs and 230 MCMs together in one - * move and be done. */ unsigned int j = i; - while (j < end && info_is_mcm (info[j])) + while (j < end && info_cc(info[j]) == cc && info_is_mcm (info[j])) j++; - DEBUG_MSG (ARABIC, buffer, "Found %d's from %d to %d\n", cc, i, j); if (i == j) continue; + DEBUG_MSG (ARABIC, buffer, "Found %d's from %d to %d", cc, i, j); + /* Shift it! */ - DEBUG_MSG (ARABIC, buffer, "Shifting %d's: %d %d\n", cc, i, j); + DEBUG_MSG (ARABIC, buffer, "Shifting %d's: %d %d", cc, i, j); hb_glyph_info_t temp[HB_OT_SHAPE_COMPLEX_MAX_COMBINING_MARKS]; assert (j - i <= ARRAY_LENGTH (temp)); buffer->merge_clusters (start, j); @@ -679,7 +678,25 @@ reorder_marks_arabic (const hb_ot_shape_plan_t *plan, memmove (&info[start + j - i], &info[start], (i - start) * sizeof (hb_glyph_info_t)); memmove (&info[start], temp, (j - i) * sizeof (hb_glyph_info_t)); - start += j - i; + /* Renumber CC such that the reordered sequence is still sorted. + * 22 and 26 are chosen because they are smaller than all Arabic categories, + * and are folded back to 220/230 respectively during fallback mark positioning. + * + * We do this because the CGJ-handling logic in the normalizer relies on + * mark sequences having an increasing order even after this reordering. + * https://github.com/harfbuzz/harfbuzz/issues/554 + * This, however, does break some obscure sequences, where the normalizer + * might compose a sequence that it should not. For example, in the seequence + * ALEF, HAMZAH, MADDAH, we should NOT try to compose ALEF+MADDAH, but with this + * renumbering, we will. + */ + unsigned int new_start = start + j - i; + unsigned int new_cc = cc == 220 ? HB_MODIFIED_COMBINING_CLASS_CCC22 : HB_MODIFIED_COMBINING_CLASS_CCC26; + while (start < new_start) + { + _hb_glyph_info_set_modified_combining_class (&info[start], new_cc); + start++; + } i = j; } diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-indic-machine.hh b/gfx/harfbuzz/src/hb-ot-shape-complex-indic-machine.hh index 7eaba4e4e7b0..f3cea2271237 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-indic-machine.hh +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-indic-machine.hh @@ -34,1106 +34,889 @@ #line 36 "hb-ot-shape-complex-indic-machine.hh" static const unsigned char _indic_syllable_machine_trans_keys[] = { - 8u, 8u, 1u, 16u, 8u, 13u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, - 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, - 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, - 4u, 8u, 6u, 6u, 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, - 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 8u, 8u, 1u, 16u, 8u, 13u, - 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, - 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, - 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, - 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, - 4u, 14u, 4u, 14u, 8u, 8u, 1u, 16u, 8u, 13u, 5u, 8u, 5u, 7u, 7u, 7u, - 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, - 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, - 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, - 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 8u, 8u, 1u, 16u, - 8u, 13u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, + 8u, 8u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, - 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, - 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 5u, 8u, 4u, 14u, 4u, 14u, 5u, 8u, - 5u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, - 5u, 7u, 7u, 7u, 8u, 8u, 1u, 16u, 8u, 13u, 4u, 8u, 6u, 6u, 16u, 16u, + 16u, 16u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, + 4u, 13u, 4u, 8u, 4u, 13u, 8u, 8u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, + 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, - 16u, 16u, 8u, 8u, 1u, 19u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, + 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, + 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 8u, 8u, 5u, 8u, + 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, + 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, + 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, + 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, + 8u, 8u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, + 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, + 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, + 16u, 16u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, + 4u, 13u, 4u, 8u, 4u, 13u, 4u, 13u, 5u, 8u, 5u, 8u, 5u, 7u, 5u, 8u, + 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, + 8u, 8u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, + 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 8u, 8u, 1u, 19u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, - 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, - 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, - 3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, - 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, - 5u, 14u, 3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, - 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, + 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, + 3u, 17u, 4u, 17u, 5u, 10u, 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, + 5u, 10u, 3u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, + 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, + 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, + 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, - 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, - 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, - 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, - 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, - 3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, - 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 1u, 16u, + 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 10u, 5u, 10u, 5u, 10u, + 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 3u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, + 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, + 5u, 10u, 3u, 10u, 4u, 10u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, + 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, + 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, + 1u, 16u, 1u, 16u, 1u, 16u, 4u, 8u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, + 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, + 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 10u, + 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 3u, 10u, 3u, 10u, + 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, + 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 3u, 17u, 3u, 17u, 1u, 16u, + 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, + 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, + 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 13u, 3u, 17u, 4u, 8u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, - 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, - 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, - 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, - 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u, - 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, - 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, - 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 3u, 17u, 4u, 14u, - 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, - 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, - 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, - 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, - 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, - 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u, - 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, - 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, - 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 1u, 17u, 3u, 17u, - 1u, 17u, 4u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, - 5u, 10u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 3u, 17u, 3u, 17u, 1u, 16u, - 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, - 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, - 3u, 13u, 1u, 16u, 3u, 10u, 5u, 10u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, - 9u, 10u, 9u, 9u, 5u, 10u, 1u, 16u, 0 + 3u, 17u, 3u, 17u, 4u, 17u, 5u, 10u, 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, + 10u, 10u, 5u, 10u, 3u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, + 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, + 4u, 10u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, + 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, + 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, + 1u, 16u, 3u, 17u, 1u, 17u, 3u, 17u, 1u, 17u, 4u, 13u, 5u, 10u, 10u, 10u, + 10u, 10u, 10u, 10u, 5u, 10u, 1u, 16u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, + 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, + 3u, 10u, 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 1u, 16u, + 0 }; static const char _indic_syllable_machine_key_spans[] = { - 1, 16, 6, 4, 3, 1, 4, 3, - 1, 4, 3, 1, 4, 3, 1, 5, - 1, 1, 5, 1, 1, 5, 1, 1, - 5, 1, 1, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 1, 16, 6, - 4, 3, 1, 4, 3, 1, 4, 3, - 1, 4, 3, 1, 5, 1, 1, 5, - 1, 1, 5, 1, 1, 5, 1, 1, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 1, 16, 6, 4, 3, 1, - 4, 3, 1, 4, 3, 1, 4, 3, - 1, 5, 1, 1, 5, 1, 1, 5, - 1, 1, 5, 1, 1, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 1, 16, - 6, 4, 3, 1, 4, 3, 1, 4, + 1, 4, 3, 1, 4, 3, 1, 4, 3, 1, 4, 3, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, - 1, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 4, 11, 11, 4, - 3, 4, 3, 1, 4, 3, 1, 4, - 3, 1, 1, 16, 6, 5, 1, 1, + 1, 5, 10, 5, 10, 5, 10, 5, + 10, 5, 10, 1, 4, 3, 1, 4, + 3, 1, 4, 3, 1, 4, 3, 1, 5, 1, 1, 5, 1, 1, 5, 1, - 1, 1, 19, 15, 15, 14, 16, 15, + 1, 5, 1, 1, 5, 10, 5, 10, + 5, 10, 5, 10, 5, 10, 1, 4, + 3, 1, 4, 3, 1, 4, 3, 1, + 4, 3, 1, 5, 1, 1, 5, 1, + 1, 5, 1, 1, 5, 1, 1, 5, + 10, 5, 10, 5, 10, 5, 10, 5, + 1, 4, 3, 1, 4, 3, 1, 4, + 3, 1, 4, 3, 1, 5, 1, 1, + 5, 1, 1, 5, 1, 1, 5, 1, + 1, 5, 10, 5, 10, 5, 10, 5, + 10, 5, 10, 10, 4, 4, 3, 4, + 3, 1, 4, 3, 1, 4, 3, 1, + 1, 5, 1, 1, 5, 1, 1, 5, + 1, 1, 5, 1, 1, 1, 19, 15, 15, 14, 16, 15, 15, 14, 16, 15, - 15, 14, 16, 15, 15, 14, 10, 10, - 6, 2, 1, 2, 2, 1, 6, 11, - 8, 6, 8, 11, 12, 12, 11, 10, - 12, 11, 10, 12, 11, 10, 12, 11, - 10, 12, 16, 11, 15, 15, 16, 16, - 16, 16, 16, 15, 15, 16, 16, 16, + 15, 14, 16, 15, 15, 14, 16, 15, + 15, 14, 6, 6, 6, 1, 1, 1, + 6, 8, 8, 7, 6, 8, 7, 6, + 8, 7, 6, 8, 7, 6, 8, 7, + 15, 15, 16, 16, 16, 16, 15, 15, + 16, 16, 16, 16, 15, 15, 16, 16, 16, 16, 15, 15, 16, 16, 16, 16, - 16, 15, 15, 16, 16, 16, 16, 16, 15, 15, 15, 15, 14, 16, 15, 15, 14, 16, 15, 15, 14, 16, 15, 15, - 14, 16, 15, 15, 14, 10, 10, 6, - 2, 1, 2, 2, 1, 6, 11, 8, - 6, 8, 11, 12, 12, 11, 10, 12, - 11, 10, 12, 11, 10, 12, 11, 10, - 12, 16, 11, 15, 15, 16, 16, 16, - 16, 16, 15, 15, 16, 16, 16, 16, - 16, 15, 15, 16, 16, 16, 16, 16, - 15, 15, 16, 16, 16, 16, 11, 16, + 14, 16, 15, 15, 14, 6, 6, 6, + 1, 1, 1, 6, 8, 8, 7, 6, + 8, 7, 6, 8, 7, 6, 8, 7, + 6, 8, 7, 15, 15, 16, 16, 16, + 16, 15, 15, 16, 16, 16, 16, 15, + 15, 16, 16, 16, 16, 15, 15, 16, + 16, 16, 16, 5, 15, 15, 14, 16, + 15, 15, 14, 16, 15, 15, 14, 16, + 15, 15, 14, 16, 15, 15, 14, 6, + 6, 6, 1, 1, 1, 6, 8, 8, + 7, 6, 8, 7, 6, 8, 7, 6, + 8, 7, 6, 8, 7, 15, 15, 16, + 16, 16, 16, 15, 15, 16, 16, 16, + 16, 15, 15, 16, 16, 16, 16, 15, + 15, 16, 16, 16, 16, 10, 15, 5, 15, 15, 14, 16, 15, 15, 14, 16, 15, 15, 14, 16, 15, 15, 14, 16, - 15, 15, 14, 10, 10, 6, 2, 1, - 2, 2, 1, 6, 11, 8, 6, 8, - 11, 12, 12, 11, 10, 12, 11, 10, - 12, 11, 10, 12, 11, 10, 12, 16, - 11, 15, 15, 16, 16, 16, 16, 16, - 15, 15, 16, 16, 16, 16, 16, 15, - 15, 16, 16, 16, 16, 16, 15, 15, - 16, 16, 16, 16, 16, 11, 15, 11, - 15, 15, 14, 16, 15, 15, 14, 16, - 15, 15, 14, 16, 15, 15, 14, 16, - 15, 15, 14, 10, 10, 6, 2, 1, - 2, 2, 1, 6, 11, 8, 6, 8, - 11, 12, 12, 11, 10, 12, 11, 10, - 12, 11, 10, 12, 11, 10, 12, 16, - 11, 15, 15, 16, 16, 16, 16, 16, - 15, 15, 16, 16, 16, 16, 16, 15, - 15, 16, 16, 16, 16, 16, 15, 15, - 16, 16, 16, 16, 16, 15, 17, 15, - 17, 11, 6, 2, 1, 2, 2, 1, - 6, 16, 15, 15, 14, 15, 15, 16, - 12, 11, 10, 12, 11, 10, 12, 11, - 10, 12, 11, 10, 11, 8, 6, 8, - 11, 16, 8, 6, 6, 2, 1, 2, - 2, 1, 6, 16 + 15, 15, 14, 6, 6, 6, 1, 1, + 1, 6, 8, 8, 7, 6, 8, 7, + 6, 8, 7, 6, 8, 7, 6, 8, + 7, 15, 15, 16, 16, 16, 16, 15, + 15, 16, 16, 16, 16, 15, 15, 16, + 16, 16, 16, 15, 15, 16, 16, 16, + 16, 15, 17, 15, 17, 10, 6, 1, + 1, 1, 6, 16, 8, 7, 6, 8, + 7, 6, 8, 7, 6, 8, 7, 6, + 8, 6, 6, 1, 1, 1, 6, 16 }; static const short _indic_syllable_machine_index_offsets[] = { - 0, 2, 19, 26, 31, 35, 37, 42, - 46, 48, 53, 57, 59, 64, 68, 70, - 76, 78, 80, 86, 88, 90, 96, 98, - 100, 106, 108, 110, 122, 134, 146, 158, - 170, 182, 194, 206, 218, 230, 232, 249, - 256, 261, 265, 267, 272, 276, 278, 283, - 287, 289, 294, 298, 300, 306, 308, 310, - 316, 318, 320, 326, 328, 330, 336, 338, - 340, 352, 364, 376, 388, 400, 412, 424, - 436, 448, 460, 462, 479, 486, 491, 495, - 497, 502, 506, 508, 513, 517, 519, 524, - 528, 530, 536, 538, 540, 546, 548, 550, - 556, 558, 560, 566, 568, 570, 582, 594, - 606, 618, 630, 642, 654, 666, 678, 680, - 697, 704, 709, 713, 715, 720, 724, 726, - 731, 735, 737, 742, 746, 748, 754, 756, - 758, 764, 766, 768, 774, 776, 778, 784, - 786, 788, 800, 812, 824, 836, 848, 860, - 872, 884, 896, 908, 920, 925, 937, 949, - 954, 958, 963, 967, 969, 974, 978, 980, - 985, 989, 991, 993, 1010, 1017, 1023, 1025, - 1027, 1033, 1035, 1037, 1043, 1045, 1047, 1053, - 1055, 1057, 1059, 1079, 1095, 1111, 1126, 1143, - 1159, 1175, 1190, 1207, 1223, 1239, 1254, 1271, - 1287, 1303, 1318, 1335, 1351, 1367, 1382, 1393, - 1404, 1411, 1414, 1416, 1419, 1422, 1424, 1431, - 1443, 1452, 1459, 1468, 1480, 1493, 1506, 1518, - 1529, 1542, 1554, 1565, 1578, 1590, 1601, 1614, - 1626, 1637, 1650, 1667, 1679, 1695, 1711, 1728, - 1745, 1762, 1779, 1796, 1812, 1828, 1845, 1862, - 1879, 1896, 1913, 1929, 1945, 1962, 1979, 1996, - 2013, 2030, 2046, 2062, 2079, 2096, 2113, 2130, - 2147, 2163, 2179, 2195, 2211, 2226, 2243, 2259, - 2275, 2290, 2307, 2323, 2339, 2354, 2371, 2387, - 2403, 2418, 2435, 2451, 2467, 2482, 2493, 2504, - 2511, 2514, 2516, 2519, 2522, 2524, 2531, 2543, - 2552, 2559, 2568, 2580, 2593, 2606, 2618, 2629, - 2642, 2654, 2665, 2678, 2690, 2701, 2714, 2726, - 2737, 2750, 2767, 2779, 2795, 2811, 2828, 2845, - 2862, 2879, 2896, 2912, 2928, 2945, 2962, 2979, - 2996, 3013, 3029, 3045, 3062, 3079, 3096, 3113, - 3130, 3146, 3162, 3179, 3196, 3213, 3230, 3242, - 3259, 3275, 3291, 3306, 3323, 3339, 3355, 3370, - 3387, 3403, 3419, 3434, 3451, 3467, 3483, 3498, - 3515, 3531, 3547, 3562, 3573, 3584, 3591, 3594, - 3596, 3599, 3602, 3604, 3611, 3623, 3632, 3639, - 3648, 3660, 3673, 3686, 3698, 3709, 3722, 3734, - 3745, 3758, 3770, 3781, 3794, 3806, 3817, 3830, - 3847, 3859, 3875, 3891, 3908, 3925, 3942, 3959, - 3976, 3992, 4008, 4025, 4042, 4059, 4076, 4093, - 4109, 4125, 4142, 4159, 4176, 4193, 4210, 4226, - 4242, 4259, 4276, 4293, 4310, 4327, 4339, 4355, - 4367, 4383, 4399, 4414, 4431, 4447, 4463, 4478, - 4495, 4511, 4527, 4542, 4559, 4575, 4591, 4606, - 4623, 4639, 4655, 4670, 4681, 4692, 4699, 4702, - 4704, 4707, 4710, 4712, 4719, 4731, 4740, 4747, - 4756, 4768, 4781, 4794, 4806, 4817, 4830, 4842, - 4853, 4866, 4878, 4889, 4902, 4914, 4925, 4938, - 4955, 4967, 4983, 4999, 5016, 5033, 5050, 5067, - 5084, 5100, 5116, 5133, 5150, 5167, 5184, 5201, - 5217, 5233, 5250, 5267, 5284, 5301, 5318, 5334, - 5350, 5367, 5384, 5401, 5418, 5435, 5451, 5469, - 5485, 5503, 5515, 5522, 5525, 5527, 5530, 5533, - 5535, 5542, 5559, 5575, 5591, 5606, 5622, 5638, - 5655, 5668, 5680, 5691, 5704, 5716, 5727, 5740, - 5752, 5763, 5776, 5788, 5799, 5811, 5820, 5827, - 5836, 5848, 5865, 5874, 5881, 5888, 5891, 5893, - 5896, 5899, 5901, 5908 + 0, 2, 7, 11, 13, 18, 22, 24, + 29, 33, 35, 40, 44, 46, 52, 54, + 56, 62, 64, 66, 72, 74, 76, 82, + 84, 86, 92, 103, 109, 120, 126, 137, + 143, 154, 160, 171, 173, 178, 182, 184, + 189, 193, 195, 200, 204, 206, 211, 215, + 217, 223, 225, 227, 233, 235, 237, 243, + 245, 247, 253, 255, 257, 263, 274, 280, + 291, 297, 308, 314, 325, 331, 342, 344, + 349, 353, 355, 360, 364, 366, 371, 375, + 377, 382, 386, 388, 394, 396, 398, 404, + 406, 408, 414, 416, 418, 424, 426, 428, + 434, 445, 451, 462, 468, 479, 485, 496, + 502, 504, 509, 513, 515, 520, 524, 526, + 531, 535, 537, 542, 546, 548, 554, 556, + 558, 564, 566, 568, 574, 576, 578, 584, + 586, 588, 594, 605, 611, 622, 628, 639, + 645, 656, 662, 673, 684, 689, 694, 698, + 703, 707, 709, 714, 718, 720, 725, 729, + 731, 733, 739, 741, 743, 749, 751, 753, + 759, 761, 763, 769, 771, 773, 775, 795, + 811, 827, 842, 859, 875, 891, 906, 923, + 939, 955, 970, 987, 1003, 1019, 1034, 1051, + 1067, 1083, 1098, 1105, 1112, 1119, 1121, 1123, + 1125, 1132, 1141, 1150, 1158, 1165, 1174, 1182, + 1189, 1198, 1206, 1213, 1222, 1230, 1237, 1246, + 1254, 1270, 1286, 1303, 1320, 1337, 1354, 1370, + 1386, 1403, 1420, 1437, 1454, 1470, 1486, 1503, + 1520, 1537, 1554, 1570, 1586, 1603, 1620, 1637, + 1654, 1670, 1686, 1702, 1718, 1733, 1750, 1766, + 1782, 1797, 1814, 1830, 1846, 1861, 1878, 1894, + 1910, 1925, 1942, 1958, 1974, 1989, 1996, 2003, + 2010, 2012, 2014, 2016, 2023, 2032, 2041, 2049, + 2056, 2065, 2073, 2080, 2089, 2097, 2104, 2113, + 2121, 2128, 2137, 2145, 2161, 2177, 2194, 2211, + 2228, 2245, 2261, 2277, 2294, 2311, 2328, 2345, + 2361, 2377, 2394, 2411, 2428, 2445, 2461, 2477, + 2494, 2511, 2528, 2545, 2551, 2567, 2583, 2598, + 2615, 2631, 2647, 2662, 2679, 2695, 2711, 2726, + 2743, 2759, 2775, 2790, 2807, 2823, 2839, 2854, + 2861, 2868, 2875, 2877, 2879, 2881, 2888, 2897, + 2906, 2914, 2921, 2930, 2938, 2945, 2954, 2962, + 2969, 2978, 2986, 2993, 3002, 3010, 3026, 3042, + 3059, 3076, 3093, 3110, 3126, 3142, 3159, 3176, + 3193, 3210, 3226, 3242, 3259, 3276, 3293, 3310, + 3326, 3342, 3359, 3376, 3393, 3410, 3421, 3437, + 3443, 3459, 3475, 3490, 3507, 3523, 3539, 3554, + 3571, 3587, 3603, 3618, 3635, 3651, 3667, 3682, + 3699, 3715, 3731, 3746, 3753, 3760, 3767, 3769, + 3771, 3773, 3780, 3789, 3798, 3806, 3813, 3822, + 3830, 3837, 3846, 3854, 3861, 3870, 3878, 3885, + 3894, 3902, 3918, 3934, 3951, 3968, 3985, 4002, + 4018, 4034, 4051, 4068, 4085, 4102, 4118, 4134, + 4151, 4168, 4185, 4202, 4218, 4234, 4251, 4268, + 4285, 4302, 4318, 4336, 4352, 4370, 4381, 4388, + 4390, 4392, 4394, 4401, 4418, 4427, 4435, 4442, + 4451, 4459, 4466, 4475, 4483, 4490, 4499, 4507, + 4514, 4523, 4530, 4537, 4539, 4541, 4543, 4550 }; static const short _indic_syllable_machine_indicies[] = { - 1, 0, 2, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 0, 1, 0, 0, 0, 0, - 4, 0, 5, 5, 6, 1, 0, 7, - 7, 6, 0, 6, 0, 8, 8, 9, - 1, 0, 10, 10, 9, 0, 9, 0, - 11, 11, 12, 1, 0, 13, 13, 12, - 0, 12, 0, 14, 14, 15, 1, 0, - 16, 16, 15, 0, 15, 0, 17, 0, - 0, 0, 1, 0, 18, 0, 19, 0, - 20, 14, 14, 15, 1, 0, 21, 0, - 22, 0, 23, 11, 11, 12, 1, 0, - 24, 0, 25, 0, 26, 8, 8, 9, - 1, 0, 27, 0, 28, 0, 29, 5, - 5, 6, 1, 0, 0, 0, 0, 0, - 29, 0, 29, 5, 5, 6, 1, 0, - 0, 0, 0, 30, 29, 0, 31, 5, - 5, 6, 1, 0, 0, 0, 0, 0, - 31, 0, 31, 5, 5, 6, 1, 0, - 0, 0, 0, 32, 31, 0, 33, 5, - 5, 6, 1, 0, 0, 0, 0, 0, - 33, 0, 33, 5, 5, 6, 1, 0, - 0, 0, 0, 34, 33, 0, 35, 5, - 5, 6, 1, 0, 0, 0, 0, 0, - 35, 0, 35, 5, 5, 6, 1, 0, - 0, 0, 0, 36, 35, 0, 37, 5, - 5, 6, 1, 0, 0, 0, 0, 0, - 37, 0, 37, 5, 5, 6, 1, 0, - 0, 0, 0, 38, 37, 0, 40, 39, - 41, 42, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 41, - 39, 40, 39, 39, 39, 39, 43, 39, - 44, 44, 45, 40, 39, 46, 46, 45, - 39, 45, 39, 47, 47, 48, 40, 39, - 49, 49, 48, 39, 48, 39, 50, 50, - 51, 40, 39, 52, 52, 51, 39, 51, - 39, 53, 53, 54, 40, 39, 55, 55, - 54, 39, 54, 39, 56, 39, 39, 39, - 40, 39, 57, 39, 58, 39, 59, 53, - 53, 54, 40, 39, 60, 39, 61, 39, - 62, 50, 50, 51, 40, 39, 63, 39, - 64, 39, 65, 47, 47, 48, 40, 39, - 66, 39, 67, 39, 68, 44, 44, 45, - 40, 39, 39, 39, 39, 39, 68, 39, - 68, 44, 44, 45, 40, 39, 39, 39, - 39, 69, 68, 39, 70, 44, 44, 45, - 40, 39, 39, 39, 39, 39, 70, 39, - 70, 44, 44, 45, 40, 39, 39, 39, - 39, 71, 70, 39, 72, 44, 44, 45, - 40, 39, 39, 39, 39, 39, 72, 39, - 72, 44, 44, 45, 40, 39, 39, 39, - 39, 73, 72, 39, 74, 44, 44, 45, - 40, 39, 39, 39, 39, 39, 74, 39, - 74, 44, 44, 45, 40, 39, 39, 39, - 39, 75, 74, 39, 76, 44, 44, 45, - 40, 39, 39, 39, 39, 39, 76, 39, - 76, 44, 44, 45, 40, 39, 39, 39, - 39, 77, 76, 39, 79, 78, 80, 81, - 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 80, 78, 79, - 78, 78, 78, 78, 82, 78, 83, 83, - 84, 79, 78, 86, 86, 84, 85, 84, - 85, 87, 87, 88, 79, 78, 89, 89, - 88, 78, 88, 78, 90, 90, 91, 79, - 78, 92, 92, 91, 78, 91, 78, 93, - 93, 94, 79, 78, 95, 95, 94, 78, - 94, 78, 96, 78, 78, 78, 79, 78, - 97, 78, 98, 78, 99, 93, 93, 94, - 79, 78, 100, 78, 101, 78, 102, 90, - 90, 91, 79, 78, 103, 78, 104, 78, - 105, 87, 87, 88, 79, 78, 106, 78, - 107, 78, 108, 83, 83, 84, 79, 78, - 78, 78, 78, 78, 108, 78, 108, 83, - 83, 84, 79, 78, 78, 78, 78, 109, - 108, 78, 110, 83, 83, 84, 79, 78, - 78, 78, 78, 78, 110, 78, 110, 83, - 83, 84, 79, 78, 78, 78, 78, 111, - 110, 78, 112, 83, 83, 84, 79, 78, - 78, 78, 78, 78, 112, 78, 112, 83, - 83, 84, 79, 78, 78, 78, 78, 113, - 112, 78, 114, 83, 83, 84, 79, 78, - 78, 78, 78, 78, 114, 78, 114, 83, - 83, 84, 79, 78, 78, 78, 78, 115, - 114, 78, 116, 83, 83, 84, 79, 78, - 78, 78, 78, 78, 116, 78, 118, 117, - 119, 120, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 119, - 117, 118, 117, 117, 117, 117, 121, 117, - 122, 122, 123, 118, 117, 124, 124, 123, - 117, 123, 117, 125, 125, 126, 118, 117, - 127, 127, 126, 117, 126, 117, 128, 128, - 129, 118, 117, 130, 130, 129, 117, 129, - 117, 131, 131, 132, 118, 117, 133, 133, - 132, 117, 132, 117, 134, 117, 117, 117, - 118, 117, 135, 117, 136, 117, 137, 131, - 131, 132, 118, 117, 138, 117, 139, 117, - 140, 128, 128, 129, 118, 117, 141, 117, - 142, 117, 143, 125, 125, 126, 118, 117, - 144, 117, 145, 117, 146, 122, 122, 123, - 118, 117, 117, 117, 117, 117, 146, 117, - 146, 122, 122, 123, 118, 117, 117, 117, - 117, 147, 146, 117, 148, 122, 122, 123, - 118, 117, 117, 117, 117, 117, 148, 117, - 148, 122, 122, 123, 118, 117, 117, 117, - 117, 149, 148, 117, 150, 122, 122, 123, - 118, 117, 117, 117, 117, 117, 150, 117, - 150, 122, 122, 123, 118, 117, 117, 117, - 117, 151, 150, 117, 152, 122, 122, 123, - 118, 117, 117, 117, 117, 117, 152, 117, - 152, 122, 122, 123, 118, 117, 117, 117, - 117, 153, 152, 117, 154, 122, 122, 123, - 118, 117, 117, 117, 117, 117, 154, 117, - 154, 122, 122, 123, 118, 117, 117, 117, - 117, 155, 154, 117, 116, 83, 83, 84, - 79, 78, 78, 78, 78, 156, 116, 78, - 86, 86, 84, 1, 0, 114, 83, 83, - 84, 157, 0, 0, 0, 0, 0, 114, - 0, 114, 83, 83, 84, 157, 0, 0, - 0, 0, 158, 114, 0, 159, 159, 160, - 1, 0, 7, 7, 160, 0, 161, 161, - 162, 157, 0, 163, 163, 162, 0, 162, - 0, 164, 164, 165, 157, 0, 166, 166, - 165, 0, 165, 0, 167, 167, 168, 157, - 0, 169, 169, 168, 0, 168, 0, 157, - 0, 170, 171, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 170, 0, 157, 0, 0, 0, 0, 172, - 0, 173, 0, 0, 0, 157, 0, 174, - 0, 175, 0, 176, 167, 167, 168, 157, - 0, 177, 0, 178, 0, 179, 164, 164, - 165, 157, 0, 180, 0, 181, 0, 182, - 161, 161, 162, 157, 0, 183, 0, 184, - 0, 186, 185, 188, 189, 190, 191, 192, - 193, 84, 79, 194, 195, 196, 196, 156, - 197, 198, 199, 200, 201, 202, 187, 204, - 205, 206, 207, 6, 1, 208, 209, 203, - 203, 38, 210, 203, 203, 211, 203, 212, - 205, 213, 213, 6, 1, 208, 209, 203, - 203, 203, 210, 203, 203, 211, 203, 205, - 213, 213, 6, 1, 208, 209, 203, 203, - 203, 210, 203, 203, 211, 203, 214, 203, - 203, 203, 19, 215, 203, 1, 208, 209, - 203, 203, 203, 216, 203, 214, 203, 217, - 218, 219, 220, 6, 1, 208, 209, 203, - 203, 36, 221, 203, 203, 211, 203, 222, - 218, 223, 223, 6, 1, 208, 209, 203, - 203, 203, 221, 203, 203, 211, 203, 218, - 223, 223, 6, 1, 208, 209, 203, 203, - 203, 221, 203, 203, 211, 203, 224, 203, - 203, 203, 19, 225, 203, 1, 208, 209, - 203, 203, 203, 216, 203, 224, 203, 226, - 227, 228, 229, 6, 1, 208, 209, 203, - 203, 34, 230, 203, 203, 211, 203, 231, - 227, 232, 232, 6, 1, 208, 209, 203, - 203, 203, 230, 203, 203, 211, 203, 227, - 232, 232, 6, 1, 208, 209, 203, 203, - 203, 230, 203, 203, 211, 203, 233, 203, - 203, 203, 19, 234, 203, 1, 208, 209, - 203, 203, 203, 216, 203, 233, 203, 235, - 236, 237, 238, 6, 1, 208, 209, 203, - 203, 32, 239, 203, 203, 211, 203, 240, - 236, 241, 241, 6, 1, 208, 209, 203, - 203, 203, 239, 203, 203, 211, 203, 236, - 241, 241, 6, 1, 208, 209, 203, 203, - 203, 239, 203, 203, 211, 203, 242, 203, - 203, 203, 19, 243, 203, 1, 208, 209, - 203, 203, 203, 216, 203, 242, 203, 244, - 245, 246, 247, 6, 1, 208, 209, 203, - 203, 30, 248, 203, 203, 211, 203, 249, - 245, 250, 250, 6, 1, 208, 209, 203, - 203, 203, 248, 203, 203, 211, 203, 245, - 250, 250, 6, 1, 208, 209, 203, 203, - 203, 248, 203, 203, 211, 203, 19, 251, - 203, 1, 208, 209, 203, 203, 203, 216, - 203, 252, 252, 203, 1, 208, 209, 203, - 203, 203, 216, 203, 253, 203, 203, 254, - 208, 209, 203, 208, 209, 203, 255, 203, - 208, 256, 203, 208, 257, 203, 208, 203, - 253, 203, 203, 203, 208, 209, 203, 258, - 203, 259, 260, 203, 1, 208, 209, 203, - 203, 4, 203, 3, 203, 252, 252, 203, - 1, 208, 209, 203, 252, 252, 203, 1, - 208, 209, 203, 258, 203, 252, 252, 203, - 1, 208, 209, 203, 258, 203, 259, 252, - 203, 1, 208, 209, 203, 203, 4, 203, - 19, 203, 261, 261, 6, 1, 208, 209, - 203, 203, 203, 216, 203, 262, 28, 263, - 264, 9, 1, 208, 209, 203, 203, 203, - 216, 203, 28, 263, 264, 9, 1, 208, - 209, 203, 203, 203, 216, 203, 263, 263, - 9, 1, 208, 209, 203, 203, 203, 216, - 203, 265, 25, 266, 267, 12, 1, 208, - 209, 203, 203, 203, 216, 203, 25, 266, - 267, 12, 1, 208, 209, 203, 203, 203, - 216, 203, 266, 266, 12, 1, 208, 209, - 203, 203, 203, 216, 203, 268, 22, 269, - 270, 15, 1, 208, 209, 203, 203, 203, - 216, 203, 22, 269, 270, 15, 1, 208, - 209, 203, 203, 203, 216, 203, 269, 269, - 15, 1, 208, 209, 203, 203, 203, 216, - 203, 271, 19, 252, 272, 203, 1, 208, - 209, 203, 203, 203, 216, 203, 19, 252, - 272, 203, 1, 208, 209, 203, 203, 203, - 216, 203, 252, 273, 203, 1, 208, 209, - 203, 203, 203, 216, 203, 19, 203, 252, - 252, 203, 1, 208, 209, 203, 203, 203, - 216, 203, 2, 3, 203, 203, 19, 251, - 203, 1, 208, 209, 203, 203, 203, 216, - 203, 2, 203, 245, 250, 250, 6, 1, - 208, 209, 203, 203, 203, 248, 203, 244, - 245, 250, 250, 6, 1, 208, 209, 203, - 203, 203, 248, 203, 203, 211, 203, 244, - 245, 246, 250, 6, 1, 208, 209, 203, - 203, 30, 248, 203, 203, 211, 203, 242, - 203, 274, 203, 261, 261, 6, 1, 208, - 209, 203, 203, 203, 216, 203, 242, 203, - 242, 203, 203, 203, 252, 252, 203, 1, - 208, 209, 203, 203, 203, 216, 203, 242, - 203, 242, 203, 203, 203, 252, 275, 203, - 1, 208, 209, 203, 203, 203, 216, 203, - 242, 203, 242, 203, 274, 203, 252, 252, - 203, 1, 208, 209, 203, 203, 203, 216, - 203, 242, 203, 242, 3, 203, 203, 19, - 243, 203, 1, 208, 209, 203, 203, 203, - 216, 203, 242, 203, 235, 236, 241, 241, - 6, 1, 208, 209, 203, 203, 203, 239, - 203, 203, 211, 203, 235, 236, 237, 241, - 6, 1, 208, 209, 203, 203, 32, 239, - 203, 203, 211, 203, 233, 203, 276, 203, - 261, 261, 6, 1, 208, 209, 203, 203, - 203, 216, 203, 233, 203, 233, 203, 203, - 203, 252, 252, 203, 1, 208, 209, 203, - 203, 203, 216, 203, 233, 203, 233, 203, - 203, 203, 252, 277, 203, 1, 208, 209, - 203, 203, 203, 216, 203, 233, 203, 233, - 203, 276, 203, 252, 252, 203, 1, 208, - 209, 203, 203, 203, 216, 203, 233, 203, - 233, 3, 203, 203, 19, 234, 203, 1, - 208, 209, 203, 203, 203, 216, 203, 233, - 203, 226, 227, 232, 232, 6, 1, 208, - 209, 203, 203, 203, 230, 203, 203, 211, - 203, 226, 227, 228, 232, 6, 1, 208, - 209, 203, 203, 34, 230, 203, 203, 211, - 203, 224, 203, 278, 203, 261, 261, 6, - 1, 208, 209, 203, 203, 203, 216, 203, - 224, 203, 224, 203, 203, 203, 252, 252, - 203, 1, 208, 209, 203, 203, 203, 216, - 203, 224, 203, 224, 203, 203, 203, 252, - 279, 203, 1, 208, 209, 203, 203, 203, - 216, 203, 224, 203, 224, 203, 278, 203, - 252, 252, 203, 1, 208, 209, 203, 203, - 203, 216, 203, 224, 203, 224, 3, 203, - 203, 19, 225, 203, 1, 208, 209, 203, - 203, 203, 216, 203, 224, 203, 217, 218, - 223, 223, 6, 1, 208, 209, 203, 203, - 203, 221, 203, 203, 211, 203, 217, 218, - 219, 223, 6, 1, 208, 209, 203, 203, - 36, 221, 203, 203, 211, 203, 214, 203, - 280, 203, 261, 261, 6, 1, 208, 209, - 203, 203, 203, 216, 203, 214, 203, 214, - 203, 203, 203, 252, 252, 203, 1, 208, - 209, 203, 203, 203, 216, 203, 214, 203, - 214, 203, 203, 203, 252, 281, 203, 1, - 208, 209, 203, 203, 203, 216, 203, 214, - 203, 214, 203, 280, 203, 252, 252, 203, - 1, 208, 209, 203, 203, 203, 216, 203, - 214, 203, 214, 3, 203, 203, 19, 215, - 203, 1, 208, 209, 203, 203, 203, 216, - 203, 214, 203, 204, 205, 213, 213, 6, - 1, 208, 209, 203, 203, 203, 210, 203, - 203, 211, 203, 204, 205, 206, 213, 6, - 1, 208, 209, 203, 203, 38, 210, 203, - 203, 211, 203, 283, 284, 285, 286, 45, - 40, 287, 288, 282, 282, 77, 289, 282, - 282, 290, 282, 291, 284, 292, 286, 45, - 40, 287, 288, 282, 282, 282, 289, 282, - 282, 290, 282, 284, 292, 286, 45, 40, - 287, 288, 282, 282, 282, 289, 282, 282, - 290, 282, 293, 282, 282, 282, 58, 294, - 282, 40, 287, 288, 282, 282, 282, 295, - 282, 293, 282, 296, 297, 298, 299, 45, - 40, 287, 288, 282, 282, 75, 300, 282, - 282, 290, 282, 301, 297, 302, 302, 45, - 40, 287, 288, 282, 282, 282, 300, 282, - 282, 290, 282, 297, 302, 302, 45, 40, - 287, 288, 282, 282, 282, 300, 282, 282, - 290, 282, 303, 282, 282, 282, 58, 304, - 282, 40, 287, 288, 282, 282, 282, 295, - 282, 303, 282, 305, 306, 307, 308, 45, - 40, 287, 288, 282, 282, 73, 309, 282, - 282, 290, 282, 310, 306, 311, 311, 45, - 40, 287, 288, 282, 282, 282, 309, 282, - 282, 290, 282, 306, 311, 311, 45, 40, - 287, 288, 282, 282, 282, 309, 282, 282, - 290, 282, 312, 282, 282, 282, 58, 313, - 282, 40, 287, 288, 282, 282, 282, 295, - 282, 312, 282, 314, 315, 316, 317, 45, - 40, 287, 288, 282, 282, 71, 318, 282, - 282, 290, 282, 319, 315, 320, 320, 45, - 40, 287, 288, 282, 282, 282, 318, 282, - 282, 290, 282, 315, 320, 320, 45, 40, - 287, 288, 282, 282, 282, 318, 282, 282, - 290, 282, 321, 282, 282, 282, 58, 322, - 282, 40, 287, 288, 282, 282, 282, 295, - 282, 321, 282, 323, 324, 325, 326, 45, - 40, 287, 288, 282, 282, 69, 327, 282, - 282, 290, 282, 328, 324, 329, 329, 45, - 40, 287, 288, 282, 282, 282, 327, 282, - 282, 290, 282, 324, 329, 329, 45, 40, - 287, 288, 282, 282, 282, 327, 282, 282, - 290, 282, 58, 330, 282, 40, 287, 288, - 282, 282, 282, 295, 282, 331, 331, 282, - 40, 287, 288, 282, 282, 282, 295, 282, - 332, 282, 282, 333, 287, 288, 282, 287, - 288, 282, 334, 282, 287, 335, 282, 287, - 336, 282, 287, 282, 332, 282, 282, 282, - 287, 288, 282, 337, 282, 338, 339, 282, - 40, 287, 288, 282, 282, 43, 282, 42, - 282, 331, 331, 282, 40, 287, 288, 282, - 331, 331, 282, 40, 287, 288, 282, 337, - 282, 331, 331, 282, 40, 287, 288, 282, - 337, 282, 338, 331, 282, 40, 287, 288, - 282, 282, 43, 282, 58, 282, 340, 340, - 45, 40, 287, 288, 282, 282, 282, 295, - 282, 341, 67, 342, 343, 48, 40, 287, - 288, 282, 282, 282, 295, 282, 67, 342, - 343, 48, 40, 287, 288, 282, 282, 282, - 295, 282, 342, 342, 48, 40, 287, 288, - 282, 282, 282, 295, 282, 344, 64, 345, - 346, 51, 40, 287, 288, 282, 282, 282, - 295, 282, 64, 345, 346, 51, 40, 287, - 288, 282, 282, 282, 295, 282, 345, 345, - 51, 40, 287, 288, 282, 282, 282, 295, - 282, 347, 61, 348, 349, 54, 40, 287, - 288, 282, 282, 282, 295, 282, 61, 348, - 349, 54, 40, 287, 288, 282, 282, 282, - 295, 282, 348, 348, 54, 40, 287, 288, - 282, 282, 282, 295, 282, 350, 58, 331, - 351, 282, 40, 287, 288, 282, 282, 282, - 295, 282, 58, 331, 351, 282, 40, 287, - 288, 282, 282, 282, 295, 282, 331, 352, - 282, 40, 287, 288, 282, 282, 282, 295, - 282, 58, 282, 331, 331, 282, 40, 287, - 288, 282, 282, 282, 295, 282, 41, 42, - 282, 282, 58, 330, 282, 40, 287, 288, - 282, 282, 282, 295, 282, 41, 282, 324, - 329, 329, 45, 40, 287, 288, 282, 282, - 282, 327, 282, 323, 324, 329, 329, 45, - 40, 287, 288, 282, 282, 282, 327, 282, - 282, 290, 282, 323, 324, 325, 329, 45, - 40, 287, 288, 282, 282, 69, 327, 282, - 282, 290, 282, 321, 282, 353, 282, 340, - 340, 45, 40, 287, 288, 282, 282, 282, - 295, 282, 321, 282, 321, 282, 282, 282, - 331, 331, 282, 40, 287, 288, 282, 282, - 282, 295, 282, 321, 282, 321, 282, 282, - 282, 331, 354, 282, 40, 287, 288, 282, - 282, 282, 295, 282, 321, 282, 321, 282, - 353, 282, 331, 331, 282, 40, 287, 288, - 282, 282, 282, 295, 282, 321, 282, 321, - 42, 282, 282, 58, 322, 282, 40, 287, - 288, 282, 282, 282, 295, 282, 321, 282, - 314, 315, 320, 320, 45, 40, 287, 288, - 282, 282, 282, 318, 282, 282, 290, 282, - 314, 315, 316, 320, 45, 40, 287, 288, - 282, 282, 71, 318, 282, 282, 290, 282, - 312, 282, 355, 282, 340, 340, 45, 40, - 287, 288, 282, 282, 282, 295, 282, 312, - 282, 312, 282, 282, 282, 331, 331, 282, - 40, 287, 288, 282, 282, 282, 295, 282, - 312, 282, 312, 282, 282, 282, 331, 356, - 282, 40, 287, 288, 282, 282, 282, 295, - 282, 312, 282, 312, 282, 355, 282, 331, - 331, 282, 40, 287, 288, 282, 282, 282, - 295, 282, 312, 282, 312, 42, 282, 282, - 58, 313, 282, 40, 287, 288, 282, 282, - 282, 295, 282, 312, 282, 305, 306, 311, - 311, 45, 40, 287, 288, 282, 282, 282, - 309, 282, 282, 290, 282, 305, 306, 307, - 311, 45, 40, 287, 288, 282, 282, 73, - 309, 282, 282, 290, 282, 303, 282, 357, - 282, 340, 340, 45, 40, 287, 288, 282, - 282, 282, 295, 282, 303, 282, 303, 282, - 282, 282, 331, 331, 282, 40, 287, 288, - 282, 282, 282, 295, 282, 303, 282, 303, - 282, 282, 282, 331, 358, 282, 40, 287, - 288, 282, 282, 282, 295, 282, 303, 282, - 303, 282, 357, 282, 331, 331, 282, 40, - 287, 288, 282, 282, 282, 295, 282, 303, - 282, 303, 42, 282, 282, 58, 304, 282, - 40, 287, 288, 282, 282, 282, 295, 282, - 303, 282, 296, 297, 302, 302, 45, 40, - 287, 288, 282, 282, 282, 300, 282, 282, - 290, 282, 296, 297, 298, 302, 45, 40, - 287, 288, 282, 282, 75, 300, 282, 282, - 290, 282, 293, 282, 359, 282, 340, 340, - 45, 40, 287, 288, 282, 282, 282, 295, - 282, 293, 282, 293, 282, 282, 282, 331, - 331, 282, 40, 287, 288, 282, 282, 282, - 295, 282, 293, 282, 293, 282, 282, 282, - 331, 360, 282, 40, 287, 288, 282, 282, - 282, 295, 282, 293, 282, 293, 282, 359, - 282, 331, 331, 282, 40, 287, 288, 282, - 282, 282, 295, 282, 293, 282, 76, 44, - 44, 45, 40, 282, 282, 282, 282, 282, - 76, 282, 293, 42, 282, 282, 58, 294, - 282, 40, 287, 288, 282, 282, 282, 295, - 282, 293, 282, 283, 284, 292, 286, 45, - 40, 287, 288, 282, 282, 282, 289, 282, - 282, 290, 282, 362, 191, 363, 363, 84, - 79, 194, 195, 361, 361, 361, 197, 361, - 361, 200, 361, 191, 363, 363, 84, 79, - 194, 195, 361, 361, 361, 197, 361, 361, - 200, 361, 364, 361, 361, 361, 98, 365, - 361, 79, 194, 195, 361, 361, 361, 366, - 361, 364, 361, 367, 368, 369, 370, 84, - 79, 194, 195, 361, 361, 115, 371, 361, - 361, 200, 361, 372, 368, 373, 373, 84, - 79, 194, 195, 361, 361, 361, 371, 361, - 361, 200, 361, 368, 373, 373, 84, 79, - 194, 195, 361, 361, 361, 371, 361, 361, - 200, 361, 374, 361, 361, 361, 98, 375, - 361, 79, 194, 195, 361, 361, 361, 366, - 361, 374, 361, 376, 377, 378, 379, 84, - 79, 194, 195, 361, 361, 113, 380, 361, - 361, 200, 361, 381, 377, 382, 382, 84, - 79, 194, 195, 361, 361, 361, 380, 361, - 361, 200, 361, 377, 382, 382, 84, 79, - 194, 195, 361, 361, 361, 380, 361, 361, - 200, 361, 383, 361, 361, 361, 98, 384, - 361, 79, 194, 195, 361, 361, 361, 366, - 361, 383, 361, 385, 386, 387, 388, 84, - 79, 194, 195, 361, 361, 111, 389, 361, - 361, 200, 361, 390, 386, 391, 391, 84, - 79, 194, 195, 361, 361, 361, 389, 361, - 361, 200, 361, 386, 391, 391, 84, 79, - 194, 195, 361, 361, 361, 389, 361, 361, - 200, 361, 392, 361, 361, 361, 98, 393, - 361, 79, 194, 195, 361, 361, 361, 366, - 361, 392, 361, 394, 395, 396, 397, 84, - 79, 194, 195, 361, 361, 109, 398, 361, - 361, 200, 361, 399, 395, 400, 400, 84, - 79, 194, 195, 361, 361, 361, 398, 361, - 361, 200, 361, 395, 400, 400, 84, 79, - 194, 195, 361, 361, 361, 398, 361, 361, - 200, 361, 98, 401, 361, 79, 194, 195, - 361, 361, 361, 366, 361, 402, 402, 361, - 79, 194, 195, 361, 361, 361, 366, 361, - 403, 361, 361, 404, 194, 195, 361, 194, - 195, 361, 405, 361, 194, 406, 361, 194, - 407, 361, 194, 361, 403, 361, 361, 361, - 194, 195, 361, 408, 361, 409, 410, 361, - 79, 194, 195, 361, 361, 82, 361, 81, - 361, 402, 402, 361, 79, 194, 195, 361, - 402, 402, 361, 79, 194, 195, 361, 408, - 361, 402, 402, 361, 79, 194, 195, 361, - 408, 361, 409, 402, 361, 79, 194, 195, - 361, 361, 82, 361, 98, 361, 411, 411, - 84, 79, 194, 195, 361, 361, 361, 366, - 361, 412, 107, 413, 414, 88, 79, 194, - 195, 361, 361, 361, 366, 361, 107, 413, - 414, 88, 79, 194, 195, 361, 361, 361, - 366, 361, 413, 413, 88, 79, 194, 195, - 361, 361, 361, 366, 361, 415, 104, 416, - 417, 91, 79, 194, 195, 361, 361, 361, - 366, 361, 104, 416, 417, 91, 79, 194, - 195, 361, 361, 361, 366, 361, 416, 416, - 91, 79, 194, 195, 361, 361, 361, 366, - 361, 418, 101, 419, 420, 94, 79, 194, - 195, 361, 361, 361, 366, 361, 101, 419, - 420, 94, 79, 194, 195, 361, 361, 361, - 366, 361, 419, 419, 94, 79, 194, 195, - 361, 361, 361, 366, 361, 421, 98, 402, - 422, 361, 79, 194, 195, 361, 361, 361, - 366, 361, 98, 402, 422, 361, 79, 194, - 195, 361, 361, 361, 366, 361, 402, 423, - 361, 79, 194, 195, 361, 361, 361, 366, - 361, 98, 361, 402, 402, 361, 79, 194, - 195, 361, 361, 361, 366, 361, 80, 81, - 361, 361, 98, 401, 361, 79, 194, 195, - 361, 361, 361, 366, 361, 80, 361, 395, - 400, 400, 84, 79, 194, 195, 361, 361, - 361, 398, 361, 394, 395, 400, 400, 84, - 79, 194, 195, 361, 361, 361, 398, 361, - 361, 200, 361, 394, 395, 396, 400, 84, - 79, 194, 195, 361, 361, 109, 398, 361, - 361, 200, 361, 392, 361, 424, 361, 411, - 411, 84, 79, 194, 195, 361, 361, 361, - 366, 361, 392, 361, 392, 361, 361, 361, - 402, 402, 361, 79, 194, 195, 361, 361, - 361, 366, 361, 392, 361, 392, 361, 361, - 361, 402, 425, 361, 79, 194, 195, 361, - 361, 361, 366, 361, 392, 361, 392, 361, - 424, 361, 402, 402, 361, 79, 194, 195, - 361, 361, 361, 366, 361, 392, 361, 392, - 81, 361, 361, 98, 393, 361, 79, 194, - 195, 361, 361, 361, 366, 361, 392, 361, - 385, 386, 391, 391, 84, 79, 194, 195, - 361, 361, 361, 389, 361, 361, 200, 361, - 385, 386, 387, 391, 84, 79, 194, 195, - 361, 361, 111, 389, 361, 361, 200, 361, - 383, 361, 426, 361, 411, 411, 84, 79, - 194, 195, 361, 361, 361, 366, 361, 383, - 361, 383, 361, 361, 361, 402, 402, 361, - 79, 194, 195, 361, 361, 361, 366, 361, - 383, 361, 383, 361, 361, 361, 402, 427, - 361, 79, 194, 195, 361, 361, 361, 366, - 361, 383, 361, 383, 361, 426, 361, 402, - 402, 361, 79, 194, 195, 361, 361, 361, - 366, 361, 383, 361, 383, 81, 361, 361, - 98, 384, 361, 79, 194, 195, 361, 361, - 361, 366, 361, 383, 361, 376, 377, 382, - 382, 84, 79, 194, 195, 361, 361, 361, - 380, 361, 361, 200, 361, 376, 377, 378, - 382, 84, 79, 194, 195, 361, 361, 113, - 380, 361, 361, 200, 361, 374, 361, 428, - 361, 411, 411, 84, 79, 194, 195, 361, - 361, 361, 366, 361, 374, 361, 374, 361, - 361, 361, 402, 402, 361, 79, 194, 195, - 361, 361, 361, 366, 361, 374, 361, 374, - 361, 361, 361, 402, 429, 361, 79, 194, - 195, 361, 361, 361, 366, 361, 374, 361, - 374, 361, 428, 361, 402, 402, 361, 79, - 194, 195, 361, 361, 361, 366, 361, 374, - 361, 374, 81, 361, 361, 98, 375, 361, - 79, 194, 195, 361, 361, 361, 366, 361, - 374, 361, 367, 368, 373, 373, 84, 79, - 194, 195, 361, 361, 361, 371, 361, 361, - 200, 361, 367, 368, 369, 373, 84, 79, - 194, 195, 361, 361, 115, 371, 361, 361, - 200, 361, 364, 361, 430, 361, 411, 411, - 84, 79, 194, 195, 361, 361, 361, 366, - 361, 364, 361, 364, 361, 361, 361, 402, - 402, 361, 79, 194, 195, 361, 361, 361, - 366, 361, 364, 361, 364, 361, 361, 361, - 402, 431, 361, 79, 194, 195, 361, 361, - 361, 366, 361, 364, 361, 364, 361, 430, - 361, 402, 402, 361, 79, 194, 195, 361, - 361, 361, 366, 361, 364, 361, 364, 81, - 361, 361, 98, 365, 361, 79, 194, 195, - 361, 361, 361, 366, 361, 364, 361, 116, - 83, 83, 84, 79, 432, 432, 432, 432, - 156, 116, 432, 190, 191, 363, 363, 84, - 79, 194, 195, 361, 361, 361, 197, 361, - 361, 200, 361, 116, 83, 83, 84, 79, - 432, 432, 432, 432, 432, 116, 432, 434, - 435, 436, 437, 123, 118, 438, 439, 433, - 433, 155, 440, 433, 433, 441, 433, 442, - 435, 437, 437, 123, 118, 438, 439, 433, - 433, 433, 440, 433, 433, 441, 433, 435, - 437, 437, 123, 118, 438, 439, 433, 433, - 433, 440, 433, 433, 441, 433, 443, 433, - 433, 433, 136, 444, 433, 118, 438, 439, - 433, 433, 433, 445, 433, 443, 433, 446, - 447, 448, 449, 123, 118, 438, 439, 433, - 433, 153, 450, 433, 433, 441, 433, 451, - 447, 452, 452, 123, 118, 438, 439, 433, - 433, 433, 450, 433, 433, 441, 433, 447, - 452, 452, 123, 118, 438, 439, 433, 433, - 433, 450, 433, 433, 441, 433, 453, 433, - 433, 433, 136, 454, 433, 118, 438, 439, - 433, 433, 433, 445, 433, 453, 433, 455, - 456, 457, 458, 123, 118, 438, 439, 433, - 433, 151, 459, 433, 433, 441, 433, 460, - 456, 461, 461, 123, 118, 438, 439, 433, - 433, 433, 459, 433, 433, 441, 433, 456, - 461, 461, 123, 118, 438, 439, 433, 433, - 433, 459, 433, 433, 441, 433, 462, 433, - 433, 433, 136, 463, 433, 118, 438, 439, - 433, 433, 433, 445, 433, 462, 433, 464, - 465, 466, 467, 123, 118, 438, 439, 433, - 433, 149, 468, 433, 433, 441, 433, 469, - 465, 470, 470, 123, 118, 438, 439, 433, - 433, 433, 468, 433, 433, 441, 433, 465, - 470, 470, 123, 118, 438, 439, 433, 433, - 433, 468, 433, 433, 441, 433, 471, 433, - 433, 433, 136, 472, 433, 118, 438, 439, - 433, 433, 433, 445, 433, 471, 433, 473, - 474, 475, 476, 123, 118, 438, 439, 433, - 433, 147, 477, 433, 433, 441, 433, 478, - 474, 479, 479, 123, 118, 438, 439, 433, - 433, 433, 477, 433, 433, 441, 433, 474, - 479, 479, 123, 118, 438, 439, 433, 433, - 433, 477, 433, 433, 441, 433, 136, 480, - 433, 118, 438, 439, 433, 433, 433, 445, - 433, 481, 481, 433, 118, 438, 439, 433, - 433, 433, 445, 433, 482, 433, 433, 483, - 438, 439, 433, 438, 439, 433, 484, 433, - 438, 485, 433, 438, 486, 433, 438, 433, - 482, 433, 433, 433, 438, 439, 433, 487, - 433, 488, 489, 433, 118, 438, 439, 433, - 433, 121, 433, 120, 433, 481, 481, 433, - 118, 438, 439, 433, 481, 481, 433, 118, - 438, 439, 433, 487, 433, 481, 481, 433, - 118, 438, 439, 433, 487, 433, 488, 481, - 433, 118, 438, 439, 433, 433, 121, 433, - 136, 433, 490, 490, 123, 118, 438, 439, - 433, 433, 433, 445, 433, 491, 145, 492, - 493, 126, 118, 438, 439, 433, 433, 433, - 445, 433, 145, 492, 493, 126, 118, 438, - 439, 433, 433, 433, 445, 433, 492, 492, - 126, 118, 438, 439, 433, 433, 433, 445, - 433, 494, 142, 495, 496, 129, 118, 438, - 439, 433, 433, 433, 445, 433, 142, 495, - 496, 129, 118, 438, 439, 433, 433, 433, - 445, 433, 495, 495, 129, 118, 438, 439, - 433, 433, 433, 445, 433, 497, 139, 498, - 499, 132, 118, 438, 439, 433, 433, 433, - 445, 433, 139, 498, 499, 132, 118, 438, - 439, 433, 433, 433, 445, 433, 498, 498, - 132, 118, 438, 439, 433, 433, 433, 445, - 433, 500, 136, 481, 501, 433, 118, 438, - 439, 433, 433, 433, 445, 433, 136, 481, - 501, 433, 118, 438, 439, 433, 433, 433, - 445, 433, 481, 502, 433, 118, 438, 439, - 433, 433, 433, 445, 433, 136, 433, 481, - 481, 433, 118, 438, 439, 433, 433, 433, - 445, 433, 119, 120, 433, 433, 136, 480, - 433, 118, 438, 439, 433, 433, 433, 445, - 433, 119, 433, 474, 479, 479, 123, 118, - 438, 439, 433, 433, 433, 477, 433, 473, - 474, 479, 479, 123, 118, 438, 439, 433, - 433, 433, 477, 433, 433, 441, 433, 473, - 474, 475, 479, 123, 118, 438, 439, 433, - 433, 147, 477, 433, 433, 441, 433, 471, - 433, 503, 433, 490, 490, 123, 118, 438, - 439, 433, 433, 433, 445, 433, 471, 433, - 471, 433, 433, 433, 481, 481, 433, 118, - 438, 439, 433, 433, 433, 445, 433, 471, - 433, 471, 433, 433, 433, 481, 504, 433, - 118, 438, 439, 433, 433, 433, 445, 433, - 471, 433, 471, 433, 503, 433, 481, 481, - 433, 118, 438, 439, 433, 433, 433, 445, - 433, 471, 433, 471, 120, 433, 433, 136, - 472, 433, 118, 438, 439, 433, 433, 433, - 445, 433, 471, 433, 464, 465, 470, 470, - 123, 118, 438, 439, 433, 433, 433, 468, - 433, 433, 441, 433, 464, 465, 466, 470, - 123, 118, 438, 439, 433, 433, 149, 468, - 433, 433, 441, 433, 462, 433, 505, 433, - 490, 490, 123, 118, 438, 439, 433, 433, - 433, 445, 433, 462, 433, 462, 433, 433, - 433, 481, 481, 433, 118, 438, 439, 433, - 433, 433, 445, 433, 462, 433, 462, 433, - 433, 433, 481, 506, 433, 118, 438, 439, - 433, 433, 433, 445, 433, 462, 433, 462, - 433, 505, 433, 481, 481, 433, 118, 438, - 439, 433, 433, 433, 445, 433, 462, 433, - 462, 120, 433, 433, 136, 463, 433, 118, - 438, 439, 433, 433, 433, 445, 433, 462, - 433, 455, 456, 461, 461, 123, 118, 438, - 439, 433, 433, 433, 459, 433, 433, 441, - 433, 455, 456, 457, 461, 123, 118, 438, - 439, 433, 433, 151, 459, 433, 433, 441, - 433, 453, 433, 507, 433, 490, 490, 123, - 118, 438, 439, 433, 433, 433, 445, 433, - 453, 433, 453, 433, 433, 433, 481, 481, - 433, 118, 438, 439, 433, 433, 433, 445, - 433, 453, 433, 453, 433, 433, 433, 481, - 508, 433, 118, 438, 439, 433, 433, 433, - 445, 433, 453, 433, 453, 433, 507, 433, - 481, 481, 433, 118, 438, 439, 433, 433, - 433, 445, 433, 453, 433, 453, 120, 433, - 433, 136, 454, 433, 118, 438, 439, 433, - 433, 433, 445, 433, 453, 433, 446, 447, - 452, 452, 123, 118, 438, 439, 433, 433, - 433, 450, 433, 433, 441, 433, 446, 447, - 448, 452, 123, 118, 438, 439, 433, 433, - 153, 450, 433, 433, 441, 433, 443, 433, - 509, 433, 490, 490, 123, 118, 438, 439, - 433, 433, 433, 445, 433, 443, 433, 443, - 433, 433, 433, 481, 481, 433, 118, 438, - 439, 433, 433, 433, 445, 433, 443, 433, - 443, 433, 433, 433, 481, 510, 433, 118, - 438, 439, 433, 433, 433, 445, 433, 443, - 433, 443, 433, 509, 433, 481, 481, 433, - 118, 438, 439, 433, 433, 433, 445, 433, - 443, 433, 443, 120, 433, 433, 136, 444, - 433, 118, 438, 439, 433, 433, 433, 445, - 433, 443, 433, 434, 435, 437, 437, 123, - 118, 438, 439, 433, 433, 433, 440, 433, - 433, 441, 433, 188, 189, 190, 191, 511, - 363, 84, 79, 194, 195, 196, 196, 156, - 197, 361, 188, 200, 361, 204, 512, 206, - 207, 6, 1, 208, 209, 203, 203, 38, - 210, 203, 203, 211, 203, 214, 189, 190, - 191, 513, 514, 84, 157, 515, 516, 203, - 196, 156, 517, 203, 214, 200, 203, 116, - 518, 518, 84, 157, 208, 209, 203, 203, - 156, 519, 203, 520, 203, 203, 521, 515, - 516, 203, 515, 516, 203, 255, 203, 515, - 522, 203, 515, 523, 203, 515, 203, 520, - 203, 203, 203, 515, 516, 203, 524, 3, - 361, 361, 402, 431, 361, 79, 194, 195, - 361, 361, 361, 366, 361, 524, 361, 525, - 368, 526, 527, 84, 157, 515, 516, 203, - 203, 158, 371, 203, 203, 200, 203, 528, - 368, 529, 529, 84, 157, 515, 516, 203, - 203, 203, 371, 203, 203, 200, 203, 368, - 529, 529, 84, 157, 515, 516, 203, 203, - 203, 371, 203, 203, 200, 203, 525, 368, - 529, 529, 84, 157, 515, 516, 203, 203, - 203, 371, 203, 203, 200, 203, 525, 368, - 526, 529, 84, 157, 515, 516, 203, 203, - 158, 371, 203, 203, 200, 203, 214, 203, - 280, 116, 530, 530, 160, 157, 208, 209, - 203, 203, 203, 519, 203, 214, 203, 531, - 184, 532, 533, 162, 157, 515, 516, 203, - 203, 203, 534, 203, 184, 532, 533, 162, - 157, 515, 516, 203, 203, 203, 534, 203, - 532, 532, 162, 157, 515, 516, 203, 203, - 203, 534, 203, 535, 181, 536, 537, 165, - 157, 515, 516, 203, 203, 203, 534, 203, - 181, 536, 537, 165, 157, 515, 516, 203, - 203, 203, 534, 203, 536, 536, 165, 157, - 515, 516, 203, 203, 203, 534, 203, 538, - 178, 539, 540, 168, 157, 515, 516, 203, - 203, 203, 534, 203, 178, 539, 540, 168, - 157, 515, 516, 203, 203, 203, 534, 203, - 539, 539, 168, 157, 515, 516, 203, 203, - 203, 534, 203, 541, 175, 542, 543, 203, - 157, 515, 516, 203, 203, 203, 534, 203, - 175, 542, 543, 203, 157, 515, 516, 203, - 203, 203, 534, 203, 542, 542, 203, 157, - 515, 516, 203, 203, 203, 534, 203, 544, - 203, 545, 546, 203, 157, 515, 516, 203, - 203, 172, 203, 171, 203, 542, 542, 203, - 157, 515, 516, 203, 542, 542, 203, 157, - 515, 516, 203, 544, 203, 542, 542, 203, - 157, 515, 516, 203, 544, 203, 545, 542, - 203, 157, 515, 516, 203, 203, 172, 203, - 524, 171, 361, 361, 98, 365, 361, 79, - 194, 195, 361, 361, 361, 366, 361, 524, - 361, 548, 547, 549, 549, 547, 186, 550, - 551, 547, 549, 549, 547, 186, 550, 551, - 547, 552, 547, 547, 553, 550, 551, 547, - 550, 551, 547, 554, 547, 550, 555, 547, - 550, 556, 547, 550, 547, 552, 547, 547, - 547, 550, 551, 547, 188, 432, 432, 432, - 432, 432, 432, 432, 432, 432, 196, 432, - 432, 432, 432, 188, 432, 0 + 1, 0, 2, 2, 3, 1, 0, 4, + 4, 3, 0, 3, 0, 5, 5, 6, + 1, 0, 7, 7, 6, 0, 6, 0, + 8, 8, 9, 1, 0, 10, 10, 9, + 0, 9, 0, 11, 11, 12, 1, 0, + 13, 13, 12, 0, 12, 0, 14, 0, + 0, 0, 1, 0, 15, 0, 16, 0, + 17, 11, 11, 12, 1, 0, 18, 0, + 19, 0, 20, 8, 8, 9, 1, 0, + 21, 0, 22, 0, 23, 5, 5, 6, + 1, 0, 24, 0, 25, 0, 26, 2, + 2, 3, 1, 0, 26, 2, 2, 3, + 1, 0, 0, 0, 0, 27, 0, 28, + 2, 2, 3, 1, 0, 28, 2, 2, + 3, 1, 0, 0, 0, 0, 29, 0, + 30, 2, 2, 3, 1, 0, 30, 2, + 2, 3, 1, 0, 0, 0, 0, 31, + 0, 32, 2, 2, 3, 1, 0, 32, + 2, 2, 3, 1, 0, 0, 0, 0, + 33, 0, 34, 2, 2, 3, 1, 0, + 34, 2, 2, 3, 1, 0, 0, 0, + 0, 35, 0, 37, 36, 38, 38, 39, + 37, 36, 40, 40, 39, 36, 39, 36, + 41, 41, 42, 37, 36, 43, 43, 42, + 36, 42, 36, 44, 44, 45, 37, 36, + 46, 46, 45, 36, 45, 36, 47, 47, + 48, 37, 36, 49, 49, 48, 36, 48, + 36, 50, 36, 36, 36, 37, 36, 51, + 36, 52, 36, 53, 47, 47, 48, 37, + 36, 54, 36, 55, 36, 56, 44, 44, + 45, 37, 36, 57, 36, 58, 36, 59, + 41, 41, 42, 37, 36, 60, 36, 61, + 36, 62, 38, 38, 39, 37, 36, 62, + 38, 38, 39, 37, 36, 36, 36, 36, + 63, 36, 64, 38, 38, 39, 37, 36, + 64, 38, 38, 39, 37, 36, 36, 36, + 36, 65, 36, 66, 38, 38, 39, 37, + 36, 66, 38, 38, 39, 37, 36, 36, + 36, 36, 67, 36, 68, 38, 38, 39, + 37, 36, 68, 38, 38, 39, 37, 36, + 36, 36, 36, 69, 36, 70, 38, 38, + 39, 37, 36, 70, 38, 38, 39, 37, + 36, 36, 36, 36, 71, 36, 73, 72, + 74, 74, 75, 73, 72, 77, 77, 75, + 76, 75, 76, 78, 78, 79, 73, 72, + 80, 80, 79, 72, 79, 72, 81, 81, + 82, 73, 72, 83, 83, 82, 72, 82, + 72, 84, 84, 85, 73, 72, 86, 86, + 85, 72, 85, 72, 87, 72, 72, 72, + 73, 72, 88, 72, 89, 72, 90, 84, + 84, 85, 73, 72, 91, 72, 92, 72, + 93, 81, 81, 82, 73, 72, 94, 72, + 95, 72, 96, 78, 78, 79, 73, 72, + 97, 72, 98, 72, 99, 74, 74, 75, + 73, 72, 99, 74, 74, 75, 73, 72, + 72, 72, 72, 100, 72, 101, 74, 74, + 75, 73, 72, 101, 74, 74, 75, 73, + 72, 72, 72, 72, 102, 72, 103, 74, + 74, 75, 73, 72, 103, 74, 74, 75, + 73, 72, 72, 72, 72, 104, 72, 105, + 74, 74, 75, 73, 72, 105, 74, 74, + 75, 73, 72, 72, 72, 72, 106, 72, + 107, 74, 74, 75, 73, 72, 109, 108, + 110, 110, 111, 109, 108, 112, 112, 111, + 108, 111, 108, 113, 113, 114, 109, 108, + 115, 115, 114, 108, 114, 108, 116, 116, + 117, 109, 108, 118, 118, 117, 108, 117, + 108, 119, 119, 120, 109, 108, 121, 121, + 120, 108, 120, 108, 122, 108, 108, 108, + 109, 108, 123, 108, 124, 108, 125, 119, + 119, 120, 109, 108, 126, 108, 127, 108, + 128, 116, 116, 117, 109, 108, 129, 108, + 130, 108, 131, 113, 113, 114, 109, 108, + 132, 108, 133, 108, 134, 110, 110, 111, + 109, 108, 134, 110, 110, 111, 109, 108, + 108, 108, 108, 135, 108, 136, 110, 110, + 111, 109, 108, 136, 110, 110, 111, 109, + 108, 108, 108, 108, 137, 108, 138, 110, + 110, 111, 109, 108, 138, 110, 110, 111, + 109, 108, 108, 108, 108, 139, 108, 140, + 110, 110, 111, 109, 108, 140, 110, 110, + 111, 109, 108, 108, 108, 108, 141, 108, + 142, 110, 110, 111, 109, 108, 142, 110, + 110, 111, 109, 108, 108, 108, 108, 143, + 108, 107, 74, 74, 75, 73, 72, 72, + 72, 72, 144, 72, 77, 77, 75, 1, + 0, 145, 145, 146, 1, 0, 4, 4, + 146, 0, 147, 147, 148, 149, 0, 150, + 150, 148, 0, 148, 0, 151, 151, 152, + 149, 0, 153, 153, 152, 0, 152, 0, + 154, 154, 155, 149, 0, 156, 156, 155, + 0, 155, 0, 149, 0, 157, 0, 0, + 0, 149, 0, 158, 0, 159, 0, 160, + 154, 154, 155, 149, 0, 161, 0, 162, + 0, 163, 151, 151, 152, 149, 0, 164, + 0, 165, 0, 166, 147, 147, 148, 149, + 0, 167, 0, 168, 0, 170, 169, 172, + 173, 174, 175, 176, 177, 75, 73, 171, + 178, 179, 179, 144, 171, 180, 181, 182, + 183, 184, 171, 186, 187, 188, 189, 3, + 1, 185, 190, 185, 185, 35, 185, 185, + 185, 191, 185, 192, 187, 193, 193, 3, + 1, 185, 190, 185, 185, 185, 185, 185, + 185, 191, 185, 187, 193, 193, 3, 1, + 185, 190, 185, 185, 185, 185, 185, 185, + 191, 185, 194, 185, 185, 185, 16, 195, + 185, 1, 185, 190, 185, 185, 185, 185, + 185, 194, 185, 196, 197, 198, 199, 3, + 1, 185, 190, 185, 185, 33, 185, 185, + 185, 191, 185, 200, 197, 201, 201, 3, + 1, 185, 190, 185, 185, 185, 185, 185, + 185, 191, 185, 197, 201, 201, 3, 1, + 185, 190, 185, 185, 185, 185, 185, 185, + 191, 185, 202, 185, 185, 185, 16, 203, + 185, 1, 185, 190, 185, 185, 185, 185, + 185, 202, 185, 204, 205, 206, 207, 3, + 1, 185, 190, 185, 185, 31, 185, 185, + 185, 191, 185, 208, 205, 209, 209, 3, + 1, 185, 190, 185, 185, 185, 185, 185, + 185, 191, 185, 205, 209, 209, 3, 1, + 185, 190, 185, 185, 185, 185, 185, 185, + 191, 185, 210, 185, 185, 185, 16, 211, + 185, 1, 185, 190, 185, 185, 185, 185, + 185, 210, 185, 212, 213, 214, 215, 3, + 1, 185, 190, 185, 185, 29, 185, 185, + 185, 191, 185, 216, 213, 217, 217, 3, + 1, 185, 190, 185, 185, 185, 185, 185, + 185, 191, 185, 213, 217, 217, 3, 1, + 185, 190, 185, 185, 185, 185, 185, 185, + 191, 185, 218, 185, 185, 185, 16, 219, + 185, 1, 185, 190, 185, 185, 185, 185, + 185, 218, 185, 220, 221, 222, 223, 3, + 1, 185, 190, 185, 185, 27, 185, 185, + 185, 191, 185, 224, 221, 225, 225, 3, + 1, 185, 190, 185, 185, 185, 185, 185, + 185, 191, 185, 221, 225, 225, 3, 1, + 185, 190, 185, 185, 185, 185, 185, 185, + 191, 185, 16, 226, 185, 1, 185, 190, + 185, 227, 227, 185, 1, 185, 190, 185, + 228, 185, 185, 229, 185, 190, 185, 190, + 185, 230, 185, 231, 185, 228, 185, 185, + 185, 185, 190, 185, 16, 185, 232, 232, + 3, 1, 185, 190, 185, 233, 25, 234, + 235, 6, 1, 185, 190, 185, 25, 234, + 235, 6, 1, 185, 190, 185, 234, 234, + 6, 1, 185, 190, 185, 236, 22, 237, + 238, 9, 1, 185, 190, 185, 22, 237, + 238, 9, 1, 185, 190, 185, 237, 237, + 9, 1, 185, 190, 185, 239, 19, 240, + 241, 12, 1, 185, 190, 185, 19, 240, + 241, 12, 1, 185, 190, 185, 240, 240, + 12, 1, 185, 190, 185, 242, 16, 227, + 243, 185, 1, 185, 190, 185, 16, 227, + 243, 185, 1, 185, 190, 185, 227, 244, + 185, 1, 185, 190, 185, 16, 185, 227, + 227, 185, 1, 185, 190, 185, 221, 225, + 225, 3, 1, 185, 190, 185, 220, 221, + 225, 225, 3, 1, 185, 190, 185, 185, + 185, 185, 185, 185, 191, 185, 220, 221, + 222, 225, 3, 1, 185, 190, 185, 185, + 27, 185, 185, 185, 191, 185, 218, 185, + 245, 185, 232, 232, 3, 1, 185, 190, + 185, 185, 185, 185, 185, 218, 185, 218, + 185, 185, 185, 227, 227, 185, 1, 185, + 190, 185, 185, 185, 185, 185, 218, 185, + 218, 185, 185, 185, 227, 246, 185, 1, + 185, 190, 185, 185, 185, 185, 185, 218, + 185, 218, 185, 245, 185, 227, 227, 185, + 1, 185, 190, 185, 185, 185, 185, 185, + 218, 185, 212, 213, 217, 217, 3, 1, + 185, 190, 185, 185, 185, 185, 185, 185, + 191, 185, 212, 213, 214, 217, 3, 1, + 185, 190, 185, 185, 29, 185, 185, 185, + 191, 185, 210, 185, 247, 185, 232, 232, + 3, 1, 185, 190, 185, 185, 185, 185, + 185, 210, 185, 210, 185, 185, 185, 227, + 227, 185, 1, 185, 190, 185, 185, 185, + 185, 185, 210, 185, 210, 185, 185, 185, + 227, 248, 185, 1, 185, 190, 185, 185, + 185, 185, 185, 210, 185, 210, 185, 247, + 185, 227, 227, 185, 1, 185, 190, 185, + 185, 185, 185, 185, 210, 185, 204, 205, + 209, 209, 3, 1, 185, 190, 185, 185, + 185, 185, 185, 185, 191, 185, 204, 205, + 206, 209, 3, 1, 185, 190, 185, 185, + 31, 185, 185, 185, 191, 185, 202, 185, + 249, 185, 232, 232, 3, 1, 185, 190, + 185, 185, 185, 185, 185, 202, 185, 202, + 185, 185, 185, 227, 227, 185, 1, 185, + 190, 185, 185, 185, 185, 185, 202, 185, + 202, 185, 185, 185, 227, 250, 185, 1, + 185, 190, 185, 185, 185, 185, 185, 202, + 185, 202, 185, 249, 185, 227, 227, 185, + 1, 185, 190, 185, 185, 185, 185, 185, + 202, 185, 196, 197, 201, 201, 3, 1, + 185, 190, 185, 185, 185, 185, 185, 185, + 191, 185, 196, 197, 198, 201, 3, 1, + 185, 190, 185, 185, 33, 185, 185, 185, + 191, 185, 194, 185, 251, 185, 232, 232, + 3, 1, 185, 190, 185, 185, 185, 185, + 185, 194, 185, 194, 185, 185, 185, 227, + 227, 185, 1, 185, 190, 185, 185, 185, + 185, 185, 194, 185, 194, 185, 185, 185, + 227, 252, 185, 1, 185, 190, 185, 185, + 185, 185, 185, 194, 185, 194, 185, 251, + 185, 227, 227, 185, 1, 185, 190, 185, + 185, 185, 185, 185, 194, 185, 186, 187, + 193, 193, 3, 1, 185, 190, 185, 185, + 185, 185, 185, 185, 191, 185, 186, 187, + 188, 193, 3, 1, 185, 190, 185, 185, + 35, 185, 185, 185, 191, 185, 254, 255, + 256, 257, 39, 37, 253, 258, 253, 253, + 71, 253, 253, 253, 259, 253, 260, 255, + 261, 257, 39, 37, 253, 258, 253, 253, + 253, 253, 253, 253, 259, 253, 255, 261, + 257, 39, 37, 253, 258, 253, 253, 253, + 253, 253, 253, 259, 253, 262, 253, 253, + 253, 52, 263, 253, 37, 253, 258, 253, + 253, 253, 253, 253, 262, 253, 264, 265, + 266, 267, 39, 37, 253, 258, 253, 253, + 69, 253, 253, 253, 259, 253, 268, 265, + 269, 269, 39, 37, 253, 258, 253, 253, + 253, 253, 253, 253, 259, 253, 265, 269, + 269, 39, 37, 253, 258, 253, 253, 253, + 253, 253, 253, 259, 253, 270, 253, 253, + 253, 52, 271, 253, 37, 253, 258, 253, + 253, 253, 253, 253, 270, 253, 272, 273, + 274, 275, 39, 37, 253, 258, 253, 253, + 67, 253, 253, 253, 259, 253, 276, 273, + 277, 277, 39, 37, 253, 258, 253, 253, + 253, 253, 253, 253, 259, 253, 273, 277, + 277, 39, 37, 253, 258, 253, 253, 253, + 253, 253, 253, 259, 253, 278, 253, 253, + 253, 52, 279, 253, 37, 253, 258, 253, + 253, 253, 253, 253, 278, 253, 280, 281, + 282, 283, 39, 37, 253, 258, 253, 253, + 65, 253, 253, 253, 259, 253, 284, 281, + 285, 285, 39, 37, 253, 258, 253, 253, + 253, 253, 253, 253, 259, 253, 281, 285, + 285, 39, 37, 253, 258, 253, 253, 253, + 253, 253, 253, 259, 253, 286, 253, 253, + 253, 52, 287, 253, 37, 253, 258, 253, + 253, 253, 253, 253, 286, 253, 288, 289, + 290, 291, 39, 37, 253, 258, 253, 253, + 63, 253, 253, 253, 259, 253, 292, 289, + 293, 293, 39, 37, 253, 258, 253, 253, + 253, 253, 253, 253, 259, 253, 289, 293, + 293, 39, 37, 253, 258, 253, 253, 253, + 253, 253, 253, 259, 253, 52, 294, 253, + 37, 253, 258, 253, 295, 295, 253, 37, + 253, 258, 253, 296, 253, 253, 297, 253, + 258, 253, 258, 253, 298, 253, 299, 253, + 296, 253, 253, 253, 253, 258, 253, 52, + 253, 300, 300, 39, 37, 253, 258, 253, + 301, 61, 302, 303, 42, 37, 253, 258, + 253, 61, 302, 303, 42, 37, 253, 258, + 253, 302, 302, 42, 37, 253, 258, 253, + 304, 58, 305, 306, 45, 37, 253, 258, + 253, 58, 305, 306, 45, 37, 253, 258, + 253, 305, 305, 45, 37, 253, 258, 253, + 307, 55, 308, 309, 48, 37, 253, 258, + 253, 55, 308, 309, 48, 37, 253, 258, + 253, 308, 308, 48, 37, 253, 258, 253, + 310, 52, 295, 311, 253, 37, 253, 258, + 253, 52, 295, 311, 253, 37, 253, 258, + 253, 295, 312, 253, 37, 253, 258, 253, + 52, 253, 295, 295, 253, 37, 253, 258, + 253, 289, 293, 293, 39, 37, 253, 258, + 253, 288, 289, 293, 293, 39, 37, 253, + 258, 253, 253, 253, 253, 253, 253, 259, + 253, 288, 289, 290, 293, 39, 37, 253, + 258, 253, 253, 63, 253, 253, 253, 259, + 253, 286, 253, 313, 253, 300, 300, 39, + 37, 253, 258, 253, 253, 253, 253, 253, + 286, 253, 286, 253, 253, 253, 295, 295, + 253, 37, 253, 258, 253, 253, 253, 253, + 253, 286, 253, 286, 253, 253, 253, 295, + 314, 253, 37, 253, 258, 253, 253, 253, + 253, 253, 286, 253, 286, 253, 313, 253, + 295, 295, 253, 37, 253, 258, 253, 253, + 253, 253, 253, 286, 253, 280, 281, 285, + 285, 39, 37, 253, 258, 253, 253, 253, + 253, 253, 253, 259, 253, 280, 281, 282, + 285, 39, 37, 253, 258, 253, 253, 65, + 253, 253, 253, 259, 253, 278, 253, 315, + 253, 300, 300, 39, 37, 253, 258, 253, + 253, 253, 253, 253, 278, 253, 278, 253, + 253, 253, 295, 295, 253, 37, 253, 258, + 253, 253, 253, 253, 253, 278, 253, 278, + 253, 253, 253, 295, 316, 253, 37, 253, + 258, 253, 253, 253, 253, 253, 278, 253, + 278, 253, 315, 253, 295, 295, 253, 37, + 253, 258, 253, 253, 253, 253, 253, 278, + 253, 272, 273, 277, 277, 39, 37, 253, + 258, 253, 253, 253, 253, 253, 253, 259, + 253, 272, 273, 274, 277, 39, 37, 253, + 258, 253, 253, 67, 253, 253, 253, 259, + 253, 270, 253, 317, 253, 300, 300, 39, + 37, 253, 258, 253, 253, 253, 253, 253, + 270, 253, 270, 253, 253, 253, 295, 295, + 253, 37, 253, 258, 253, 253, 253, 253, + 253, 270, 253, 270, 253, 253, 253, 295, + 318, 253, 37, 253, 258, 253, 253, 253, + 253, 253, 270, 253, 270, 253, 317, 253, + 295, 295, 253, 37, 253, 258, 253, 253, + 253, 253, 253, 270, 253, 264, 265, 269, + 269, 39, 37, 253, 258, 253, 253, 253, + 253, 253, 253, 259, 253, 264, 265, 266, + 269, 39, 37, 253, 258, 253, 253, 69, + 253, 253, 253, 259, 253, 262, 253, 319, + 253, 300, 300, 39, 37, 253, 258, 253, + 253, 253, 253, 253, 262, 253, 262, 253, + 253, 253, 295, 295, 253, 37, 253, 258, + 253, 253, 253, 253, 253, 262, 253, 262, + 253, 253, 253, 295, 320, 253, 37, 253, + 258, 253, 253, 253, 253, 253, 262, 253, + 262, 253, 319, 253, 295, 295, 253, 37, + 253, 258, 253, 253, 253, 253, 253, 262, + 253, 70, 38, 38, 39, 37, 253, 254, + 255, 261, 257, 39, 37, 253, 258, 253, + 253, 253, 253, 253, 253, 259, 253, 322, + 175, 323, 323, 75, 73, 321, 178, 321, + 321, 321, 321, 321, 321, 182, 321, 175, + 323, 323, 75, 73, 321, 178, 321, 321, + 321, 321, 321, 321, 182, 321, 324, 321, + 321, 321, 89, 325, 321, 73, 321, 178, + 321, 321, 321, 321, 321, 324, 321, 326, + 327, 328, 329, 75, 73, 321, 178, 321, + 321, 106, 321, 321, 321, 182, 321, 330, + 327, 331, 331, 75, 73, 321, 178, 321, + 321, 321, 321, 321, 321, 182, 321, 327, + 331, 331, 75, 73, 321, 178, 321, 321, + 321, 321, 321, 321, 182, 321, 332, 321, + 321, 321, 89, 333, 321, 73, 321, 178, + 321, 321, 321, 321, 321, 332, 321, 334, + 335, 336, 337, 75, 73, 321, 178, 321, + 321, 104, 321, 321, 321, 182, 321, 338, + 335, 339, 339, 75, 73, 321, 178, 321, + 321, 321, 321, 321, 321, 182, 321, 335, + 339, 339, 75, 73, 321, 178, 321, 321, + 321, 321, 321, 321, 182, 321, 340, 321, + 321, 321, 89, 341, 321, 73, 321, 178, + 321, 321, 321, 321, 321, 340, 321, 342, + 343, 344, 345, 75, 73, 321, 178, 321, + 321, 102, 321, 321, 321, 182, 321, 346, + 343, 347, 347, 75, 73, 321, 178, 321, + 321, 321, 321, 321, 321, 182, 321, 343, + 347, 347, 75, 73, 321, 178, 321, 321, + 321, 321, 321, 321, 182, 321, 348, 321, + 321, 321, 89, 349, 321, 73, 321, 178, + 321, 321, 321, 321, 321, 348, 321, 350, + 351, 352, 353, 75, 73, 321, 178, 321, + 321, 100, 321, 321, 321, 182, 321, 354, + 351, 355, 355, 75, 73, 321, 178, 321, + 321, 321, 321, 321, 321, 182, 321, 351, + 355, 355, 75, 73, 321, 178, 321, 321, + 321, 321, 321, 321, 182, 321, 89, 356, + 321, 73, 321, 178, 321, 357, 357, 321, + 73, 321, 178, 321, 358, 321, 321, 359, + 321, 178, 321, 178, 321, 360, 321, 361, + 321, 358, 321, 321, 321, 321, 178, 321, + 89, 321, 362, 362, 75, 73, 321, 178, + 321, 363, 98, 364, 365, 79, 73, 321, + 178, 321, 98, 364, 365, 79, 73, 321, + 178, 321, 364, 364, 79, 73, 321, 178, + 321, 366, 95, 367, 368, 82, 73, 321, + 178, 321, 95, 367, 368, 82, 73, 321, + 178, 321, 367, 367, 82, 73, 321, 178, + 321, 369, 92, 370, 371, 85, 73, 321, + 178, 321, 92, 370, 371, 85, 73, 321, + 178, 321, 370, 370, 85, 73, 321, 178, + 321, 372, 89, 357, 373, 321, 73, 321, + 178, 321, 89, 357, 373, 321, 73, 321, + 178, 321, 357, 374, 321, 73, 321, 178, + 321, 89, 321, 357, 357, 321, 73, 321, + 178, 321, 351, 355, 355, 75, 73, 321, + 178, 321, 350, 351, 355, 355, 75, 73, + 321, 178, 321, 321, 321, 321, 321, 321, + 182, 321, 350, 351, 352, 355, 75, 73, + 321, 178, 321, 321, 100, 321, 321, 321, + 182, 321, 348, 321, 375, 321, 362, 362, + 75, 73, 321, 178, 321, 321, 321, 321, + 321, 348, 321, 348, 321, 321, 321, 357, + 357, 321, 73, 321, 178, 321, 321, 321, + 321, 321, 348, 321, 348, 321, 321, 321, + 357, 376, 321, 73, 321, 178, 321, 321, + 321, 321, 321, 348, 321, 348, 321, 375, + 321, 357, 357, 321, 73, 321, 178, 321, + 321, 321, 321, 321, 348, 321, 342, 343, + 347, 347, 75, 73, 321, 178, 321, 321, + 321, 321, 321, 321, 182, 321, 342, 343, + 344, 347, 75, 73, 321, 178, 321, 321, + 102, 321, 321, 321, 182, 321, 340, 321, + 377, 321, 362, 362, 75, 73, 321, 178, + 321, 321, 321, 321, 321, 340, 321, 340, + 321, 321, 321, 357, 357, 321, 73, 321, + 178, 321, 321, 321, 321, 321, 340, 321, + 340, 321, 321, 321, 357, 378, 321, 73, + 321, 178, 321, 321, 321, 321, 321, 340, + 321, 340, 321, 377, 321, 357, 357, 321, + 73, 321, 178, 321, 321, 321, 321, 321, + 340, 321, 334, 335, 339, 339, 75, 73, + 321, 178, 321, 321, 321, 321, 321, 321, + 182, 321, 334, 335, 336, 339, 75, 73, + 321, 178, 321, 321, 104, 321, 321, 321, + 182, 321, 332, 321, 379, 321, 362, 362, + 75, 73, 321, 178, 321, 321, 321, 321, + 321, 332, 321, 332, 321, 321, 321, 357, + 357, 321, 73, 321, 178, 321, 321, 321, + 321, 321, 332, 321, 332, 321, 321, 321, + 357, 380, 321, 73, 321, 178, 321, 321, + 321, 321, 321, 332, 321, 332, 321, 379, + 321, 357, 357, 321, 73, 321, 178, 321, + 321, 321, 321, 321, 332, 321, 326, 327, + 331, 331, 75, 73, 321, 178, 321, 321, + 321, 321, 321, 321, 182, 321, 326, 327, + 328, 331, 75, 73, 321, 178, 321, 321, + 106, 321, 321, 321, 182, 321, 324, 321, + 381, 321, 362, 362, 75, 73, 321, 178, + 321, 321, 321, 321, 321, 324, 321, 324, + 321, 321, 321, 357, 357, 321, 73, 321, + 178, 321, 321, 321, 321, 321, 324, 321, + 324, 321, 321, 321, 357, 382, 321, 73, + 321, 178, 321, 321, 321, 321, 321, 324, + 321, 324, 321, 381, 321, 357, 357, 321, + 73, 321, 178, 321, 321, 321, 321, 321, + 324, 321, 107, 74, 74, 75, 73, 383, + 383, 383, 383, 144, 383, 174, 175, 323, + 323, 75, 73, 321, 178, 321, 321, 321, + 321, 321, 321, 182, 321, 107, 74, 74, + 75, 73, 383, 385, 386, 387, 388, 111, + 109, 384, 389, 384, 384, 143, 384, 384, + 384, 390, 384, 391, 386, 388, 388, 111, + 109, 384, 389, 384, 384, 384, 384, 384, + 384, 390, 384, 386, 388, 388, 111, 109, + 384, 389, 384, 384, 384, 384, 384, 384, + 390, 384, 392, 384, 384, 384, 124, 393, + 384, 109, 384, 389, 384, 384, 384, 384, + 384, 392, 384, 394, 395, 396, 397, 111, + 109, 384, 389, 384, 384, 141, 384, 384, + 384, 390, 384, 398, 395, 399, 399, 111, + 109, 384, 389, 384, 384, 384, 384, 384, + 384, 390, 384, 395, 399, 399, 111, 109, + 384, 389, 384, 384, 384, 384, 384, 384, + 390, 384, 400, 384, 384, 384, 124, 401, + 384, 109, 384, 389, 384, 384, 384, 384, + 384, 400, 384, 402, 403, 404, 405, 111, + 109, 384, 389, 384, 384, 139, 384, 384, + 384, 390, 384, 406, 403, 407, 407, 111, + 109, 384, 389, 384, 384, 384, 384, 384, + 384, 390, 384, 403, 407, 407, 111, 109, + 384, 389, 384, 384, 384, 384, 384, 384, + 390, 384, 408, 384, 384, 384, 124, 409, + 384, 109, 384, 389, 384, 384, 384, 384, + 384, 408, 384, 410, 411, 412, 413, 111, + 109, 384, 389, 384, 384, 137, 384, 384, + 384, 390, 384, 414, 411, 415, 415, 111, + 109, 384, 389, 384, 384, 384, 384, 384, + 384, 390, 384, 411, 415, 415, 111, 109, + 384, 389, 384, 384, 384, 384, 384, 384, + 390, 384, 416, 384, 384, 384, 124, 417, + 384, 109, 384, 389, 384, 384, 384, 384, + 384, 416, 384, 418, 419, 420, 421, 111, + 109, 384, 389, 384, 384, 135, 384, 384, + 384, 390, 384, 422, 419, 423, 423, 111, + 109, 384, 389, 384, 384, 384, 384, 384, + 384, 390, 384, 419, 423, 423, 111, 109, + 384, 389, 384, 384, 384, 384, 384, 384, + 390, 384, 124, 424, 384, 109, 384, 389, + 384, 425, 425, 384, 109, 384, 389, 384, + 426, 384, 384, 427, 384, 389, 384, 389, + 384, 428, 384, 429, 384, 426, 384, 384, + 384, 384, 389, 384, 124, 384, 430, 430, + 111, 109, 384, 389, 384, 431, 133, 432, + 433, 114, 109, 384, 389, 384, 133, 432, + 433, 114, 109, 384, 389, 384, 432, 432, + 114, 109, 384, 389, 384, 434, 130, 435, + 436, 117, 109, 384, 389, 384, 130, 435, + 436, 117, 109, 384, 389, 384, 435, 435, + 117, 109, 384, 389, 384, 437, 127, 438, + 439, 120, 109, 384, 389, 384, 127, 438, + 439, 120, 109, 384, 389, 384, 438, 438, + 120, 109, 384, 389, 384, 440, 124, 425, + 441, 384, 109, 384, 389, 384, 124, 425, + 441, 384, 109, 384, 389, 384, 425, 442, + 384, 109, 384, 389, 384, 124, 384, 425, + 425, 384, 109, 384, 389, 384, 419, 423, + 423, 111, 109, 384, 389, 384, 418, 419, + 423, 423, 111, 109, 384, 389, 384, 384, + 384, 384, 384, 384, 390, 384, 418, 419, + 420, 423, 111, 109, 384, 389, 384, 384, + 135, 384, 384, 384, 390, 384, 416, 384, + 443, 384, 430, 430, 111, 109, 384, 389, + 384, 384, 384, 384, 384, 416, 384, 416, + 384, 384, 384, 425, 425, 384, 109, 384, + 389, 384, 384, 384, 384, 384, 416, 384, + 416, 384, 384, 384, 425, 444, 384, 109, + 384, 389, 384, 384, 384, 384, 384, 416, + 384, 416, 384, 443, 384, 425, 425, 384, + 109, 384, 389, 384, 384, 384, 384, 384, + 416, 384, 410, 411, 415, 415, 111, 109, + 384, 389, 384, 384, 384, 384, 384, 384, + 390, 384, 410, 411, 412, 415, 111, 109, + 384, 389, 384, 384, 137, 384, 384, 384, + 390, 384, 408, 384, 445, 384, 430, 430, + 111, 109, 384, 389, 384, 384, 384, 384, + 384, 408, 384, 408, 384, 384, 384, 425, + 425, 384, 109, 384, 389, 384, 384, 384, + 384, 384, 408, 384, 408, 384, 384, 384, + 425, 446, 384, 109, 384, 389, 384, 384, + 384, 384, 384, 408, 384, 408, 384, 445, + 384, 425, 425, 384, 109, 384, 389, 384, + 384, 384, 384, 384, 408, 384, 402, 403, + 407, 407, 111, 109, 384, 389, 384, 384, + 384, 384, 384, 384, 390, 384, 402, 403, + 404, 407, 111, 109, 384, 389, 384, 384, + 139, 384, 384, 384, 390, 384, 400, 384, + 447, 384, 430, 430, 111, 109, 384, 389, + 384, 384, 384, 384, 384, 400, 384, 400, + 384, 384, 384, 425, 425, 384, 109, 384, + 389, 384, 384, 384, 384, 384, 400, 384, + 400, 384, 384, 384, 425, 448, 384, 109, + 384, 389, 384, 384, 384, 384, 384, 400, + 384, 400, 384, 447, 384, 425, 425, 384, + 109, 384, 389, 384, 384, 384, 384, 384, + 400, 384, 394, 395, 399, 399, 111, 109, + 384, 389, 384, 384, 384, 384, 384, 384, + 390, 384, 394, 395, 396, 399, 111, 109, + 384, 389, 384, 384, 141, 384, 384, 384, + 390, 384, 392, 384, 449, 384, 430, 430, + 111, 109, 384, 389, 384, 384, 384, 384, + 384, 392, 384, 392, 384, 384, 384, 425, + 425, 384, 109, 384, 389, 384, 384, 384, + 384, 384, 392, 384, 392, 384, 384, 384, + 425, 450, 384, 109, 384, 389, 384, 384, + 384, 384, 384, 392, 384, 392, 384, 449, + 384, 425, 425, 384, 109, 384, 389, 384, + 384, 384, 384, 384, 392, 384, 385, 386, + 388, 388, 111, 109, 384, 389, 384, 384, + 384, 384, 384, 384, 390, 384, 172, 173, + 174, 175, 451, 323, 75, 73, 321, 178, + 179, 179, 144, 321, 321, 172, 182, 321, + 186, 452, 188, 189, 3, 1, 185, 190, + 185, 185, 35, 185, 185, 185, 191, 185, + 194, 173, 174, 175, 453, 454, 75, 149, + 185, 455, 185, 179, 144, 185, 185, 194, + 182, 185, 107, 456, 456, 75, 149, 185, + 190, 185, 185, 144, 185, 457, 185, 185, + 458, 185, 455, 185, 455, 185, 459, 185, + 231, 185, 457, 185, 185, 185, 185, 455, + 185, 194, 185, 251, 107, 460, 460, 146, + 149, 185, 190, 185, 185, 185, 185, 185, + 194, 185, 461, 168, 462, 463, 148, 149, + 185, 455, 185, 168, 462, 463, 148, 149, + 185, 455, 185, 462, 462, 148, 149, 185, + 455, 185, 464, 165, 465, 466, 152, 149, + 185, 455, 185, 165, 465, 466, 152, 149, + 185, 455, 185, 465, 465, 152, 149, 185, + 455, 185, 467, 162, 468, 469, 155, 149, + 185, 455, 185, 162, 468, 469, 155, 149, + 185, 455, 185, 468, 468, 155, 149, 185, + 455, 185, 470, 159, 471, 472, 185, 149, + 185, 455, 185, 159, 471, 472, 185, 149, + 185, 455, 185, 471, 471, 185, 149, 185, + 455, 185, 474, 473, 475, 475, 473, 170, + 473, 476, 473, 475, 475, 473, 170, 473, + 476, 473, 477, 473, 473, 478, 473, 476, + 473, 476, 473, 479, 473, 480, 473, 477, + 473, 473, 473, 473, 476, 473, 172, 383, + 383, 383, 383, 383, 383, 383, 383, 383, + 179, 383, 383, 383, 383, 172, 383, 0 }; static const short _indic_syllable_machine_trans_targs[] = { - 178, 200, 207, 209, 210, 4, 213, 5, - 7, 216, 8, 10, 219, 11, 13, 222, - 14, 16, 17, 199, 19, 20, 221, 22, - 23, 218, 25, 26, 215, 224, 228, 232, - 235, 239, 242, 246, 249, 253, 256, 178, - 279, 286, 288, 289, 41, 292, 42, 44, - 295, 45, 47, 298, 48, 50, 301, 51, - 53, 54, 278, 56, 57, 300, 59, 60, - 297, 62, 63, 294, 303, 307, 311, 314, - 318, 321, 325, 328, 332, 336, 178, 357, - 364, 366, 367, 78, 370, 178, 79, 81, - 373, 82, 84, 376, 85, 87, 379, 88, - 90, 91, 356, 93, 94, 378, 96, 97, - 375, 99, 100, 372, 381, 385, 389, 392, - 396, 399, 403, 406, 410, 178, 437, 444, - 446, 447, 114, 450, 115, 117, 453, 118, - 120, 456, 121, 123, 459, 124, 126, 127, - 436, 129, 130, 458, 132, 133, 455, 135, - 136, 452, 461, 465, 469, 472, 476, 479, - 483, 486, 490, 493, 414, 498, 509, 152, - 512, 154, 515, 155, 157, 518, 158, 160, - 521, 161, 524, 526, 527, 166, 167, 523, - 169, 170, 520, 172, 173, 517, 175, 176, - 514, 178, 532, 178, 179, 258, 337, 339, - 413, 415, 359, 360, 416, 412, 494, 495, - 384, 530, 539, 178, 180, 182, 36, 257, - 202, 203, 255, 227, 181, 35, 183, 251, - 1, 184, 186, 34, 250, 248, 185, 33, - 187, 244, 188, 190, 32, 243, 241, 189, - 31, 191, 237, 192, 194, 30, 236, 234, - 193, 29, 195, 230, 196, 198, 28, 229, - 226, 197, 27, 212, 0, 201, 206, 178, - 204, 205, 208, 2, 211, 3, 214, 6, - 24, 217, 9, 21, 220, 12, 18, 223, - 15, 225, 231, 233, 238, 240, 245, 247, - 252, 254, 178, 259, 261, 73, 334, 281, - 282, 335, 306, 260, 72, 262, 330, 38, - 263, 265, 71, 329, 327, 264, 70, 266, - 323, 267, 269, 69, 322, 320, 268, 68, - 270, 316, 271, 273, 67, 315, 313, 272, - 66, 274, 309, 275, 277, 65, 308, 305, - 276, 64, 291, 37, 280, 285, 178, 283, - 284, 287, 39, 290, 40, 293, 43, 61, - 296, 46, 58, 299, 49, 55, 302, 52, - 304, 310, 312, 317, 319, 324, 326, 331, - 333, 178, 338, 109, 340, 408, 75, 341, - 343, 108, 407, 405, 342, 107, 344, 401, - 345, 347, 106, 400, 398, 346, 105, 348, - 394, 349, 351, 104, 393, 391, 350, 103, - 352, 387, 353, 355, 102, 386, 383, 354, - 101, 369, 74, 358, 363, 178, 361, 362, - 365, 76, 368, 77, 371, 80, 98, 374, - 83, 95, 377, 86, 92, 380, 89, 382, - 388, 390, 395, 397, 402, 404, 409, 411, - 178, 178, 417, 419, 146, 145, 439, 440, - 492, 464, 418, 420, 488, 111, 421, 423, - 144, 487, 485, 422, 143, 424, 481, 425, - 427, 142, 480, 478, 426, 141, 428, 474, - 429, 431, 140, 473, 471, 430, 139, 432, - 467, 433, 435, 138, 466, 463, 434, 137, - 449, 110, 438, 443, 178, 441, 442, 445, - 112, 448, 113, 451, 116, 134, 454, 119, - 131, 457, 122, 128, 460, 125, 462, 468, - 470, 475, 477, 482, 484, 489, 491, 147, - 496, 497, 511, 500, 501, 529, 148, 505, - 499, 504, 502, 503, 506, 507, 150, 510, - 508, 149, 151, 513, 153, 174, 163, 516, - 156, 171, 519, 159, 168, 522, 162, 165, - 525, 164, 528, 178, 531, 177, 534, 535, - 533, 538, 178, 536, 537 + 166, 188, 2, 194, 3, 5, 197, 6, + 8, 200, 9, 11, 203, 12, 14, 15, + 187, 17, 18, 202, 20, 21, 199, 23, + 24, 196, 205, 208, 212, 214, 218, 220, + 224, 226, 230, 232, 166, 255, 37, 261, + 38, 40, 264, 41, 43, 267, 44, 46, + 270, 47, 49, 50, 254, 52, 53, 269, + 55, 56, 266, 58, 59, 263, 272, 275, + 279, 281, 285, 287, 291, 293, 297, 300, + 166, 321, 72, 327, 166, 73, 75, 330, + 76, 78, 333, 79, 81, 336, 82, 84, + 85, 320, 87, 88, 335, 90, 91, 332, + 93, 94, 329, 338, 341, 345, 347, 351, + 353, 357, 359, 363, 166, 389, 106, 395, + 107, 109, 398, 110, 112, 401, 113, 115, + 404, 116, 118, 119, 388, 121, 122, 403, + 124, 125, 400, 127, 128, 397, 406, 409, + 413, 415, 419, 421, 425, 427, 431, 433, + 366, 142, 444, 144, 447, 438, 145, 147, + 450, 148, 150, 453, 151, 154, 155, 455, + 157, 158, 452, 160, 161, 449, 163, 164, + 446, 166, 458, 166, 167, 234, 301, 303, + 365, 367, 323, 368, 434, 435, 340, 456, + 463, 166, 168, 170, 34, 233, 190, 207, + 169, 33, 171, 228, 172, 174, 32, 227, + 173, 31, 175, 222, 176, 178, 30, 221, + 177, 29, 179, 216, 180, 182, 28, 215, + 181, 27, 183, 210, 184, 186, 26, 209, + 185, 25, 193, 0, 189, 192, 191, 166, + 1, 195, 4, 22, 198, 7, 19, 201, + 10, 16, 204, 13, 206, 211, 213, 217, + 219, 223, 225, 229, 231, 166, 235, 237, + 69, 299, 257, 274, 236, 68, 238, 295, + 239, 241, 67, 294, 240, 66, 242, 289, + 243, 245, 65, 288, 244, 64, 246, 283, + 247, 249, 63, 282, 248, 62, 250, 277, + 251, 253, 61, 276, 252, 60, 260, 35, + 256, 259, 258, 166, 36, 262, 39, 57, + 265, 42, 54, 268, 45, 51, 271, 48, + 273, 278, 280, 284, 286, 290, 292, 296, + 298, 166, 302, 103, 304, 361, 305, 307, + 102, 360, 306, 101, 308, 355, 309, 311, + 100, 354, 310, 99, 312, 349, 313, 315, + 98, 348, 314, 97, 316, 343, 317, 319, + 96, 342, 318, 95, 326, 70, 322, 325, + 324, 166, 71, 328, 74, 92, 331, 77, + 89, 334, 80, 86, 337, 83, 339, 344, + 346, 350, 352, 356, 358, 362, 364, 166, + 166, 369, 371, 138, 137, 391, 408, 370, + 372, 429, 373, 375, 136, 428, 374, 135, + 376, 423, 377, 379, 134, 422, 378, 133, + 380, 417, 381, 383, 132, 416, 382, 131, + 384, 411, 385, 387, 130, 410, 386, 129, + 394, 104, 390, 393, 392, 166, 105, 396, + 108, 126, 399, 111, 123, 402, 114, 120, + 405, 117, 407, 412, 414, 418, 420, 424, + 426, 430, 432, 139, 436, 437, 443, 440, + 140, 439, 442, 441, 141, 445, 143, 162, + 448, 146, 159, 451, 149, 156, 454, 152, + 153, 166, 457, 165, 460, 459, 462, 461, + 166 }; static const char _indic_syllable_machine_trans_actions[] = { - 1, 0, 2, 2, 2, 0, 2, 0, - 0, 2, 0, 0, 2, 0, 0, 2, - 0, 0, 0, 2, 0, 0, 2, 0, - 0, 2, 0, 0, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 3, - 0, 2, 2, 2, 0, 2, 0, 0, - 2, 0, 0, 2, 0, 0, 2, 0, - 0, 0, 2, 0, 0, 2, 0, 0, - 2, 0, 0, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 4, 0, - 2, 2, 2, 0, 2, 5, 0, 0, - 2, 0, 0, 2, 0, 0, 2, 0, - 0, 0, 2, 0, 0, 2, 0, 0, - 2, 0, 0, 2, 2, 6, 2, 6, - 2, 6, 2, 6, 2, 7, 0, 2, - 2, 2, 0, 2, 0, 0, 2, 0, + 1, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 6, 0, 8, 0, - 2, 0, 2, 0, 0, 2, 0, 0, - 2, 0, 2, 2, 2, 0, 0, 2, + 2, 2, 2, 2, 3, 0, 0, 2, + 0, 0, 2, 0, 0, 2, 0, 0, + 2, 0, 0, 0, 2, 0, 0, 2, + 0, 0, 2, 0, 0, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 4, 0, 0, 2, 5, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, - 2, 9, 0, 12, 2, 2, 6, 2, - 13, 13, 0, 0, 2, 2, 6, 2, - 6, 2, 0, 14, 2, 2, 0, 2, - 0, 0, 2, 2, 2, 0, 2, 2, - 0, 2, 2, 0, 2, 2, 2, 0, - 2, 2, 2, 2, 0, 2, 2, 2, - 0, 2, 2, 2, 2, 0, 2, 2, - 2, 0, 2, 2, 2, 2, 0, 2, - 2, 2, 0, 2, 0, 0, 0, 15, - 0, 0, 2, 0, 2, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2, - 0, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 16, 2, 2, 0, 2, 0, - 0, 2, 2, 2, 0, 2, 2, 0, - 2, 2, 0, 2, 2, 2, 0, 2, - 2, 2, 2, 0, 2, 2, 2, 0, - 2, 2, 2, 2, 0, 2, 2, 2, - 0, 2, 2, 2, 2, 0, 2, 2, - 2, 0, 2, 0, 0, 0, 17, 0, - 0, 2, 0, 2, 0, 2, 0, 0, + 0, 0, 2, 2, 6, 2, 6, 2, + 6, 2, 6, 2, 7, 0, 0, 2, + 0, 0, 2, 0, 0, 2, 0, 0, + 2, 0, 0, 0, 2, 0, 0, 2, + 0, 0, 2, 0, 0, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 6, 0, 2, 0, 2, 0, 0, 0, + 2, 0, 0, 2, 0, 0, 0, 2, + 0, 0, 2, 0, 0, 2, 0, 0, + 2, 8, 0, 11, 2, 2, 6, 0, + 12, 12, 0, 2, 6, 2, 6, 2, + 0, 13, 2, 0, 0, 2, 0, 2, + 2, 0, 2, 2, 2, 0, 0, 2, + 2, 0, 2, 2, 2, 0, 0, 2, + 2, 0, 2, 2, 2, 0, 0, 2, + 2, 0, 2, 2, 2, 0, 0, 2, + 2, 0, 2, 0, 0, 0, 0, 14, + 0, 2, 0, 0, 2, 0, 0, 2, + 0, 0, 2, 0, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 15, 2, 0, + 0, 2, 0, 2, 2, 0, 2, 2, + 2, 0, 0, 2, 2, 0, 2, 2, + 2, 0, 0, 2, 2, 0, 2, 2, + 2, 0, 0, 2, 2, 0, 2, 2, + 2, 0, 0, 2, 2, 0, 2, 0, + 0, 0, 0, 16, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 18, 6, 0, 6, 6, 0, 6, - 2, 0, 6, 2, 6, 0, 6, 6, - 6, 2, 0, 6, 2, 6, 0, 6, - 6, 6, 2, 0, 6, 2, 6, 0, - 6, 6, 6, 2, 0, 6, 2, 6, - 0, 6, 0, 0, 0, 19, 0, 0, - 2, 0, 2, 0, 2, 0, 0, 2, - 0, 0, 2, 0, 0, 2, 0, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 20, 21, 2, 2, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 0, 2, 2, - 0, 2, 2, 2, 0, 2, 2, 2, - 2, 0, 2, 2, 2, 0, 2, 2, - 2, 2, 0, 2, 2, 2, 0, 2, - 2, 2, 2, 0, 2, 2, 2, 0, - 2, 0, 0, 0, 22, 0, 0, 2, - 0, 2, 0, 2, 0, 0, 2, 0, + 2, 17, 6, 0, 6, 6, 6, 0, + 0, 6, 6, 0, 6, 6, 6, 0, + 0, 6, 6, 0, 6, 6, 6, 0, + 0, 6, 6, 0, 6, 6, 6, 0, + 0, 6, 6, 0, 6, 0, 0, 0, + 0, 18, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 0, - 0, 8, 2, 0, 0, 2, 0, 2, - 0, 0, 0, 0, 8, 8, 0, 8, - 8, 0, 0, 2, 0, 0, 0, 2, + 2, 2, 2, 2, 2, 2, 2, 19, + 20, 2, 0, 0, 0, 0, 2, 2, + 2, 2, 2, 0, 0, 2, 2, 0, + 2, 2, 2, 0, 0, 2, 2, 0, + 2, 2, 2, 0, 0, 2, 2, 0, + 2, 2, 2, 0, 0, 2, 2, 0, + 2, 0, 0, 0, 0, 21, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, - 2, 0, 2, 23, 2, 0, 0, 0, - 0, 0, 24, 0, 0 + 2, 0, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 0, 0, 22, 2, 0, + 0, 0, 0, 0, 0, 2, 0, 0, + 2, 0, 0, 2, 0, 0, 2, 0, + 0, 23, 2, 0, 0, 0, 0, 0, + 24 }; static const char _indic_syllable_machine_to_state_actions[] = { @@ -1157,9 +940,7 @@ static const char _indic_syllable_machine_to_state_actions[] = { 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, 10, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 9, 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, @@ -1196,15 +977,7 @@ static const char _indic_syllable_machine_to_state_actions[] = { 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, - 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 }; static const char _indic_syllable_machine_from_state_actions[] = { @@ -1228,9 +1001,7 @@ static const char _indic_syllable_machine_from_state_actions[] = { 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, 11, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 10, 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, @@ -1267,15 +1038,7 @@ static const char _indic_syllable_machine_from_state_actions[] = { 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, - 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 }; static const short _indic_syllable_machine_eof_trans[] = { @@ -1283,84 +1046,74 @@ static const short _indic_syllable_machine_eof_trans[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 79, 79, 79, 79, 86, 86, - 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 79, 1, 1, 1, 1, + 1, 1, 1, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 73, 73, + 77, 77, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, + 109, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 73, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 186, 0, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, - 362, 362, 362, 362, 362, 433, 362, 433, - 434, 434, 434, 434, 434, 434, 434, 434, - 434, 434, 434, 434, 434, 434, 434, 434, - 434, 434, 434, 434, 434, 434, 434, 434, - 434, 434, 434, 434, 434, 434, 434, 434, - 434, 434, 434, 434, 434, 434, 434, 434, - 434, 434, 434, 434, 434, 434, 434, 434, - 434, 434, 434, 434, 434, 434, 434, 434, - 434, 434, 434, 434, 434, 434, 434, 434, - 434, 434, 434, 434, 434, 434, 434, 434, - 434, 434, 434, 434, 434, 434, 362, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 362, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 362, 548, 548, 548, 548, 548, 548, - 548, 548, 548, 433 + 1, 1, 1, 1, 1, 170, 0, 186, + 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 384, 322, 384, + 385, 385, 385, 385, 385, 385, 385, 385, + 385, 385, 385, 385, 385, 385, 385, 385, + 385, 385, 385, 385, 385, 385, 385, 385, + 385, 385, 385, 385, 385, 385, 385, 385, + 385, 385, 385, 385, 385, 385, 385, 385, + 385, 385, 385, 385, 385, 385, 385, 385, + 385, 385, 385, 385, 385, 385, 385, 385, + 385, 385, 385, 385, 385, 385, 385, 385, + 385, 385, 322, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, + 474, 474, 474, 474, 474, 474, 474, 384 }; -static const int indic_syllable_machine_start = 178; -static const int indic_syllable_machine_first_final = 178; +static const int indic_syllable_machine_start = 166; +static const int indic_syllable_machine_first_final = 166; static const int indic_syllable_machine_error = -1; -static const int indic_syllable_machine_en_main = 178; +static const int indic_syllable_machine_en_main = 166; #line 36 "hb-ot-shape-complex-indic-machine.rl" -#line 97 "hb-ot-shape-complex-indic-machine.rl" +#line 92 "hb-ot-shape-complex-indic-machine.rl" #define found_syllable(syllable_type) \ @@ -1380,7 +1133,7 @@ find_syllables (hb_buffer_t *buffer) int cs; hb_glyph_info_t *info = buffer->info; -#line 1384 "hb-ot-shape-complex-indic-machine.hh" +#line 1137 "hb-ot-shape-complex-indic-machine.hh" { cs = indic_syllable_machine_start; ts = 0; @@ -1388,7 +1141,7 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 118 "hb-ot-shape-complex-indic-machine.rl" +#line 113 "hb-ot-shape-complex-indic-machine.rl" p = 0; @@ -1397,7 +1150,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int last = 0; unsigned int syllable_serial = 1; -#line 1401 "hb-ot-shape-complex-indic-machine.hh" +#line 1154 "hb-ot-shape-complex-indic-machine.hh" { int _slen; int _trans; @@ -1407,11 +1160,11 @@ find_syllables (hb_buffer_t *buffer) goto _test_eof; _resume: switch ( _indic_syllable_machine_from_state_actions[cs] ) { - case 11: + case 10: #line 1 "NONE" {ts = p;} break; -#line 1415 "hb-ot-shape-complex-indic-machine.hh" +#line 1168 "hb-ot-shape-complex-indic-machine.hh" } _keys = _indic_syllable_machine_trans_keys + (cs<<1); @@ -1433,72 +1186,72 @@ _eof_trans: #line 1 "NONE" {te = p+1;} break; - case 15: -#line 88 "hb-ot-shape-complex-indic-machine.rl" + case 14: +#line 83 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (consonant_syllable); }} break; - case 17: -#line 89 "hb-ot-shape-complex-indic-machine.rl" + case 16: +#line 84 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (vowel_syllable); }} break; - case 22: -#line 90 "hb-ot-shape-complex-indic-machine.rl" + case 21: +#line 85 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (standalone_cluster); }} break; case 24: -#line 91 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (symbol_cluster); }} break; - case 19: -#line 92 "hb-ot-shape-complex-indic-machine.rl" + case 18: +#line 87 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (broken_cluster); }} break; - case 12: -#line 93 "hb-ot-shape-complex-indic-machine.rl" + case 11: +#line 88 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (non_indic_cluster); }} break; - case 14: -#line 88 "hb-ot-shape-complex-indic-machine.rl" + case 13: +#line 83 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (consonant_syllable); }} break; - case 16: -#line 89 "hb-ot-shape-complex-indic-machine.rl" + case 15: +#line 84 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (vowel_syllable); }} break; - case 21: -#line 90 "hb-ot-shape-complex-indic-machine.rl" + case 20: +#line 85 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (standalone_cluster); }} break; case 23: -#line 91 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (symbol_cluster); }} break; - case 18: -#line 92 "hb-ot-shape-complex-indic-machine.rl" + case 17: +#line 87 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (broken_cluster); }} break; - case 20: -#line 93 "hb-ot-shape-complex-indic-machine.rl" + case 19: +#line 88 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (non_indic_cluster); }} break; case 1: -#line 88 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} break; case 3: -#line 89 "hb-ot-shape-complex-indic-machine.rl" +#line 84 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (vowel_syllable); }} break; case 7: -#line 90 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (standalone_cluster); }} break; - case 9: -#line 91 "hb-ot-shape-complex-indic-machine.rl" + case 8: +#line 86 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (symbol_cluster); }} break; case 4: -#line 92 "hb-ot-shape-complex-indic-machine.rl" +#line 87 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (broken_cluster); }} break; case 5: @@ -1516,34 +1269,34 @@ _eof_trans: } } break; - case 8: + case 22: #line 1 "NONE" {te = p+1;} -#line 88 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "hb-ot-shape-complex-indic-machine.rl" {act = 1;} break; case 6: #line 1 "NONE" {te = p+1;} -#line 92 "hb-ot-shape-complex-indic-machine.rl" +#line 87 "hb-ot-shape-complex-indic-machine.rl" {act = 5;} break; - case 13: + case 12: #line 1 "NONE" {te = p+1;} -#line 93 "hb-ot-shape-complex-indic-machine.rl" +#line 88 "hb-ot-shape-complex-indic-machine.rl" {act = 6;} break; -#line 1538 "hb-ot-shape-complex-indic-machine.hh" +#line 1291 "hb-ot-shape-complex-indic-machine.hh" } _again: switch ( _indic_syllable_machine_to_state_actions[cs] ) { - case 10: + case 9: #line 1 "NONE" {ts = 0;} break; -#line 1547 "hb-ot-shape-complex-indic-machine.hh" +#line 1300 "hb-ot-shape-complex-indic-machine.hh" } if ( ++p != pe ) @@ -1559,7 +1312,7 @@ _again: } -#line 127 "hb-ot-shape-complex-indic-machine.rl" +#line 122 "hb-ot-shape-complex-indic-machine.rl" } diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-indic-machine.rl b/gfx/harfbuzz/src/hb-ot-shape-complex-indic-machine.rl index 58d35c0016cc..0ea91c0cfe72 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-indic-machine.rl +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-indic-machine.rl @@ -38,7 +38,6 @@ %%{ # Same order as enum indic_category_t. Not sure how to avoid duplication. -X = 0; C = 1; V = 2; N = 3; @@ -47,12 +46,10 @@ ZWNJ = 5; ZWJ = 6; M = 7; SM = 8; -VD = 9; A = 10; PLACEHOLDER = 11; DOTTEDCIRCLE = 12; RS = 13; -Coeng = 14; Repha = 15; Ra = 16; CM = 17; @@ -62,19 +59,17 @@ CS = 19; c = (C | Ra); # is_consonant n = ((ZWNJ?.RS)? (N.N?)?); # is_consonant_modifier z = ZWJ|ZWNJ; # is_joiner -h = H | Coeng; # is_halant_or_coeng reph = (Ra H | Repha); # possible reph cn = c.ZWJ?.n?; forced_rakar = ZWJ H ZWJ Ra; symbol = Symbol.N?; matra_group = z{0,3}.M.N?.(H | forced_rakar)?; -syllable_tail = (z?.SM.SM?.ZWNJ?)? A{0,3}? VD{0,2}; -place_holder = PLACEHOLDER | DOTTEDCIRCLE; -halant_group = (z?.h.(ZWJ.N?)?); -final_halant_group = halant_group | h.ZWNJ; +syllable_tail = (z?.SM.SM?.ZWNJ?)? A{0,3}?; +halant_group = (z?.H.(ZWJ.N?)?); +final_halant_group = halant_group | H.ZWNJ; medial_group = CM?; -halant_or_matra_group = (final_halant_group | (h.ZWJ)? matra_group{0,4}) (Coeng (cn|V))?; +halant_or_matra_group = (final_halant_group | (H.ZWJ)? matra_group{0,4}); consonant_syllable = (Repha|CS)? (cn.halant_group){0,4} cn medial_group halant_or_matra_group syllable_tail; diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-indic-private.hh b/gfx/harfbuzz/src/hb-ot-shape-complex-indic-private.hh index a1e0d5266b4a..a64e9d03919d 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-indic-private.hh +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-indic-private.hh @@ -51,7 +51,7 @@ enum indic_category_t { OT_ZWJ = 6, OT_M = 7, OT_SM = 8, - OT_VD = 9, + /* OT_VD = 9, UNUSED; we use OT_A instead. */ OT_A = 10, OT_PLACEHOLDER = 11, OT_DOTTEDCIRCLE = 12, @@ -73,7 +73,6 @@ enum indic_category_t { * consonant syllable logic from the vowel syllable function and get it all right! */ #define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_CS) | FLAG (OT_Ra) | MEDIAL_FLAGS | FLAG (OT_V) | FLAG (OT_PLACEHOLDER) | FLAG (OT_DOTTEDCIRCLE)) #define JOINER_FLAGS (FLAG (OT_ZWJ) | FLAG (OT_ZWNJ)) -#define HALANT_OR_COENG_FLAGS (FLAG (OT_H) | FLAG (OT_Coeng)) /* Visual positions in a syllable from left to right. */ diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-indic-table.cc b/gfx/harfbuzz/src/hb-ot-shape-complex-indic-table.cc index bfd1c6d34295..867cfb33bf11 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-indic-table.cc +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-indic-table.cc @@ -399,10 +399,10 @@ hb_indic_get_categories (hb_codepoint_t u) switch (u >> 12) { case 0x0u: + if (unlikely (u == 0x00A0u)) return _(CP,x); if (hb_in_range (u, 0x0028u, 0x003Fu)) return indic_table[u - 0x0028u + indic_offset_0x0028u]; if (hb_in_range (u, 0x00B0u, 0x00D7u)) return indic_table[u - 0x00B0u + indic_offset_0x00b0u]; if (hb_in_range (u, 0x0900u, 0x0DF7u)) return indic_table[u - 0x0900u + indic_offset_0x0900u]; - if (unlikely (u == 0x00A0u)) return _(CP,x); break; case 0x1u: @@ -412,9 +412,9 @@ hb_indic_get_categories (hb_codepoint_t u) break; case 0x2u: + if (unlikely (u == 0x25CCu)) return _(CP,x); if (hb_in_range (u, 0x2008u, 0x2017u)) return indic_table[u - 0x2008u + indic_offset_0x2008u]; if (hb_in_range (u, 0x2070u, 0x2087u)) return indic_table[u - 0x2070u + indic_offset_0x2070u]; - if (unlikely (u == 0x25CCu)) return _(CP,x); break; case 0xAu: diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-indic.cc b/gfx/harfbuzz/src/hb-ot-shape-complex-indic.cc index 97d6d38287a9..9d150e0d3c13 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-indic.cc +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-indic.cc @@ -49,7 +49,6 @@ #define IS_KNDA(u) (IN_HALF_BLOCK (u, 0x0C80u)) #define IS_MLYM(u) (IN_HALF_BLOCK (u, 0x0D00u)) #define IS_SINH(u) (IN_HALF_BLOCK (u, 0x0D80u)) -#define IS_KHMR(u) (IN_HALF_BLOCK (u, 0x1780u)) #define MATRA_POS_LEFT(u) POS_PRE_M @@ -64,7 +63,6 @@ IS_KNDA(u) ? (u < 0x0CC3u || u > 0xCD6u ? POS_BEFORE_SUB : POS_AFTER_SUB) : \ IS_MLYM(u) ? POS_AFTER_POST : \ IS_SINH(u) ? POS_AFTER_SUB : \ - IS_KHMR(u) ? POS_AFTER_POST : \ /*default*/ POS_AFTER_SUB \ ) #define MATRA_POS_TOP(u) ( /* BENG and MLYM don't have top matras. */ \ @@ -76,7 +74,6 @@ IS_TELU(u) ? POS_BEFORE_SUB : \ IS_KNDA(u) ? POS_BEFORE_SUB : \ IS_SINH(u) ? POS_AFTER_SUB : \ - IS_KHMR(u) ? POS_AFTER_POST : \ /*default*/ POS_AFTER_SUB \ ) #define MATRA_POS_BOTTOM(u) ( \ @@ -90,7 +87,6 @@ IS_KNDA(u) ? POS_BEFORE_SUB : \ IS_MLYM(u) ? POS_AFTER_POST : \ IS_SINH(u) ? POS_AFTER_SUB : \ - IS_KHMR(u) ? POS_AFTER_POST : \ /*default*/ POS_AFTER_SUB \ ) @@ -124,8 +120,6 @@ static const hb_codepoint_t ra_chars[] = { 0x0D30u, /* Malayalam */ /* No Reph, Logical Repha */ 0x0DBBu, /* Sinhala */ /* Reph formed only with ZWJ */ - - 0x179Au, /* Khmer */ /* No Reph, Visual Repha */ }; static inline bool @@ -158,9 +152,9 @@ is_consonant (const hb_glyph_info_t &info) } static inline bool -is_halant_or_coeng (const hb_glyph_info_t &info) +is_halant (const hb_glyph_info_t &info) { - return is_one_of (info, HALANT_OR_COENG_FLAGS); + return is_one_of (info, FLAG (OT_H)); } static inline void @@ -200,14 +194,6 @@ set_indic_properties (hb_glyph_info_t &info) cat = OT_Symbol; static_assert (((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol), ""); } - else if (unlikely (hb_in_range (u, 0x17CDu, 0x17D1u) || - u == 0x17CBu || u == 0x17D3u || u == 0x17DDu)) /* Khmer Various signs */ - { - /* These can occur mid-syllable (eg. before matras), even though Unicode marks them as Syllable_Modifier. - * https://github.com/roozbehp/unicode-data/issues/5 */ - cat = OT_M; - pos = POS_ABOVE_C; - } else if (unlikely (u == 0x0A51u)) { /* https://github.com/harfbuzz/harfbuzz/issues/524 */ @@ -224,7 +210,6 @@ set_indic_properties (hb_glyph_info_t &info) else if (unlikely (u == 0x0980u)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/issues/538 */ else if (unlikely (u == 0x0C80u)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/pull/623 */ - else if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */ else if (unlikely (hb_in_range (u, 0x2010u, 0x2011u))) cat = OT_PLACEHOLDER; else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE; @@ -244,7 +229,7 @@ set_indic_properties (hb_glyph_info_t &info) { pos = matra_position (u, pos); } - else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_VD) | FLAG (OT_A) | FLAG (OT_Symbol)))) + else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) /* | FLAG (OT_VD) */ | FLAG (OT_A) | FLAG (OT_Symbol)))) { pos = POS_SMVD; } @@ -271,7 +256,6 @@ set_indic_properties (hb_glyph_info_t &info) */ enum base_position_t { - BASE_POS_FIRST, BASE_POS_LAST_SINHALA, BASE_POS_LAST }; @@ -280,13 +264,11 @@ enum reph_position_t { REPH_POS_BEFORE_SUB = POS_BEFORE_SUB, REPH_POS_AFTER_SUB = POS_AFTER_SUB, REPH_POS_BEFORE_POST = POS_BEFORE_POST, - REPH_POS_AFTER_POST = POS_AFTER_POST, - REPH_POS_DONT_CARE = POS_RA_TO_BECOME_REPH + REPH_POS_AFTER_POST = POS_AFTER_POST }; enum reph_mode_t { REPH_MODE_IMPLICIT, /* Reph formed out of initial Ra,H sequence. */ REPH_MODE_EXPLICIT, /* Reph formed out of initial Ra,H,ZWJ sequence. */ - REPH_MODE_VIS_REPHA, /* Encoded Repha character, no reordering needed. */ REPH_MODE_LOG_REPHA /* Encoded Repha character, needs reordering. */ }; enum blwf_mode_t { @@ -319,7 +301,6 @@ static const indic_config_t indic_configs[] = {HB_SCRIPT_MALAYALAM, true, 0x0D4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_LOG_REPHA,BLWF_MODE_PRE_AND_POST}, {HB_SCRIPT_SINHALA, false,0x0DCAu,BASE_POS_LAST_SINHALA, REPH_POS_AFTER_MAIN, REPH_MODE_EXPLICIT, BLWF_MODE_PRE_AND_POST}, - {HB_SCRIPT_KHMER, false,0x17D2u,BASE_POS_FIRST,REPH_POS_DONT_CARE, REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST}, }; @@ -351,7 +332,6 @@ indic_features[] = {HB_TAG('p','s','t','f'), F_NONE}, {HB_TAG('v','a','t','u'), F_GLOBAL}, {HB_TAG('c','j','c','t'), F_GLOBAL}, - {HB_TAG('c','f','a','r'), F_NONE}, /* * Other features. * These features are applied all at once, after final_reordering. @@ -385,7 +365,6 @@ enum { PSTF, _VATU, _CJCT, - CFAR, INIT, _PRES, @@ -452,17 +431,6 @@ collect_features_indic (hb_ot_shape_planner_t *plan) static void override_features_indic (hb_ot_shape_planner_t *plan) { - /* Uniscribe does not apply 'kern' in Khmer. */ - if (hb_options ().uniscribe_bug_compatible) - { - switch ((hb_tag_t) plan->props.script) - { - case HB_SCRIPT_KHMER: - plan->map.add_feature (HB_TAG('k','e','r','n'), 0, F_GLOBAL); - break; - } - } - plan->map.add_feature (HB_TAG('l','i','g','a'), 0, F_GLOBAL); } @@ -730,8 +698,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->config->reph_pos != REPH_POS_DONT_CARE && - indic_plan->mask_array[RPHF] && + if (indic_plan->mask_array[RPHF] && start + 3 <= end && ( (indic_plan->config->reph_mode == REPH_MODE_IMPLICIT && !is_joiner (info[start + 2])) || @@ -840,22 +807,6 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, info[i].indic_position() = POS_BELOW_C; } break; - - case BASE_POS_FIRST: - { - /* The first consonant is always the base. */ - - assert (indic_plan->config->reph_mode == REPH_MODE_VIS_REPHA); - assert (!has_reph); - - base = start; - - /* Mark all subsequent consonants as below. */ - for (unsigned int i = base + 1; i < end; i++) - if (is_consonant (info[i])) - info[i].indic_position() = POS_BELOW_C; - } - break; } /* -> If the syllable starts with Ra + Halant (in a script that has Reph) @@ -910,15 +861,15 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, if (base < end) info[base].indic_position() = POS_BASE_C; - /* Mark final consonants. A final consonant is one appearing after a matra, - * like in Khmer. */ + /* Mark final consonants. A final consonant is one appearing after a matra. + * Happens in Sinhala. */ for (unsigned int i = base + 1; i < end; i++) if (info[i].indic_category() == OT_M) { for (unsigned int j = i + 1; j < end; j++) - if (is_consonant (info[j])) { - info[j].indic_position() = POS_FINAL_C; - break; - } + if (is_consonant (info[j])) { + info[j].indic_position() = POS_FINAL_C; + break; + } break; } @@ -969,7 +920,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, indic_position_t last_pos = POS_START; for (unsigned int i = start; i < end; i++) { - if ((FLAG_UNSAFE (info[i].indic_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | MEDIAL_FLAGS | HALANT_OR_COENG_FLAGS))) + if ((FLAG_UNSAFE (info[i].indic_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | MEDIAL_FLAGS | FLAG (OT_H)))) { info[i].indic_position() = last_pos; if (unlikely (info[i].indic_category() == OT_H && @@ -1133,17 +1084,6 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, { for (unsigned int j = 0; j < pref_len; j++) info[i++].mask |= indic_plan->mask_array[PREF]; - - /* Mark the subsequent stuff with 'cfar'. Used in Khmer. - * Read the feature spec. - * This allows distinguishing the following cases with MS Khmer fonts: - * U+1784,U+17D2,U+179A,U+17D2,U+1782 - * U+1784,U+17D2,U+1782,U+17D2,U+179A - */ - if (indic_plan->mask_array[CFAR]) - for (; i < end; i++) - info[i].mask |= indic_plan->mask_array[CFAR]; - break; } } @@ -1311,7 +1251,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, _hb_glyph_info_ligated (&info[i]) && _hb_glyph_info_multiplied (&info[i])) { - /* This will make sure that this glyph passes is_halant_or_coeng() test. */ + /* This will make sure that this glyph passes is_halant() test. */ info[i].indic_category() = OT_H; _hb_glyph_info_clear_ligated_and_multiplied (&info[i]); } @@ -1344,7 +1284,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, /* Ok, this was a 'pref' candidate but didn't form any. * Base is around here... */ base = i; - while (base < end && is_halant_or_coeng (info[base])) + while (base < end && is_halant (info[base])) base++; info[base].indic_position() = POS_BASE_C; @@ -1360,7 +1300,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, { while (i < end && is_joiner (info[i])) i++; - if (i == end || !is_halant_or_coeng (info[i])) + if (i == end || !is_halant (info[i])) break; i++; /* Skip halant. */ while (i < end && is_joiner (info[i])) @@ -1382,7 +1322,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, base--; if (base < end) while (start < base && - is_one_of (info[base], (FLAG (OT_N) | HALANT_OR_COENG_FLAGS))) + is_one_of (info[base], (FLAG (OT_N) | FLAG (OT_H)))) base--; @@ -1408,13 +1348,13 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != HB_SCRIPT_TAMIL) { while (new_pos > start && - !(is_one_of (info[new_pos], (FLAG (OT_M) | HALANT_OR_COENG_FLAGS)))) + !(is_one_of (info[new_pos], (FLAG (OT_M) | FLAG (OT_H))))) new_pos--; /* If we found no Halant we are done. * Otherwise only proceed if the Halant does * not belong to the Matra itself! */ - if (is_halant_or_coeng (info[new_pos]) && + if (is_halant (info[new_pos]) && info[new_pos].indic_position() != POS_PRE_M) { /* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */ @@ -1481,8 +1421,6 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, unsigned int new_reph_pos; reph_position_t reph_pos = indic_plan->config->reph_pos; - assert (reph_pos != REPH_POS_DONT_CARE); - /* 1. If reph should be positioned after post-base consonant forms, * proceed to step 5. */ @@ -1504,10 +1442,10 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, */ { new_reph_pos = start + 1; - while (new_reph_pos < base && !is_halant_or_coeng (info[new_reph_pos])) + while (new_reph_pos < base && !is_halant (info[new_reph_pos])) new_reph_pos++; - if (new_reph_pos < base && is_halant_or_coeng (info[new_reph_pos])) + if (new_reph_pos < base && is_halant (info[new_reph_pos])) { /* ->If ZWJ or ZWNJ are following this halant, position is moved after it. */ if (new_reph_pos + 1 < base && is_joiner (info[new_reph_pos + 1])) @@ -1556,10 +1494,10 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, { /* Copied from step 2. */ new_reph_pos = start + 1; - while (new_reph_pos < base && !is_halant_or_coeng (info[new_reph_pos])) + while (new_reph_pos < base && !is_halant (info[new_reph_pos])) new_reph_pos++; - if (new_reph_pos < base && is_halant_or_coeng (info[new_reph_pos])) + if (new_reph_pos < base && is_halant (info[new_reph_pos])) { /* ->If ZWJ or ZWNJ are following this halant, position is moved after it. */ if (new_reph_pos + 1 < base && is_joiner (info[new_reph_pos + 1])) @@ -1583,7 +1521,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, * TEST: U+0930,U+094D,U+0915,U+094B,U+094D */ if (!hb_options ().uniscribe_bug_compatible && - unlikely (is_halant_or_coeng (info[new_reph_pos]))) { + unlikely (is_halant (info[new_reph_pos]))) { for (unsigned int i = base + 1; i < new_reph_pos; i++) if (info[i].indic_category() == OT_M) { /* Ok, got it. */ @@ -1644,24 +1582,11 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != HB_SCRIPT_TAMIL) { while (new_pos > start && - !(is_one_of (info[new_pos - 1], FLAG(OT_M) | HALANT_OR_COENG_FLAGS))) + !(is_one_of (info[new_pos - 1], FLAG(OT_M) | FLAG (OT_H)))) new_pos--; - - /* In Khmer coeng model, a H,Ra can go *after* matras. If it goes after a - * split matra, it should be reordered to *before* the left part of such matra. */ - if (new_pos > start && info[new_pos - 1].indic_category() == OT_M) - { - unsigned int old_pos = i; - for (unsigned int j = base + 1; j < old_pos; j++) - if (info[j].indic_category() == OT_M) - { - new_pos--; - break; - } - } } - if (new_pos > start && is_halant_or_coeng (info[new_pos - 1])) + if (new_pos > start && is_halant (info[new_pos - 1])) { /* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */ if (new_pos < end && is_joiner (info[new_pos])) @@ -1766,13 +1691,6 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c, * Decompose split matras that don't have Unicode decompositions. */ - /* Khmer */ - case 0x17BEu : *a = 0x17C1u; *b= 0x17BEu; return true; - case 0x17BFu : *a = 0x17C1u; *b= 0x17BFu; return true; - case 0x17C0u : *a = 0x17C1u; *b= 0x17C0u; return true; - case 0x17C4u : *a = 0x17C1u; *b= 0x17C4u; return true; - case 0x17C5u : *a = 0x17C1u; *b= 0x17C5u; return true; - #if 0 /* Gujarati */ /* This one has no decomposition in Unicode, but needs no decomposition either. */ diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-khmer-machine.hh b/gfx/harfbuzz/src/hb-ot-shape-complex-khmer-machine.hh new file mode 100644 index 000000000000..380705a50510 --- /dev/null +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-khmer-machine.hh @@ -0,0 +1,294 @@ + +#line 1 "hb-ot-shape-complex-khmer-machine.rl" +/* + * Copyright © 2011,2012 Google, 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. + * + * Google Author(s): Behdad Esfahbod + */ + +#ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH +#define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH + +#include "hb-private.hh" + + +#line 36 "hb-ot-shape-complex-khmer-machine.hh" +static const unsigned char _khmer_syllable_machine_trans_keys[] = { + 7u, 7u, 1u, 16u, 13u, 13u, 1u, 16u, 7u, 13u, 7u, 7u, 1u, 16u, 13u, 13u, + 1u, 16u, 7u, 13u, 1u, 16u, 3u, 14u, 3u, 14u, 5u, 14u, 3u, 14u, 5u, 14u, + 8u, 8u, 3u, 13u, 3u, 8u, 8u, 8u, 3u, 8u, 3u, 14u, 3u, 14u, 5u, 14u, + 3u, 14u, 5u, 14u, 8u, 8u, 3u, 13u, 3u, 8u, 8u, 8u, 3u, 8u, 3u, 14u, + 3u, 14u, 7u, 13u, 7u, 7u, 1u, 16u, 0 +}; + +static const char _khmer_syllable_machine_key_spans[] = { + 1, 16, 1, 16, 7, 1, 16, 1, + 16, 7, 16, 12, 12, 10, 12, 10, + 1, 11, 6, 1, 6, 12, 12, 10, + 12, 10, 1, 11, 6, 1, 6, 12, + 12, 7, 1, 16 +}; + +static const short _khmer_syllable_machine_index_offsets[] = { + 0, 2, 19, 21, 38, 46, 48, 65, + 67, 84, 92, 109, 122, 135, 146, 159, + 170, 172, 184, 191, 193, 200, 213, 226, + 237, 250, 261, 263, 275, 282, 284, 291, + 304, 317, 325, 327 +}; + +static const char _khmer_syllable_machine_indicies[] = { + 1, 0, 2, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2, 0, 3, 0, 4, 4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4, 0, 1, 0, + 0, 0, 0, 0, 5, 0, 7, 6, + 8, 8, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 8, + 6, 9, 6, 10, 10, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 10, 6, 7, 6, 6, 6, + 6, 6, 11, 6, 4, 4, 13, 12, + 14, 15, 7, 16, 12, 12, 4, 4, + 11, 17, 12, 4, 12, 19, 18, 20, + 21, 1, 22, 18, 18, 18, 18, 5, + 23, 18, 24, 18, 21, 21, 1, 22, + 18, 18, 18, 18, 18, 23, 18, 21, + 21, 1, 22, 18, 18, 18, 18, 18, + 23, 18, 25, 18, 21, 21, 1, 22, + 18, 18, 18, 18, 18, 26, 18, 21, + 21, 1, 22, 18, 18, 18, 18, 18, + 26, 18, 27, 18, 28, 18, 29, 18, + 18, 22, 18, 18, 18, 18, 3, 18, + 30, 18, 18, 18, 18, 22, 18, 22, + 18, 28, 18, 18, 18, 18, 22, 18, + 19, 18, 21, 21, 1, 22, 18, 18, + 18, 18, 18, 23, 18, 32, 31, 33, + 33, 7, 16, 31, 31, 31, 31, 31, + 34, 31, 33, 33, 7, 16, 31, 31, + 31, 31, 31, 34, 31, 35, 31, 33, + 33, 7, 16, 31, 31, 31, 31, 31, + 36, 31, 33, 33, 7, 16, 31, 31, + 31, 31, 31, 36, 31, 37, 31, 38, + 31, 39, 31, 31, 16, 31, 31, 31, + 31, 9, 31, 40, 31, 31, 31, 31, + 16, 31, 16, 31, 38, 31, 31, 31, + 31, 16, 31, 13, 31, 41, 33, 7, + 16, 31, 31, 31, 31, 11, 34, 31, + 13, 31, 33, 33, 7, 16, 31, 31, + 31, 31, 31, 34, 31, 7, 42, 42, + 42, 42, 42, 11, 42, 7, 42, 10, + 10, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 10, 42, + 0 +}; + +static const char _khmer_syllable_machine_trans_targs[] = { + 10, 14, 17, 20, 11, 21, 10, 24, + 27, 30, 31, 32, 10, 22, 33, 34, + 26, 35, 10, 12, 4, 0, 16, 3, + 13, 15, 1, 10, 18, 2, 19, 10, + 23, 5, 8, 25, 6, 10, 28, 7, + 29, 9, 10 +}; + +static const char _khmer_syllable_machine_trans_actions[] = { + 1, 2, 2, 0, 2, 2, 3, 2, + 2, 0, 2, 2, 6, 2, 0, 0, + 0, 0, 7, 2, 0, 0, 0, 0, + 2, 2, 0, 8, 0, 0, 0, 9, + 2, 0, 0, 2, 0, 10, 0, 0, + 0, 0, 11 +}; + +static const char _khmer_syllable_machine_to_state_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 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 +}; + +static const char _khmer_syllable_machine_from_state_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 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 +}; + +static const unsigned char _khmer_syllable_machine_eof_trans[] = { + 1, 1, 1, 1, 1, 7, 7, 7, + 7, 7, 0, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 43, 43, 43 +}; + +static const int khmer_syllable_machine_start = 10; +static const int khmer_syllable_machine_first_final = 10; +static const int khmer_syllable_machine_error = -1; + +static const int khmer_syllable_machine_en_main = 10; + + +#line 36 "hb-ot-shape-complex-khmer-machine.rl" + + + +#line 74 "hb-ot-shape-complex-khmer-machine.rl" + + +#define found_syllable(syllable_type) \ + HB_STMT_START { \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ + for (unsigned int i = last; i < p+1; i++) \ + info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + last = p+1; \ + syllable_serial++; \ + if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ + } HB_STMT_END + +static void +find_syllables (hb_buffer_t *buffer) +{ + unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; + int cs; + hb_glyph_info_t *info = buffer->info; + +#line 181 "hb-ot-shape-complex-khmer-machine.hh" + { + cs = khmer_syllable_machine_start; + ts = 0; + te = 0; + act = 0; + } + +#line 95 "hb-ot-shape-complex-khmer-machine.rl" + + + p = 0; + pe = eof = buffer->len; + + unsigned int last = 0; + unsigned int syllable_serial = 1; + +#line 198 "hb-ot-shape-complex-khmer-machine.hh" + { + int _slen; + int _trans; + const unsigned char *_keys; + const char *_inds; + if ( p == pe ) + goto _test_eof; +_resume: + switch ( _khmer_syllable_machine_from_state_actions[cs] ) { + case 5: +#line 1 "NONE" + {ts = p;} + break; +#line 212 "hb-ot-shape-complex-khmer-machine.hh" + } + + _keys = _khmer_syllable_machine_trans_keys + (cs<<1); + _inds = _khmer_syllable_machine_indicies + _khmer_syllable_machine_index_offsets[cs]; + + _slen = _khmer_syllable_machine_key_spans[cs]; + _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].khmer_category()) && + ( info[p].khmer_category()) <= _keys[1] ? + ( info[p].khmer_category()) - _keys[0] : _slen ]; + +_eof_trans: + cs = _khmer_syllable_machine_trans_targs[_trans]; + + if ( _khmer_syllable_machine_trans_actions[_trans] == 0 ) + goto _again; + + switch ( _khmer_syllable_machine_trans_actions[_trans] ) { + case 2: +#line 1 "NONE" + {te = p+1;} + break; + case 8: +#line 68 "hb-ot-shape-complex-khmer-machine.rl" + {te = p+1;{ found_syllable (consonant_syllable); }} + break; + case 10: +#line 69 "hb-ot-shape-complex-khmer-machine.rl" + {te = p+1;{ found_syllable (broken_cluster); }} + break; + case 6: +#line 70 "hb-ot-shape-complex-khmer-machine.rl" + {te = p+1;{ found_syllable (non_khmer_cluster); }} + break; + case 7: +#line 68 "hb-ot-shape-complex-khmer-machine.rl" + {te = p;p--;{ found_syllable (consonant_syllable); }} + break; + case 9: +#line 69 "hb-ot-shape-complex-khmer-machine.rl" + {te = p;p--;{ found_syllable (broken_cluster); }} + break; + case 11: +#line 70 "hb-ot-shape-complex-khmer-machine.rl" + {te = p;p--;{ found_syllable (non_khmer_cluster); }} + break; + case 1: +#line 68 "hb-ot-shape-complex-khmer-machine.rl" + {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} + break; + case 3: +#line 69 "hb-ot-shape-complex-khmer-machine.rl" + {{p = ((te))-1;}{ found_syllable (broken_cluster); }} + break; +#line 266 "hb-ot-shape-complex-khmer-machine.hh" + } + +_again: + switch ( _khmer_syllable_machine_to_state_actions[cs] ) { + case 4: +#line 1 "NONE" + {ts = 0;} + break; +#line 275 "hb-ot-shape-complex-khmer-machine.hh" + } + + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + if ( _khmer_syllable_machine_eof_trans[cs] > 0 ) { + _trans = _khmer_syllable_machine_eof_trans[cs] - 1; + goto _eof_trans; + } + } + + } + +#line 104 "hb-ot-shape-complex-khmer-machine.rl" + +} + +#endif /* HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH */ diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-khmer-machine.rl b/gfx/harfbuzz/src/hb-ot-shape-complex-khmer-machine.rl new file mode 100644 index 000000000000..8b00c37f093a --- /dev/null +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-khmer-machine.rl @@ -0,0 +1,107 @@ +/* + * Copyright © 2011,2012 Google, 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. + * + * Google Author(s): Behdad Esfahbod + */ + +#ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH +#define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH + +#include "hb-private.hh" + +%%{ + machine khmer_syllable_machine; + alphtype unsigned char; + write data; +}%% + +%%{ + +# Same order as enum khmer_category_t. Not sure how to avoid duplication. +C = 1; +V = 2; +N = 3; +ZWNJ = 5; +ZWJ = 6; +M = 7; +SM = 8; +PLACEHOLDER = 11; +DOTTEDCIRCLE = 12; +RS = 13; +Coeng = 14; +Ra = 16; + +c = (C | Ra | V); # is_consonant +n = ((ZWNJ?.RS)? (N.N?)?); # is_consonant_modifier +z = ZWJ|ZWNJ; # is_joiner + +cn = c.n?; +matra_group = z?.M.N?; +syllable_tail = (SM.SM?)?; + + +broken_cluster = n? (Coeng.cn)* matra_group* (Coeng.cn)? syllable_tail; +consonant_syllable = (c|PLACEHOLDER|DOTTEDCIRCLE) broken_cluster; +other = any; + +main := |* + consonant_syllable => { found_syllable (consonant_syllable); }; + broken_cluster => { found_syllable (broken_cluster); }; + other => { found_syllable (non_khmer_cluster); }; +*|; + + +}%% + +#define found_syllable(syllable_type) \ + HB_STMT_START { \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ + for (unsigned int i = last; i < p+1; i++) \ + info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + last = p+1; \ + syllable_serial++; \ + if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ + } HB_STMT_END + +static void +find_syllables (hb_buffer_t *buffer) +{ + unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; + int cs; + hb_glyph_info_t *info = buffer->info; + %%{ + write init; + getkey info[p].khmer_category(); + }%% + + p = 0; + pe = eof = buffer->len; + + unsigned int last = 0; + unsigned int syllable_serial = 1; + %%{ + write exec; + }%% +} + +#endif /* HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH */ diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-khmer.cc b/gfx/harfbuzz/src/hb-ot-shape-complex-khmer.cc new file mode 100644 index 000000000000..2db4f6097d81 --- /dev/null +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-khmer.cc @@ -0,0 +1,945 @@ +/* + * Copyright © 2011,2012 Google, 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. + * + * Google Author(s): Behdad Esfahbod + */ + +#include "hb-ot-shape-complex-indic-private.hh" +#include "hb-ot-layout-private.hh" + +/* buffer var allocations */ +#define khmer_category() complex_var_u8_0() /* khmer_category_t */ +#define khmer_position() complex_var_u8_1() /* khmer_position_t */ + + +/* + * Khmer shaper. + */ + +typedef indic_category_t khmer_category_t; +typedef indic_position_t khmer_position_t; + + +static inline khmer_position_t +matra_position (khmer_position_t side) +{ + switch ((int) side) + { + case POS_PRE_C: + return POS_PRE_M; + + case POS_POST_C: + case POS_ABOVE_C: + case POS_BELOW_C: + return POS_AFTER_POST; + + default: + return side; + }; +} + +static inline bool +is_one_of (const hb_glyph_info_t &info, unsigned int flags) +{ + /* If it ligated, all bets are off. */ + if (_hb_glyph_info_ligated (&info)) return false; + return !!(FLAG_UNSAFE (info.khmer_category()) & flags); +} + +static inline bool +is_joiner (const hb_glyph_info_t &info) +{ + return is_one_of (info, JOINER_FLAGS); +} + +static inline bool +is_consonant (const hb_glyph_info_t &info) +{ + return is_one_of (info, CONSONANT_FLAGS | FLAG (OT_V)); +} + +static inline bool +is_coeng (const hb_glyph_info_t &info) +{ + return is_one_of (info, FLAG (OT_Coeng)); +} + +static inline void +set_khmer_properties (hb_glyph_info_t &info) +{ + hb_codepoint_t u = info.codepoint; + unsigned int type = hb_indic_get_categories (u); + khmer_category_t cat = (khmer_category_t) (type & 0x7Fu); + khmer_position_t pos = (khmer_position_t) (type >> 8); + + + /* + * Re-assign category + */ + + if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */ + else if (unlikely (hb_in_range (u, 0x17CDu, 0x17D1u) || + u == 0x17CBu || u == 0x17D3u || u == 0x17DDu)) /* Khmer Various signs */ + { + /* These can occur mid-syllable (eg. before matras), even though Unicode marks them as Syllable_Modifier. + * https://github.com/roozbehp/unicode-data/issues/5 */ + cat = OT_M; + pos = POS_ABOVE_C; + } + else if (unlikely (hb_in_range (u, 0x2010u, 0x2011u))) cat = OT_PLACEHOLDER; + else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE; + + + /* + * Re-assign position. + */ + + if ((FLAG_UNSAFE (cat) & CONSONANT_FLAGS)) + { + pos = POS_BASE_C; + if (u == 0x179Au) + cat = OT_Ra; + } + else if (cat == OT_M) + { + pos = matra_position (pos); + } + else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_A) | FLAG (OT_Symbol)))) + { + pos = POS_SMVD; + } + + info.khmer_category() = cat; + info.khmer_position() = pos; +} + +/* + * Things above this line should ideally be moved to the Indic table itself. + */ + + +/* + * Khmer shaper. + */ + +struct feature_list_t { + hb_tag_t tag; + hb_ot_map_feature_flags_t flags; +}; + +static const feature_list_t +khmer_features[] = +{ + /* + * Basic features. + * These features are applied in order, one at a time, after initial_reordering. + */ + {HB_TAG('p','r','e','f'), F_NONE}, + {HB_TAG('b','l','w','f'), F_NONE}, + {HB_TAG('a','b','v','f'), F_NONE}, + {HB_TAG('p','s','t','f'), F_NONE}, + {HB_TAG('c','f','a','r'), F_NONE}, + /* + * Other features. + * These features are applied all at once, after final_reordering. + * Default Bengali font in Windows for example has intermixed + * lookups for init,pres,abvs,blws features. + */ + {HB_TAG('p','r','e','s'), F_GLOBAL}, + {HB_TAG('a','b','v','s'), F_GLOBAL}, + {HB_TAG('b','l','w','s'), F_GLOBAL}, + {HB_TAG('p','s','t','s'), F_GLOBAL}, + /* Positioning features, though we don't care about the types. */ + {HB_TAG('d','i','s','t'), F_GLOBAL}, + {HB_TAG('a','b','v','m'), F_GLOBAL}, + {HB_TAG('b','l','w','m'), F_GLOBAL}, +}; + +/* + * Must be in the same order as the khmer_features array. + */ +enum { + PREF, + BLWF, + ABVF, + PSTF, + CFAR, + + _PRES, + _ABVS, + _BLWS, + _PSTS, + _DIST, + _ABVM, + _BLWM, + + KHMER_NUM_FEATURES, + KHMER_BASIC_FEATURES = _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 +initial_reordering (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); +static void +clear_syllables (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) +{ + hb_ot_map_builder_t *map = &plan->map; + + /* Do this before any lookups have been applied. */ + map->add_gsub_pause (setup_syllables); + + map->add_global_bool_feature (HB_TAG('l','o','c','l')); + /* The Indic specs do not require ccmp, but we apply it here since if + * there is a use of it, it's typically at the beginning. */ + map->add_global_bool_feature (HB_TAG('c','c','m','p')); + + + unsigned int i = 0; + map->add_gsub_pause (initial_reordering); + for (; i < KHMER_BASIC_FEATURES; i++) { + map->add_feature (khmer_features[i].tag, 1, khmer_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ); + map->add_gsub_pause (nullptr); + } + map->add_gsub_pause (final_reordering); + for (; i < KHMER_NUM_FEATURES; i++) { + map->add_feature (khmer_features[i].tag, 1, khmer_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ); + } + + map->add_global_bool_feature (HB_TAG('c','a','l','t')); + map->add_global_bool_feature (HB_TAG('c','l','i','g')); + + map->add_gsub_pause (clear_syllables); +} + +static void +override_features_khmer (hb_ot_shape_planner_t *plan) +{ + /* Uniscribe does not apply 'kern' in Khmer. */ + if (hb_options ().uniscribe_bug_compatible) + { + plan->map.add_feature (HB_TAG('k','e','r','n'), 0, F_GLOBAL); + } + + plan->map.add_feature (HB_TAG('l','i','g','a'), 0, F_GLOBAL); +} + + +struct would_substitute_feature_t +{ + inline 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); + } + + inline 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_fast (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 +{ + ASSERT_POD (); + + inline bool get_virama_glyph (hb_font_t *font, hb_codepoint_t *pglyph) const + { + hb_codepoint_t glyph = virama_glyph; + if (unlikely (virama_glyph == (hb_codepoint_t) -1)) + { + if (!font->get_nominal_glyph (0x17D2u, &glyph)) + glyph = 0; + /* Technically speaking, the spec says we should apply 'locl' to virama too. + * Maybe one day... */ + + /* Our get_nominal_glyph() function needs a font, so we can't get the virama glyph + * during shape planning... Instead, overwrite it here. It's safe. Don't worry! */ + virama_glyph = glyph; + } + + *pglyph = glyph; + return glyph != 0; + } + + mutable hb_codepoint_t virama_glyph; + + would_substitute_feature_t pref; + + hb_mask_t mask_array[KHMER_NUM_FEATURES]; +}; + +static void * +data_create_khmer (const hb_ot_shape_plan_t *plan) +{ + khmer_shape_plan_t *khmer_plan = (khmer_shape_plan_t *) calloc (1, sizeof (khmer_shape_plan_t)); + if (unlikely (!khmer_plan)) + return nullptr; + + khmer_plan->virama_glyph = (hb_codepoint_t) -1; + + khmer_plan->pref.init (&plan->map, HB_TAG('p','r','e','f'), true); + + for (unsigned int i = 0; i < ARRAY_LENGTH (khmer_plan->mask_array); i++) + khmer_plan->mask_array[i] = (khmer_features[i].flags & F_GLOBAL) ? + 0 : plan->map.get_1_mask (khmer_features[i].tag); + + return khmer_plan; +} + +static void +data_destroy_khmer (void *data) +{ + free (data); +} + + +enum syllable_type_t { + consonant_syllable, + broken_cluster, + non_khmer_cluster, +}; + +#include "hb-ot-shape-complex-khmer-machine.hh" + +static void +setup_masks_khmer (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_buffer_t *buffer, + hb_font_t *font HB_UNUSED) +{ + HB_BUFFER_ALLOCATE_VAR (buffer, khmer_category); + HB_BUFFER_ALLOCATE_VAR (buffer, khmer_position); + + /* We cannot setup masks here. We save information about characters + * and setup masks later on in a pause-callback. */ + + unsigned int count = buffer->len; + hb_glyph_info_t *info = buffer->info; + for (unsigned int i = 0; i < count; i++) + set_khmer_properties (info[i]); +} + +static void +setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_font_t *font HB_UNUSED, + hb_buffer_t *buffer) +{ + find_syllables (buffer); + foreach_syllable (buffer, start, end) + buffer->unsafe_to_break (start, end); +} + +static int +compare_khmer_order (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb) +{ + int a = pa->khmer_position(); + int b = pb->khmer_position(); + + return a < b ? -1 : a == b ? 0 : +1; +} + + +/* Rules from: + * https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx */ + +static void +initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, + hb_face_t *face, + hb_buffer_t *buffer, + unsigned int start, unsigned int end) +{ + const khmer_shape_plan_t *khmer_plan = (const khmer_shape_plan_t *) plan->data; + hb_glyph_info_t *info = buffer->info; + + /* 1. Khmer shaping assumes that a syllable will begin with a Cons, IndV, or Number. */ + + /* The first consonant is always the base. */ + unsigned int base = start; + info[base].khmer_position() = POS_BASE_C; + + /* Mark all subsequent consonants as below. */ + for (unsigned int i = base + 1; i < end; i++) + if (is_consonant (info[i])) + info[i].khmer_position() = POS_BELOW_C; + + /* Mark final consonants. A final consonant is one appearing after a matra, + * like in Khmer. */ + for (unsigned int i = base + 1; i < end; i++) + if (info[i].khmer_category() == OT_M) { + for (unsigned int j = i + 1; j < end; j++) + if (is_consonant (info[j])) { + info[j].khmer_position() = POS_FINAL_C; + break; + } + break; + } + + /* Attach misc marks to previous char to move with them. */ + { + khmer_position_t last_pos = POS_START; + for (unsigned int i = start; i < end; i++) + { + if ((FLAG_UNSAFE (info[i].khmer_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | MEDIAL_FLAGS | FLAG (OT_Coeng)))) + { + info[i].khmer_position() = last_pos; + if (unlikely (info[i].khmer_category() == OT_H && + info[i].khmer_position() == POS_PRE_M)) + { + /* + * Uniscribe doesn't move the Halant with Left Matra. + * TEST: U+092B,U+093F,U+094DE + * We follow. This is important for the Sinhala + * U+0DDA split matra since it decomposes to U+0DD9,U+0DCA + * where U+0DD9 is a left matra and U+0DCA is the virama. + * We don't want to move the virama with the left matra. + * TEST: U+0D9A,U+0DDA + */ + for (unsigned int j = i; j > start; j--) + if (info[j - 1].khmer_position() != POS_PRE_M) { + info[i].khmer_position() = info[j - 1].khmer_position(); + break; + } + } + } else if (info[i].khmer_position() != POS_SMVD) { + last_pos = (khmer_position_t) info[i].khmer_position(); + } + } + } + /* For post-base consonants let them own anything before them + * since the last consonant or matra. */ + { + unsigned int last = base; + for (unsigned int i = base + 1; i < end; i++) + if (is_consonant (info[i])) + { + for (unsigned int j = last + 1; j < i; j++) + if (info[j].khmer_position() < POS_SMVD) + info[j].khmer_position() = info[i].khmer_position(); + last = i; + } else if (info[i].khmer_category() == OT_M) + last = i; + } + + { + /* Use syllable() for sort accounting temporarily. */ + unsigned int syllable = info[start].syllable(); + for (unsigned int i = start; i < end; i++) + info[i].syllable() = i - start; + + /* Sit tight, rock 'n roll! */ + hb_stable_sort (info + start, end - start, compare_khmer_order); + /* Find base again */ + base = end; + for (unsigned int i = start; i < end; i++) + if (info[i].khmer_position() == POS_BASE_C) + { + base = i; + break; + } + + /* Note! syllable() is a one-byte field. */ + for (unsigned int i = base; i < end; i++) + if (info[i].syllable() != 255) + { + unsigned int max = i; + unsigned int j = start + info[i].syllable(); + while (j != i) + { + max = MAX (max, j); + unsigned int next = start + info[j].syllable(); + info[j].syllable() = 255; /* So we don't process j later again. */ + j = next; + } + if (i != max) + buffer->merge_clusters (i, max + 1); + } + + /* Put syllable back in. */ + for (unsigned int i = start; i < end; i++) + info[i].syllable() = syllable; + } + + /* Setup masks now */ + + { + hb_mask_t mask; + + /* Post-base */ + mask = khmer_plan->mask_array[BLWF] | khmer_plan->mask_array[ABVF] | khmer_plan->mask_array[PSTF]; + for (unsigned int i = base + 1; i < end; i++) + info[i].mask |= mask; + } + + unsigned int pref_len = 2; + if (khmer_plan->mask_array[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++) { + hb_codepoint_t glyphs[2]; + for (unsigned int j = 0; j < pref_len; j++) + glyphs[j] = info[i + j].codepoint; + if (khmer_plan->pref.would_substitute (glyphs, pref_len, face)) + { + for (unsigned int j = 0; j < pref_len; j++) + info[i++].mask |= khmer_plan->mask_array[PREF]; + + /* Mark the subsequent stuff with 'cfar'. Used in Khmer. + * Read the feature spec. + * This allows distinguishing the following cases with MS Khmer fonts: + * 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]) + for (; i < end; i++) + info[i].mask |= khmer_plan->mask_array[CFAR]; + + break; + } + } + } +} + +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) +{ + syllable_type_t syllable_type = (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: + initial_reordering_consonant_syllable (plan, face, buffer, start, end); + break; + + case 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) +{ + /* Note: This loop is extra overhead, but should not be measurable. */ + bool has_broken_syllables = false; + 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) + { + has_broken_syllables = true; + break; + } + if (likely (!has_broken_syllables)) + return; + + + hb_codepoint_t dottedcircle_glyph; + if (!font->get_nominal_glyph (0x25CCu, &dottedcircle_glyph)) + return; + + hb_glyph_info_t dottedcircle = {0}; + dottedcircle.codepoint = 0x25CCu; + set_khmer_properties (dottedcircle); + dottedcircle.codepoint = dottedcircle_glyph; + + buffer->clear_output (); + + buffer->idx = 0; + unsigned int last_syllable = 0; + while (buffer->idx < buffer->len && !buffer->in_error) + { + 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)) + { + last_syllable = syllable; + + hb_glyph_info_t ginfo = dottedcircle; + ginfo.cluster = buffer->cur().cluster; + ginfo.mask = buffer->cur().mask; + ginfo.syllable() = buffer->cur().syllable(); + /* TODO Set glyph_props? */ + + /* Insert dottedcircle after possible Repha. */ + while (buffer->idx < buffer->len && !buffer->in_error && + last_syllable == buffer->cur().syllable() && + buffer->cur().khmer_category() == OT_Repha) + buffer->next_glyph (); + + buffer->output_info (ginfo); + } + else + buffer->next_glyph (); + } + + buffer->swap_buffers (); +} + +static void +initial_reordering (const hb_ot_shape_plan_t *plan, + hb_font_t *font, + hb_buffer_t *buffer) +{ + insert_dotted_circles (plan, font, buffer); + + foreach_syllable (buffer, start, end) + initial_reordering_syllable (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) +{ + const khmer_shape_plan_t *khmer_plan = (const khmer_shape_plan_t *) plan->data; + hb_glyph_info_t *info = buffer->info; + + + /* This function relies heavily on halant glyphs. Lots of ligation + * and possibly multiple substitutions happened prior to this + * phase, and that might have messed up our properties. Recover + * from a particular case of that where we're fairly sure that a + * class of OT_H is desired but has been lost. */ + if (khmer_plan->virama_glyph) + { + unsigned int virama_glyph = khmer_plan->virama_glyph; + for (unsigned int i = start; i < end; i++) + if (info[i].codepoint == virama_glyph && + _hb_glyph_info_ligated (&info[i]) && + _hb_glyph_info_multiplied (&info[i])) + { + /* This will make sure that this glyph passes is_coeng() test. */ + info[i].khmer_category() = OT_H; + _hb_glyph_info_clear_ligated_and_multiplied (&info[i]); + } + } + + + /* 4. Final reordering: + * + * After the localized forms and basic shaping forms GSUB features have been + * applied (see below), the shaping engine performs some final glyph + * reordering before applying all the remaining font features to the entire + * syllable. + */ + + bool try_pref = !!khmer_plan->mask_array[PREF]; + + /* Find base again */ + unsigned int base; + for (base = start; base < end; base++) + if (info[base].khmer_position() >= POS_BASE_C) + { + if (try_pref && base + 1 < end) + { + for (unsigned int i = base + 1; i < end; i++) + if ((info[i].mask & khmer_plan->mask_array[PREF]) != 0) + { + if (!(_hb_glyph_info_substituted (&info[i]) && + _hb_glyph_info_ligated_and_didnt_multiply (&info[i]))) + { + /* Ok, this was a 'pref' candidate but didn't form any. + * Base is around here... */ + base = i; + while (base < end && is_coeng (info[base])) + base++; + info[base].khmer_position() = POS_BASE_C; + + try_pref = false; + } + break; + } + } + + if (start < base && info[base].khmer_position() > POS_BASE_C) + base--; + break; + } + if (base == end && start < base && + is_one_of (info[base - 1], FLAG (OT_ZWJ))) + base--; + if (base < end) + while (start < base && + is_one_of (info[base], (FLAG (OT_N) | FLAG (OT_Coeng)))) + base--; + + + /* o Reorder matras: + * + * If a pre-base matra character had been reordered before applying basic + * features, the glyph can be moved closer to the main consonant based on + * whether half-forms had been formed. Actual position for the matra is + * defined as “after last standalone halant glyph, after initial matra + * position and before the main consonant”. If ZWJ or ZWNJ follow this + * halant, position is moved after it. + */ + + if (start + 1 < end && start < base) /* Otherwise there can't be any pre-base matra characters. */ + { + /* If we lost track of base, alas, position before last thingy. */ + unsigned int new_pos = base == end ? base - 2 : base - 1; + + while (new_pos > start && + !(is_one_of (info[new_pos], (FLAG (OT_M) | FLAG (OT_Coeng))))) + new_pos--; + + /* If we found no Halant we are done. + * Otherwise only proceed if the Halant does + * not belong to the Matra itself! */ + if (is_coeng (info[new_pos]) && + info[new_pos].khmer_position() != POS_PRE_M) + { + /* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */ + if (new_pos + 1 < end && is_joiner (info[new_pos + 1])) + new_pos++; + } + else + new_pos = start; /* No move. */ + + if (start < new_pos && info[new_pos].khmer_position () != POS_PRE_M) + { + /* Now go see if there's actually any matras... */ + for (unsigned int i = new_pos; i > start; i--) + if (info[i - 1].khmer_position () == POS_PRE_M) + { + unsigned int old_pos = i - 1; + if (old_pos < base && base <= new_pos) /* Shouldn't actually happen. */ + base--; + + hb_glyph_info_t tmp = info[old_pos]; + memmove (&info[old_pos], &info[old_pos + 1], (new_pos - old_pos) * sizeof (info[0])); + info[new_pos] = tmp; + + /* Note: this merge_clusters() is intentionally *after* the reordering. + * Indic matra reordering is special and tricky... */ + buffer->merge_clusters (new_pos, MIN (end, base + 1)); + + new_pos--; + } + } else { + for (unsigned int i = start; i < base; i++) + if (info[i].khmer_position () == POS_PRE_M) { + buffer->merge_clusters (i, MIN (end, base + 1)); + break; + } + } + } + + + /* o Reorder pre-base-reordering consonants: + * + * If a pre-base-reordering consonant is found, reorder it according to + * the following rules: + */ + + 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 & khmer_plan->mask_array[PREF]) != 0) + { + /* 1. Only reorder a glyph produced by substitution during application + * of the feature. (Note that a font may shape a Ra consonant with + * the feature generally but block it in certain contexts.) + */ + /* Note: We just check that something got substituted. We don't check that + * the feature actually did it... + * + * Reorder pref only if it ligated. */ + if (_hb_glyph_info_ligated_and_didnt_multiply (&info[i])) + { + /* + * 2. Try to find a target position the same way as for pre-base matra. + * If it is found, reorder pre-base consonant glyph. + * + * 3. If position is not found, reorder immediately before main + * consonant. + */ + + unsigned int new_pos = base; + while (new_pos > start && + !(is_one_of (info[new_pos - 1], FLAG(OT_M) | FLAG (OT_Coeng)))) + new_pos--; + + /* In Khmer coeng model, a H,Ra can go *after* matras. If it goes after a + * split matra, it should be reordered to *before* the left part of such matra. */ + if (new_pos > start && info[new_pos - 1].khmer_category() == OT_M) + { + unsigned int old_pos = i; + for (unsigned int j = base + 1; j < old_pos; j++) + if (info[j].khmer_category() == OT_M) + { + new_pos--; + break; + } + } + + if (new_pos > start && is_coeng (info[new_pos - 1])) + { + /* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */ + if (new_pos < end && is_joiner (info[new_pos])) + new_pos++; + } + + { + unsigned int old_pos = i; + + buffer->merge_clusters (new_pos, old_pos + 1); + hb_glyph_info_t tmp = info[old_pos]; + memmove (&info[new_pos + 1], &info[new_pos], (old_pos - new_pos) * sizeof (info[0])); + info[new_pos] = tmp; + + if (new_pos <= base && base < old_pos) + base++; + } + } + + break; + } + } + + + /* + * Finish off the clusters and go home! + */ + if (hb_options ().uniscribe_bug_compatible) + { + /* Uniscribe merges the entire syllable into a single cluster... Except for Tamil & Sinhala. + * This means, half forms are submerged into the main consonant's cluster. + * This is unnecessary, and makes cursor positioning harder, but that's what + * Uniscribe does. */ + buffer->merge_clusters (start, end); + } +} + + +static void +final_reordering (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); + + HB_BUFFER_DEALLOCATE_VAR (buffer, khmer_category); + HB_BUFFER_DEALLOCATE_VAR (buffer, khmer_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; +} + + +static bool +decompose_khmer (const hb_ot_shape_normalize_context_t *c, + hb_codepoint_t ab, + hb_codepoint_t *a, + hb_codepoint_t *b) +{ + switch (ab) + { + /* + * Decompose split matras that don't have Unicode decompositions. + */ + + /* Khmer */ + case 0x17BEu : *a = 0x17C1u; *b= 0x17BEu; return true; + case 0x17BFu : *a = 0x17C1u; *b= 0x17BFu; return true; + case 0x17C0u : *a = 0x17C1u; *b= 0x17C0u; return true; + case 0x17C4u : *a = 0x17C1u; *b= 0x17C4u; return true; + case 0x17C5u : *a = 0x17C1u; *b= 0x17C5u; return true; + } + + return (bool) c->unicode->decompose (ab, a, b); +} + +static bool +compose_khmer (const hb_ot_shape_normalize_context_t *c, + hb_codepoint_t a, + hb_codepoint_t b, + hb_codepoint_t *ab) +{ + /* Avoid recomposing split matras. */ + if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (c->unicode->general_category (a))) + return false; + + return (bool) c->unicode->compose (a, b, ab); +} + + +const hb_ot_complex_shaper_t _hb_ot_complex_shaper_khmer = +{ + collect_features_khmer, + override_features_khmer, + data_create_khmer, + data_destroy_khmer, + nullptr, /* preprocess_text */ + nullptr, /* postprocess_glyphs */ + HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, + decompose_khmer, + compose_khmer, + setup_masks_khmer, + nullptr, /* disable_otl */ + nullptr, /* reorder_marks */ + HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, + false, /* fallback_position */ +}; diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-private.hh b/gfx/harfbuzz/src/hb-ot-shape-complex-private.hh index fb2f61157a2b..08b6fe9697d5 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-private.hh +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-private.hh @@ -54,9 +54,10 @@ enum hb_ot_shape_zero_width_marks_type_t { HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \ HB_COMPLEX_SHAPER_IMPLEMENT (hangul) \ HB_COMPLEX_SHAPER_IMPLEMENT (hebrew) \ - HB_COMPLEX_SHAPER_IMPLEMENT (myanmar_old) \ HB_COMPLEX_SHAPER_IMPLEMENT (indic) \ + HB_COMPLEX_SHAPER_IMPLEMENT (khmer) \ HB_COMPLEX_SHAPER_IMPLEMENT (myanmar) \ + HB_COMPLEX_SHAPER_IMPLEMENT (myanmar_old) \ HB_COMPLEX_SHAPER_IMPLEMENT (thai) \ HB_COMPLEX_SHAPER_IMPLEMENT (tibetan) \ HB_COMPLEX_SHAPER_IMPLEMENT (use) \ @@ -285,7 +286,7 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner) planner->map.language_index[0], HB_TAG ('p','r','e','f'), nullptr)) - return &_hb_ot_complex_shaper_indic; + return &_hb_ot_complex_shaper_khmer; else return &_hb_ot_complex_shaper_default; diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-use-machine.hh b/gfx/harfbuzz/src/hb-ot-shape-complex-use-machine.hh index 4f6727186ded..e767865bc4b2 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-use-machine.hh +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-use-machine.hh @@ -36,271 +36,288 @@ #line 38 "hb-ot-shape-complex-use-machine.hh" static const unsigned char _use_syllable_machine_trans_keys[] = { - 1u, 1u, 0u, 43u, 21u, 21u, 8u, 39u, 8u, 39u, 1u, 1u, 8u, 39u, 8u, 39u, - 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, + 1u, 1u, 12u, 12u, 1u, 15u, 1u, 15u, 1u, 1u, 12u, 12u, 0u, 43u, 21u, 21u, + 8u, 39u, 8u, 39u, 1u, 15u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, + 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, + 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 13u, 21u, 4u, 4u, 13u, 13u, + 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, - 13u, 21u, 4u, 4u, 13u, 13u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, - 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, - 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 1u, 1u, 1u, 39u, 8u, 39u, - 21u, 42u, 41u, 42u, 42u, 42u, 1u, 5u, 0 + 8u, 39u, 8u, 39u, 1u, 15u, 12u, 12u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u, + 42u, 42u, 1u, 5u, 0 }; static const char _use_syllable_machine_key_spans[] = { - 1, 44, 1, 32, 32, 1, 32, 32, - 32, 19, 19, 19, 32, 32, 32, 32, + 1, 1, 15, 15, 1, 1, 44, 1, + 32, 32, 15, 32, 32, 32, 19, 19, + 19, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 9, 1, 1, + 32, 32, 32, 32, 19, 19, 19, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 9, 1, 1, 32, 32, 32, 32, 19, - 19, 19, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 1, 39, 32, - 22, 2, 1, 5 + 32, 32, 15, 1, 39, 32, 22, 2, + 1, 5 }; static const short _use_syllable_machine_index_offsets[] = { - 0, 2, 47, 49, 82, 115, 117, 150, - 183, 216, 236, 256, 276, 309, 342, 375, - 408, 441, 474, 507, 540, 573, 606, 639, - 672, 682, 684, 686, 719, 752, 785, 818, - 838, 858, 878, 911, 944, 977, 1010, 1043, - 1076, 1109, 1142, 1175, 1208, 1241, 1243, 1283, - 1316, 1339, 1342, 1344 + 0, 2, 4, 20, 36, 38, 40, 85, + 87, 120, 153, 169, 202, 235, 268, 288, + 308, 328, 361, 394, 427, 460, 493, 526, + 559, 592, 625, 658, 691, 724, 734, 736, + 738, 771, 804, 837, 870, 890, 910, 930, + 963, 996, 1029, 1062, 1095, 1128, 1161, 1194, + 1227, 1260, 1293, 1309, 1311, 1351, 1384, 1407, + 1410, 1412 }; static const char _use_syllable_machine_indicies[] = { - 1, 0, 2, 3, 4, 2, 5, 3, - 4, 4, 6, 4, 4, 1, 7, 4, - 4, 4, 2, 2, 8, 9, 4, 4, - 10, 11, 12, 13, 14, 15, 16, 10, - 17, 18, 19, 20, 21, 22, 4, 23, - 24, 25, 4, 4, 4, 26, 4, 28, - 27, 30, 29, 29, 31, 32, 29, 29, - 29, 29, 29, 29, 29, 29, 33, 34, - 35, 36, 37, 38, 39, 40, 34, 41, - 33, 42, 43, 44, 45, 29, 46, 47, - 48, 29, 30, 29, 29, 31, 32, 29, - 29, 29, 29, 29, 29, 29, 29, 49, - 34, 35, 36, 37, 38, 39, 40, 34, - 41, 42, 42, 43, 44, 45, 29, 46, - 47, 48, 29, 31, 50, 30, 29, 29, - 31, 32, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 34, 35, 36, 37, 38, - 39, 40, 34, 41, 42, 42, 43, 44, - 45, 29, 46, 47, 48, 29, 30, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 34, 35, 36, 37, - 38, 29, 29, 29, 29, 29, 29, 43, - 44, 45, 29, 46, 47, 48, 29, 30, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 35, 36, - 37, 38, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 46, 47, 48, 29, - 30, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 36, 37, 38, 29, 30, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 37, 38, 29, - 30, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 38, 29, 30, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 36, 37, 38, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 46, 47, 48, 29, 30, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 36, 37, 38, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 47, 48, 29, 30, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 36, 37, - 38, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 48, 29, 30, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 35, 36, - 37, 38, 29, 29, 29, 29, 29, 29, - 43, 44, 45, 29, 46, 47, 48, 29, - 30, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 35, - 36, 37, 38, 29, 29, 29, 29, 29, - 29, 29, 44, 45, 29, 46, 47, 48, - 29, 30, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 35, 36, 37, 38, 29, 29, 29, 29, - 29, 29, 29, 29, 45, 29, 46, 47, - 48, 29, 30, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 34, 35, 36, 37, 38, 29, 40, 34, - 29, 29, 29, 43, 44, 45, 29, 46, - 47, 48, 29, 30, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 34, 35, 36, 37, 38, 29, 51, - 34, 29, 29, 29, 43, 44, 45, 29, - 46, 47, 48, 29, 30, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 34, 35, 36, 37, 38, 29, - 29, 34, 29, 29, 29, 43, 44, 45, - 29, 46, 47, 48, 29, 30, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 34, 35, 36, 37, 38, - 39, 40, 34, 29, 29, 29, 43, 44, - 45, 29, 46, 47, 48, 29, 30, 29, - 29, 31, 32, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 34, 35, 36, 37, - 38, 39, 40, 34, 41, 29, 42, 43, - 44, 45, 29, 46, 47, 48, 29, 30, - 29, 29, 31, 32, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 34, 35, 36, - 37, 38, 39, 40, 34, 41, 33, 42, - 43, 44, 45, 29, 46, 47, 48, 29, - 53, 52, 52, 52, 52, 52, 52, 52, - 54, 52, 5, 55, 53, 52, 6, 56, - 56, 1, 57, 56, 56, 56, 56, 56, - 56, 56, 56, 58, 10, 11, 12, 13, - 14, 15, 16, 10, 17, 19, 19, 20, - 21, 22, 56, 23, 24, 25, 56, 6, - 56, 56, 1, 57, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 10, 11, 12, - 13, 14, 15, 16, 10, 17, 19, 19, - 20, 21, 22, 56, 23, 24, 25, 56, - 6, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 10, 11, - 12, 13, 14, 56, 56, 56, 56, 56, - 56, 20, 21, 22, 56, 23, 24, 25, - 56, 6, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 11, 12, 13, 14, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 23, 24, - 25, 56, 6, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 12, 13, 14, 56, 6, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 13, - 14, 56, 6, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 14, 56, 6, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 12, 13, - 14, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 23, 24, 25, 56, 6, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 12, - 13, 14, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 24, 25, 56, - 6, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 12, 13, 14, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 25, - 56, 6, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 11, 12, 13, 14, 56, 56, 56, 56, - 56, 56, 20, 21, 22, 56, 23, 24, - 25, 56, 6, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 11, 12, 13, 14, 56, 56, 56, - 56, 56, 56, 56, 21, 22, 56, 23, - 24, 25, 56, 6, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 11, 12, 13, 14, 56, 56, - 56, 56, 56, 56, 56, 56, 22, 56, - 23, 24, 25, 56, 6, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 10, 11, 12, 13, 14, 56, - 16, 10, 56, 56, 56, 20, 21, 22, - 56, 23, 24, 25, 56, 6, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 10, 11, 12, 13, 14, - 56, 59, 10, 56, 56, 56, 20, 21, - 22, 56, 23, 24, 25, 56, 6, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 10, 11, 12, 13, - 14, 56, 56, 10, 56, 56, 56, 20, - 21, 22, 56, 23, 24, 25, 56, 6, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 10, 11, 12, - 13, 14, 15, 16, 10, 56, 56, 56, - 20, 21, 22, 56, 23, 24, 25, 56, - 6, 56, 56, 1, 57, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 10, 11, - 12, 13, 14, 15, 16, 10, 17, 56, - 19, 20, 21, 22, 56, 23, 24, 25, - 56, 1, 60, 3, 56, 56, 56, 3, - 56, 56, 6, 56, 56, 1, 57, 56, - 56, 56, 56, 56, 56, 56, 56, 56, - 10, 11, 12, 13, 14, 15, 16, 10, - 17, 18, 19, 20, 21, 22, 56, 23, - 24, 25, 56, 6, 56, 56, 1, 57, - 56, 56, 56, 56, 56, 56, 56, 56, - 56, 10, 11, 12, 13, 14, 15, 16, - 10, 17, 18, 19, 20, 21, 22, 56, - 23, 24, 25, 56, 62, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, - 62, 63, 61, 62, 63, 61, 63, 61, - 3, 60, 60, 60, 3, 60, 0 + 1, 0, 3, 2, 1, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 4, 2, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 5, 0, 8, 7, + 9, 10, 11, 9, 12, 10, 11, 11, + 13, 11, 11, 5, 14, 11, 11, 15, + 9, 9, 16, 17, 11, 11, 18, 19, + 20, 21, 22, 23, 24, 18, 25, 26, + 27, 28, 29, 30, 11, 31, 32, 33, + 11, 11, 11, 34, 11, 36, 35, 38, + 37, 37, 1, 39, 37, 37, 40, 37, + 37, 37, 37, 37, 41, 42, 43, 44, + 45, 46, 47, 48, 42, 49, 41, 50, + 51, 52, 53, 37, 54, 55, 56, 37, + 38, 37, 37, 1, 39, 37, 37, 40, + 37, 37, 37, 37, 37, 57, 42, 43, + 44, 45, 46, 47, 48, 42, 49, 50, + 50, 51, 52, 53, 37, 54, 55, 56, + 37, 1, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 4, + 58, 38, 37, 37, 1, 39, 37, 37, + 40, 37, 37, 37, 37, 37, 37, 42, + 43, 44, 45, 46, 47, 48, 42, 49, + 50, 50, 51, 52, 53, 37, 54, 55, + 56, 37, 38, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 42, 43, 44, 45, 46, 37, 37, 37, + 37, 37, 37, 51, 52, 53, 37, 54, + 55, 56, 37, 38, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 43, 44, 45, 46, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 54, 55, 56, 37, 38, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 44, 45, 46, 37, + 38, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 45, 46, 37, 38, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 46, 37, + 38, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 44, 45, 46, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 54, 55, 56, + 37, 38, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 44, 45, 46, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 55, + 56, 37, 38, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 44, 45, 46, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 56, 37, 38, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 43, 44, 45, 46, 37, 37, + 37, 37, 37, 37, 51, 52, 53, 37, + 54, 55, 56, 37, 38, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 43, 44, 45, 46, 37, + 37, 37, 37, 37, 37, 37, 52, 53, + 37, 54, 55, 56, 37, 38, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 43, 44, 45, 46, + 37, 37, 37, 37, 37, 37, 37, 37, + 53, 37, 54, 55, 56, 37, 38, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 42, 43, 44, 45, + 46, 37, 48, 42, 37, 37, 37, 51, + 52, 53, 37, 54, 55, 56, 37, 38, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 42, 43, 44, + 45, 46, 37, 59, 42, 37, 37, 37, + 51, 52, 53, 37, 54, 55, 56, 37, + 38, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 42, 43, + 44, 45, 46, 37, 37, 42, 37, 37, + 37, 51, 52, 53, 37, 54, 55, 56, + 37, 38, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 42, + 43, 44, 45, 46, 47, 48, 42, 37, + 37, 37, 51, 52, 53, 37, 54, 55, + 56, 37, 38, 37, 37, 1, 39, 37, + 37, 40, 37, 37, 37, 37, 37, 37, + 42, 43, 44, 45, 46, 47, 48, 42, + 49, 37, 50, 51, 52, 53, 37, 54, + 55, 56, 37, 38, 37, 37, 1, 39, + 37, 37, 40, 37, 37, 37, 37, 37, + 37, 42, 43, 44, 45, 46, 47, 48, + 42, 49, 41, 50, 51, 52, 53, 37, + 54, 55, 56, 37, 61, 60, 60, 60, + 60, 60, 60, 60, 62, 60, 12, 63, + 61, 60, 13, 64, 64, 5, 8, 64, + 64, 65, 64, 64, 64, 64, 64, 66, + 18, 19, 20, 21, 22, 23, 24, 18, + 25, 27, 27, 28, 29, 30, 64, 31, + 32, 33, 64, 13, 64, 64, 5, 8, + 64, 64, 65, 64, 64, 64, 64, 64, + 64, 18, 19, 20, 21, 22, 23, 24, + 18, 25, 27, 27, 28, 29, 30, 64, + 31, 32, 33, 64, 13, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 18, 19, 20, 21, 22, 64, + 64, 64, 64, 64, 64, 28, 29, 30, + 64, 31, 32, 33, 64, 13, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 19, 20, 21, 22, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 31, 32, 33, 64, 13, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 20, 21, + 22, 64, 13, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 21, 22, 64, 13, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 22, 64, 13, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 20, 21, 22, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 31, + 32, 33, 64, 13, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 20, 21, 22, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 32, 33, 64, 13, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 20, 21, 22, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 33, 64, 13, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 19, 20, 21, 22, + 64, 64, 64, 64, 64, 64, 28, 29, + 30, 64, 31, 32, 33, 64, 13, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 19, 20, 21, + 22, 64, 64, 64, 64, 64, 64, 64, + 29, 30, 64, 31, 32, 33, 64, 13, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 19, 20, + 21, 22, 64, 64, 64, 64, 64, 64, + 64, 64, 30, 64, 31, 32, 33, 64, + 13, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 18, 19, + 20, 21, 22, 64, 24, 18, 64, 64, + 64, 28, 29, 30, 64, 31, 32, 33, + 64, 13, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 18, + 19, 20, 21, 22, 64, 67, 18, 64, + 64, 64, 28, 29, 30, 64, 31, 32, + 33, 64, 13, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 18, 19, 20, 21, 22, 64, 64, 18, + 64, 64, 64, 28, 29, 30, 64, 31, + 32, 33, 64, 13, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 18, 19, 20, 21, 22, 23, 24, + 18, 64, 64, 64, 28, 29, 30, 64, + 31, 32, 33, 64, 13, 64, 64, 5, + 8, 64, 64, 65, 64, 64, 64, 64, + 64, 64, 18, 19, 20, 21, 22, 23, + 24, 18, 25, 64, 27, 28, 29, 30, + 64, 31, 32, 33, 64, 5, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 6, 68, 8, 68, 10, + 64, 64, 64, 10, 64, 64, 13, 64, + 64, 5, 8, 64, 64, 65, 64, 64, + 64, 64, 64, 64, 18, 19, 20, 21, + 22, 23, 24, 18, 25, 26, 27, 28, + 29, 30, 64, 31, 32, 33, 64, 13, + 64, 64, 5, 8, 64, 64, 65, 64, + 64, 64, 64, 64, 64, 18, 19, 20, + 21, 22, 23, 24, 18, 25, 26, 27, + 28, 29, 30, 64, 31, 32, 33, 64, + 70, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 70, 71, 69, 70, + 71, 69, 71, 69, 10, 68, 68, 68, + 10, 68, 0 }; static const char _use_syllable_machine_trans_targs[] = { - 1, 27, 2, 3, 1, 24, 1, 45, - 46, 48, 29, 30, 31, 32, 33, 40, - 41, 43, 47, 44, 37, 38, 39, 34, - 35, 36, 51, 1, 1, 1, 1, 4, - 5, 23, 7, 8, 9, 10, 11, 18, - 19, 21, 22, 15, 16, 17, 12, 13, - 14, 6, 1, 20, 1, 25, 26, 1, - 1, 0, 28, 42, 1, 1, 49, 50 + 6, 9, 6, 2, 0, 32, 4, 6, + 3, 7, 8, 6, 29, 6, 50, 51, + 52, 54, 34, 35, 36, 37, 38, 45, + 46, 48, 53, 49, 42, 43, 44, 39, + 40, 41, 57, 6, 6, 6, 6, 10, + 1, 28, 12, 13, 14, 15, 16, 23, + 24, 26, 27, 20, 21, 22, 17, 18, + 19, 11, 6, 25, 6, 30, 31, 6, + 6, 5, 33, 47, 6, 6, 55, 56 }; static const char _use_syllable_machine_trans_actions[] = { - 1, 2, 0, 0, 5, 0, 6, 0, - 2, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 2, 0, 0, 0, 0, - 0, 0, 0, 7, 8, 9, 10, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 11, 0, 12, 0, 0, 13, - 14, 0, 2, 0, 15, 16, 0, 0 + 1, 2, 3, 0, 0, 4, 0, 5, + 0, 0, 2, 8, 0, 9, 10, 10, + 4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 4, 0, 0, 0, 0, + 0, 0, 0, 11, 12, 13, 14, 15, + 0, 2, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, 0, 0, + 0, 2, 16, 0, 17, 0, 0, 18, + 19, 0, 4, 0, 20, 21, 0, 0 }; static const char _use_syllable_machine_to_state_actions[] = { - 0, 3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 6, 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 }; static const char _use_syllable_machine_from_state_actions[] = { - 0, 4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 7, 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 }; static const short _use_syllable_machine_eof_trans[] = { - 1, 0, 28, 30, 30, 51, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, - 53, 56, 53, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 61, 57, 57, - 62, 62, 62, 61 + 1, 3, 3, 1, 1, 8, 0, 36, + 38, 38, 59, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 61, 64, 61, + 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 69, 69, 65, 65, 70, 70, + 70, 69 }; -static const int use_syllable_machine_start = 1; -static const int use_syllable_machine_first_final = 1; +static const int use_syllable_machine_start = 6; +static const int use_syllable_machine_first_final = 6; static const int use_syllable_machine_error = -1; -static const int use_syllable_machine_en_main = 1; +static const int use_syllable_machine_en_main = 6; #line 38 "hb-ot-shape-complex-use-machine.rl" -#line 140 "hb-ot-shape-complex-use-machine.rl" +#line 141 "hb-ot-shape-complex-use-machine.rl" #define found_syllable(syllable_type) \ @@ -320,7 +337,7 @@ find_syllables (hb_buffer_t *buffer) int cs; hb_glyph_info_t *info = buffer->info; -#line 324 "hb-ot-shape-complex-use-machine.hh" +#line 341 "hb-ot-shape-complex-use-machine.hh" { cs = use_syllable_machine_start; ts = 0; @@ -328,7 +345,7 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 161 "hb-ot-shape-complex-use-machine.rl" +#line 162 "hb-ot-shape-complex-use-machine.rl" p = 0; @@ -337,7 +354,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int last = 0; unsigned int syllable_serial = 1; -#line 341 "hb-ot-shape-complex-use-machine.hh" +#line 358 "hb-ot-shape-complex-use-machine.hh" { int _slen; int _trans; @@ -347,11 +364,11 @@ find_syllables (hb_buffer_t *buffer) goto _test_eof; _resume: switch ( _use_syllable_machine_from_state_actions[cs] ) { - case 4: + case 7: #line 1 "NONE" {ts = p;} break; -#line 355 "hb-ot-shape-complex-use-machine.hh" +#line 372 "hb-ot-shape-complex-use-machine.hh" } _keys = _use_syllable_machine_trans_keys + (cs<<1); @@ -369,72 +386,114 @@ _eof_trans: goto _again; switch ( _use_syllable_machine_trans_actions[_trans] ) { - case 2: -#line 1 "NONE" - {te = p+1;} - break; - case 8: -#line 129 "hb-ot-shape-complex-use-machine.rl" + case 12: +#line 130 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (independent_cluster); }} break; - case 10: -#line 131 "hb-ot-shape-complex-use-machine.rl" + case 14: +#line 132 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (standard_cluster); }} break; - case 6: -#line 135 "hb-ot-shape-complex-use-machine.rl" + case 9: +#line 136 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (broken_cluster); }} break; - case 5: -#line 136 "hb-ot-shape-complex-use-machine.rl" + case 8: +#line 137 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (non_cluster); }} break; - case 7: -#line 129 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (independent_cluster); }} - break; case 11: #line 130 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (virama_terminated_cluster); }} + {te = p;p--;{ found_syllable (independent_cluster); }} break; - case 9: + case 16: #line 131 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (standard_cluster); }} + {te = p;p--;{ found_syllable (virama_terminated_cluster); }} break; case 13: #line 132 "hb-ot-shape-complex-use-machine.rl" + {te = p;p--;{ found_syllable (standard_cluster); }} + break; + case 18: +#line 133 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (number_joiner_terminated_cluster); }} break; - case 12: -#line 133 "hb-ot-shape-complex-use-machine.rl" + case 17: +#line 134 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (numeral_cluster); }} break; - case 16: -#line 134 "hb-ot-shape-complex-use-machine.rl" + case 21: +#line 135 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (symbol_cluster); }} break; - case 14: -#line 135 "hb-ot-shape-complex-use-machine.rl" + case 19: +#line 136 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (broken_cluster); }} break; - case 15: -#line 136 "hb-ot-shape-complex-use-machine.rl" + case 20: +#line 137 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (non_cluster); }} break; - case 1: -#line 135 "hb-ot-shape-complex-use-machine.rl" + case 3: +#line 132 "hb-ot-shape-complex-use-machine.rl" + {{p = ((te))-1;}{ found_syllable (standard_cluster); }} + break; + case 5: +#line 136 "hb-ot-shape-complex-use-machine.rl" {{p = ((te))-1;}{ found_syllable (broken_cluster); }} break; -#line 429 "hb-ot-shape-complex-use-machine.hh" + case 1: +#line 1 "NONE" + { switch( act ) { + case 2: + {{p = ((te))-1;} found_syllable (virama_terminated_cluster); } + break; + case 3: + {{p = ((te))-1;} found_syllable (standard_cluster); } + break; + case 7: + {{p = ((te))-1;} found_syllable (broken_cluster); } + break; + case 8: + {{p = ((te))-1;} found_syllable (non_cluster); } + break; + } + } + break; + case 15: +#line 1 "NONE" + {te = p+1;} +#line 131 "hb-ot-shape-complex-use-machine.rl" + {act = 2;} + break; + case 2: +#line 1 "NONE" + {te = p+1;} +#line 132 "hb-ot-shape-complex-use-machine.rl" + {act = 3;} + break; + case 4: +#line 1 "NONE" + {te = p+1;} +#line 136 "hb-ot-shape-complex-use-machine.rl" + {act = 7;} + break; + case 10: +#line 1 "NONE" + {te = p+1;} +#line 137 "hb-ot-shape-complex-use-machine.rl" + {act = 8;} + break; +#line 488 "hb-ot-shape-complex-use-machine.hh" } _again: switch ( _use_syllable_machine_to_state_actions[cs] ) { - case 3: + case 6: #line 1 "NONE" {ts = 0;} break; -#line 438 "hb-ot-shape-complex-use-machine.hh" +#line 497 "hb-ot-shape-complex-use-machine.hh" } if ( ++p != pe ) @@ -450,7 +509,7 @@ _again: } -#line 170 "hb-ot-shape-complex-use-machine.rl" +#line 171 "hb-ot-shape-complex-use-machine.rl" } diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-use-machine.rl b/gfx/harfbuzz/src/hb-ot-shape-complex-use-machine.rl index 86cd8b25fb68..89b776390b79 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-use-machine.rl +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-use-machine.rl @@ -89,7 +89,8 @@ SMBlw = 42; # SYM_MOD_BELOW CS = 43; # CONS_WITH_STACKER -consonant_modifiers = CMAbv* CMBlw* ((H B | SUB) VS? CMAbv? CMBlw*)*; +# Override: Adjoc ZWJ placement. https://github.com/harfbuzz/harfbuzz/issues/542#issuecomment-353169729 +consonant_modifiers = CMAbv* CMBlw* ((ZWJ?.H.ZWJ? B | SUB) VS? CMAbv? CMBlw*)*; # Override: Allow two MBlw. https://github.com/harfbuzz/harfbuzz/issues/376 medial_consonants = MPre? MAbv? MBlw?.MBlw? MPst?; dependent_vowels = VPre* VAbv* VBlw* VPst*; diff --git a/gfx/harfbuzz/src/hb-ot-shape-complex-use-table.cc b/gfx/harfbuzz/src/hb-ot-shape-complex-use-table.cc index fd6978f281e0..a67ef061122b 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-complex-use-table.cc +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-use-table.cc @@ -75,7 +75,13 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 00C0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, /* 00D0 */ O, O, O, O, O, O, O, GB, -#define use_offset_0x0900u 80 +#define use_offset_0x0348u 80 + + + /* Combining Diacritical Marks */ + O, O, O, O, O, O, O, CGJ, + +#define use_offset_0x0900u 88 /* Devanagari */ @@ -188,7 +194,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0DE0 */ O, O, O, O, O, O, B, B, B, B, B, B, B, B, B, B, /* 0DF0 */ O, O, VPst, VPst, O, O, O, O, -#define use_offset_0x1000u 1352 +#define use_offset_0x1000u 1360 /* Myanmar */ @@ -204,7 +210,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1080 */ B, B, MBlw, VPst, VPre, VAbv, VAbv, VMPst, VMPst, VMPst, VMPst, VMPst, VMPst, VMBlw, B, VMPst, /* 1090 */ B, B, B, B, B, B, B, B, B, B, VMPst, VMPst, VPst, VAbv, O, O, -#define use_offset_0x1700u 1512 +#define use_offset_0x1700u 1520 /* Tagalog */ @@ -237,7 +243,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 17D0 */ FM, VAbv, H, FM, O, O, O, O, O, O, O, O, B, VAbv, O, O, /* 17E0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x1900u 1752 +#define use_offset_0x1900u 1760 /* Limbu */ @@ -281,7 +287,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1A80 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, /* 1A90 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x1b00u 2168 +#define use_offset_0x1b00u 2176 /* Balinese */ @@ -307,7 +313,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1BC0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1BD0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1BE0 */ B, B, B, B, B, B, CMAbv, VPst, VAbv, VAbv, VPst, VPst, VPst, VAbv, VPst, VAbv, - /* 1BF0 */ FAbv, FAbv, VPst, VPst, O, O, O, O, O, O, O, O, O, O, O, O, + /* 1BF0 */ FAbv, FAbv, CMBlw, CMBlw, O, O, O, O, O, O, O, O, O, O, O, O, /* Lepcha */ @@ -317,7 +323,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1C30 */ FAbv, FAbv, FAbv, FAbv, VMPre, VMPre, FM, CMBlw, O, O, O, O, O, O, O, O, /* 1C40 */ B, B, B, B, B, B, B, B, B, B, O, O, O, B, B, B, -#define use_offset_0x1cd0u 2504 +#define use_offset_0x1cd0u 2512 /* Vedic Extensions */ @@ -326,20 +332,20 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1CE0 */ VMAbv, VMPst, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, O, O, O, O, VMBlw, O, O, /* 1CF0 */ O, O, VMPst, VMPst, VMAbv, O, O, VMPst, VMAbv, VMAbv, O, O, O, O, O, O, -#define use_offset_0x1df8u 2552 +#define use_offset_0x1df8u 2560 /* Combining Diacritical Marks Supplement */ O, O, O, FM, O, O, O, O, -#define use_offset_0x2008u 2560 +#define use_offset_0x2008u 2568 /* General Punctuation */ O, O, O, O, ZWNJ, ZWJ, O, O, /* 2010 */ GB, GB, GB, GB, GB, O, O, O, -#define use_offset_0x2060u 2576 +#define use_offset_0x2060u 2584 /* 2060 */ WJ, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, @@ -348,14 +354,20 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 2070 */ O, O, O, O, FM, O, O, O, O, O, O, O, O, O, O, O, /* 2080 */ O, O, FM, FM, FM, O, O, O, -#define use_offset_0x20f0u 2616 +#define use_offset_0x20f0u 2624 /* Combining Diacritical Marks for Symbols */ /* 20F0 */ VMAbv, O, O, O, O, O, O, O, -#define use_offset_0xa800u 2624 +#define use_offset_0x25c8u 2632 + + + /* Geometric Shapes */ + O, O, O, O, GB, O, O, O, + +#define use_offset_0xa800u 2640 /* Syloti Nagri */ @@ -442,7 +454,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* AAE0 */ B, B, B, B, B, B, B, B, B, B, B, VPre, VBlw, VAbv, VPre, VPst, /* AAF0 */ O, O, O, O, O, VMPst, H, O, -#define use_offset_0xabc0u 3384 +#define use_offset_0xabc0u 3400 /* Meetei Mayek */ @@ -452,14 +464,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* ABE0 */ B, B, B, VPst, VPst, VAbv, VPst, VPst, VBlw, VPst, VPst, O, VMPst, VBlw, O, O, /* ABF0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0xfe00u 3448 +#define use_offset_0xfe00u 3464 /* Variation Selectors */ /* FE00 */ VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, -#define use_offset_0x10a00u 3464 +#define use_offset_0x10a00u 3480 /* Kharoshthi */ @@ -470,7 +482,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 10A30 */ B, B, B, B, O, O, O, O, CMAbv, CMBlw, CMBlw, O, O, O, O, H, /* 10A40 */ B, B, B, B, B, B, B, B, -#define use_offset_0x11000u 3536 +#define use_offset_0x11000u 3552 /* Brahmi */ @@ -482,7 +494,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11040 */ VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, H, O, O, O, O, O, O, O, O, O, /* 11050 */ O, O, N, N, N, N, N, N, N, N, N, N, N, N, N, N, /* 11060 */ N, N, N, N, N, N, B, B, B, B, B, B, B, B, B, B, - /* 11070 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, + /* 11070 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, HN, /* Kaithi */ @@ -491,7 +503,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 110A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 110B0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VPst, VPst, H, CMBlw, O, O, O, O, O, -#define use_offset_0x11100u 3728 +#define use_offset_0x11100u 3744 /* Chakma */ @@ -529,7 +541,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11220 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VBlw, /* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv, O, O, O, O, O, O, VMAbv, O, -#define use_offset_0x11280u 4048 +#define use_offset_0x11280u 4064 /* Multani */ @@ -557,7 +569,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11360 */ B, B, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, /* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, -#define use_offset_0x11400u 4296 +#define use_offset_0x11400u 4312 /* Newa */ @@ -580,7 +592,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 114C0 */ VMAbv, VMPst, H, CMBlw, B, O, O, O, O, O, O, O, O, O, O, O, /* 114D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x11580u 4520 +#define use_offset_0x11580u 4536 /* Siddham */ @@ -623,7 +635,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11720 */ VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VBlw, VAbv, VAbv, VAbv, O, O, O, O, /* 11730 */ B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, -#define use_offset_0x11a00u 4968 +#define use_offset_0x11a00u 4984 /* Zanabazar Square */ @@ -642,7 +654,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11A80 */ B, B, B, B, O, O, R, R, R, R, FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, /* 11A90 */ FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, VMAbv, VMPst, CMAbv, H, O, O, O, O, O, O, -#define use_offset_0x11c00u 5128 +#define use_offset_0x11c00u 5144 /* Bhaiksuki */ @@ -663,7 +675,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11CA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, /* 11CB0 */ VBlw, VPre, VBlw, VAbv, VPst, VMAbv, VMAbv, O, -#define use_offset_0x11d00u 5312 +#define use_offset_0x11d00u 5328 /* Masaram Gondi */ @@ -675,7 +687,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11D40 */ VMAbv, VMAbv, CMBlw, VAbv, VBlw, H, R, MBlw, O, O, O, O, O, O, O, O, /* 11D50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -}; /* Table items: 5408; occupancy: 73% */ +}; /* Table items: 5424; occupancy: 73% */ USE_TABLE_ELEMENT_TYPE hb_use_get_categories (hb_codepoint_t u) @@ -685,8 +697,8 @@ hb_use_get_categories (hb_codepoint_t u) case 0x0u: if (hb_in_range (u, 0x0028u, 0x003Fu)) return use_table[u - 0x0028u + use_offset_0x0028u]; if (hb_in_range (u, 0x00A0u, 0x00D7u)) return use_table[u - 0x00A0u + use_offset_0x00a0u]; + if (hb_in_range (u, 0x0348u, 0x034Fu)) return use_table[u - 0x0348u + use_offset_0x0348u]; if (hb_in_range (u, 0x0900u, 0x0DF7u)) return use_table[u - 0x0900u + use_offset_0x0900u]; - if (unlikely (u == 0x034Fu)) return CGJ; break; case 0x1u: @@ -702,7 +714,7 @@ hb_use_get_categories (hb_codepoint_t u) if (hb_in_range (u, 0x2008u, 0x2017u)) return use_table[u - 0x2008u + use_offset_0x2008u]; if (hb_in_range (u, 0x2060u, 0x2087u)) return use_table[u - 0x2060u + use_offset_0x2060u]; if (hb_in_range (u, 0x20F0u, 0x20F7u)) return use_table[u - 0x20F0u + use_offset_0x20f0u]; - if (unlikely (u == 0x25CCu)) return GB; + if (hb_in_range (u, 0x25C8u, 0x25CFu)) return use_table[u - 0x25C8u + use_offset_0x25c8u]; break; case 0xAu: @@ -727,7 +739,6 @@ hb_use_get_categories (hb_codepoint_t u) if (hb_in_range (u, 0x11A00u, 0x11A9Fu)) return use_table[u - 0x11A00u + use_offset_0x11a00u]; if (hb_in_range (u, 0x11C00u, 0x11CB7u)) return use_table[u - 0x11C00u + use_offset_0x11c00u]; if (hb_in_range (u, 0x11D00u, 0x11D5Fu)) return use_table[u - 0x11D00u + use_offset_0x11d00u]; - if (unlikely (u == 0x1107Fu)) return HN; break; default: diff --git a/gfx/harfbuzz/src/hb-ot-shape-fallback.cc b/gfx/harfbuzz/src/hb-ot-shape-fallback.cc index 458c8eaa048d..6b228790af89 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-fallback.cc +++ b/gfx/harfbuzz/src/hb-ot-shape-fallback.cc @@ -442,10 +442,10 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, { if (!plan->has_kern) return; - OT::hb_apply_context_t c (1, font, buffer); + OT::hb_ot_apply_context_t c (1, font, buffer); c.set_lookup_mask (plan->kern_mask); c.set_lookup_props (OT::LookupFlag::IgnoreMarks); - OT::hb_apply_context_t::skipping_iterator_t &skippy_iter = c.iter_input; + OT::hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c.iter_input; skippy_iter.init (&c); unsigned int count = buffer->len; @@ -473,6 +473,7 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, pos[idx].x_advance += kern1; pos[skippy_iter.idx].x_advance += kern2; pos[skippy_iter.idx].x_offset += kern2; + buffer->unsafe_to_break (idx, skippy_iter.idx + 1); } if (y_kern) @@ -482,6 +483,7 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, pos[idx].y_advance += kern1; pos[skippy_iter.idx].y_advance += kern2; pos[skippy_iter.idx].y_offset += kern2; + buffer->unsafe_to_break (idx, skippy_iter.idx + 1); } idx = skippy_iter.idx; diff --git a/gfx/harfbuzz/src/hb-ot-shape-normalize.cc b/gfx/harfbuzz/src/hb-ot-shape-normalize.cc index fd9e7c2a8df4..62cbb9de998f 100644 --- a/gfx/harfbuzz/src/hb-ot-shape-normalize.cc +++ b/gfx/harfbuzz/src/hb-ot-shape-normalize.cc @@ -345,9 +345,8 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, if (_hb_glyph_info_get_modified_combining_class (&buffer->info[end]) == 0) break; - /* We are going to do a O(n^2). Only do this if the sequence is short, - * but not too short ;). */ - if (end - i < 2 || end - i > HB_OT_SHAPE_COMPLEX_MAX_COMBINING_MARKS) { + /* We are going to do a O(n^2). Only do this if the sequence is short. */ + if (end - i > HB_OT_SHAPE_COMPLEX_MAX_COMBINING_MARKS) { i = end; continue; } @@ -373,13 +372,11 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, buffer->clear_output (); count = buffer->len; unsigned int starter = 0; - bool combine = true; buffer->next_glyph (); while (buffer->idx < count && !buffer->in_error) { hb_codepoint_t composed, glyph; - if (combine && - /* We don't try to compose a non-mark character with it's preceding starter. + if (/* We don't try to compose a non-mark character with it's preceding starter. * This is both an optimization to avoid trying to compose every two neighboring * glyphs in most scripts AND a desired feature for Hangul. Apparently Hangul * fonts are not designed to mix-and-match pre-composed syllables and Jamo. */ @@ -410,22 +407,27 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, continue; } - else if (/* We sometimes custom-tailor the sorted order of marks. In that case, stop - * trying to combine as soon as combining-class drops. */ - starter < buffer->out_len - 1 && - info_cc (buffer->prev()) > info_cc (buffer->cur())) - combine = false; } /* Blocked, or doesn't compose. */ buffer->next_glyph (); if (info_cc (buffer->prev()) == 0) - { starter = buffer->out_len - 1; - combine = true; - } } buffer->swap_buffers (); + if (buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_CGJ) + { + /* For all CGJ, check if it prevented any reordering at all. + * If it did NOT, then make it skippable. + * https://github.com/harfbuzz/harfbuzz/issues/554 + */ + for (unsigned int i = 1; i + 1 < buffer->len; i++) + if (buffer->info[i].codepoint == 0x034Fu/*CGJ*/ && + info_cc(buffer->info[i-1]) <= info_cc(buffer->info[i+1])) + { + _hb_glyph_info_unhide (&buffer->info[i]); + } + } } diff --git a/gfx/harfbuzz/src/hb-ot-shape.cc b/gfx/harfbuzz/src/hb-ot-shape.cc index 2f28b5620daa..fc5dd1084d25 100644 --- a/gfx/harfbuzz/src/hb-ot-shape.cc +++ b/gfx/harfbuzz/src/hb-ot-shape.cc @@ -40,6 +40,8 @@ #include "hb-unicode-private.hh" #include "hb-set-private.hh" +#include "hb-ot-layout-gsubgpos-private.hh" +#include "hb-aat-layout-private.hh" static hb_tag_t common_features[] = { HB_TAG('c','c','m','p'), @@ -450,7 +452,8 @@ hb_ot_zero_width_default_ignorables (hb_ot_shape_context_t *c) hb_buffer_t *buffer = c->buffer; if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES) || - (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES)) + (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES) || + (buffer->flags & HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES)) return; unsigned int count = buffer->len; @@ -486,7 +489,8 @@ hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c) return; hb_codepoint_t space; - if (c->font->get_nominal_glyph (' ', &space)) + if (!(buffer->flags & HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES) && + c->font->get_nominal_glyph (' ', &space)) { /* Replace default-ignorables with a zero-advance space glyph. */ for (/*continue*/; i < count; i++) @@ -614,7 +618,8 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c) c->plan->substitute (c->font, buffer); - return; + /* XXX Call morx instead. */ + //hb_aat_layout_substitute (c->font, c->buffer); } static inline void diff --git a/gfx/harfbuzz/src/hb-ot-var-avar-table.hh b/gfx/harfbuzz/src/hb-ot-var-avar-table.hh index 4b88a4030417..e305a67c2610 100644 --- a/gfx/harfbuzz/src/hb-ot-var-avar-table.hh +++ b/gfx/harfbuzz/src/hb-ot-var-avar-table.hh @@ -133,8 +133,8 @@ struct avar protected: FixedVersion<>version; /* Version of the avar table * initially set to 0x00010000u */ - UINT16 reserved; /* This field is permanently reserved. Set to 0. */ - UINT16 axisCount; /* The number of variation axes in the font. This + HBUINT16 reserved; /* This field is permanently reserved. Set to 0. */ + HBUINT16 axisCount; /* The number of variation axes in the font. This * must be the same number as axisCount in the * 'fvar' table. */ SegmentMaps axisSegmentMapsZ; diff --git a/gfx/harfbuzz/src/hb-ot-var-fvar-table.hh b/gfx/harfbuzz/src/hb-ot-var-fvar-table.hh index 2a9357a5e2d1..999b7236f3b5 100644 --- a/gfx/harfbuzz/src/hb-ot-var-fvar-table.hh +++ b/gfx/harfbuzz/src/hb-ot-var-fvar-table.hh @@ -42,11 +42,11 @@ struct InstanceRecord } protected: - UINT16 subfamilyNameID;/* The name ID for entries in the 'name' table + HBUINT16 subfamilyNameID;/* The name ID for entries in the 'name' table * that provide subfamily names for this instance. */ - UINT16 reserved; /* Reserved for future use — set to 0. */ + HBUINT16 reserved; /* Reserved for future use — set to 0. */ Fixed coordinates[VAR];/* The coordinates array for this instance. */ - //UINT16 postScriptNameIDX;/*Optional. The name ID for entries in the 'name' + //HBUINT16 postScriptNameIDX;/*Optional. The name ID for entries in the 'name' // * table that provide PostScript names for this // * instance. */ @@ -67,8 +67,8 @@ struct AxisRecord Fixed minValue; /* The minimum coordinate value for the axis. */ Fixed defaultValue; /* The default coordinate value for the axis. */ Fixed maxValue; /* The maximum coordinate value for the axis. */ - UINT16 reserved; /* Reserved for future use — set to 0. */ - UINT16 axisNameID; /* The name ID for entries in the 'name' table that + HBUINT16 reserved; /* Reserved for future use — set to 0. */ + HBUINT16 axisNameID; /* The name ID for entries in the 'name' table that * provide a display name for this axis. */ public: @@ -188,14 +188,14 @@ struct fvar * initially set to 0x00010000u */ Offset16 things; /* Offset in bytes from the beginning of the table * to the start of the AxisRecord array. */ - UINT16 reserved; /* This field is permanently reserved. Set to 2. */ - UINT16 axisCount; /* The number of variation axes in the font (the + HBUINT16 reserved; /* This field is permanently reserved. Set to 2. */ + HBUINT16 axisCount; /* The number of variation axes in the font (the * number of records in the axes array). */ - UINT16 axisSize; /* The size in bytes of each VariationAxisRecord — + HBUINT16 axisSize; /* The size in bytes of each VariationAxisRecord — * set to 20 (0x0014) for this version. */ - UINT16 instanceCount; /* The number of named instances defined in the font + HBUINT16 instanceCount; /* The number of named instances defined in the font * (the number of records in the instances array). */ - UINT16 instanceSize; /* The size in bytes of each InstanceRecord — set + HBUINT16 instanceSize; /* The size in bytes of each InstanceRecord — set * to either axisCount * sizeof(Fixed) + 4, or to * axisCount * sizeof(Fixed) + 6. */ diff --git a/gfx/harfbuzz/src/hb-ot-var-hvar-table.hh b/gfx/harfbuzz/src/hb-ot-var-hvar-table.hh index fac843a71993..e20131b161ac 100644 --- a/gfx/harfbuzz/src/hb-ot-var-hvar-table.hh +++ b/gfx/harfbuzz/src/hb-ot-var-hvar-table.hh @@ -55,7 +55,7 @@ struct DeltaSetIndexMap unsigned int u = 0; { /* Fetch it. */ unsigned int w = get_width (); - const UINT8 *p = mapData + w * v; + const HBUINT8 *p = mapData + w * v; for (; w; w--) u = (u << 8) + *p++; } @@ -78,10 +78,10 @@ struct DeltaSetIndexMap { return (format & 0xF) + 1; } protected: - UINT16 format; /* A packed field that describes the compressed + HBUINT16 format; /* A packed field that describes the compressed * representation of delta-set indices. */ - UINT16 mapCount; /* The number of mapping entries. */ - UINT8 mapData[VAR]; /* The delta-set index mapping data. */ + HBUINT16 mapCount; /* The number of mapping entries. */ + HBUINT8 mapData[VAR]; /* The delta-set index mapping data. */ public: DEFINE_SIZE_ARRAY (4, mapData); diff --git a/gfx/harfbuzz/src/hb-ot-var-mvar-table.hh b/gfx/harfbuzz/src/hb-ot-var-mvar-table.hh index e17ff5160a6f..e835768521e2 100644 --- a/gfx/harfbuzz/src/hb-ot-var-mvar-table.hh +++ b/gfx/harfbuzz/src/hb-ot-var-mvar-table.hh @@ -43,7 +43,7 @@ struct VariationValueRecord public: Tag valueTag; /* Four-byte tag identifying a font-wide measure. */ - UINT32 varIdx; /* Outer/inner index into VariationStore item. */ + HBUINT32 varIdx; /* Outer/inner index into VariationStore item. */ public: DEFINE_SIZE_STATIC (8); @@ -95,13 +95,13 @@ protected: protected: FixedVersion<>version; /* Version of the metrics variation table * initially set to 0x00010000u */ - UINT16 reserved; /* Not used; set to 0. */ - UINT16 valueRecordSize;/* The size in bytes of each value record — + HBUINT16 reserved; /* Not used; set to 0. */ + HBUINT16 valueRecordSize;/* The size in bytes of each value record — * must be greater than zero. */ - UINT16 valueRecordCount;/* The number of value records — may be zero. */ + HBUINT16 valueRecordCount;/* The number of value records — may be zero. */ OffsetTo varStore; /* Offset to item variation store table. */ - UINT8 values[VAR]; /* Array of value records. The records must be + HBUINT8 values[VAR]; /* Array of value records. The records must be * in binary order of their valueTag field. */ public: diff --git a/gfx/harfbuzz/src/hb-private.hh b/gfx/harfbuzz/src/hb-private.hh index acddd8938108..62c9fb278fce 100644 --- a/gfx/harfbuzz/src/hb-private.hh +++ b/gfx/harfbuzz/src/hb-private.hh @@ -29,6 +29,8 @@ #ifndef HB_PRIVATE_HH #define HB_PRIVATE_HH +#define _GNU_SOURCE 1 + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -40,6 +42,7 @@ #define HB_OT_H_IN #endif +#include #include #include #include @@ -86,8 +89,6 @@ extern "C" void hb_free_impl(void *ptr); #endif // __cplusplus < 201103L -#define _GNU_SOURCE 1 - #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__) #define likely(expr) (__builtin_expect (!!(expr), 1)) #define unlikely(expr) (__builtin_expect (!!(expr), 0)) @@ -297,9 +298,10 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); /* Misc */ -/* Void! */ -struct _hb_void_t {}; -typedef const _hb_void_t *hb_void_t; +/* + * Void! + */ +typedef const struct _hb_void_t *hb_void_t; #define HB_VOID ((const _hb_void_t *) nullptr) /* Return the number of 1 bits in mask. */ diff --git a/gfx/harfbuzz/src/hb-set-private.hh b/gfx/harfbuzz/src/hb-set-private.hh index 9c6f3ee37aa3..576c169e6780 100644 --- a/gfx/harfbuzz/src/hb-set-private.hh +++ b/gfx/harfbuzz/src/hb-set-private.hh @@ -185,6 +185,7 @@ struct hb_set_t inline void init (void) { + in_error = false; page_map.init (); pages.init (); } diff --git a/gfx/harfbuzz/src/hb-uniscribe.cc b/gfx/harfbuzz/src/hb-uniscribe.cc index 0b0bad58dbd5..5e05baa869b5 100644 --- a/gfx/harfbuzz/src/hb-uniscribe.cc +++ b/gfx/harfbuzz/src/hb-uniscribe.cc @@ -351,7 +351,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name) * full, PS. All of them point to the same name data with our unique name. */ - blob = OT::Sanitizer::sanitize (blob); + blob = OT::Sanitizer().sanitize (blob); unsigned int length, new_length, name_str_len; const char *orig_sfnt_data = hb_blob_get_data (blob, &length); diff --git a/gfx/harfbuzz/src/hb-version.h b/gfx/harfbuzz/src/hb-version.h index fc81b66b40ac..f0f5a1814e28 100644 --- a/gfx/harfbuzz/src/hb-version.h +++ b/gfx/harfbuzz/src/hb-version.h @@ -38,9 +38,9 @@ HB_BEGIN_DECLS #define HB_VERSION_MAJOR 1 #define HB_VERSION_MINOR 7 -#define HB_VERSION_MICRO 4 +#define HB_VERSION_MICRO 5 -#define HB_VERSION_STRING "1.7.4" +#define HB_VERSION_STRING "1.7.5" #define HB_VERSION_ATLEAST(major,minor,micro) \ ((major)*10000+(minor)*100+(micro) <= \ diff --git a/gfx/harfbuzz/src/main.cc b/gfx/harfbuzz/src/main.cc index 819100e47e53..72de189d8252 100644 --- a/gfx/harfbuzz/src/main.cc +++ b/gfx/harfbuzz/src/main.cc @@ -24,7 +24,6 @@ * Red Hat Author(s): Behdad Esfahbod */ -#include "hb-mutex-private.hh" #include "hb-open-file-private.hh" #include "hb-ot-layout-gdef-table.hh" #include "hb-ot-layout-gsubgpos-private.hh" diff --git a/gfx/harfbuzz/src/moz.build b/gfx/harfbuzz/src/moz.build index 23b2886d3bf3..1d2dec518b63 100644 --- a/gfx/harfbuzz/src/moz.build +++ b/gfx/harfbuzz/src/moz.build @@ -32,12 +32,14 @@ SOURCES += [ 'hb-ot-math.cc', # conflict with hb-ot-layout.cc 'hb-ot-shape-complex-hangul.cc', # error: redefinition of enumerator 'NONE' 'hb-ot-shape-complex-indic.cc', # error: redefinition of enumerator 'INIT' + 'hb-ot-shape-complex-khmer.cc', # error: redefinition of enumerator 'syllable_type_t' 'hb-ot-shape-complex-use.cc', # error: redefinition of 'basic_features' 'hb-ot-shape.cc', # error: functions that differ only in their return type cannot be overloaded 'hb-shape-plan.cc', # error: redefinition of 'hb_ot_shaper_face_data_ensure' ] UNIFIED_SOURCES += [ + 'hb-aat-layout.cc', 'hb-buffer.cc', 'hb-face.cc', 'hb-font.cc',