diff --git a/.circleci/config.yml b/.circleci/config.yml index a747ec5c2..87d752589 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,13 +28,13 @@ jobs: steps: - checkout - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install wget autoconf automake libtool pkg-config ragel freetype glib cairo icu4c graphite2 - - run: export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig" && ./autogen.sh --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-coretext --with-graphite2 + - run: export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig" && ./autogen.sh --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-coretext --with-graphite2 - run: make -j4 - run: make check || .ci/fail.sh distcheck: docker: - - image: ubuntu:17.10 + - image: ubuntu:19.04 steps: - checkout - run: apt update && apt install -y ninja-build binutils libtool autoconf automake make cmake gcc g++ pkg-config ragel gtk-doc-tools libfontconfig1-dev libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip @@ -203,7 +203,7 @@ jobs: cmake-gcc: docker: - - image: ubuntu:17.10 + - image: ubuntu:19.04 steps: - checkout - run: apt update && apt install -y ninja-build binutils cmake gcc g++ pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip @@ -235,22 +235,13 @@ jobs: - run: CFLAGS="-Wno-attributes" CXXFLAGS="-Wno-attributes" ./autogen.sh --prefix=/usr/local/djgpp --host=i586-pc-msdosdjgpp - run: make -j32 - crosscompile-notest-freebsd9: - docker: - - image: donbowman/freebsd-cross-build - steps: - - checkout - - run: apt update && apt install -y pkg-config ragel - - run: ./autogen.sh --prefix=/freebsd --host=x86_64-pc-freebsd9 - - run: make -j32 - crosscompile-notest-psvita: docker: - image: dockcross/base steps: - checkout - run: git clone https://github.com/vitasdk/vdpm && cd vdpm && ./bootstrap-vitasdk.sh - - run: echo "#""!""/bin/true" > /usr/bin/ragel && chmod +x /usr/bin/ragel + - run: echo '#!/bin/true' > /usr/bin/ragel && chmod +x /usr/bin/ragel - run: ./autogen.sh --prefix=/usr/local/vitasdk/arm-vita-eabi --host=arm-vita-eabi - run: make -j32 @@ -327,7 +318,6 @@ workflows: # they can't be test thus are without tests ## autotools - crosscompile-notest-djgpp - - crosscompile-notest-freebsd9 - crosscompile-notest-psvita ## cmake diff --git a/.editorconfig b/.editorconfig index 499147351..4850f2bf6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,7 +9,7 @@ insert_final_newline = true [*.{c,cc,h,hh}] tab_width = 8 indent_size = 2 -indent_style = space +indent_style = tab # should be space [*.{py,sh}] indent_style = tab diff --git a/AUTHORS b/AUTHORS index 0763761bb..83c0c66f9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,11 +1,14 @@ Behdad Esfahbod +David Corbett David Turner Ebrahim Byagowi +Garret Rieger Jonathan Kew Khaled Hosny Lars Knoll Martin Hosken Owen Taylor +Roderick Sheeter Roozbeh Pournader Simon Hausmann Werner Lemberg diff --git a/CMakeLists.txt b/CMakeLists.txt index f64f96d1c..a8d12c163 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -844,7 +844,7 @@ endif () if (HB_BUILD_TESTS) ## src/ executables - foreach (prog main test test-would-substitute test-size-params test-buffer-serialize hb-ot-tag test-unicode-ranges) + foreach (prog main test test-gsub-would-substitute test-gpos-size-params test-buffer-serialize hb-ot-tag test-unicode-ranges) set (prog_name ${prog}) if (${prog_name} STREQUAL "test") # test can not be used as a valid executable name on cmake, lets special case it diff --git a/COPYING b/COPYING index 9d1056f40..0278e60a5 100644 --- a/COPYING +++ b/COPYING @@ -2,7 +2,8 @@ HarfBuzz is licensed under the so-called "Old MIT" license. Details follow. For parts of HarfBuzz that are licensed under different licenses see individual files names COPYING in subdirectories where applicable. -Copyright © 2010,2011,2012 Google, Inc. +Copyright © 2010,2011,2012,2013,2014,2015,2016,2017,2018,2019 Google, Inc. +Copyright © 2019 Facebook, Inc. Copyright © 2012 Mozilla Foundation Copyright © 2011 Codethink Limited Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies) diff --git a/README.md b/README.md index fd93be84f..ce0a04d1f 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,10 @@ For bug reports, mailing list, and other information please visit: http://harfbuzz.org/ -For license information, see the file COPYING. +For license information, see [COPYING](COPYING). + +For build information, see [BUILD.md](BUILD.md). + +For test execution, see [TESTING.md](TESTING.md). Documentation: https://harfbuzz.github.io diff --git a/TESTING.md b/TESTING.md new file mode 100644 index 000000000..ba9e32f2c --- /dev/null +++ b/TESTING.md @@ -0,0 +1,64 @@ +## Build & Run + +Depending on what area you are working in change or add `HB_DEBUG_`. +Values defined in `hb-debug.hh`. + +```shell +# quick sanity check +time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \ + && (make -j4 -C test/api check || cat test/api/test-suite.log)) + +# slower sanity check +time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \ + && make -j4 -C src check \ + && make -j4 -C test/api check \ + && make -j4 -C test/subset check) + +# confirm you didn't break anything else +time (make -j4 CPPFLAGS='-DHB_DEBUG_SUBSET=100' \ + && make -j4 check) + +# often catches files you didn't add, e.g. test fonts to EXTRA_DIST +make distcheck +``` + +### Run tests with asan + +```shell +./configure CC=clang CXX=clang++ CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address +# make/run tests as usual +``` + +### Debug with GDB + +``` +cd ./util +../libtool --mode=execute gdb --args ./hb-subset ... +``` + +### Enable Debug Logging + +```shell +# make clean if you previously build w/o debug logging +make CPPFLAGS=-DHB_DEBUG_SUBSET=100 +``` + +## Build and Test via CMake + +Note: You'll need to first install ninja-build via apt-get. + +```shell +cd harfbuzz +mkdir buid +cmake -DHB_CHECK=ON -Bbuild -H. -GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test +``` +## Test with the Fuzzer + +```shell +# push your changs to a branch on googlefonts/harfbuzz +# In a local copy of oss-fuzz, edit projects/harfbuzz/Dockerfile +# Change the git clone to pull your branch +sudo python infra/helper.py build_image harfbuzz +sudo python infra/helper.py build_fuzzers --sanitizer address harfbuzz +sudo python infra/helper.py run_fuzzer harfbuzz hb-subset-fuzzer +``` diff --git a/THANKS b/THANKS index 940cfde5c..88cb7e9ea 100644 --- a/THANKS +++ b/THANKS @@ -1,6 +1,6 @@ Bradley Grainger -Khaled Hosny Kenichi Ishibashi +Ivan Kuckir Ryan Lortie Jeff Muizelaar suzuki toshiya diff --git a/configure.ac b/configure.ac index 98e9c32d8..8444e3bf2 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([src/harfbuzz.pc.in]) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([1.13.0 gnits tar-ustar dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability]) +AM_INIT_AUTOMAKE([1.13.0 gnits tar-ustar dist-xz no-dist-gzip -Wall no-define color-tests -Wno-portability]) AM_SILENT_RULES([yes]) AX_CODE_COVERAGE diff --git a/docs/Makefile.am b/docs/Makefile.am index 9b54b40e1..d8da37073 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -33,7 +33,7 @@ SCAN_OPTIONS=--rebuild-types --deprecated-guards="HB_DISABLE_DEPRECATED" \ # Header files or dirs to ignore when scanning. Use base file/dir names # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code -IGNORE_HFILES=`cd $(top_srcdir)/src; find . -path './hb-*/*.h' | sed 's@^.*/@@'` +IGNORE_HFILES=`cd $(top_srcdir)/src; find . -path './*/*.h' | sed 's@^.*/@@'` if HAVE_GOBJECT else IGNORE_HFILES+=hb-gobject.h hb-gobject-enums.h hb-gobject-structs.h @@ -76,6 +76,7 @@ content_files= \ usermanual-install-harfbuzz.xml \ usermanual-getting-started.xml \ usermanual-shaping-concepts.xml \ + usermanual-object-model.xml \ usermanual-buffers-language-script-and-direction.xml \ usermanual-fonts-and-faces.xml \ usermanual-clusters.xml \ diff --git a/docs/harfbuzz-docs.xml b/docs/harfbuzz-docs.xml index f4ad134ea..a0400daeb 100644 --- a/docs/harfbuzz-docs.xml +++ b/docs/harfbuzz-docs.xml @@ -20,11 +20,7 @@ The canonical source-code tree is available at - github.com/harfbuzz/harfbuzz - and is also available at - cgit.freedesktop.org/harfbuzz. + github.com/harfbuzz/harfbuzz. See for release tarballs. @@ -37,6 +33,7 @@ + diff --git a/docs/usermanual-object-model.xml b/docs/usermanual-object-model.xml new file mode 100644 index 000000000..f571c477f --- /dev/null +++ b/docs/usermanual-object-model.xml @@ -0,0 +1,258 @@ + + + +]> + + The HarfBuzz object model +
+ An overview of data types in HarfBuzz + + HarfBuzz features two kinds of data types: non-opaque, + pass-by-value types and opaque, heap-allocated types. This kind + of separation is common in C libraries that have to provide + API/ABI compatibility (almost) indefinitely. + + + Value types: The non-opaque, pass-by-value + types include integer types, enums, and small structs. Exposing + a struct in the public API makes it impossible to expand the + struct in the future. As such, exposing structs is reserved for + cases where it’s extremely inefficient to do otherwise. + + + In HarfBuzz, several structs, like hb_glyph_info_t and + hb_glyph_position_t, fall into that efficiency-sensitive + category and are non-opaque. + + + For all non-opaque structs where future extensibility may be + necessary, reserved members are included to hold space for + possible future members. As such, it’s important to provide + equal(), and hash() + methods for such structs, allowing users of the API do + effectively deal with the type without having to + adapt their code to future changes. + + + Important value types provided by HarfBuzz include the structs + for working with Unicode code points, glyphs, and tags for font + tables and features, as well as the enums for many Unicode and + OpenType properties. + +
+ +
+ Objects in HarfBuzz + + Object types: Opaque struct types are used + for what HarfBuzz loosely calls "objects." This doesn’t have + much to do with the terminology from object-oriented programming + (OOP), although some of the concepts are similar. + + + In HarfBuzz, all object types provide certain + lifecycle-management APIs. Objects are reference-counted, and + constructed with various create() methods, referenced via + reference() and dereferenced using + destroy(). + + + For example, + the hb_buffer_t object has + hb_buffer_create() as its constructor, + hb_buffer_reference() to reference, and + hb_buffer_destroy() to dereference. + + + After construction, each object's properties are accessible only + through the setter and getter functions described in the API + Reference manual. + + + Key object types provided by HarfBuzz include: + + + + + blobs, which act as low-level wrappers around binary + data. Blobs are typically used to hold the contents of a + binary font file. + + + + + faces, which represent typefaces from a + font file, but without specific parameters (such as size) set. + + + + + fonts, which represent instances of a + face with all of their parameters specified. + + + + + buffers, which hold Unicode code points + for characters (before shaping) and the shaped glyph output + (after shaping). + + + + + shape plans, which store the settings + that HarfBuzz will use when shaping a particular text + segment. Shape plans are not generally used by client + programs directly, but as we will see in a later chapter, + they are still valuable to understand. + + + + +
+ + + +
+ Object lifecycle management + + Each object type in HarfBuzz provides a + create() method. Some object types provide + additional variants of create() to handle + special cases or to speed up common tasks; those variants are + documented in the API reference. For example, + hb_blob_create_from_file() constructs a new + blob directly from the contents of a file. + + + All objects are created with an initial reference count of + 1. Client programs can increase the reference + count on an object by calling its + reference() method. Whenever a client + program is finished with an object, it should call its + corresponding destroy() method. The destroy + method will decrease the reference count on the object and, + whenever the reference count reaches zero, it will also destroy + the object and free all of the associated memory. + + + All of HarfBuzz's object-lifecycle-management APIs are + thread-safe (unless you compiled HarfBuzz from source with the + HB_NO_MT configuration flag), even when the + object as a whole is not thread-safe. + It is also permissible to reference() or to + destroy() the NULL + value. + + + Some objects are thread-safe after they have been constructed + and set up. The general pattern is to + create() the object, make a few + set_*() calls to set up the + object, and then use it without further modification. + + + To ensure that such an object is not modified, client programs + can explicitly mark an object as immutable. HarfBuzz provides + make_immutable() methods to mark an object + as immutable and is_immutable() methods to + test whether or not an object is immutable. Attempts to use + setter functions on immutable objects will fail silently; see the API + Reference manual for specifics. + + + Note also that there are no "make mutable" methods. If client + programs need to alter an object previously marked as immutable, + they will need to make a duplicate of the original. + + + Finally, object constructors (and, indeed, as much of the + shaping API as possible) will never return + NULL. Instead, if there is an allocation + error, each constructor will return an “empty” object + singleton. + + + These empty-object singletons are inert and safe (although + typically useless) to pass around. This design choice avoids + having to check for NULL pointers all + throughout the code. + + + In addition, this “empty” object singleton can also be accessed + using the get_empty() method of the object + type in question. + +
+ + +
+ User data + + To better integrate with client programs, HarfBuzz's objects + offer a "user data" mechanism that can be used to attach + arbitrary data to the object. User-data attachment can be + useful for tying the lifecycles of various pieces of data + together, or for creating language bindings. + + + Each object type has a set_user_data() + method and a get_user_data() method. The + set_user_data() methods take a client-provided + key and a pointer, + user_data, pointing to the data itself. Once + the key-data pair has been attached to the object, the + get_user_data() method can be called with + the key, returning the user_data pointer. + + + The set_user_data() methods also support an + optional destroy callback. Client programs + can set the destroy callback and receive + notification from HarfBuzz whenever the object is destructed. + + + Finally, each set_user_data() method allows + the client program to set a replace Boolean + indicating whether or not the function call should replace any + existing user_data + associated with the specified key. + +
+ + + +
+ Blobs + + While most of HarfBuzz's object types are specific to the + shaping process, blobs are somewhat + different. + + + Blobs are an abstraction desgined to negotiate lifecycle and + permissions for raw pieces of data. For example, when you load + the raw font data into memory and want to pass it to HarfBuzz, + you do so in a hb_blob_t wrapper. + + + This allows you to take advantage of HarffBuzz's + reference-counting and destroy + callbacks. If you allocated the memory for the data using + malloc(), you would create the blob using + + + hb_blob_create (data, length, HB_MEMORY_MODE_WRITABLE, NULL, free) + + + That way, HarfBuzz will call free() on the + allocated memory whenever the blob drops its last reference and + is deconstructed. Consequently, the user code can stop worrying + about freeing memory and let the reference-counting machinery + take care of that. + +
+ +
diff --git a/docs/usermanual-what-is-harfbuzz.xml b/docs/usermanual-what-is-harfbuzz.xml index ed053f9ae..3513fb285 100644 --- a/docs/usermanual-what-is-harfbuzz.xml +++ b/docs/usermanual-what-is-harfbuzz.xml @@ -151,9 +151,9 @@ For example, in Tamil, when the letter "TTA" (ட) - letter is followed by "U" (உ), the pair + letter is followed by the vowel sign "U" (ு), the pair must be replaced by the single glyph "டு". The - sequence of Unicode characters "டஉ" needs to be + sequence of Unicode characters "ட,ு" needs to be substituted with a single "டு" glyph from the font. diff --git a/src/Makefile.am b/src/Makefile.am index 66a3b3177..fc772e0ac 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -310,9 +310,9 @@ noinst_PROGRAMS = \ main \ test \ test-buffer-serialize \ - test-name-table \ - test-size-params \ - test-would-substitute \ + test-ot-name \ + test-gpos-size-params \ + test-gsub-would-substitute \ $(NULL) bin_PROGRAMS = @@ -328,17 +328,17 @@ test_buffer_serialize_SOURCES = test-buffer-serialize.cc test_buffer_serialize_CPPFLAGS = $(HBCFLAGS) test_buffer_serialize_LDADD = libharfbuzz.la $(HBLIBS) -test_name_table_SOURCES = test-name-table.cc -test_name_table_CPPFLAGS = $(HBCFLAGS) -test_name_table_LDADD = libharfbuzz.la $(HBLIBS) +test_ot_name_SOURCES = test-ot-name.cc +test_ot_name_CPPFLAGS = $(HBCFLAGS) +test_ot_name_LDADD = libharfbuzz.la $(HBLIBS) -test_size_params_SOURCES = test-size-params.cc -test_size_params_CPPFLAGS = $(HBCFLAGS) -test_size_params_LDADD = libharfbuzz.la $(HBLIBS) +test_gpos_size_params_SOURCES = test-gpos-size-params.cc +test_gpos_size_params_CPPFLAGS = $(HBCFLAGS) +test_gpos_size_params_LDADD = libharfbuzz.la $(HBLIBS) -test_would_substitute_SOURCES = test-would-substitute.cc -test_would_substitute_CPPFLAGS = $(HBCFLAGS) $(FREETYPE_CFLAGS) -test_would_substitute_LDADD = libharfbuzz.la $(HBLIBS) $(FREETYPE_LIBS) +test_gsub_would_substitute_SOURCES = test-gsub-would-substitute.cc +test_gsub_would_substitute_CPPFLAGS = $(HBCFLAGS) $(FREETYPE_CFLAGS) +test_gsub_would_substitute_LDADD = libharfbuzz.la $(HBLIBS) $(FREETYPE_LIBS) if HAVE_FREETYPE if HAVE_CAIRO_FT @@ -384,7 +384,7 @@ dump_use_data_SOURCES = dump-use-data.cc hb-ot-shape-complex-use-table.cc dump_use_data_CPPFLAGS = $(HBCFLAGS) dump_use_data_LDADD = libharfbuzz.la $(HBLIBS) -COMPILED_TESTS = test-algs test-iter test-ot-tag test-unicode-ranges +COMPILED_TESTS = test-algs test-iter test-meta test-ot-tag test-unicode-ranges COMPILED_TESTS_CPPFLAGS = $(HBCFLAGS) -DMAIN -UNDEBUG COMPILED_TESTS_LDADD = libharfbuzz.la $(HBLIBS) check_PROGRAMS += $(COMPILED_TESTS) @@ -398,6 +398,10 @@ test_iter_SOURCES = test-iter.cc hb-static.cc test_iter_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) test_iter_LDADD = $(COMPILED_TESTS_LDADD) +test_meta_SOURCES = test-meta.cc hb-static.cc +test_meta_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_meta_LDADD = $(COMPILED_TESTS_LDADD) + test_ot_tag_SOURCES = hb-ot-tag.cc test_ot_tag_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) test_ot_tag_LDADD = $(COMPILED_TESTS_LDADD) diff --git a/src/Makefile.sources b/src/Makefile.sources index 17956c59d..0615a8bfc 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -31,6 +31,7 @@ HB_BASE_sources = \ hb-cff1-interp-cs.hh \ hb-cff2-interp-cs.hh \ hb-common.cc \ + hb-config.hh \ hb-debug.hh \ hb-dispatch.hh \ hb-face.cc \ @@ -84,7 +85,7 @@ HB_BASE_sources = \ hb-ot-math-table.hh \ hb-ot-math.cc \ hb-ot-maxp-table.hh \ - hb-ot-name-language.cc \ + hb-ot-name-language-static.hh \ hb-ot-name-language.hh \ hb-ot-name-table.hh \ hb-ot-name.cc \ diff --git a/src/gen-os2-unicode-ranges.py b/src/gen-os2-unicode-ranges.py index 8cf598588..95f1f1156 100644 --- a/src/gen-os2-unicode-ranges.py +++ b/src/gen-os2-unicode-ranges.py @@ -2,7 +2,7 @@ # Generates the code for a sorted unicode range array as used in hb-ot-os2-unicode-ranges.hh # Input is a tab seperated list of unicode ranges from the otspec -# (https://docs.microsoft.com/en-us/typography/opentype/spec/os2#ulunicoderange1). +# (https://docs.microsoft.com/en-us/typography/opentype/spec/os2#ur). from __future__ import print_function, division, absolute_import diff --git a/src/gen-tag-table.py b/src/gen-tag-table.py index 13004629d..49f5b30bb 100755 --- a/src/gen-tag-table.py +++ b/src/gen-tag-table.py @@ -895,20 +895,18 @@ def language_name_intersection (a, b): def get_matching_language_name (intersection, candidates): return next (iter (c for c in candidates if not intersection.isdisjoint (get_variant_set (c)))) -maximum_tags = 0 +def same_tag (bcp_47_tag, ot_tags): + return len (bcp_47_tag) == 3 and len (ot_tags) == 1 and bcp_47_tag == ot_tags[0].lower () + for language, tags in sorted (ot.from_bcp_47.items ()): if language == '' or '-' in language: continue - print (' {\"%s\",\t{' % language, end='') - maximum_tags = max (maximum_tags, len (tags)) - tag_count = len (tags) + commented_out = same_tag (language, tags) for i, tag in enumerate (tags, start=1): - if i > 1: - print ('\t\t ', end='') - print (hb_tag (tag), end='') - if i == tag_count: - print ('}}', end='') - print (',\t/* ', end='') + print ('%s{\"%s\",\t%s},' % ('/*' if commented_out else ' ', language, hb_tag (tag)), end='') + if commented_out: + print ('*/', end='') + print ('\t/* ', end='') bcp_47_name = bcp_47.names.get (language, '') bcp_47_name_candidates = bcp_47_name.split ('\n') intersection = language_name_intersection (bcp_47_name, ot.names[tag]) @@ -923,8 +921,6 @@ for language, tags in sorted (ot.from_bcp_47.items ()): print ('};') print () -print ('static_assert (HB_OT_MAX_TAGS_PER_LANGUAGE == %iu, "");' % maximum_tags) -print () print ('/**') print (' * hb_ot_tags_from_complex_language:') @@ -1051,7 +1047,8 @@ print (' * @tag: A language tag.') print (' *') print (' * Converts @tag to a BCP 47 language tag if it is ambiguous (it corresponds to') print (' * many language tags) and the best tag is not the alphabetically first, or if') -print (' * the best tag consists of multiple subtags.') +print (' * the best tag consists of multiple subtags, or if the best tag does not appear') +print (' * in #ot_languages.') print (' *') print (' * Return value: The #hb_language_t corresponding to the BCP 47 language tag,') print (' * or #HB_LANGUAGE_INVALID if @tag is not ambiguous.') @@ -1102,7 +1099,8 @@ def verify_disambiguation_dict (): '%s is not a valid disambiguation for %s' % (disambiguation[ot_tag], ot_tag)) elif ot_tag not in disambiguation: disambiguation[ot_tag] = macrolanguages[0] - if disambiguation[ot_tag] == sorted (primary_tags)[0] and '-' not in disambiguation[ot_tag]: + different_primary_tags = sorted (t for t in primary_tags if not same_tag (t, ot.from_bcp_47.get (t))) + if different_primary_tags and disambiguation[ot_tag] == different_primary_tags[0] and '-' not in disambiguation[ot_tag]: del disambiguation[ot_tag] for ot_tag in disambiguation.keys (): expect (ot_tag in ot.to_bcp_47, 'unknown OT tag: %s' % ot_tag) diff --git a/src/gen-use-table.py b/src/gen-use-table.py index 029e66e53..9b1a00a68 100755 --- a/src/gen-use-table.py +++ b/src/gen-use-table.py @@ -47,8 +47,22 @@ defaults = ('Other', 'Not_Applicable', 'Cn', 'No_Block') # TODO Characters that are not in Unicode Indic files, but used in USE data[0][0x034F] = defaults[0] +data[0][0x1B61] = defaults[0] +data[0][0x1B63] = defaults[0] +data[0][0x1B64] = defaults[0] +data[0][0x1B65] = defaults[0] +data[0][0x1B66] = defaults[0] +data[0][0x1B67] = defaults[0] +data[0][0x1B69] = defaults[0] +data[0][0x1B6A] = defaults[0] data[0][0x2060] = defaults[0] -# TODO https://github.com/roozbehp/unicode-data/issues/9 +# TODO https://github.com/harfbuzz/harfbuzz/pull/1685 +data[0][0x1B5B] = 'Consonant_Placeholder' +data[0][0x1B5C] = 'Consonant_Placeholder' +data[0][0x1B5F] = 'Consonant_Placeholder' +data[0][0x1B62] = 'Consonant_Placeholder' +data[0][0x1B68] = 'Consonant_Placeholder' +# TODO https://github.com/harfbuzz/harfbuzz/issues/1035 data[0][0x11C44] = 'Consonant_Placeholder' data[0][0x11C45] = 'Consonant_Placeholder' # TODO https://github.com/harfbuzz/harfbuzz/pull/1399 @@ -171,7 +185,7 @@ def is_BASE(U, UISC, UGC): def is_BASE_IND(U, UISC, UGC): #SPEC-DRAFT return (UISC in [Consonant_Dead, Modifying_Letter] or UGC == Po) return (UISC in [Consonant_Dead, Modifying_Letter] or - (UGC == Po and not U in [0x104B, 0x104E, 0x2022, 0x111C8, 0x11A3F, 0x11A45, 0x11C44, 0x11C45]) or + (UGC == Po and not U in [0x104B, 0x104E, 0x1B5B, 0x1B5C, 0x1B5F, 0x2022, 0x111C8, 0x11A3F, 0x11A45, 0x11C44, 0x11C45]) or False # SPEC-DRAFT-OUTDATED! U == 0x002D ) def is_BASE_NUM(U, UISC, UGC): @@ -216,6 +230,7 @@ def is_Word_Joiner(U, UISC, UGC): def is_OTHER(U, UISC, UGC): #SPEC-OUTDATED return UGC == Zs # or any other SCRIPT_COMMON characters return (UISC == Other + and not is_SYM(U, UISC, UGC) and not is_SYM_MOD(U, UISC, UGC) and not is_CGJ(U, UISC, UGC) and not is_Word_Joiner(U, UISC, UGC) @@ -228,17 +243,17 @@ def is_REPHA(U, UISC, UGC): def is_SYM(U, UISC, UGC): if U == 0x25CC: return False #SPEC-DRAFT #SPEC-DRAFT return UGC in [So, Sc] or UISC == Symbol_Letter - return UGC in [So, Sc] + return UGC in [So, Sc] and U not in [0x1B62, 0x1B68] def is_SYM_MOD(U, UISC, UGC): return U in [0x1B6B, 0x1B6C, 0x1B6D, 0x1B6E, 0x1B6F, 0x1B70, 0x1B71, 0x1B72, 0x1B73] def is_VARIATION_SELECTOR(U, UISC, UGC): return 0xFE00 <= U <= 0xFE0F def is_VOWEL(U, UISC, UGC): - # https://github.com/roozbehp/unicode-data/issues/6 + # https://github.com/harfbuzz/harfbuzz/issues/376 return (UISC == Pure_Killer or (UGC != Lo and UISC in [Vowel, Vowel_Dependent] and U not in [0xAA29])) def is_VOWEL_MOD(U, UISC, UGC): - # https://github.com/roozbehp/unicode-data/issues/6 + # https://github.com/harfbuzz/harfbuzz/issues/376 return (UISC in [Tone_Mark, Cantillation_Mark, Register_Shifter, Visarga] or (UGC != Lo and (UISC == Bindu or U in [0xAA29]))) diff --git a/src/gen-vowel-constraints.py b/src/gen-vowel-constraints.py index afb21d928..1340d97dc 100755 --- a/src/gen-vowel-constraints.py +++ b/src/gen-vowel-constraints.py @@ -180,6 +180,9 @@ print ('_hb_preprocess_text_vowel_constraints (const hb_ot_shape_plan_t *plan HB print ('\t\t\t\t hb_buffer_t *buffer,') print ('\t\t\t\t hb_font_t *font HB_UNUSED)') print ('{') +print ('#if defined(HB_NO_OT_SHAPE_COMPLEX_VOWEL_CONSTRAINTS)') +print (' return;') +print ('#endif') print (' if (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE)') print (' return;') print () diff --git a/src/hb-aat-layout-ankr-table.hh b/src/hb-aat-layout-ankr-table.hh index 4087b8c1f..ef988841a 100644 --- a/src/hb-aat-layout-ankr-table.hh +++ b/src/hb-aat-layout-ankr-table.hh @@ -83,7 +83,7 @@ struct ankr protected: HBUINT16 version; /* Version number (set to zero) */ HBUINT16 flags; /* Flags (currently unused; set to zero) */ - LOffsetTo > > + LOffsetTo>> lookupTable; /* Offset to the table's lookup table */ LNNOffsetTo anchorData; /* Offset to the glyph data table */ diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 2508276c2..a8c4b7637 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -125,7 +125,7 @@ struct LookupFormat2 protected: HBUINT16 format; /* Format identifier--format = 2 */ - VarSizedBinSearchArrayOf > + VarSizedBinSearchArrayOf> segments; /* The actual segments. These must already be sorted, * according to the first word in each one (the last * glyph in each segment). */ @@ -153,18 +153,18 @@ struct LookupSegmentArray first <= last && valuesZ.sanitize (c, base, last - first + 1)); } - template - bool sanitize (hb_sanitize_context_t *c, const void *base, T2 user_data) const + template + bool sanitize (hb_sanitize_context_t *c, const void *base, Ts&&... ds) const { TRACE_SANITIZE (this); return_trace (c->check_struct (this) && first <= last && - valuesZ.sanitize (c, base, last - first + 1, user_data)); + valuesZ.sanitize (c, base, last - first + 1, hb_forward (ds)...)); } GlyphID last; /* Last GlyphID in this segment */ GlyphID first; /* First GlyphID in this segment */ - NNOffsetTo > + NNOffsetTo> valuesZ; /* A 16-bit offset from the start of * the table to the data. */ public: @@ -196,7 +196,7 @@ struct LookupFormat4 protected: HBUINT16 format; /* Format identifier--format = 4 */ - VarSizedBinSearchArrayOf > + VarSizedBinSearchArrayOf> segments; /* The actual segments. These must already be sorted, * according to the first word in each one (the last * glyph in each segment). */ @@ -253,7 +253,7 @@ struct LookupFormat6 protected: HBUINT16 format; /* Format identifier--format = 6 */ - VarSizedBinSearchArrayOf > + VarSizedBinSearchArrayOf> entries; /* The actual entries, sorted by glyph index. */ public: DEFINE_SIZE_ARRAY (8, entries); @@ -419,7 +419,7 @@ struct Lookup /* Ugly hand-coded null objects for template Lookup<> :(. */ extern HB_INTERNAL const unsigned char _hb_Null_AAT_Lookup[2]; template -struct Null > { +struct Null> { static AAT::Lookup const & get_null () { return *reinterpret_cast *> (_hb_Null_AAT_Lookup); } }; @@ -510,7 +510,7 @@ struct StateTable const Entry &get_entry (int state, unsigned int klass) const { if (unlikely (klass >= nClasses)) - klass = StateTable >::CLASS_OUT_OF_BOUNDS; + klass = StateTable>::CLASS_OUT_OF_BOUNDS; const HBUSHORT *states = (this+stateArrayTable).arrayZ; const Entry *entries = (this+entryTable).arrayZ; @@ -576,7 +576,7 @@ struct StateTable if (unlikely (stop > states)) return_trace (false); for (const HBUSHORT *p = states; stop < p; p--) - num_entries = MAX (num_entries, *(p - 1) + 1); + num_entries = hb_max (num_entries, *(p - 1) + 1); state_neg = min_state; } } @@ -597,7 +597,7 @@ struct StateTable if (unlikely (stop < states)) return_trace (false); for (const HBUSHORT *p = &states[state_pos * num_classes]; p < stop; p++) - num_entries = MAX (num_entries, *p + 1); + num_entries = hb_max (num_entries, *p + 1); state_pos = max_state + 1; } } @@ -611,8 +611,8 @@ struct StateTable for (const Entry *p = &entries[entry]; p < stop; p++) { int newState = new_state (p->newState); - min_state = MIN (min_state, newState); - max_state = MAX (max_state, newState); + min_state = hb_min (min_state, newState); + max_state = hb_max (max_state, newState); } entry = num_entries; } @@ -631,7 +631,7 @@ struct StateTable classTable; /* Offset to the class table. */ NNOffsetTo, HBUINT> stateArrayTable;/* Offset to the state array. */ - NNOffsetTo >, HBUINT> + NNOffsetTo>, HBUINT> entryTable; /* Offset to the entry array. */ public: diff --git a/src/hb-aat-layout-feat-table.hh b/src/hb-aat-layout-feat-table.hh index ab23ee056..a20ef8640 100644 --- a/src/hb-aat-layout-feat-table.hh +++ b/src/hb-aat-layout-feat-table.hh @@ -165,7 +165,7 @@ struct feat unsigned int feature_count = featureNameCount; if (count && *count) { - unsigned int len = MIN (feature_count - start_offset, *count); + unsigned int len = hb_min (feature_count - start_offset, *count); for (unsigned int i = 0; i < len; i++) features[i] = namesZ[i + start_offset].get_feature_type (); *count = len; diff --git a/src/hb-aat-layout-just-table.hh b/src/hb-aat-layout-just-table.hh index d53f8f19e..e15c946a2 100644 --- a/src/hb-aat-layout-just-table.hh +++ b/src/hb-aat-layout-just-table.hh @@ -309,7 +309,7 @@ struct WidthDeltaPair public: DEFINE_SIZE_STATIC (24); }; - + typedef OT::LArrayOf WidthDeltaCluster; struct JustificationCategory @@ -371,7 +371,7 @@ struct JustificationHeader * of postcompensation subtable (set to zero if none). * * The postcompensation subtable, if present in the font. */ - Lookup > + Lookup> lookupTable; /* Lookup table associating glyphs with width delta * clusters. See the description of Width Delta Clusters * table for details on how to interpret the lookup values. */ diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index a64c80738..cec63ac6d 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -251,7 +251,7 @@ struct KerxSubTableFormat1 if (Format1EntryT::performAction (entry) && depth) { - unsigned int tuple_count = MAX (1u, table->header.tuple_count ()); + unsigned int tuple_count = hb_max (1u, table->header.tuple_count ()); unsigned int kern_idx = Format1EntryT::kernActionIndex (entry); kern_idx = Types::byteOffsetToIndex (kern_idx, &table->machine, kernAction.arrayZ); @@ -712,18 +712,18 @@ struct KerxSubTableFormat6 { struct Long { - LNNOffsetTo > rowIndexTable; - LNNOffsetTo > columnIndexTable; - LNNOffsetTo > array; + LNNOffsetTo> rowIndexTable; + LNNOffsetTo> columnIndexTable; + LNNOffsetTo> array; } l; struct Short { - LNNOffsetTo > rowIndexTable; - LNNOffsetTo > columnIndexTable; - LNNOffsetTo > array; + LNNOffsetTo> rowIndexTable; + LNNOffsetTo> columnIndexTable; + LNNOffsetTo> array; } s; } u; - LNNOffsetTo > vector; + LNNOffsetTo> vector; public: DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 24); }; @@ -771,17 +771,17 @@ struct KerxSubTable unsigned int get_size () const { return u.header.length; } unsigned int get_type () const { return u.header.coverage & u.header.SubtableType; } - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { unsigned int subtable_type = get_type (); TRACE_DISPATCH (this, subtable_type); switch (subtable_type) { - case 0: return_trace (c->dispatch (u.format0)); - case 1: return_trace (c->dispatch (u.format1)); - case 2: return_trace (c->dispatch (u.format2)); - case 4: return_trace (c->dispatch (u.format4)); - case 6: return_trace (c->dispatch (u.format6)); + case 0: return_trace (c->dispatch (u.format0, hb_forward (ds)...)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); + case 2: return_trace (c->dispatch (u.format2, hb_forward (ds)...)); + case 4: return_trace (c->dispatch (u.format4, hb_forward (ds)...)); + case 6: return_trace (c->dispatch (u.format6, hb_forward (ds)...)); default: return_trace (c->default_return_value ()); } } diff --git a/src/hb-aat-layout-lcar-table.hh b/src/hb-aat-layout-lcar-table.hh index 4be799fbc..cd96d034d 100644 --- a/src/hb-aat-layout-lcar-table.hh +++ b/src/hb-aat-layout-lcar-table.hh @@ -81,7 +81,7 @@ struct lcar protected: FixedVersion<>version; /* Version number of the ligature caret table */ HBUINT16 format; /* Format of the ligature caret table. */ - Lookup > + Lookup> lookup; /* data Lookup table associating glyphs */ public: diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 4a1d959ef..81d78972a 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -88,7 +88,7 @@ struct RearrangementSubtable start = buffer->idx; if (flags & MarkLast) - end = MIN (buffer->idx + 1, buffer->len); + end = hb_min (buffer->idx + 1, buffer->len); if ((flags & Verb) && start < end) { @@ -117,14 +117,14 @@ struct RearrangementSubtable }; unsigned int m = map[flags & Verb]; - unsigned int l = MIN (2, m >> 4); - unsigned int r = MIN (2, m & 0x0F); + unsigned int l = hb_min (2u, m >> 4); + unsigned int r = hb_min (2u, m & 0x0F); bool reverse_l = 3 == (m >> 4); bool reverse_r = 3 == (m & 0x0F); if (end - start >= l + r) { - buffer->merge_clusters (start, MIN (buffer->idx + 1, buffer->len)); + buffer->merge_clusters (start, hb_min (buffer->idx + 1, buffer->len)); buffer->merge_clusters (start, end); hb_glyph_info_t *info = buffer->info; @@ -261,13 +261,13 @@ struct ContextualSubtable } if (replacement) { - buffer->unsafe_to_break (mark, MIN (buffer->idx + 1, buffer->len)); + buffer->unsafe_to_break (mark, hb_min (buffer->idx + 1, buffer->len)); buffer->info[mark].codepoint = *replacement; ret = true; } replacement = nullptr; - unsigned int idx = MIN (buffer->idx, buffer->len - 1); + unsigned int idx = hb_min (buffer->idx, buffer->len - 1); if (Types::extended) { if (entry.data.currentIndex != 0xFFFF) @@ -337,9 +337,9 @@ struct ContextualSubtable const EntryData &data = entries[i].data; if (data.markIndex != 0xFFFF) - num_lookups = MAX (num_lookups, 1 + data.markIndex); + num_lookups = hb_max (num_lookups, 1 + data.markIndex); if (data.currentIndex != 0xFFFF) - num_lookups = MAX (num_lookups, 1 + data.currentIndex); + num_lookups = hb_max (num_lookups, 1 + data.currentIndex); } return_trace (substitutionTables.sanitize (c, this, num_lookups)); @@ -744,7 +744,7 @@ struct InsertionSubtable buffer->move_to (end + count); - buffer->unsafe_to_break_from_outbuffer (mark, MIN (buffer->idx + 1, buffer->len)); + buffer->unsafe_to_break_from_outbuffer (mark, hb_min (buffer->idx + 1, buffer->len)); } if (flags & SetMark) @@ -883,17 +883,17 @@ struct ChainSubtable Insertion = 5 }; - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) 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)); + case Rearrangement: return_trace (c->dispatch (u.rearrangement, hb_forward (ds)...)); + case Contextual: return_trace (c->dispatch (u.contextual, hb_forward (ds)...)); + case Ligature: return_trace (c->dispatch (u.ligature, hb_forward (ds)...)); + case Noncontextual: return_trace (c->dispatch (u.noncontextual, hb_forward (ds)...)); + case Insertion: return_trace (c->dispatch (u.insertion, hb_forward (ds)...)); default: return_trace (c->default_return_value ()); } } @@ -969,7 +969,7 @@ struct Chain void apply (hb_aat_apply_context_t *c, hb_mask_t flags) const { - const ChainSubtable *subtable = &StructAfter > (featureZ.as_array (featureCount)); + const ChainSubtable *subtable = &StructAfter> (featureZ.as_array (featureCount)); unsigned int count = subtableCount; for (unsigned int i = 0; i < count; i++) { @@ -1031,7 +1031,7 @@ struct Chain if (unlikely (!c->buffer->successful)) return; skip: - subtable = &StructAfter > (*subtable); + subtable = &StructAfter> (*subtable); c->set_lookup_index (c->lookup_index + 1); } } @@ -1049,13 +1049,13 @@ struct Chain if (!c->check_array (featureZ.arrayZ, featureCount)) return_trace (false); - const ChainSubtable *subtable = &StructAfter > (featureZ.as_array (featureCount)); + const ChainSubtable *subtable = &StructAfter> (featureZ.as_array (featureCount)); unsigned int count = subtableCount; for (unsigned int i = 0; i < count; i++) { if (!subtable->sanitize (c)) return_trace (false); - subtable = &StructAfter > (*subtable); + subtable = &StructAfter> (*subtable); } return_trace (true); @@ -1095,7 +1095,7 @@ struct mortmorx for (unsigned int i = 0; i < count; i++) { map->chain_flags.push (chain->compile_flags (mapper)); - chain = &StructAfter > (*chain); + chain = &StructAfter> (*chain); } } @@ -1109,7 +1109,7 @@ struct mortmorx { chain->apply (c, c->plan->aat_map.chain_flags[i]); if (unlikely (!c->buffer->successful)) return; - chain = &StructAfter > (*chain); + chain = &StructAfter> (*chain); } } @@ -1125,7 +1125,7 @@ struct mortmorx { if (!chain->sanitize (c, version)) return_trace (false); - chain = &StructAfter > (*chain); + chain = &StructAfter> (*chain); } return_trace (true); diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh index 0c8e4558f..2eace2aa0 100644 --- a/src/hb-aat-layout-trak-table.hh +++ b/src/hb-aat-layout-trak-table.hh @@ -66,7 +66,7 @@ struct TrackTableEntry NameID trackNameID; /* The 'name' table index for this track. * (a short word or phrase like "loose" * or "very tight") */ - NNOffsetTo > + NNOffsetTo> valuesZ; /* Offset from start of tracking table to * per-size tracking values for this track. */ @@ -133,8 +133,8 @@ struct TrackData if (size_table[size_index].to_float () >= csspx) break; - return round (interpolate_at (size_index ? size_index - 1 : 0, csspx, - *trackTableEntry, base)); + return roundf (interpolate_at (size_index ? size_index - 1 : 0, csspx, + *trackTableEntry, base)); } bool sanitize (hb_sanitize_context_t *c, const void *base) const diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index 5168a9c85..22cbd7338 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -135,6 +135,10 @@ static const hb_aat_feature_mapping_t feature_mappings[] = const hb_aat_feature_mapping_t * hb_aat_layout_find_feature_mapping (hb_tag_t tag) { +#ifdef HB_NO_SHAPE_AAT + return nullptr; +#endif + return (const hb_aat_feature_mapping_t *) bsearch (&tag, feature_mappings, ARRAY_LENGTH (feature_mappings), @@ -147,6 +151,8 @@ hb_aat_layout_find_feature_mapping (hb_tag_t tag) * hb_aat_apply_context_t */ +/* Note: This context is used for kerning, even without AAT. */ + AAT::hb_aat_apply_context_t::hb_aat_apply_context_t (const hb_ot_shape_plan_t *plan_, hb_font_t *font_, hb_buffer_t *buffer_, @@ -183,6 +189,10 @@ void hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper, hb_aat_map_t *map) { +#ifdef HB_NO_SHAPE_AAT + return; +#endif + const AAT::morx& morx = *mapper->face->table.morx; if (morx.has_data ()) { @@ -209,6 +219,10 @@ hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper, hb_bool_t hb_aat_layout_has_substitution (hb_face_t *face) { +#ifdef HB_NO_SHAPE_AAT + return false; +#endif + return face->table.morx->has_data () || face->table.mort->has_data (); } @@ -218,6 +232,10 @@ hb_aat_layout_substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { +#ifdef HB_NO_SHAPE_AAT + return; +#endif + hb_blob_t *morx_blob = font->face->table.morx.get_blob (); const AAT::morx& morx = *morx_blob->as (); if (morx.has_data ()) @@ -240,6 +258,10 @@ hb_aat_layout_substitute (const hb_ot_shape_plan_t *plan, void hb_aat_layout_zero_width_deleted_glyphs (hb_buffer_t *buffer) { +#ifdef HB_NO_SHAPE_AAT + return; +#endif + unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; hb_glyph_position_t *pos = buffer->pos; @@ -257,6 +279,10 @@ is_deleted_glyph (const hb_glyph_info_t *info) void hb_aat_layout_remove_deleted_glyphs (hb_buffer_t *buffer) { +#ifdef HB_NO_SHAPE_AAT + return; +#endif + hb_ot_layout_delete_glyphs_inplace (buffer, is_deleted_glyph); } @@ -270,6 +296,10 @@ hb_aat_layout_remove_deleted_glyphs (hb_buffer_t *buffer) hb_bool_t hb_aat_layout_has_positioning (hb_face_t *face) { +#ifdef HB_NO_SHAPE_AAT + return false; +#endif + return face->table.kerx->has_data (); } @@ -278,6 +308,10 @@ hb_aat_layout_position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { +#ifdef HB_NO_SHAPE_AAT + return; +#endif + hb_blob_t *kerx_blob = font->face->table.kerx.get_blob (); const AAT::kerx& kerx = *kerx_blob->as (); @@ -297,6 +331,10 @@ hb_aat_layout_position (const hb_ot_shape_plan_t *plan, hb_bool_t hb_aat_layout_has_tracking (hb_face_t *face) { +#ifdef HB_NO_SHAPE_AAT + return false; +#endif + return face->table.trak->has_data (); } @@ -305,20 +343,16 @@ hb_aat_layout_track (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { +#ifdef HB_NO_SHAPE_AAT + return; +#endif + const AAT::trak& trak = *font->face->table.trak; AAT::hb_aat_apply_context_t c (plan, font, buffer); trak.apply (&c); } - -hb_language_t -_hb_aat_language_get (hb_face_t *face, - unsigned int i) -{ - return face->table.ltag->get_language (i); -} - /** * hb_aat_layout_get_feature_types: * @face: a face object @@ -336,6 +370,12 @@ hb_aat_layout_get_feature_types (hb_face_t *face, unsigned int *feature_count, /* IN/OUT. May be NULL. */ hb_aat_layout_feature_type_t *features /* OUT. May be NULL. */) { +#ifdef HB_NO_SHAPE_AAT + if (feature_count) + *feature_count = 0; + return 0; +#endif + return face->table.feat->get_feature_types (start_offset, feature_count, features); } @@ -352,6 +392,10 @@ hb_ot_name_id_t hb_aat_layout_feature_type_get_name_id (hb_face_t *face, hb_aat_layout_feature_type_t feature_type) { +#ifdef HB_NO_SHAPE_AAT + return HB_OT_NAME_ID_INVALID; +#endif + return face->table.feat->get_feature_name_id (feature_type); } @@ -380,5 +424,11 @@ hb_aat_layout_feature_type_get_selector_infos (hb_face_t hb_aat_layout_feature_selector_info_t *selectors, /* OUT. May be NULL. */ unsigned int *default_index /* OUT. May be NULL. */) { +#ifdef HB_NO_SHAPE_AAT + if (selector_count) + *selector_count = 0; + return 0; +#endif + return face->table.feat->get_selector_infos (feature_type, start_offset, selector_count, selectors, default_index); } diff --git a/src/hb-aat-layout.hh b/src/hb-aat-layout.hh index 8346d9f00..9a0e4468f 100644 --- a/src/hb-aat-layout.hh +++ b/src/hb-aat-layout.hh @@ -30,7 +30,7 @@ #include "hb.hh" #include "hb-ot-shape.hh" - +#include "hb-aat-ltag-table.hh" struct hb_aat_feature_mapping_t { @@ -39,7 +39,7 @@ struct hb_aat_feature_mapping_t hb_aat_layout_feature_selector_t selectorToEnable; hb_aat_layout_feature_selector_t selectorToDisable; - static int cmp (const void *key_, const void *entry_) + HB_INTERNAL static int cmp (const void *key_, const void *entry_) { hb_tag_t key = * (unsigned int *) key_; const hb_aat_feature_mapping_t * entry = (const hb_aat_feature_mapping_t *) entry_; @@ -77,9 +77,13 @@ hb_aat_layout_track (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer); -HB_INTERNAL hb_language_t + +inline hb_language_t _hb_aat_language_get (hb_face_t *face, - unsigned int i); + unsigned int i) +{ + return face->table.ltag->get_language (i); +} #endif /* HB_AAT_LAYOUT_HH */ diff --git a/src/hb-aat-ltag-table.hh b/src/hb-aat-ltag-table.hh index 6f34a0095..711f9aa6c 100644 --- a/src/hb-aat-ltag-table.hh +++ b/src/hb-aat-ltag-table.hh @@ -50,7 +50,7 @@ struct FTStringRange } protected: - NNOffsetTo > + NNOffsetTo> tag; /* Offset from the start of the table to * the beginning of the string */ HBUINT16 length; /* String length (in bytes) */ diff --git a/src/hb-aat-map.cc b/src/hb-aat-map.cc index 98c5d7fe4..d57ee849d 100644 --- a/src/hb-aat-map.cc +++ b/src/hb-aat-map.cc @@ -34,6 +34,10 @@ void hb_aat_map_builder_t::add_feature (hb_tag_t tag, unsigned int value) { +#ifdef HB_NO_SHAPE_AAT + return; +#endif + if (tag == HB_TAG ('a','a','l','t')) { feature_info_t *info = features.push(); @@ -53,6 +57,10 @@ void hb_aat_map_builder_t::add_feature (hb_tag_t tag, void hb_aat_map_builder_t::compile (hb_aat_map_t &m) { +#ifdef HB_NO_SHAPE_AAT + return; +#endif + /* Sort features and merge duplicates */ if (features.length) { diff --git a/src/hb-aat-map.hh b/src/hb-aat-map.hh index f103d276c..984a59cca 100644 --- a/src/hb-aat-map.hh +++ b/src/hb-aat-map.hh @@ -66,7 +66,7 @@ struct hb_aat_map_builder_t hb_aat_layout_feature_selector_t setting; unsigned seq; /* For stable sorting only. */ - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const feature_info_t *a = (const feature_info_t *) pa; const feature_info_t *b = (const feature_info_t *) pb; diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 2765e1ced..24bdeb190 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -1,5 +1,6 @@ /* * Copyright © 2017 Google, Inc. + * Copyright © 2019 Google, Inc. * * This is part of HarfBuzz, a text shaping library. * @@ -22,6 +23,7 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * Google Author(s): Behdad Esfahbod + * Facebook Author(s): Behdad Esfahbod */ #ifndef HB_ALGS_HH @@ -32,41 +34,178 @@ #include "hb-null.hh" -static const struct +struct { - /* Don't know how to set priority of following. Doesn't work right now. */ - //template - //uint32_t operator () (const T& v) const - //{ return hb_deref_pointer (v).hash (); } - /* Instead, the following ugly soution: */ - template - uint32_t operator () (T&& v) const { return v.hash (); } - - template - uint32_t operator () (const T *v) const - { return operator() (*v); } - - template - uint32_t operator () (T v) const - { - /* Knuth's multiplicative method: */ - return (uint32_t) v * 2654435761u; - } -} hb_hash HB_UNUSED; - -static const struct + /* Note. This is dangerous in that if it's passed an rvalue, it returns rvalue-reference. */ + template auto + operator () (T&& v) const HB_AUTO_RETURN ( hb_forward (v) ) +} +HB_FUNCOBJ (hb_identity); +struct { - template T - operator () (const T& v) const { return v; } -} hb_identity HB_UNUSED; + /* Like identity(), but only retains lvalue-references. Rvalues are returned as rvalues. */ + template T& + operator () (T& v) const { return v; } -static const struct + template hb_remove_reference + operator () (T&& v) const { return v; } +} +HB_FUNCOBJ (hb_lidentity); +struct +{ + /* Like identity(), but always returns rvalue. */ + template hb_remove_reference + operator () (T&& v) const { return v; } +} +HB_FUNCOBJ (hb_ridentity); + +struct { template bool - operator () (const T& v) const { return bool (v); } -} hb_bool HB_UNUSED; + operator () (T&& v) const { return bool (hb_forward (v)); } +} +HB_FUNCOBJ (hb_bool); + +struct +{ + private: + template auto + impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, hb_deref (v).hash ()) + + template auto + impl (const T& v, hb_priority<0>) const HB_AUTO_RETURN + ( + /* Knuth's multiplicative method: */ + (uint32_t) v * 2654435761u + ) + + public: + + template auto + operator () (const T& v) const HB_RETURN (uint32_t, impl (v, hb_prioritize)) +} +HB_FUNCOBJ (hb_hash); + + +struct +{ + private: + + /* Pointer-to-member-function. */ + template auto + impl (Appl&& a, hb_priority<2>, T &&v, Ts&&... ds) const HB_AUTO_RETURN + ((hb_deref (hb_forward (v)).*hb_forward (a)) (hb_forward (ds)...)) + + /* Pointer-to-member. */ + template auto + impl (Appl&& a, hb_priority<1>, T &&v) const HB_AUTO_RETURN + ((hb_deref (hb_forward (v))).*hb_forward (a)) + + /* Operator(). */ + template auto + impl (Appl&& a, hb_priority<0>, Ts&&... ds) const HB_AUTO_RETURN + (hb_deref (hb_forward (a)) (hb_forward (ds)...)) + + public: + + template auto + operator () (Appl&& a, Ts&&... ds) const HB_AUTO_RETURN + ( + impl (hb_forward (a), + hb_prioritize, + hb_forward (ds)...) + ) +} +HB_FUNCOBJ (hb_invoke); + +struct +{ + private: + + template auto + impl (Pred&& p, Val &&v, hb_priority<1>) const HB_AUTO_RETURN + (hb_deref (hb_forward (p)).has (hb_forward (v))) + + template auto + impl (Pred&& p, Val &&v, hb_priority<0>) const HB_AUTO_RETURN + ( + hb_invoke (hb_forward (p), + hb_forward (v)) + ) + + public: + + template auto + operator () (Pred&& p, Val &&v) const HB_RETURN (bool, + impl (hb_forward (p), + hb_forward (v), + hb_prioritize) + ) +} +HB_FUNCOBJ (hb_has); + +struct +{ + private: + + template auto + impl (Pred&& p, Val &&v, hb_priority<1>) const HB_AUTO_RETURN + ( + hb_has (hb_forward (p), + hb_forward (v)) + ) + + template auto + impl (Pred&& p, Val &&v, hb_priority<0>) const HB_AUTO_RETURN + ( + hb_forward (p) == hb_forward (v) + ) + + public: + + template auto + operator () (Pred&& p, Val &&v) const HB_RETURN (bool, + impl (hb_forward (p), + hb_forward (v), + hb_prioritize) + ) +} +HB_FUNCOBJ (hb_match); + +struct +{ + private: + + template auto + impl (Proj&& f, Val &&v, hb_priority<2>) const HB_AUTO_RETURN + (hb_deref (hb_forward (f)).get (hb_forward (v))) + + template auto + impl (Proj&& f, Val &&v, hb_priority<1>) const HB_AUTO_RETURN + ( + hb_invoke (hb_forward (f), + hb_forward (v)) + ) + + template auto + impl (Proj&& f, Val &&v, hb_priority<0>) const HB_AUTO_RETURN + ( + hb_forward (f)[hb_forward (v)] + ) + + public: + + template auto + operator () (Proj&& f, Val &&v) const HB_AUTO_RETURN + ( + impl (hb_forward (f), + hb_forward (v), + hb_prioritize) + ) +} +HB_FUNCOBJ (hb_get); + template struct hb_pair_t @@ -78,36 +217,73 @@ struct hb_pair_t hb_pair_t (T1 a, T2 b) : first (a), second (b) {} hb_pair_t (const pair_t& o) : first (o.first), second (o.second) {} + template + operator hb_pair_t () { return hb_pair_t (first, second); } + + hb_pair_t reverse () const + { return hb_pair_t (second, first); } + bool operator == (const pair_t& o) const { return first == o.first && second == o.second; } T1 first; T2 second; }; +#define hb_pair_t(T1,T2) hb_pair_t template static inline hb_pair_t hb_pair (T1&& a, T2&& b) { return hb_pair_t (a, b); } -static const struct +struct { - template decltype (hb_declval (Pair).first) - operator () (const Pair& pair) const { return pair.first; } -} hb_first HB_UNUSED; + template auto + operator () (const Pair& pair) const HB_AUTO_RETURN (pair.first) +} +HB_FUNCOBJ (hb_first); -static const struct +struct { - template decltype (hb_declval (Pair).second) - operator () (const Pair& pair) const { return pair.second; } -} hb_second HB_UNUSED; + template auto + operator () (const Pair& pair) const HB_AUTO_RETURN (pair.second) +} +HB_FUNCOBJ (hb_second); -static const struct +/* Note. In min/max impl, we can use hb_type_identity for second argument. + * However, that would silently convert between different-signedness integers. + * Instead we accept two different types, such that compiler can err if + * comparing integers of different signedness. */ +struct { - template T - operator () (const T& a, const T2& b) const { return a <= b ? a : b; } -} hb_min HB_UNUSED; -static const struct + private: + template auto + impl (T&& a, T2&& b) const HB_AUTO_RETURN + (hb_forward (a) <= hb_forward (b) ? hb_forward (a) : hb_forward (b)) + + public: + template auto + operator () (T&& a) const HB_AUTO_RETURN (hb_forward (a)) + + template auto + operator () (T&& a, Ts&& ...ds) const HB_AUTO_RETURN + (impl (hb_forward (a), (*this) (hb_forward (ds)...))) +} +HB_FUNCOBJ (hb_min); +struct { - template T - operator () (const T& a, const T2& b) const { return a >= b ? a : b; } -} hb_max HB_UNUSED; + private: + template auto + impl (T&& a, T2&& b) const HB_AUTO_RETURN + (hb_forward (a) >= hb_forward (b) ? hb_forward (a) : hb_forward (b)) + + public: + template auto + operator () (T&& a) const HB_AUTO_RETURN (hb_forward (a)) + + template auto + operator () (T&& a, Ts&& ...ds) const HB_AUTO_RETURN + (impl (hb_forward (a), (*this) (hb_forward (ds)...))) +} +HB_FUNCOBJ (hb_max); /* @@ -319,14 +495,6 @@ static inline unsigned char TOUPPER (unsigned char c) static inline unsigned char TOLOWER (unsigned char c) { return (c >= 'A' && c <= 'Z') ? c - 'A' + 'a' : c; } -#undef MIN -template -static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; } - -#undef MAX -template -static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; } - static inline unsigned int DIV_CEIL (const unsigned int a, unsigned int b) { return (a + (b - 1)) / b; } @@ -578,7 +746,7 @@ hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *o { /* Pain because we don't know whether s is nul-terminated. */ char buf[64]; - len = MIN (ARRAY_LENGTH (buf) - 1, len); + len = hb_min (ARRAY_LENGTH (buf) - 1, len); strncpy (buf, s, len); buf[len] = '\0'; diff --git a/src/hb-array.hh b/src/hb-array.hh index 2bfbdd4f5..705bc6a46 100644 --- a/src/hb-array.hh +++ b/src/hb-array.hh @@ -42,19 +42,21 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> /* * Constructors. */ - hb_array_t () : arrayZ (nullptr), length (0) {} - hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), length (o.length) {} - template - hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), length (o.length) {} + hb_array_t () : arrayZ (nullptr), length (0), backwards_length (0) {} + hb_array_t (Type *array_, unsigned int length_) : arrayZ (array_), length (length_), backwards_length (0) {} + template + hb_array_t (Type (&array_)[length_]) : arrayZ (array_), length (length_), backwards_length (0) {} - hb_array_t (Type *array_, unsigned int length_) : arrayZ (array_), length (length_) {} - template hb_array_t (Type (&array_)[length_]) : arrayZ (array_), length (length_) {} + template + hb_array_t (const hb_array_t &o) : + hb_iter_with_fallback_t, Type&> (), + arrayZ (o.arrayZ), length (o.length), backwards_length (o.backwards_length) {} + template + hb_array_t& operator = (const hb_array_t &o) + { arrayZ = o.arrayZ; length = o.length; backwards_length = o.backwards_length; return *this; } - template - hb_array_t& operator = (const hb_array_t &o) - { arrayZ = o.arrayZ; length = o.length; return *this; } - hb_array_t& operator = (const hb_array_t &o) - { arrayZ = o.arrayZ; length = o.length; return *this; } /* * Iterator implementation. */ @@ -70,15 +72,20 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> if (unlikely (n > length)) n = length; length -= n; + backwards_length += n; arrayZ += n; } void __rewind__ (unsigned n) { - if (unlikely (n > length)) - n = length; - length -= n; + if (unlikely (n > backwards_length)) + n = backwards_length; + length += n; + backwards_length -= n; + arrayZ -= n; } unsigned __len__ () const { return length; } + bool operator != (const hb_array_t& o) const + { return arrayZ != o.arrayZ || length != o.length || backwards_length != o.backwards_length; } /* Extra operators. */ @@ -86,8 +93,8 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> operator hb_array_t () { return hb_array_t (arrayZ, length); } template operator T * () const { return arrayZ; } - bool operator == (const hb_array_t &o) const; - uint32_t hash () const; + HB_INTERNAL bool operator == (const hb_array_t &o) const; + HB_INTERNAL uint32_t hash () const; /* * Compare, Sort, and Search. @@ -100,7 +107,7 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> return (int) a.length - (int) length; return hb_memcmp (a.arrayZ, arrayZ, get_size ()); } - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { hb_array_t *a = (hb_array_t *) pa; hb_array_t *b = (hb_array_t *) pb; @@ -140,7 +147,7 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> } void qsort (unsigned int start, unsigned int end) { - end = MIN (end, length); + end = hb_min (end, length); assert (start <= end); if (likely (start < end)) ::qsort (arrayZ + start, end - start, this->item_size, Type::cmp); @@ -163,7 +170,7 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> else count -= start_offset; if (seg_count) - count = *seg_count = MIN (count, *seg_count); + count = *seg_count = hb_min (count, *seg_count); return hb_array_t (arrayZ + start_offset, count); } hb_array_t sub_array (unsigned int start_offset, unsigned int seg_count) const @@ -173,6 +180,17 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> void free () { ::free ((void *) arrayZ); arrayZ = nullptr; length = 0; } + template + hb_array_t copy (hb_serialize_context_t *c) const + { + TRACE_SERIALIZE (this); + auto* out = c->start_embed (arrayZ); + if (unlikely (!c->extend_size (out, get_size ()))) return_trace (hb_array_t ()); + for (unsigned i = 0; i < length; i++) + out[i] = arrayZ[i]; /* TODO: add version that calls c->copy() */ + return_trace (hb_array_t (out, length)); + } + template bool sanitize (hb_sanitize_context_t *c) const { return c->check_array (arrayZ, length); } @@ -184,6 +202,7 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> public: Type *arrayZ; unsigned int length; + unsigned int backwards_length; }; template inline hb_array_t hb_array (T *array, unsigned int length) @@ -210,11 +229,23 @@ struct hb_sorted_array_t : static constexpr bool is_sorted_iterator = true; hb_sorted_array_t () : hb_array_t () {} - hb_sorted_array_t (const hb_array_t &o) : hb_array_t (o) {} - template - hb_sorted_array_t (const hb_sorted_array_t &o) : hb_array_t (o) {} hb_sorted_array_t (Type *array_, unsigned int length_) : hb_array_t (array_, length_) {} - template hb_sorted_array_t (Type (&array_)[length_]) : hb_array_t (array_) {} + template + hb_sorted_array_t (Type (&array_)[length_]) : hb_array_t (array_) {} + + template + hb_sorted_array_t (const hb_array_t &o) : + hb_iter_t, Type&> (), + hb_array_t (o) {} + template + hb_sorted_array_t& operator = (const hb_array_t &o) + { hb_array_t (*this) = o; return *this; } + + /* Iterator implementation. */ + bool operator != (const hb_sorted_array_t& o) const + { return this->arrayZ != o.arrayZ || this->length != o.length; } hb_sorted_array_t sub_array (unsigned int start_offset, unsigned int *seg_count /* IN/OUT */) const { return hb_sorted_array_t (((const hb_array_t *) (this))->sub_array (start_offset, seg_count)); } diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh index a2ce8f28d..a82ce6cf3 100644 --- a/src/hb-atomic.hh +++ b/src/hb-atomic.hh @@ -107,7 +107,7 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) static inline void _hb_memory_barrier () { -#if !defined(MemoryBarrier) +#ifndef MemoryBarrier /* MinGW has a convoluted history of supporting MemoryBarrier. */ LONG dummy = 0; InterlockedExchange (&dummy, 1); @@ -283,7 +283,7 @@ struct hb_atomic_int_t template struct hb_atomic_ptr_t { - typedef hb_remove_pointer (P) T; + typedef hb_remove_pointer

T; void init (T* v_ = nullptr) { set_relaxed (v_); } void set_relaxed (T* v_) { hb_atomic_ptr_impl_set_relaxed (&v, v_); } diff --git a/src/hb-blob.cc b/src/hb-blob.cc index 54637c727..699f66b1a 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -155,7 +155,7 @@ hb_blob_create_sub_blob (hb_blob_t *parent, hb_blob_make_immutable (parent); blob = hb_blob_create (parent->data + offset, - MIN (length, parent->length - offset), + hb_min (length, parent->length - offset), HB_MEMORY_MODE_READONLY, hb_blob_reference (parent), _hb_blob_destroy); diff --git a/src/hb-blob.hh b/src/hb-blob.hh index 3a30efe55..cff492fa0 100644 --- a/src/hb-blob.hh +++ b/src/hb-blob.hh @@ -81,7 +81,7 @@ struct hb_blob_t template struct hb_blob_ptr_t { - typedef hb_remove_pointer (P) T; + typedef hb_remove_pointer

T; hb_blob_ptr_t (hb_blob_t *b_ = nullptr) : b (b_) {} hb_blob_t * operator = (hb_blob_t *b_) { return b = b_; } diff --git a/src/hb-buffer-deserialize-json.hh b/src/hb-buffer-deserialize-json.hh index 1f9e2e91d..8631d52e8 100644 --- a/src/hb-buffer-deserialize-json.hh +++ b/src/hb-buffer-deserialize-json.hh @@ -1,30 +1,28 @@ - -#line 1 "hb-buffer-deserialize-json.rl" /* - * Copyright © 2013 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 - */ +* Copyright © 2013 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_BUFFER_DESERIALIZE_JSON_HH #define HB_BUFFER_DESERIALIZE_JSON_HH @@ -32,400 +30,208 @@ #include "hb.hh" -#line 36 "hb-buffer-deserialize-json.hh" static const unsigned char _deserialize_json_trans_keys[] = { - 0u, 0u, 9u, 123u, 9u, 34u, 97u, 103u, 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u, - 48u, 57u, 9u, 125u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, - 9u, 125u, 9u, 125u, 108u, 108u, 34u, 34u, 9u, 58u, 9u, 57u, 9u, 125u, 9u, 125u, - 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 34u, 34u, - 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, - 65u, 122u, 34u, 122u, 9u, 125u, 9u, 125u, 9u, 93u, 9u, 123u, 0u, 0u, 0 + 1u, 0u, 0u, 18u, 0u, 2u, 11u, 14u, + 16u, 17u, 2u, 2u, 0u, 8u, 0u, 7u, + 6u, 7u, 0u, 19u, 0u, 19u, 0u, 19u, + 2u, 2u, 0u, 8u, 0u, 7u, 6u, 7u, + 0u, 19u, 0u, 19u, 15u, 15u, 2u, 2u, + 0u, 8u, 0u, 7u, 0u, 19u, 0u, 19u, + 16u, 17u, 2u, 2u, 0u, 8u, 0u, 7u, + 6u, 7u, 0u, 19u, 0u, 19u, 2u, 2u, + 0u, 8u, 0u, 7u, 6u, 7u, 0u, 19u, + 0u, 19u, 2u, 2u, 0u, 8u, 0u, 7u, + 9u, 17u, 2u, 17u, 0u, 19u, 0u, 19u, + 0u, 10u, 0u, 18u, 1u, 0u, 0u }; -static const char _deserialize_json_key_spans[] = { - 0, 115, 26, 7, 2, 1, 50, 49, - 10, 117, 117, 117, 1, 50, 49, 10, - 117, 117, 1, 1, 50, 49, 117, 117, - 2, 1, 50, 49, 10, 117, 117, 1, - 50, 49, 10, 117, 117, 1, 50, 49, - 58, 89, 117, 117, 85, 115, 0 +static const char _deserialize_json_char_class[] = { + 0, 0, 0, 0, 0, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 4, 5, 1, 6, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 8, 1, 1, 1, 1, 1, 1, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 1, 1, 10, 1, 5, 1, + 11, 9, 12, 13, 9, 9, 14, 9, + 9, 9, 9, 15, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 16, + 17, 9, 18, 1, 19, 0 }; static const short _deserialize_json_index_offsets[] = { - 0, 0, 116, 143, 151, 154, 156, 207, - 257, 268, 386, 504, 622, 624, 675, 725, - 736, 854, 972, 974, 976, 1027, 1077, 1195, - 1313, 1316, 1318, 1369, 1419, 1430, 1548, 1666, - 1668, 1719, 1769, 1780, 1898, 2016, 2018, 2069, - 2119, 2178, 2268, 2386, 2504, 2590, 2706 + 0, 0, 19, 22, 26, 28, 29, 38, + 46, 48, 68, 88, 108, 109, 118, 126, + 128, 148, 168, 169, 170, 179, 187, 207, + 227, 229, 230, 239, 247, 249, 269, 289, + 290, 299, 307, 309, 329, 349, 350, 359, + 367, 376, 392, 412, 432, 443, 462, 0 }; static const char _deserialize_json_indicies[] = { - 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 0, 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, 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, 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, - 1, 1, 1, 2, 1, 3, 3, 3, - 3, 3, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 1, 4, 1, - 5, 1, 6, 7, 1, 1, 8, 1, - 9, 10, 1, 11, 1, 11, 11, 11, - 11, 11, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 11, 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, 12, 1, - 12, 12, 12, 12, 12, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 12, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 13, 1, 1, 14, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 1, 16, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 1, 18, 18, 18, - 18, 18, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 18, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 19, 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, 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, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 20, 1, 21, 21, 21, 21, 21, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 21, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 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, 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, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 22, - 1, 18, 18, 18, 18, 18, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 18, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 19, 1, 1, 1, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 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, 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, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 20, 1, 23, - 1, 23, 23, 23, 23, 23, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 23, 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, 24, 1, 24, 24, 24, 24, - 24, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 24, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 25, 1, 1, 26, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 1, 28, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 1, 30, 30, 30, 30, 30, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 30, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 31, 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, 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, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 32, 1, 30, - 30, 30, 30, 30, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 30, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 31, 1, 1, 1, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, - 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, 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, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 32, 1, 33, 1, 34, - 1, 34, 34, 34, 34, 34, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 34, 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, 35, 1, 35, 35, 35, 35, - 35, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 35, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 36, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 1, 38, 38, - 38, 38, 38, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 38, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 39, 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, 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, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 40, 1, 38, 38, 38, 38, - 38, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 38, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 39, - 1, 1, 1, 41, 41, 41, 41, 41, - 41, 41, 41, 41, 41, 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, 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, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 40, 1, 42, 43, 1, 44, 1, 44, - 44, 44, 44, 44, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 44, 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, - 45, 1, 45, 45, 45, 45, 45, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 45, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 46, 1, - 1, 47, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 1, 49, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 1, 51, - 51, 51, 51, 51, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 51, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 52, 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, - 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, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 53, 1, 51, 51, 51, - 51, 51, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 51, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 52, 1, 1, 1, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 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, 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, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 53, 1, 54, 1, 54, 54, 54, - 54, 54, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 54, 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, 55, 1, - 55, 55, 55, 55, 55, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 55, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 56, 1, 1, 57, - 58, 58, 58, 58, 58, 58, 58, 58, - 58, 1, 59, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 1, 61, 61, 61, - 61, 61, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 61, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 62, 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, 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, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 63, 1, 61, 61, 61, 61, 61, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 61, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 62, 1, - 1, 1, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 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, 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, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 63, - 1, 64, 1, 64, 64, 64, 64, 64, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 64, 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, 65, 1, 65, 65, - 65, 65, 65, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 65, 1, 66, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 67, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 1, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 1, 1, 1, 1, 1, 1, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 1, 70, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 71, 71, - 1, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 1, 1, 1, 1, 1, - 1, 1, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 1, 1, 1, 1, - 71, 1, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 1, 72, 72, 72, - 72, 72, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 72, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 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, 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, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 74, 1, 72, 72, 72, 72, 72, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 72, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 73, 1, - 1, 1, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 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, 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, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 74, - 1, 76, 76, 76, 76, 76, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 76, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 77, 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, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 78, 1, 0, - 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 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, 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, 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, 1, 1, - 1, 2, 1, 1, 0 + 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 3, 1, 4, 5, 6, + 7, 8, 9, 10, 11, 11, 1, 1, + 1, 1, 1, 1, 1, 12, 12, 1, + 1, 1, 13, 1, 14, 15, 16, 17, + 18, 1, 1, 19, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 20, 21, 1, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 22, + 18, 1, 1, 19, 1, 1, 17, 17, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 20, 23, 23, 1, 1, + 1, 1, 1, 1, 1, 24, 24, 1, + 1, 1, 25, 1, 26, 27, 28, 29, + 30, 1, 1, 31, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 32, 30, 1, 1, 31, + 1, 1, 29, 29, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 32, + 33, 34, 34, 1, 1, 1, 1, 1, + 1, 1, 35, 35, 1, 1, 1, 1, + 1, 36, 37, 38, 1, 1, 39, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 40, 38, + 1, 1, 39, 1, 1, 41, 41, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 40, 42, 43, 44, 44, 1, + 1, 1, 1, 1, 1, 1, 45, 45, + 1, 1, 1, 46, 1, 47, 48, 49, + 50, 51, 1, 1, 52, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 53, 51, 1, 1, + 52, 1, 1, 50, 50, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 53, 54, 54, 1, 1, 1, 1, 1, + 1, 1, 55, 55, 1, 1, 1, 56, + 1, 57, 58, 59, 60, 61, 1, 1, + 62, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 63, 61, 1, 1, 62, 1, 1, 60, + 60, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 63, 64, 64, 1, + 1, 1, 1, 1, 1, 1, 65, 65, + 1, 66, 1, 1, 1, 67, 68, 69, + 1, 69, 69, 69, 69, 69, 69, 69, + 70, 1, 71, 71, 71, 71, 1, 71, + 1, 71, 71, 71, 71, 71, 71, 71, + 72, 1, 1, 73, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 74, 72, 1, 1, 73, + 1, 1, 75, 75, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 74, + 76, 1, 1, 77, 1, 1, 1, 1, + 1, 1, 78, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 0 }; -static const char _deserialize_json_trans_targs[] = { - 1, 0, 2, 2, 3, 4, 18, 24, - 37, 5, 12, 6, 7, 8, 9, 11, - 9, 11, 10, 2, 44, 10, 44, 13, - 14, 15, 16, 17, 16, 17, 10, 2, - 44, 19, 20, 21, 22, 23, 10, 2, - 44, 23, 25, 31, 26, 27, 28, 29, - 30, 29, 30, 10, 2, 44, 32, 33, - 34, 35, 36, 35, 36, 10, 2, 44, - 38, 39, 40, 42, 43, 41, 10, 41, - 10, 2, 44, 43, 44, 45, 46 +static const char _deserialize_json_index_defaults[] = { + 0, 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, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0 }; -static const char _deserialize_json_trans_actions[] = { - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 2, 2, 2, - 0, 0, 3, 3, 4, 0, 5, 0, - 0, 2, 2, 2, 0, 0, 6, 6, - 7, 0, 0, 0, 2, 2, 8, 8, - 9, 0, 0, 0, 0, 0, 2, 2, - 2, 0, 0, 10, 10, 11, 0, 0, - 2, 2, 2, 0, 0, 12, 12, 13, - 0, 0, 0, 2, 2, 2, 14, 0, - 15, 15, 16, 0, 0, 0, 0 +static const char _deserialize_json_trans_cond_spaces[] = { + -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, -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, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 0 +}; + +static const char _deserialize_json_cond_targs[] = { + 1, 0, 2, 2, 3, 4, 18, 24, + 37, 5, 12, 6, 7, 8, 9, 11, + 9, 11, 10, 2, 44, 10, 44, 13, + 14, 15, 16, 17, 16, 17, 10, 2, + 44, 19, 20, 21, 22, 23, 10, 2, + 44, 23, 25, 31, 26, 27, 28, 29, + 30, 29, 30, 10, 2, 44, 32, 33, + 34, 35, 36, 35, 36, 10, 2, 44, + 38, 39, 40, 42, 43, 41, 10, 41, + 10, 2, 44, 43, 44, 45, 46, 0 +}; + +static const char _deserialize_json_cond_actions[] = { + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2, 2, 2, + 0, 0, 3, 3, 4, 0, 5, 0, + 0, 2, 2, 2, 0, 0, 6, 6, + 7, 0, 0, 0, 2, 2, 8, 8, + 9, 0, 0, 0, 0, 0, 2, 2, + 2, 0, 0, 10, 10, 11, 0, 0, + 2, 2, 2, 0, 0, 12, 12, 13, + 0, 0, 0, 2, 2, 2, 14, 0, + 15, 15, 16, 0, 0, 0, 0, 0 +}; + +static const char _deserialize_json_eof_cond_spaces[] = { + -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, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 0 +}; + +static const char _deserialize_json_eof_cond_key_offs[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 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 _deserialize_json_eof_cond_key_lens[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 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 _deserialize_json_eof_cond_keys[] = { + 0 +}; + +static const char _deserialize_json_nfa_targs[] = { + 0, 0 +}; + +static const char _deserialize_json_nfa_offsets[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 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 _deserialize_json_nfa_push_actions[] = { + 0, 0 +}; + +static const char _deserialize_json_nfa_pop_trans[] = { + 0, 0 }; static const int deserialize_json_start = 1; @@ -435,209 +241,254 @@ static const int deserialize_json_error = 0; static const int deserialize_json_en_main = 1; -#line 97 "hb-buffer-deserialize-json.rl" - static hb_bool_t _hb_buffer_deserialize_glyphs_json (hb_buffer_t *buffer, - const char *buf, - unsigned int buf_len, - const char **end_ptr, - hb_font_t *font) +const char *buf, +unsigned int buf_len, +const char **end_ptr, +hb_font_t *font) { - const char *p = buf, *pe = buf + buf_len; - - /* Ensure we have positions. */ - (void) hb_buffer_get_glyph_positions (buffer, nullptr); - - while (p < pe && ISSPACE (*p)) - p++; - if (p < pe && *p == (buffer->len ? ',' : '[')) - { - *end_ptr = ++p; - } - - const char *tok = nullptr; - int cs; - hb_glyph_info_t info = {0}; - hb_glyph_position_t pos = {0}; - -#line 466 "hb-buffer-deserialize-json.hh" + const char *p = buf, *pe = buf + buf_len; + + /* Ensure we have positions. */ + (void) hb_buffer_get_glyph_positions (buffer, nullptr); + + while (p < pe && ISSPACE (*p)) + p++; + if (p < pe && *p == (buffer->len ? ',' : '[')) { - cs = deserialize_json_start; + *end_ptr = ++p; } - -#line 471 "hb-buffer-deserialize-json.hh" + + const char *tok = nullptr; + int cs; + hb_glyph_info_t info = {0}; + hb_glyph_position_t pos = {0}; + { - int _slen; - int _trans; - const unsigned char *_keys; - const char *_inds; - if ( p == pe ) - goto _test_eof; - if ( cs == 0 ) - goto _out; -_resume: - _keys = _deserialize_json_trans_keys + (cs<<1); - _inds = _deserialize_json_indicies + _deserialize_json_index_offsets[cs]; - - _slen = _deserialize_json_key_spans[cs]; - _trans = _inds[ _slen > 0 && _keys[0] <=(*p) && - (*p) <= _keys[1] ? - (*p) - _keys[0] : _slen ]; - - cs = _deserialize_json_trans_targs[_trans]; - - if ( _deserialize_json_trans_actions[_trans] == 0 ) - goto _again; - - switch ( _deserialize_json_trans_actions[_trans] ) { - case 1: -#line 38 "hb-buffer-deserialize-json.rl" - { - memset (&info, 0, sizeof (info)); - memset (&pos , 0, sizeof (pos )); -} - break; - case 5: -#line 43 "hb-buffer-deserialize-json.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 2: -#line 51 "hb-buffer-deserialize-json.rl" - { - tok = p; -} - break; - case 14: -#line 55 "hb-buffer-deserialize-json.rl" - { - if (!hb_font_glyph_from_string (font, - tok, p - tok, - &info.codepoint)) - return false; -} - break; - case 15: -#line 62 "hb-buffer-deserialize-json.rl" - { if (!parse_uint (tok, p, &info.codepoint)) return false; } - break; - case 8: -#line 63 "hb-buffer-deserialize-json.rl" - { if (!parse_uint (tok, p, &info.cluster )) return false; } - break; - case 10: -#line 64 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.x_offset )) return false; } - break; - case 12: -#line 65 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.y_offset )) return false; } - break; - case 3: -#line 66 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.x_advance)) return false; } - break; - case 6: -#line 67 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.y_advance)) return false; } - break; - case 16: -#line 62 "hb-buffer-deserialize-json.rl" - { if (!parse_uint (tok, p, &info.codepoint)) return false; } -#line 43 "hb-buffer-deserialize-json.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 9: -#line 63 "hb-buffer-deserialize-json.rl" - { if (!parse_uint (tok, p, &info.cluster )) return false; } -#line 43 "hb-buffer-deserialize-json.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 11: -#line 64 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.x_offset )) return false; } -#line 43 "hb-buffer-deserialize-json.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 13: -#line 65 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.y_offset )) return false; } -#line 43 "hb-buffer-deserialize-json.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 4: -#line 66 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.x_advance)) return false; } -#line 43 "hb-buffer-deserialize-json.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 7: -#line 67 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.y_advance)) return false; } -#line 43 "hb-buffer-deserialize-json.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; -#line 624 "hb-buffer-deserialize-json.hh" + cs = (int)deserialize_json_start; } - -_again: - if ( cs == 0 ) - goto _out; - if ( ++p != pe ) - goto _resume; - _test_eof: {} - _out: {} + + { + unsigned int _trans = 0;const unsigned char * _keys;const char * _inds; { + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; + _resume: { + _keys = ( _deserialize_json_trans_keys + ((cs<<1))); + _inds = ( _deserialize_json_indicies + (_deserialize_json_index_offsets[cs])); + + if ( ( (*( p))) <= 125 && ( (*( p))) >= 9 ) + { + int _ic = (int)_deserialize_json_char_class[(int)( (*( p))) - 9]; + if ( _ic <= (int)(*( _keys+1)) && _ic >= (int)(*( _keys)) ) + _trans = (unsigned int)(*( _inds + (int)( _ic - (int)(*( _keys)) ) )); + else + _trans = (unsigned int)_deserialize_json_index_defaults[cs]; + } + else { + _trans = (unsigned int)_deserialize_json_index_defaults[cs]; + } + + goto _match_cond; + } + _match_cond: { + cs = (int)_deserialize_json_cond_targs[_trans]; + + if ( _deserialize_json_cond_actions[_trans] == 0 ) + goto _again; + + switch ( _deserialize_json_cond_actions[_trans] ) { + case 1: { + { + #line 38 "hb-buffer-deserialize-json.rl" + + memset (&info, 0, sizeof (info)); + memset (&pos , 0, sizeof (pos )); + } + + break; } + case 5: { + { + #line 43 "hb-buffer-deserialize-json.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 2: { + { + #line 51 "hb-buffer-deserialize-json.rl" + + tok = p; + } + + break; } + case 14: { + { + #line 55 "hb-buffer-deserialize-json.rl" + + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + + break; } + case 15: { + { + #line 62 "hb-buffer-deserialize-json.rl" + if (!parse_uint (tok, p, &info.codepoint)) return false; } + + break; } + case 8: { + { + #line 63 "hb-buffer-deserialize-json.rl" + if (!parse_uint (tok, p, &info.cluster )) return false; } + + break; } + case 10: { + { + #line 64 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.x_offset )) return false; } + + break; } + case 12: { + { + #line 65 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.y_offset )) return false; } + + break; } + case 3: { + { + #line 66 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.x_advance)) return false; } + + break; } + case 6: { + { + #line 67 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.y_advance)) return false; } + + break; } + case 16: { + { + #line 62 "hb-buffer-deserialize-json.rl" + if (!parse_uint (tok, p, &info.codepoint)) return false; } + { + #line 43 "hb-buffer-deserialize-json.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 9: { + { + #line 63 "hb-buffer-deserialize-json.rl" + if (!parse_uint (tok, p, &info.cluster )) return false; } + { + #line 43 "hb-buffer-deserialize-json.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 11: { + { + #line 64 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.x_offset )) return false; } + { + #line 43 "hb-buffer-deserialize-json.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 13: { + { + #line 65 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.y_offset )) return false; } + { + #line 43 "hb-buffer-deserialize-json.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 4: { + { + #line 66 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.x_advance)) return false; } + { + #line 43 "hb-buffer-deserialize-json.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 7: { + { + #line 67 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.y_advance)) return false; } + { + #line 43 "hb-buffer-deserialize-json.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + } + + + } + _again: { + if ( cs == 0 ) + goto _out; + p += 1; + if ( p != pe ) + goto _resume; + } + _test_eof: { {} + } + _out: { {} + } + } } - -#line 125 "hb-buffer-deserialize-json.rl" - - - *end_ptr = p; - - return p == pe && *(p-1) != ']'; + + + *end_ptr = p; + + return p == pe && *(p-1) != ']'; } #endif /* HB_BUFFER_DESERIALIZE_JSON_HH */ diff --git a/src/hb-buffer-deserialize-text.hh b/src/hb-buffer-deserialize-text.hh index 67f0a1252..28ab3f1cd 100644 --- a/src/hb-buffer-deserialize-text.hh +++ b/src/hb-buffer-deserialize-text.hh @@ -1,30 +1,28 @@ - -#line 1 "hb-buffer-deserialize-text.rl" /* - * Copyright © 2013 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 - */ +* Copyright © 2013 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_BUFFER_DESERIALIZE_TEXT_HH #define HB_BUFFER_DESERIALIZE_TEXT_HH @@ -32,277 +30,160 @@ #include "hb.hh" -#line 36 "hb-buffer-deserialize-text.hh" static const unsigned char _deserialize_text_trans_keys[] = { - 0u, 0u, 9u, 122u, 45u, 57u, 48u, 57u, 45u, 57u, 48u, 57u, 48u, 57u, 45u, 57u, - 48u, 57u, 44u, 44u, 45u, 57u, 48u, 57u, 44u, 57u, 9u, 124u, 9u, 124u, 0u, 0u, - 9u, 122u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, - 9u, 124u, 9u, 124u, 9u, 124u, 0 + 1u, 0u, 0u, 10u, 4u, 7u, 6u, 7u, + 4u, 7u, 6u, 7u, 6u, 7u, 4u, 7u, + 6u, 7u, 3u, 3u, 4u, 7u, 6u, 7u, + 3u, 7u, 0u, 12u, 0u, 12u, 1u, 0u, + 0u, 10u, 0u, 12u, 0u, 12u, 0u, 12u, + 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, + 0u, 12u, 0u, 12u, 0u, 12u, 0u }; -static const char _deserialize_text_key_spans[] = { - 0, 114, 13, 10, 13, 10, 10, 13, - 10, 1, 13, 10, 14, 116, 116, 0, - 114, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116 +static const char _deserialize_text_char_class[] = { + 0, 0, 0, 0, 0, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 3, 4, 5, 1, 6, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 1, 1, 1, 8, 1, 1, 9, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 1, 1, 11, 1, 5, 1, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 1, 12, 0 }; static const short _deserialize_text_index_offsets[] = { - 0, 0, 115, 129, 140, 154, 165, 176, - 190, 201, 203, 217, 228, 243, 360, 477, - 478, 593, 710, 827, 944, 1061, 1178, 1295, - 1412, 1529, 1646 + 0, 0, 11, 15, 17, 21, 23, 25, + 29, 31, 32, 36, 38, 43, 56, 69, + 69, 80, 93, 106, 119, 132, 145, 158, + 171, 184, 197, 0 }; static const char _deserialize_text_indicies[] = { - 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 2, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 1, 5, 1, 1, 6, - 7, 7, 7, 7, 7, 7, 7, 7, - 7, 1, 8, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 1, 10, 1, 1, - 11, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 1, 13, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 1, 15, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 1, 17, 1, 1, 18, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 1, 20, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 1, 22, 1, 23, 1, 1, 24, - 25, 25, 25, 25, 25, 25, 25, 25, - 25, 1, 26, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 1, 22, 1, 1, - 1, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 1, 28, 28, 28, 28, - 28, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 28, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 29, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 30, 1, 1, 31, 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, - 32, 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, 1, 33, - 1, 34, 34, 34, 34, 34, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 34, 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, 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, 1, 1, 35, 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, 1, 36, 1, 1, 0, - 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 1, 1, 1, 1, 1, 1, 1, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 1, 1, 1, 1, 1, 1, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 1, 28, 28, 28, 28, 28, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 28, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 29, 1, 1, 1, - 1, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 1, 1, 1, 30, 1, - 1, 31, 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, 32, 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, 1, 33, 1, 38, - 38, 38, 38, 38, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 38, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 39, 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, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 40, 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, 1, 41, 1, 42, 42, 42, 42, - 42, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 42, 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, 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, 1, 1, - 43, 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, 1, 44, - 1, 42, 42, 42, 42, 42, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 42, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 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, 1, - 1, 1, 1, 1, 1, 43, 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, 1, 44, 1, 38, 38, - 38, 38, 38, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 38, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 39, 1, 1, 1, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 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, 1, 1, 1, 1, - 1, 1, 40, 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, - 1, 41, 1, 45, 45, 45, 45, 45, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 45, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 46, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 47, 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, 48, - 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, 1, 49, 1, - 50, 50, 50, 50, 50, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 50, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 51, 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, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 52, 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, 1, 53, 1, 50, 50, 50, - 50, 50, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 50, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 51, - 1, 1, 1, 1, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 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, 1, 1, 1, 1, 1, - 1, 52, 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, 1, - 53, 1, 45, 45, 45, 45, 45, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 45, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 46, 1, 1, 1, - 1, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 1, 1, 1, 1, 1, - 1, 47, 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, 48, 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, 1, 49, 1, 28, - 28, 28, 28, 28, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 28, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 29, 1, 55, 55, 1, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 1, 1, 1, 30, 1, 1, 31, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 1, 1, 32, 1, 55, 1, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, - 55, 1, 33, 1, 0 + 0, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 5, 1, 6, 7, 8, + 9, 10, 1, 11, 12, 13, 14, 15, + 16, 17, 1, 18, 19, 20, 21, 22, + 23, 1, 24, 25, 26, 27, 22, 1, + 1, 21, 21, 28, 1, 29, 1, 1, + 1, 1, 1, 30, 31, 1, 32, 33, + 34, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 35, 36, 0, 1, 1, + 1, 1, 1, 2, 3, 1, 1, 4, + 28, 1, 29, 1, 1, 1, 37, 37, + 30, 31, 1, 32, 33, 38, 1, 1, + 39, 1, 1, 1, 1, 1, 1, 1, + 40, 41, 42, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 43, 44, 42, + 1, 1, 1, 1, 1, 14, 14, 1, + 1, 1, 43, 44, 38, 1, 1, 39, + 1, 1, 9, 9, 1, 1, 1, 40, + 41, 45, 1, 46, 1, 1, 1, 1, + 1, 1, 47, 1, 48, 49, 50, 1, + 51, 1, 1, 1, 1, 1, 1, 1, + 1, 52, 53, 50, 1, 51, 1, 1, + 1, 27, 27, 1, 1, 1, 52, 53, + 45, 1, 46, 1, 1, 1, 54, 54, + 1, 47, 1, 48, 49, 28, 1, 29, + 1, 55, 55, 55, 55, 30, 31, 55, + 32, 33, 0 }; -static const char _deserialize_text_trans_targs[] = { - 1, 0, 13, 17, 26, 3, 18, 21, - 18, 21, 5, 19, 20, 19, 20, 22, - 25, 8, 9, 12, 9, 12, 10, 11, - 23, 24, 23, 24, 14, 2, 6, 7, - 15, 16, 14, 15, 16, 17, 14, 4, - 15, 16, 14, 15, 16, 14, 2, 7, - 15, 16, 14, 2, 15, 16, 25, 26 +static const char _deserialize_text_index_defaults[] = { + 0, 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, 0 }; -static const char _deserialize_text_trans_actions[] = { - 0, 0, 1, 1, 1, 2, 2, 2, - 0, 0, 2, 2, 2, 0, 0, 2, - 2, 2, 2, 2, 0, 0, 3, 2, - 2, 2, 0, 0, 4, 5, 5, 5, - 4, 4, 0, 0, 0, 0, 6, 7, - 6, 6, 8, 8, 8, 9, 10, 10, - 9, 9, 11, 12, 11, 11, 0, 0 +static const char _deserialize_text_trans_cond_spaces[] = { + -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, -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, + 0 +}; + +static const char _deserialize_text_cond_targs[] = { + 1, 0, 13, 17, 26, 3, 18, 21, + 18, 21, 5, 19, 20, 19, 20, 22, + 25, 8, 9, 12, 9, 12, 10, 11, + 23, 24, 23, 24, 14, 2, 6, 7, + 15, 16, 14, 15, 16, 17, 14, 4, + 15, 16, 14, 15, 16, 14, 2, 7, + 15, 16, 14, 2, 15, 16, 25, 26, + 0 +}; + +static const char _deserialize_text_cond_actions[] = { + 0, 0, 1, 1, 1, 2, 2, 2, + 0, 0, 2, 2, 2, 0, 0, 2, + 2, 2, 2, 2, 0, 0, 3, 2, + 2, 2, 0, 0, 4, 5, 5, 5, + 4, 4, 0, 0, 0, 0, 6, 7, + 6, 6, 8, 8, 8, 9, 10, 10, + 9, 9, 11, 12, 11, 11, 0, 0, + 0 +}; + +static const char _deserialize_text_eof_cond_spaces[] = { + -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, 0 +}; + +static const char _deserialize_text_eof_cond_key_offs[] = { + 0, 0, 0, 0, 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 _deserialize_text_eof_cond_key_lens[] = { + 0, 0, 0, 0, 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 _deserialize_text_eof_cond_keys[] = { + 0 }; static const char _deserialize_text_eof_actions[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 4, 0, 0, - 0, 4, 6, 8, 8, 6, 9, 11, - 11, 9, 4 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 4, 0, 0, + 0, 4, 6, 8, 8, 6, 9, 11, + 11, 9, 4, 0 +}; + +static const char _deserialize_text_nfa_targs[] = { + 0, 0 +}; + +static const char _deserialize_text_nfa_offsets[] = { + 0, 0, 0, 0, 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 _deserialize_text_nfa_push_actions[] = { + 0, 0 +}; + +static const char _deserialize_text_nfa_pop_trans[] = { + 0, 0 }; static const int deserialize_text_start = 1; @@ -312,260 +193,338 @@ static const int deserialize_text_error = 0; static const int deserialize_text_en_main = 1; -#line 91 "hb-buffer-deserialize-text.rl" - static hb_bool_t _hb_buffer_deserialize_glyphs_text (hb_buffer_t *buffer, - const char *buf, - unsigned int buf_len, - const char **end_ptr, - hb_font_t *font) +const char *buf, +unsigned int buf_len, +const char **end_ptr, +hb_font_t *font) { - const char *p = buf, *pe = buf + buf_len; - - /* Ensure we have positions. */ - (void) hb_buffer_get_glyph_positions (buffer, nullptr); - - while (p < pe && ISSPACE (*p)) - p++; - if (p < pe && *p == (buffer->len ? '|' : '[')) - { - *end_ptr = ++p; - } - - const char *eof = pe, *tok = nullptr; - int cs; - hb_glyph_info_t info = {0}; - hb_glyph_position_t pos = {0}; - -#line 343 "hb-buffer-deserialize-text.hh" + const char *p = buf, *pe = buf + buf_len; + + /* Ensure we have positions. */ + (void) hb_buffer_get_glyph_positions (buffer, nullptr); + + while (p < pe && ISSPACE (*p)) + p++; + if (p < pe && *p == (buffer->len ? '|' : '[')) { - cs = deserialize_text_start; + *end_ptr = ++p; } - -#line 348 "hb-buffer-deserialize-text.hh" + + const char *eof = pe, *tok = nullptr; + int cs; + hb_glyph_info_t info = {0}; + hb_glyph_position_t pos = {0}; + { - int _slen; - int _trans; - const unsigned char *_keys; - const char *_inds; - if ( p == pe ) - goto _test_eof; - if ( cs == 0 ) - goto _out; -_resume: - _keys = _deserialize_text_trans_keys + (cs<<1); - _inds = _deserialize_text_indicies + _deserialize_text_index_offsets[cs]; - - _slen = _deserialize_text_key_spans[cs]; - _trans = _inds[ _slen > 0 && _keys[0] <=(*p) && - (*p) <= _keys[1] ? - (*p) - _keys[0] : _slen ]; - - cs = _deserialize_text_trans_targs[_trans]; - - if ( _deserialize_text_trans_actions[_trans] == 0 ) - goto _again; - - switch ( _deserialize_text_trans_actions[_trans] ) { - case 2: -#line 51 "hb-buffer-deserialize-text.rl" - { - tok = p; -} - break; - case 5: -#line 55 "hb-buffer-deserialize-text.rl" - { - if (!hb_font_glyph_from_string (font, - tok, p - tok, - &info.codepoint)) - return false; -} - break; - case 10: -#line 62 "hb-buffer-deserialize-text.rl" - { if (!parse_uint (tok, p, &info.cluster )) return false; } - break; - case 3: -#line 63 "hb-buffer-deserialize-text.rl" - { if (!parse_int (tok, p, &pos.x_offset )) return false; } - break; - case 12: -#line 64 "hb-buffer-deserialize-text.rl" - { if (!parse_int (tok, p, &pos.y_offset )) return false; } - break; - case 7: -#line 65 "hb-buffer-deserialize-text.rl" - { if (!parse_int (tok, p, &pos.x_advance)) return false; } - break; - case 1: -#line 38 "hb-buffer-deserialize-text.rl" - { - memset (&info, 0, sizeof (info)); - memset (&pos , 0, sizeof (pos )); -} -#line 51 "hb-buffer-deserialize-text.rl" - { - tok = p; -} - break; - case 4: -#line 55 "hb-buffer-deserialize-text.rl" - { - if (!hb_font_glyph_from_string (font, - tok, p - tok, - &info.codepoint)) - return false; -} -#line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 9: -#line 62 "hb-buffer-deserialize-text.rl" - { if (!parse_uint (tok, p, &info.cluster )) return false; } -#line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 11: -#line 64 "hb-buffer-deserialize-text.rl" - { if (!parse_int (tok, p, &pos.y_offset )) return false; } -#line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 6: -#line 65 "hb-buffer-deserialize-text.rl" - { if (!parse_int (tok, p, &pos.x_advance)) return false; } -#line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 8: -#line 66 "hb-buffer-deserialize-text.rl" - { if (!parse_int (tok, p, &pos.y_advance)) return false; } -#line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; -#line 480 "hb-buffer-deserialize-text.hh" + cs = (int)deserialize_text_start; } - -_again: - if ( cs == 0 ) - goto _out; - if ( ++p != pe ) - goto _resume; - _test_eof: {} - if ( p == eof ) + { - switch ( _deserialize_text_eof_actions[cs] ) { - case 4: -#line 55 "hb-buffer-deserialize-text.rl" - { - if (!hb_font_glyph_from_string (font, - tok, p - tok, - &info.codepoint)) - return false; -} -#line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 9: -#line 62 "hb-buffer-deserialize-text.rl" - { if (!parse_uint (tok, p, &info.cluster )) return false; } -#line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 11: -#line 64 "hb-buffer-deserialize-text.rl" - { if (!parse_int (tok, p, &pos.y_offset )) return false; } -#line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 6: -#line 65 "hb-buffer-deserialize-text.rl" - { if (!parse_int (tok, p, &pos.x_advance)) return false; } -#line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; - case 8: -#line 66 "hb-buffer-deserialize-text.rl" - { if (!parse_int (tok, p, &pos.y_advance)) return false; } -#line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; - *end_ptr = p; -} - break; -#line 557 "hb-buffer-deserialize-text.hh" + int _cpc; + int _klen;const char * _cekeys;unsigned int _trans = 0;const unsigned char * _keys;const char * _inds; { + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; + _resume: { + _keys = ( _deserialize_text_trans_keys + ((cs<<1))); + _inds = ( _deserialize_text_indicies + (_deserialize_text_index_offsets[cs])); + + if ( ( (*( p))) <= 124 && ( (*( p))) >= 9 ) + { + int _ic = (int)_deserialize_text_char_class[(int)( (*( p))) - 9]; + if ( _ic <= (int)(*( _keys+1)) && _ic >= (int)(*( _keys)) ) + _trans = (unsigned int)(*( _inds + (int)( _ic - (int)(*( _keys)) ) )); + else + _trans = (unsigned int)_deserialize_text_index_defaults[cs]; + } + else { + _trans = (unsigned int)_deserialize_text_index_defaults[cs]; + } + + goto _match_cond; + } + _match_cond: { + cs = (int)_deserialize_text_cond_targs[_trans]; + + if ( _deserialize_text_cond_actions[_trans] == 0 ) + goto _again; + + switch ( _deserialize_text_cond_actions[_trans] ) { + case 2: { + { + #line 51 "hb-buffer-deserialize-text.rl" + + tok = p; + } + + break; } + case 5: { + { + #line 55 "hb-buffer-deserialize-text.rl" + + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + + break; } + case 10: { + { + #line 62 "hb-buffer-deserialize-text.rl" + if (!parse_uint (tok, p, &info.cluster )) return false; } + + break; } + case 3: { + { + #line 63 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.x_offset )) return false; } + + break; } + case 12: { + { + #line 64 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.y_offset )) return false; } + + break; } + case 7: { + { + #line 65 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.x_advance)) return false; } + + break; } + case 1: { + { + #line 38 "hb-buffer-deserialize-text.rl" + + memset (&info, 0, sizeof (info)); + memset (&pos , 0, sizeof (pos )); + } + { + #line 51 "hb-buffer-deserialize-text.rl" + + tok = p; + } + + break; } + case 4: { + { + #line 55 "hb-buffer-deserialize-text.rl" + + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + { + #line 43 "hb-buffer-deserialize-text.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 9: { + { + #line 62 "hb-buffer-deserialize-text.rl" + if (!parse_uint (tok, p, &info.cluster )) return false; } + { + #line 43 "hb-buffer-deserialize-text.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 11: { + { + #line 64 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.y_offset )) return false; } + { + #line 43 "hb-buffer-deserialize-text.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 6: { + { + #line 65 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.x_advance)) return false; } + { + #line 43 "hb-buffer-deserialize-text.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 8: { + { + #line 66 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.y_advance)) return false; } + { + #line 43 "hb-buffer-deserialize-text.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + } + + + } + _again: { + if ( cs == 0 ) + goto _out; + p += 1; + if ( p != pe ) + goto _resume; + } + _test_eof: { {} + if ( p == eof ) + { + if ( _deserialize_text_eof_cond_spaces[cs] != -1 ) { + _cekeys = ( _deserialize_text_eof_cond_keys + (_deserialize_text_eof_cond_key_offs[cs])); + _klen = (int)_deserialize_text_eof_cond_key_lens[cs]; + _cpc = 0; + { + const char *_lower = _cekeys; + const char *_upper = _cekeys + _klen - 1; + const char *_mid; + while ( 1 ) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( _cpc < (int)(*( _mid)) ) + _upper = _mid - 1; + else if ( _cpc > (int)(*( _mid)) ) + _lower = _mid + 1; + else { + goto _ok; + } + } + cs = 0; + goto _out; + } + _ok: {} + } + switch ( _deserialize_text_eof_actions[cs] ) { + case 4: { + { + #line 55 "hb-buffer-deserialize-text.rl" + + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + { + #line 43 "hb-buffer-deserialize-text.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 9: { + { + #line 62 "hb-buffer-deserialize-text.rl" + if (!parse_uint (tok, p, &info.cluster )) return false; } + { + #line 43 "hb-buffer-deserialize-text.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 11: { + { + #line 64 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.y_offset )) return false; } + { + #line 43 "hb-buffer-deserialize-text.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 6: { + { + #line 65 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.x_advance)) return false; } + { + #line 43 "hb-buffer-deserialize-text.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + case 8: { + { + #line 66 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.y_advance)) return false; } + { + #line 43 "hb-buffer-deserialize-text.rl" + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + + break; } + } + } + + } + _out: { {} + } + } } - } - - _out: {} - } - -#line 119 "hb-buffer-deserialize-text.rl" - - - *end_ptr = p; - - return p == pe && *(p-1) != ']'; + + + *end_ptr = p; + + return p == pe && *(p-1) != ']'; } #endif /* HB_BUFFER_DESERIALIZE_TEXT_HH */ diff --git a/src/hb-buffer-serialize.cc b/src/hb-buffer-serialize.cc index 6e265e84c..dcbdcea45 100644 --- a/src/hb-buffer-serialize.cc +++ b/src/hb-buffer-serialize.cc @@ -138,34 +138,34 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, *p++ = '"'; } else - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%u", info[i].codepoint)); + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%u", info[i].codepoint)); if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS)) { - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"cl\":%u", info[i].cluster)); + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"cl\":%u", info[i].cluster)); } if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS)) { - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"dx\":%d,\"dy\":%d", + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"dx\":%d,\"dy\":%d", 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", + p += hb_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) { if (info[i].mask & HB_GLYPH_FLAG_DEFINED) - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"fl\":%u", info[i].mask & HB_GLYPH_FLAG_DEFINED)); + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"fl\":%u", info[i].mask & HB_GLYPH_FLAG_DEFINED)); } if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS) { hb_glyph_extents_t extents; hb_font_get_glyph_extents(font, info[i].codepoint, &extents); - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"xb\":%d,\"yb\":%d", + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"xb\":%d,\"yb\":%d", extents.x_bearing, extents.y_bearing)); - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"w\":%d,\"h\":%d", + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"w\":%d,\"h\":%d", extents.width, extents.height)); } @@ -224,37 +224,37 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, p += strlen (p); } else - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%u", info[i].codepoint)); + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%u", info[i].codepoint)); if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS)) { - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "=%u", info[i].cluster)); + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "=%u", info[i].cluster)); } if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS)) { 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 += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "@%d,%d", x+pos[i].x_offset, y+pos[i].y_offset)); if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES)) { *p++ = '+'; - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%d", pos[i].x_advance)); + p += hb_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)); + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",%d", pos[i].y_advance)); } } if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS) { if (info[i].mask & HB_GLYPH_FLAG_DEFINED) - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "#%X", info[i].mask &HB_GLYPH_FLAG_DEFINED)); + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "#%X", info[i].mask &HB_GLYPH_FLAG_DEFINED)); } if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS) { hb_glyph_extents_t extents; hb_font_get_glyph_extents(font, info[i].codepoint, &extents); - p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "<%d,%d,%d,%d>", extents.x_bearing, extents.y_bearing, extents.width, extents.height)); + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "<%d,%d,%d,%d>", extents.x_bearing, extents.y_bearing, extents.width, extents.height)); } unsigned int l = p - b; @@ -380,7 +380,7 @@ static hb_bool_t parse_uint (const char *pp, const char *end, uint32_t *pv) { char buf[32]; - unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - pp)); + unsigned int len = hb_min (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - pp)); strncpy (buf, pp, len); buf[len] = '\0'; @@ -401,7 +401,7 @@ static hb_bool_t parse_int (const char *pp, const char *end, int32_t *pv) { char buf[32]; - unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - pp)); + unsigned int len = hb_min (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - pp)); strncpy (buf, pp, len); buf[len] = '\0'; diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 2dc02e9d6..d95404f5c 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -524,7 +524,7 @@ hb_buffer_t::merge_clusters_impl (unsigned int start, unsigned int cluster = info[start].cluster; for (unsigned int i = start + 1; i < end; i++) - cluster = MIN (cluster, info[i].cluster); + cluster = hb_min (cluster, info[i].cluster); /* Extend end */ while (end < len && info[end - 1].cluster == info[end].cluster) @@ -555,7 +555,7 @@ hb_buffer_t::merge_out_clusters (unsigned int start, unsigned int cluster = out_info[start].cluster; for (unsigned int i = start + 1; i < end; i++) - cluster = MIN (cluster, out_info[i].cluster); + cluster = hb_min (cluster, out_info[i].cluster); /* Extend start */ while (start && out_info[start - 1].cluster == out_info[start].cluster) diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 330f88bac..b2b190ace 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -379,7 +379,7 @@ struct hb_buffer_t unsigned int cluster) const { for (unsigned int i = start; i < end; i++) - cluster = MIN (cluster, infos[i].cluster); + cluster = hb_min (cluster, infos[i].cluster); return cluster; } void diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh index 78ef997b1..c5157c783 100644 --- a/src/hb-cff-interp-common.hh +++ b/src/hb-cff-interp-common.hh @@ -691,7 +691,7 @@ struct opset_t case OpCode_TwoByteNegInt0: case OpCode_TwoByteNegInt1: case OpCode_TwoByteNegInt2: case OpCode_TwoByteNegInt3: - env.argStack.push_int ((int16_t)(-(op - OpCode_TwoByteNegInt0) * 256 - env.str_ref[0] - 108)); + env.argStack.push_int ((-(int16_t)(op - OpCode_TwoByteNegInt0) * 256 - env.str_ref[0] - 108)); env.str_ref.inc (); break; diff --git a/src/hb-cff-interp-cs-common.hh b/src/hb-cff-interp-cs-common.hh index 283bdf14a..61bdba5f5 100644 --- a/src/hb-cff-interp-cs-common.hh +++ b/src/hb-cff-interp-cs-common.hh @@ -147,8 +147,9 @@ struct cs_interp_env_t : interp_env_t return callStack.in_error () || SUPER::in_error (); } - bool popSubrNum (const biased_subrs_t& biasedSubrs, unsigned int &subr_num) + bool pop_subr_num (const biased_subrs_t& biasedSubrs, unsigned int &subr_num) { + subr_num = 0; int n = SUPER::argStack.pop_int (); n += biasedSubrs.get_bias (); if (unlikely ((n < 0) || ((unsigned int)n >= biasedSubrs.get_count ()))) @@ -158,11 +159,11 @@ struct cs_interp_env_t : interp_env_t return true; } - void callSubr (const biased_subrs_t& biasedSubrs, cs_type_t type) + void call_subr (const biased_subrs_t& biasedSubrs, cs_type_t type) { - unsigned int subr_num; + unsigned int subr_num = 0; - if (unlikely (!popSubrNum (biasedSubrs, subr_num) + if (unlikely (!pop_subr_num (biasedSubrs, subr_num) || callStack.get_count () >= kMaxCallLimit)) { SUPER::set_error (); @@ -175,7 +176,7 @@ struct cs_interp_env_t : interp_env_t SUPER::str_ref = context.str_ref; } - void returnFromSubr () + void return_from_subr () { if (unlikely (SUPER::str_ref.in_error ())) SUPER::set_error (); @@ -246,7 +247,7 @@ struct path_procs_null_t static void flex1 (ENV &env, PARAM& param) {} }; -template > +template > struct cs_opset_t : opset_t { static void process_op (op_code_t op, ENV &env, PARAM& param) @@ -254,7 +255,7 @@ struct cs_opset_t : opset_t switch (op) { case OpCode_return: - env.returnFromSubr (); + env.return_from_subr (); break; case OpCode_endchar: OPSET::check_width (op, env, param); @@ -267,11 +268,11 @@ struct cs_opset_t : opset_t break; case OpCode_callsubr: - env.callSubr (env.localSubrs, CSType_LocalSubr); + env.call_subr (env.localSubrs, CSType_LocalSubr); break; case OpCode_callgsubr: - env.callSubr (env.globalSubrs, CSType_GlobalSubr); + env.call_subr (env.globalSubrs, CSType_GlobalSubr); break; case OpCode_hstem: diff --git a/src/hb-cff1-interp-cs.hh b/src/hb-cff1-interp-cs.hh index c7209ed80..cc528564c 100644 --- a/src/hb-cff1-interp-cs.hh +++ b/src/hb-cff1-interp-cs.hh @@ -81,7 +81,7 @@ struct cff1_cs_interp_env_t : cs_interp_env_t typedef cs_interp_env_t SUPER; }; -template > +template > struct cff1_cs_opset_t : cs_opset_t { /* PostScript-originated legacy opcodes (OpCode_add etc) are unsupported */ diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh index 49e5ee739..1faf20831 100644 --- a/src/hb-cff2-interp-cs.hh +++ b/src/hb-cff2-interp-cs.hh @@ -193,7 +193,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t typedef cs_interp_env_t SUPER; }; -template > +template > struct cff2_cs_opset_t : cs_opset_t { static void process_op (op_code_t op, cff2_cs_interp_env_t &env, PARAM& param) diff --git a/src/hb-common.cc b/src/hb-common.cc index ab93bf427..70be6939b 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -356,7 +356,7 @@ hb_language_from_string (const char *str, int len) { /* NUL-terminate it. */ char strbuf[64]; - len = MIN (len, (int) sizeof (strbuf) - 1); + len = hb_min (len, (int) sizeof (strbuf) - 1); memcpy (strbuf, str, len); strbuf[len] = '\0'; item = lang_find_or_insert (strbuf); @@ -488,7 +488,7 @@ hb_script_from_string (const char *str, int len) /** * hb_script_to_iso15924_tag: - * @script: an #hb_script_ to convert. + * @script: an #hb_script_t to convert. * * See hb_script_from_iso15924_tag(). * @@ -720,7 +720,7 @@ static bool parse_uint (const char **pp, const char *end, unsigned int *pv) { char buf[32]; - unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp)); + unsigned int len = hb_min (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp)); strncpy (buf, *pp, len); buf[len] = '\0'; @@ -744,7 +744,7 @@ static bool parse_uint32 (const char **pp, const char *end, uint32_t *pv) { char buf[32]; - unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp)); + unsigned int len = hb_min (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp)); strncpy (buf, *pp, len); buf[len] = '\0'; @@ -783,7 +783,7 @@ parse_uint32 (const char **pp, const char *end, uint32_t *pv) static void free_static_C_locale (); #endif -static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t, hb_C_locale_lazy_loader_t> { static HB_LOCALE_T create () @@ -825,7 +825,7 @@ static bool parse_float (const char **pp, const char *end, float *pv) { char buf[32]; - unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp)); + unsigned int len = hb_min (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp)); strncpy (buf, *pp, len); buf[len] = '\0'; @@ -1071,21 +1071,21 @@ hb_feature_to_string (hb_feature_t *feature, { s[len++] = '['; if (feature->start) - len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->start)); + len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->start)); if (feature->end != feature->start + 1) { s[len++] = ':'; if (feature->end != (unsigned int) -1) - len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->end)); + len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->end)); } s[len++] = ']'; } if (feature->value > 1) { s[len++] = '='; - len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->value)); + len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->value)); } assert (len < ARRAY_LENGTH (s)); - len = MIN (len, size - 1); + len = hb_min (len, size - 1); memcpy (buf, s, len); buf[len] = '\0'; } @@ -1152,14 +1152,71 @@ hb_variation_to_string (hb_variation_t *variation, while (len && s[len - 1] == ' ') len--; s[len++] = '='; - len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", (double) variation->value)); + len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", (double) variation->value)); assert (len < ARRAY_LENGTH (s)); - len = MIN (len, size - 1); + len = hb_min (len, size - 1); memcpy (buf, s, len); buf[len] = '\0'; } +/** + * hb_color_get_alpha: + * color: a #hb_color_t we are interested in its channels. + * + * Return value: Alpha channel value of the given color + * + * Since: REPLACEME + */ +uint8_t +(hb_color_get_alpha) (hb_color_t color) +{ + return hb_color_get_alpha (color); +} + +/** + * hb_color_get_red: + * color: a #hb_color_t we are interested in its channels. + * + * Return value: Red channel value of the given color + * + * Since: REPLACEME + */ +uint8_t +(hb_color_get_red) (hb_color_t color) +{ + return hb_color_get_red (color); +} + +/** + * hb_color_get_green: + * color: a #hb_color_t we are interested in its channels. + * + * Return value: Green channel value of the given color + * + * Since: REPLACEME + */ +uint8_t +(hb_color_get_green) (hb_color_t color) +{ + return hb_color_get_green (color); +} + +/** + * hb_color_get_blue: + * color: a #hb_color_t we are interested in its channels. + * + * Return value: Blue channel value of the given color + * + * Since: REPLACEME + */ +uint8_t +(hb_color_get_blue) (hb_color_t color) +{ + return hb_color_get_blue (color); +} + + /* If there is no visibility control, then hb-static.cc will NOT * define anything. Instead, we get it to define one set in here * only, so only libharfbuzz.so defines them, not other libs. */ diff --git a/src/hb-common.h b/src/hb-common.h index 371b2bfc9..edd9ffb86 100644 --- a/src/hb-common.h +++ b/src/hb-common.h @@ -467,39 +467,21 @@ typedef uint32_t hb_color_t; #define HB_COLOR(b,g,r,a) ((hb_color_t) HB_TAG ((b),(g),(r),(a))) -/** - * hb_color_get_alpha: - * - * - * - * Since: 2.1.0 - */ +HB_EXTERN uint8_t +hb_color_get_alpha (hb_color_t color); #define hb_color_get_alpha(color) ((color) & 0xFF) -/** - * hb_color_get_red: - * - * - * - * Since: 2.1.0 - */ -#define hb_color_get_red(color) (((color) >> 8) & 0xFF) -/** - * hb_color_get_green: - * - * - * - * Since: 2.1.0 - */ -#define hb_color_get_green(color) (((color) >> 16) & 0xFF) -/** - * hb_color_get_blue: - * - * - * - * Since: 2.1.0 - */ -#define hb_color_get_blue(color) (((color) >> 24) & 0xFF) +HB_EXTERN uint8_t +hb_color_get_red (hb_color_t color); +#define hb_color_get_red(color) (((color) >> 8) & 0xFF) + +HB_EXTERN uint8_t +hb_color_get_green (hb_color_t color); +#define hb_color_get_green(color) (((color) >> 16) & 0xFF) + +HB_EXTERN uint8_t +hb_color_get_blue (hb_color_t color); +#define hb_color_get_blue(color) (((color) >> 24) & 0xFF) HB_END_DECLS diff --git a/src/hb-config.hh b/src/hb-config.hh new file mode 100644 index 000000000..836d0cdb1 --- /dev/null +++ b/src/hb-config.hh @@ -0,0 +1,100 @@ +/* + * Copyright © 2019 Facebook, 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. + * + * Facebook Author(s): Behdad Esfahbod + */ + +#ifndef HB_CONFIG_HH +#define HB_CONFIG_HH + +#if 0 /* Make test happy. */ +#include "hb.hh" +#endif +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#ifdef HB_TINY +#define HB_LEAN +#define HB_MINI +//#define HB_NO_MT /* Let user choose */ +#endif + +#ifdef HB_LEAN +#define HB_DISABLE_DEPRECATED +#define HB_NO_ATEXIT +#define HB_NO_BITMAP +#define HB_NO_CFF +#define HB_NO_COLOR +#define HB_NO_GETENV +#define HB_NO_MATH +#define HB_NO_NAME +#define HB_NO_LAYOUT_UNUSED +#endif + +#ifdef HB_MINI +#define HB_NO_AAT +#define HB_NO_LEGACY +#endif + +/* Closure. */ + +#ifdef HB_DISABLE_DEPRECATED +#define HB_IF_NOT_DEPRECATED(x) +#else +#define HB_IF_NOT_DEPRECATED(x) x +#endif + +#ifdef HB_NO_AAT +#define HB_NO_OT_NAME_LANGUAGE_AAT +#define HB_NO_SHAPE_AAT +#endif + +#ifdef HB_NO_BITMAP +#define HB_NO_OT_FONT_BITMAP +#endif + +#ifdef HB_NO_CFF +#define HB_NO_OT_FONT_CFF +#define HB_NO_SUBSET_CFF +#endif + +#ifdef HB_NO_LEGACY +#define HB_NO_OT_LAYOUT_BLACKLIST +#define HB_NO_OT_SHAPE_FALLBACK +#endif + +#ifdef HB_NO_NAME +#define HB_NO_OT_NAME_LANGUAGE +#endif + +#ifdef HB_NO_OT_SHAPE_FALLBACK +#define HB_NO_OT_SHAPE_COMPLEX_ARABIC_FALLBACK +#define HB_NO_OT_SHAPE_COMPLEX_HEBREW_FALLBACK +#define HB_NO_OT_SHAPE_COMPLEX_THAI_FALLBACK +#define HB_NO_OT_SHAPE_COMPLEX_VOWEL_CONSTRAINTS +#endif + + +#endif /* HB_CONFIG_HH */ diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 492356155..383428570 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -55,13 +55,13 @@ coretext_font_size_from_ptem (float ptem) * https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html */ ptem *= 96.f / 72.f; - return ptem <= 0.f ? HB_CORETEXT_DEFAULT_FONT_SIZE : ptem; + return (CGFloat) (ptem <= 0.f ? HB_CORETEXT_DEFAULT_FONT_SIZE : ptem); } static float coretext_font_size_to_ptem (CGFloat size) { - size *= 72.f / 96.f; - return size <= 0.f ? 0 : size; + size *= 72. / 96.; + return size <= 0 ? 0 : size; } static void @@ -410,7 +410,7 @@ struct active_feature_t { feature_record_t rec; unsigned int order; - static int cmp (const void *pa, const void *pb) { + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const active_feature_t *a = (const active_feature_t *) pa; const active_feature_t *b = (const active_feature_t *) pb; return a->rec.feature < b->rec.feature ? -1 : a->rec.feature > b->rec.feature ? 1 : @@ -428,7 +428,7 @@ struct feature_event_t { bool start; active_feature_t feature; - static int cmp (const void *pa, const void *pb) { + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const feature_event_t *a = (const feature_event_t *) pa; const feature_event_t *b = (const feature_event_t *) pb; return a->index < b->index ? -1 : a->index > b->index ? 1 : @@ -598,7 +598,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, } else { active_feature_t *feature = active_features.find (&event->feature); if (feature) - active_features.remove (feature - active_features.arrayZ ()); + active_features.remove (feature - active_features.arrayZ); } } } @@ -771,7 +771,7 @@ resize_and_retry: feature.start < chars_len && feature.start < feature.end) { CFRange feature_range = CFRangeMake (feature.start, - MIN (feature.end, chars_len) - feature.start); + hb_min (feature.end, chars_len) - feature.start); if (feature.value) CFAttributedStringRemoveAttribute (attr_string, feature_range, kCTKernAttributeName); else @@ -1116,7 +1116,7 @@ resize_and_retry: unsigned int cluster = info[count - 1].cluster; for (unsigned int i = count - 1; i > 0; i--) { - cluster = MIN (cluster, info[i - 1].cluster); + cluster = hb_min (cluster, info[i - 1].cluster); info[i - 1].cluster = cluster; } } @@ -1125,7 +1125,7 @@ resize_and_retry: unsigned int cluster = info[0].cluster; for (unsigned int i = 1; i < count; i++) { - cluster = MIN (cluster, info[i].cluster); + cluster = hb_min (cluster, info[i].cluster); info[i].cluster = cluster; } } diff --git a/src/hb-debug.hh b/src/hb-debug.hh index d81483bed..e6d06e310 100644 --- a/src/hb-debug.hh +++ b/src/hb-debug.hh @@ -63,6 +63,9 @@ extern HB_INTERNAL hb_atomic_int_t _hb_options; static inline hb_options_t hb_options () { +#ifdef HB_NO_GETENV + return hb_options_t (); +#endif /* Make a local copy, so we can access bitfield threadsafely. */ hb_options_union_t u; u.i = _hb_options.get_relaxed (); @@ -158,7 +161,7 @@ _hb_debug_msg_va (const char *what, VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR; fprintf (stderr, "%2u %s" VRBAR "%s", level, - bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars) - 1, (unsigned int) (sizeof (VBAR) - 1) * level), + bars + sizeof (bars) - 1 - hb_min ((unsigned int) sizeof (bars) - 1, (unsigned int) (sizeof (VBAR) - 1) * level), level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR); } else fprintf (stderr, " " VRBAR LBAR); @@ -246,8 +249,8 @@ struct hb_printer_t { }; template <> -struct hb_printer_t { - const char *print (hb_void_t) { return ""; } +struct hb_printer_t { + const char *print (hb_empty_t) { return ""; } }; @@ -263,7 +266,7 @@ static inline void _hb_warn_no_return (bool returned) } } template <> -/*static*/ inline void _hb_warn_no_return (bool returned HB_UNUSED) +/*static*/ inline void _hb_warn_no_return (bool returned HB_UNUSED) {} template @@ -327,18 +330,20 @@ struct hb_auto_trace_t<0, ret_t> const char *message, ...) HB_PRINTF_FUNC(6, 7) {} - ret_t ret (ret_t v, - const char *func HB_UNUSED = nullptr, - unsigned int line HB_UNUSED = 0) { return v; } + template + T ret (T&& v, + const char *func HB_UNUSED = nullptr, + unsigned int line HB_UNUSED = 0) { return hb_forward (v); } }; /* For disabled tracing; optimize out everything. * https://github.com/harfbuzz/harfbuzz/pull/605 */ template struct hb_no_trace_t { - ret_t ret (ret_t v, - const char *func HB_UNUSED = "", - unsigned int line HB_UNUSED = 0) { return v; } + template + T ret (T&& v, + const char *func HB_UNUSED = nullptr, + unsigned int line HB_UNUSED = 0) { return hb_forward (v); } }; #define return_trace(RET) return trace.ret (RET, HB_FUNC, __LINE__) diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc index d8076c922..6b2761e83 100644 --- a/src/hb-directwrite.cc +++ b/src/hb-directwrite.cc @@ -778,7 +778,7 @@ retry_getglyphs: { uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index ()]]; - *p = MIN (*p, buffer->info[i].cluster); + *p = hb_min (*p, buffer->info[i].cluster); } for (unsigned int i = 1; i < glyphCount; i++) if (vis_clusters[i] == (uint32_t) -1) @@ -930,7 +930,9 @@ _hb_directwrite_font_release (void *data) /** * hb_directwrite_face_create: - * @font_face: + * @font_face: a DirectWrite IDWriteFontFace object. + * + * Return value: #hb_face_t object corresponding to the given input * * Since: 2.4.0 **/ @@ -945,7 +947,9 @@ hb_directwrite_face_create (IDWriteFontFace *font_face) /** * hb_directwrite_face_get_font_face: -* @face: +* @face: a #hb_face_t object +* +* Return value: DirectWrite IDWriteFontFace object corresponding to the given input * * Since: REPLACEME **/ diff --git a/src/hb-dispatch.hh b/src/hb-dispatch.hh index c4347a6ca..be4a90f4f 100644 --- a/src/hb-dispatch.hh +++ b/src/hb-dispatch.hh @@ -38,10 +38,18 @@ template struct hb_dispatch_context_t { + private: + /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */ + const Context* thiz () const { return static_cast (this); } + Context* thiz () { return static_cast< Context *> (this); } + public: static constexpr unsigned max_debug_depth = MaxDebugDepth; typedef Return return_t; template bool may_dispatch (const T *obj HB_UNUSED, const F *format HB_UNUSED) { return true; } + template + return_t dispatch (const T &obj, Ts&&... ds) + { return obj.dispatch (thiz (), hb_forward (ds)...); } static return_t no_dispatch_return_value () { return Context::default_return_value (); } static bool stop_sublookup_iteration (const return_t r HB_UNUSED) { return false; } }; diff --git a/src/hb-font.cc b/src/hb-font.cc index 20daefd27..19ee353eb 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -336,6 +336,7 @@ hb_font_get_glyph_v_origin_default (hb_font_t *font, return ret; } +#ifndef HB_DISABLE_DEPRECATED static hb_position_t hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, @@ -373,6 +374,7 @@ hb_font_get_glyph_v_kerning_default (hb_font_t *font, { return font->parent_scale_y_distance (font->parent->get_glyph_v_kerning (top_glyph, bottom_glyph)); } +#endif static hb_bool_t hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED, @@ -925,6 +927,7 @@ hb_font_get_glyph_v_origin (hb_font_t *font, return font->get_glyph_v_origin (glyph, x, y); } +#ifndef HB_DISABLE_DEPRECATED /** * hb_font_get_glyph_h_kerning: * @font: a font. @@ -964,6 +967,7 @@ hb_font_get_glyph_v_kerning (hb_font_t *font, { return font->get_glyph_v_kerning (top_glyph, bottom_glyph); } +#endif /** * hb_font_get_glyph_extents: @@ -1173,6 +1177,7 @@ hb_font_subtract_glyph_origin_for_direction (hb_font_t *font, return font->subtract_glyph_origin_for_direction (glyph, direction, x, y); } +#ifndef HB_DISABLE_DEPRECATED /** * hb_font_get_glyph_kerning_for_direction: * @font: a font. @@ -1195,6 +1200,7 @@ hb_font_get_glyph_kerning_for_direction (hb_font_t *font, { return font->get_glyph_kerning_for_direction (first_glyph, second_glyph, direction, x, y); } +#endif /** * hb_font_get_glyph_extents_for_origin: @@ -1347,7 +1353,7 @@ hb_font_create (hb_face_t *face) { hb_font_t *font = _hb_font_create (face); -#if !defined(HB_NO_OT_FONT) +#ifndef HB_NO_OT_FONT /* Install our in-house, very lightweight, funcs. */ hb_ot_font_set_funcs (font); #endif @@ -1916,6 +1922,7 @@ hb_font_get_var_coords_normalized (hb_font_t *font, } +#ifndef HB_DISABLE_DEPRECATED /* * Deprecated get_glyph_func(): */ @@ -2038,3 +2045,4 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs, trampoline, trampoline_destroy); } +#endif diff --git a/src/hb-font.hh b/src/hb-font.hh index aaa0fd91c..95551bfd2 100644 --- a/src/hb-font.hh +++ b/src/hb-font.hh @@ -51,8 +51,8 @@ HB_FONT_FUNC_IMPLEMENT (glyph_v_advances) \ HB_FONT_FUNC_IMPLEMENT (glyph_h_origin) \ HB_FONT_FUNC_IMPLEMENT (glyph_v_origin) \ - HB_FONT_FUNC_IMPLEMENT (glyph_h_kerning) \ - HB_FONT_FUNC_IMPLEMENT (glyph_v_kerning) \ + HB_IF_NOT_DEPRECATED (HB_FONT_FUNC_IMPLEMENT (glyph_h_kerning)) \ + HB_IF_NOT_DEPRECATED (HB_FONT_FUNC_IMPLEMENT (glyph_v_kerning)) \ HB_FONT_FUNC_IMPLEMENT (glyph_extents) \ HB_FONT_FUNC_IMPLEMENT (glyph_contour_point) \ HB_FONT_FUNC_IMPLEMENT (glyph_name) \ @@ -304,17 +304,25 @@ struct hb_font_t hb_position_t get_glyph_h_kerning (hb_codepoint_t left_glyph, hb_codepoint_t right_glyph) { +#ifdef HB_DISABLE_DEPRECATED + return 0; +#else return klass->get.f.glyph_h_kerning (this, user_data, left_glyph, right_glyph, klass->user_data.glyph_h_kerning); +#endif } hb_position_t get_glyph_v_kerning (hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph) { +#ifdef HB_DISABLE_DEPRECATED + return 0; +#else return klass->get.f.glyph_v_kerning (this, user_data, top_glyph, bottom_glyph, klass->user_data.glyph_v_kerning); +#endif } hb_bool_t get_glyph_extents (hb_codepoint_t glyph, @@ -607,7 +615,7 @@ struct hb_font_t return (hb_position_t) (scaled / upem); } hb_position_t em_scalef (float v, int scale) - { return (hb_position_t) round (v * scale / face->get_upem ()); } + { return (hb_position_t) roundf (v * scale / face->get_upem ()); } float em_fscale (int16_t v, int scale) { return (float) v * scale / face->get_upem (); } }; diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 48434dc8c..d70c38a7a 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -439,7 +439,7 @@ hb_ft_get_glyph_from_name (hb_font_t *font HB_UNUSED, else { /* Make a nul-terminated version. */ char buf[128]; - len = MIN (len, (int) sizeof (buf) - 1); + len = hb_min (len, (int) sizeof (buf) - 1); strncpy (buf, name, len); buf[len] = '\0'; *glyph = FT_Get_Name_Index (ft_face, buf); @@ -748,7 +748,7 @@ hb_ft_font_create_referenced (FT_Face ft_face) static void free_static_ft_library (); #endif -static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t, hb_ft_library_lazy_loader_t> { static FT_Library create () diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index fdb545342..5b1ba4515 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -202,6 +202,7 @@ _hb_graphite2_shaper_font_data_destroy (hb_graphite2_font_data_t *data HB_UNUSED { } +#ifndef HB_DISABLE_DEPRECATED /** * hb_graphite2_font_get_gr_font: * @@ -213,6 +214,7 @@ hb_graphite2_font_get_gr_font (hb_font_t *font HB_UNUSED) { return nullptr; } +#endif /* diff --git a/src/hb-icu.cc b/src/hb-icu.cc index c26c91d48..99305ae55 100644 --- a/src/hb-icu.cc +++ b/src/hb-icu.cc @@ -236,7 +236,7 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, /* We don't ifdef-out the fallback code such that compiler always * sees it and makes sure it's compilable. */ - UChar utf16[2], normalized[2 * HB_UNICODE_MAX_DECOMPOSITION_LEN + 1]; + UChar utf16[2], normalized[2 * 19/*HB_UNICODE_MAX_DECOMPOSITION_LEN*/ + 1]; unsigned int len; hb_bool_t ret, err; UErrorCode icu_err; diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 6f8e7ece1..dcc49ee5d 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -1,5 +1,6 @@ /* * Copyright © 2018 Google, Inc. + * Copyright © 2019 Facebook, Inc. * * This is part of HarfBuzz, a text shaping library. * @@ -22,12 +23,14 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * Google Author(s): Behdad Esfahbod + * Facebook Author(s): Behdad Esfahbod */ #ifndef HB_ITER_HH #define HB_ITER_HH #include "hb.hh" +#include "hb-algs.hh" #include "hb-meta.hh" @@ -39,6 +42,17 @@ * copied by value. If the collection / object being iterated on * is writable, then the iterator returns lvalues, otherwise it * returns rvalues. + * + * TODO Document more. + * + * If iterator implementation implements operator!=, then can be + * used in range-based for loop. That comes free if the iterator + * is random-access. Otherwise, the range-based for loop incurs + * one traversal to find end(), which can be avoided if written + * as a while-style for loop, or if iterator implements a faster + * __end__() method. + * TODO When opting in for C++17, address this by changing return + * type of .end()? */ @@ -69,32 +83,41 @@ struct hb_iter_t /* Operators. */ iter_t iter () const { return *thiz(); } iter_t operator + () const { return *thiz(); } + iter_t begin () const { return *thiz(); } + iter_t end () const { return thiz()->__end__ (); } explicit operator bool () const { return thiz()->__more__ (); } unsigned len () const { return thiz()->__len__ (); } /* The following can only be enabled if item_t is reference type. Otherwise - * it will be returning pointer to temporary rvalue. */ + * it will be returning pointer to temporary rvalue. + * TODO Use a wrapper return type to fix for non-reference type. */ template - hb_remove_reference (item_t)* operator -> () const { return hb_addressof (**thiz()); } + hb_remove_reference* operator -> () const { return hb_addressof (**thiz()); } item_t operator * () const { return thiz()->__item__ (); } item_t operator * () { return thiz()->__item__ (); } item_t operator [] (unsigned i) const { return thiz()->__item_at__ (i); } item_t operator [] (unsigned i) { return thiz()->__item_at__ (i); } - iter_t& operator += (unsigned count) { thiz()->__forward__ (count); return *thiz(); } - iter_t& operator ++ () { thiz()->__next__ (); return *thiz(); } - iter_t& operator -= (unsigned count) { thiz()->__rewind__ (count); return *thiz(); } - iter_t& operator -- () { thiz()->__prev__ (); return *thiz(); } + iter_t& operator += (unsigned count) & { thiz()->__forward__ (count); return *thiz(); } + iter_t operator += (unsigned count) && { thiz()->__forward__ (count); return *thiz(); } + iter_t& operator ++ () & { thiz()->__next__ (); return *thiz(); } + iter_t operator ++ () && { thiz()->__next__ (); return *thiz(); } + iter_t& operator -= (unsigned count) & { thiz()->__rewind__ (count); return *thiz(); } + iter_t operator -= (unsigned count) && { thiz()->__rewind__ (count); return *thiz(); } + iter_t& operator -- () & { thiz()->__prev__ (); return *thiz(); } + iter_t operator -- () && { thiz()->__prev__ (); return *thiz(); } iter_t operator + (unsigned count) const { auto c = thiz()->iter (); c += count; return c; } friend iter_t operator + (unsigned count, const iter_t &it) { return it + count; } iter_t operator ++ (int) { iter_t c (*thiz()); ++*thiz(); return c; } iter_t operator - (unsigned count) const { auto c = thiz()->iter (); c -= count; return c; } iter_t operator -- (int) { iter_t c (*thiz()); --*thiz(); return c; } template - iter_t& operator >> (T &v) { v = **thiz(); ++*thiz(); return *thiz(); } + iter_t& operator >> (T &v) & { v = **thiz(); ++*thiz(); return *thiz(); } template - iter_t& operator >> (T &v) const { v = **thiz(); ++*thiz(); return *thiz(); } + iter_t operator >> (T &v) && { v = **thiz(); ++*thiz(); return *thiz(); } template - iter_t& operator << (const T v) { **thiz() = v; ++*thiz(); return *thiz(); } + iter_t& operator << (const T v) & { **thiz() = v; ++*thiz(); return *thiz(); } + template + iter_t operator << (const T v) && { **thiz() = v; ++*thiz(); return *thiz(); } protected: hb_iter_t () {} @@ -104,6 +127,8 @@ struct hb_iter_t #define HB_ITER_USING(Name) \ using item_t = typename Name::item_t; \ + using Name::begin; \ + using Name::end; \ using Name::item_size; \ using Name::is_iterator; \ using Name::iter; \ @@ -122,20 +147,20 @@ struct hb_iter_t using Name::operator <<; \ static_assert (true, "") -/* Returns iterator type of a type. */ -#define hb_iter_t(Iterable) decltype (hb_declval (Iterable).iter ()) +/* Returns iterator / item type of a type. */ +template +using hb_iter_type = decltype (hb_deref (hb_declval (Iterable)).iter ()); +template +using hb_item_type = decltype (*hb_deref (hb_declval (Iterable)).iter ()); -/* TODO Change to function-object. */ - template struct hb_array_t; -static const struct +struct { - template - hb_iter_t (T) + template hb_iter_type operator () (T&& c) const - { return c.iter (); } + { return hb_deref (hb_forward (c)).iter (); } /* Specialization for C arrays. */ @@ -147,8 +172,8 @@ static const struct operator () (Type (&array)[length]) const { return hb_array_t (array, length); } -} hb_iter HB_UNUSED; - +} +HB_FUNCOBJ (hb_iter); /* Mixin to fill in what the subclass doesn't provide. */ template @@ -165,17 +190,29 @@ struct hb_iter_fallback_mixin_t item_t __item_at__ (unsigned i) const { return *(*thiz() + i); } /* Termination: Implement __more__(), or __len__() if random-access. */ - bool __more__ () const { return thiz()->len (); } + bool __more__ () const { return bool (thiz()->len ()); } unsigned __len__ () const { iter_t c (*thiz()); unsigned l = 0; while (c) { c++; l++; }; return l; } /* Advancing: Implement __next__(), or __forward__() if random-access. */ void __next__ () { *thiz() += 1; } - void __forward__ (unsigned n) { while (n--) ++*thiz(); } + void __forward__ (unsigned n) { while (*thiz() && n--) ++*thiz(); } /* Rewinding: Implement __prev__() or __rewind__() if bidirectional. */ void __prev__ () { *thiz() -= 1; } - void __rewind__ (unsigned n) { while (n--) --*thiz(); } + void __rewind__ (unsigned n) { while (*thiz() && n--) --*thiz(); } + + /* Range-based for: Implement __end__() if can be done faster, + * and operator!=. */ + iter_t __end__ () const + { + if (thiz()->is_random_access_iterator) + return *thiz() + thiz()->len (); + /* Above expression loops twice. Following loops once. */ + auto it = *thiz(); + while (it) ++it; + return it; + } protected: hb_iter_fallback_mixin_t () {} @@ -200,53 +237,101 @@ struct hb_iter_with_fallback_t : * Meta-programming predicates. */ +/* hb_is_iterator() / hb_is_iterator_of() */ + +template +struct hb_is_iterator_of +{ + template + static hb_true_type impl (hb_priority<2>, hb_iter_t> *); + static hb_false_type impl (hb_priority<0>, const void *); + + public: + static constexpr bool value = decltype (impl (hb_prioritize, hb_declval (Iter*)))::value; +}; +#define hb_is_iterator_of(Iter, Item) hb_is_iterator_of::value +#define hb_is_iterator(Iter) hb_is_iterator_of (Iter, typename Iter::item_t) + /* hb_is_iterable() */ template struct hb_is_iterable { private: + template - static auto test (int) -> decltype (hb_declval (U).iter (), hb_true_t ()); + static auto impl (hb_priority<1>) -> decltype (hb_declval (U).iter (), hb_true_type ()); + template - static hb_false_t test (...); + static hb_false_type impl (hb_priority<0>); public: - enum { value = decltype (test (0))::value }; + static constexpr bool value = decltype (impl (hb_prioritize))::value; }; #define hb_is_iterable(Iterable) hb_is_iterable::value -/* TODO Add hb_is_iterable_of(). - * TODO Add random_access / sorted variants. */ +/* hb_is_source_of() / hb_is_sink_of() */ - -/* hb_is_iterator() / hb_is_random_access_iterator() / hb_is_sorted_iterator() */ - -template -struct _hb_is_iterator_of -{ - char operator () (...) { return 0; } - template int operator () (hb_iter_t *) { return 0; } - template int operator () (hb_iter_t *) { return 0; } - template int operator () (hb_iter_t *) { return 0; } - template int operator () (hb_iter_t *) { return 0; } - static_assert (sizeof (char) != sizeof (int), ""); -}; template -struct hb_is_iterator_of { enum { - value = sizeof (int) == sizeof (hb_declval (_hb_is_iterator_of) (hb_declval (Iter*))) }; }; -#define hb_is_iterator_of(Iter, Item) hb_is_iterator_of::value -#define hb_is_iterator(Iter) hb_is_iterator_of (Iter, typename Iter::item_t) +struct hb_is_source_of +{ + private: + template >))> + static hb_true_type impl (hb_priority<2>); + template + static auto impl (hb_priority<1>) -> decltype (hb_declval (Iter2) >> hb_declval (Item &), hb_true_type ()); + static hb_false_type impl (hb_priority<0>); -#define hb_is_random_access_iterator_of(Iter, Item) \ - hb_is_iterator_of (Iter, Item) && Iter::is_random_access_iterator -#define hb_is_random_access_iterator(Iter) \ - hb_is_random_access_iterator_of (Iter, typename Iter::item_t) + public: + static constexpr bool value = decltype (impl (hb_prioritize))::value; +}; +#define hb_is_source_of(Iter, Item) hb_is_source_of::value -#define hb_is_sorted_iterator_of(Iter, Item) \ - hb_is_iterator_of (Iter, Item) && Iter::is_sorted_iterator -#define hb_is_sorted_iterator(Iter) \ - hb_is_sorted_iterator_of (Iter, typename Iter::item_t) +template +struct hb_is_sink_of +{ + private: + template ))> + static hb_true_type impl (hb_priority<2>); + template + static auto impl (hb_priority<1>) -> decltype (hb_declval (Iter2) << hb_declval (Item), hb_true_type ()); + static hb_false_type impl (hb_priority<0>); + + public: + static constexpr bool value = decltype (impl (hb_prioritize))::value; +}; +#define hb_is_sink_of(Iter, Item) hb_is_sink_of::value + +/* This is commonly used, so define: */ +#define hb_is_sorted_source_of(Iter, Item) \ + (hb_is_source_of(Iter, Item) && Iter::is_sorted_iterator) + + +/* Range-based 'for' for iterables. */ + +template +static inline auto begin (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).begin ()) + +template +static inline auto end (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).end ()) + +/* begin()/end() are NOT looked up non-ADL. So each namespace must declare them. + * Do it for namespace OT. */ +namespace OT { + +template +static inline auto begin (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).begin ()) + +template +static inline auto end (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).end ()) + +} /* @@ -254,78 +339,109 @@ struct hb_is_iterator_of { enum { */ template -static inline decltype (hb_declval (Rhs) (hb_declval (Lhs))) -operator | (Lhs lhs, const Rhs &rhs) { return rhs (lhs); } + hb_requires (hb_is_iterator (Lhs))> +static inline auto +operator | (Lhs&& lhs, Rhs&& rhs) HB_AUTO_RETURN (hb_forward (rhs) (hb_forward (lhs))) /* hb_map(), hb_filter(), hb_reduce() */ -template -struct hb_map_iter_t : - hb_iter_t, - decltype (hb_declval (Proj) (hb_declval (typename Iter::item_t)))> -{ - hb_map_iter_t (const Iter& it, Proj f) : it (it), f (f) {} +enum sorted_t { + NOT_SORTED, + RETAINS_SORTING, + SORTED, +}; - typedef decltype (hb_declval (Proj) (hb_declval (typename Iter::item_t))) __item_t__; +template +struct hb_map_iter_t : + hb_iter_t, + decltype (hb_get (hb_declval (Proj), *hb_declval (Iter)))> +{ + hb_map_iter_t (const Iter& it, Proj f_) : it (it), f (f_) {} + + typedef decltype (hb_get (hb_declval (Proj), *hb_declval (Iter))) __item_t__; static constexpr bool is_random_access_iterator = Iter::is_random_access_iterator; - __item_t__ __item__ () const { return f (*it); } - __item_t__ __item_at__ (unsigned i) const { return f (it[i]); } + static constexpr bool is_sorted_iterator = + Sorted == SORTED ? true : Sorted == RETAINS_SORTING ? Iter::is_sorted_iterator : false; + __item_t__ __item__ () const { return hb_get (f.get (), *it); } + __item_t__ __item_at__ (unsigned i) const { return hb_get (f.get (), it[i]); } bool __more__ () const { return bool (it); } unsigned __len__ () const { return it.len (); } void __next__ () { ++it; } void __forward__ (unsigned n) { it += n; } void __prev__ () { --it; } void __rewind__ (unsigned n) { it -= n; } + hb_map_iter_t __end__ () const { return hb_map_iter_t (it.end (), f); } + bool operator != (const hb_map_iter_t& o) const + { return it != o.it || f != o.f; } private: Iter it; - Proj f; + hb_reference_wrapper f; }; -template +template struct hb_map_iter_factory_t { hb_map_iter_factory_t (Proj f) : f (f) {} template - hb_map_iter_t - operator () (Iter it) const - { return hb_map_iter_t (it, f); } + hb_requires (hb_is_iterator (Iter))> + hb_map_iter_t + operator () (Iter it) + { return hb_map_iter_t (it, f); } private: Proj f; }; -static const struct +struct { template - hb_map_iter_factory_t + hb_map_iter_factory_t operator () (Proj&& f) const - { return hb_map_iter_factory_t (f); } -} hb_map HB_UNUSED; + { return hb_map_iter_factory_t (f); } +} +HB_FUNCOBJ (hb_map); +struct +{ + template + hb_map_iter_factory_t + operator () (Proj&& f) const + { return hb_map_iter_factory_t (f); } +} +HB_FUNCOBJ (hb_map_retains_sorting); +struct +{ + template + hb_map_iter_factory_t + operator () (Proj&& f) const + { return hb_map_iter_factory_t (f); } +} +HB_FUNCOBJ (hb_map_sorted); template + hb_requires (hb_is_iterator (Iter))> struct hb_filter_iter_t : hb_iter_with_fallback_t, typename Iter::item_t> { - hb_filter_iter_t (const Iter& it_, Pred p, Proj f) : it (it_), p (p), f (f) - { while (it && !p (f (*it))) ++it; } + hb_filter_iter_t (const Iter& it_, Pred p_, Proj f_) : it (it_), p (p_), f (f_) + { while (it && !hb_has (p.get (), hb_get (f.get (), *it))) ++it; } typedef typename Iter::item_t __item_t__; static constexpr bool is_sorted_iterator = Iter::is_sorted_iterator; __item_t__ __item__ () const { return *it; } bool __more__ () const { return bool (it); } - void __next__ () { do ++it; while (it && !p (f (*it))); } - void __prev__ () { --it; } + void __next__ () { do ++it; while (it && !hb_has (p.get (), hb_get (f.get (), *it))); } + void __prev__ () { do --it; while (it && !hb_has (p.get (), hb_get (f.get (), *it))); } + hb_filter_iter_t __end__ () const { return hb_filter_iter_t (it.end (), p, f); } + bool operator != (const hb_filter_iter_t& o) const + { return it != o.it || p != o.p || f != o.f; } private: Iter it; - Pred p; - Proj f; + hb_reference_wrapper p; + hb_reference_wrapper f; }; template struct hb_filter_iter_factory_t @@ -333,23 +449,24 @@ struct hb_filter_iter_factory_t hb_filter_iter_factory_t (Pred p, Proj f) : p (p), f (f) {} template + hb_requires (hb_is_iterator (Iter))> hb_filter_iter_t - operator () (Iter it) const + operator () (Iter it) { return hb_filter_iter_t (it, p, f); } private: Pred p; Proj f; }; -static const struct +struct { - template hb_filter_iter_factory_t - operator () (Pred&& p = hb_bool, Proj&& f = hb_identity) const + operator () (Pred&& p = hb_identity, Proj&& f = hb_identity) const { return hb_filter_iter_factory_t (p, f); } -} hb_filter HB_UNUSED; +} +HB_FUNCOBJ (hb_filter); template struct hb_reduce_t @@ -357,10 +474,10 @@ struct hb_reduce_t hb_reduce_t (Redu r, InitT init_value) : r (r), init_value (init_value) {} template AccuT - operator () (Iter it) const + operator () (Iter it) { AccuT value = init_value; for (; it; ++it) @@ -372,13 +489,14 @@ struct hb_reduce_t Redu r; InitT init_value; }; -static const struct +struct { template hb_reduce_t operator () (Redu&& r, InitT init_value) const { return hb_reduce_t (r, init_value); } -} hb_reduce HB_UNUSED; +} +HB_FUNCOBJ (hb_reduce); /* hb_zip() */ @@ -386,7 +504,7 @@ static const struct template struct hb_zip_iter_t : hb_iter_t, - hb_pair_t > + hb_pair_t> { hb_zip_iter_t () {} hb_zip_iter_t (const A& a, const B& b) : a (a), b (b) {} @@ -400,60 +518,29 @@ struct hb_zip_iter_t : B::is_sorted_iterator; __item_t__ __item__ () const { return __item_t__ (*a, *b); } __item_t__ __item_at__ (unsigned i) const { return __item_t__ (a[i], b[i]); } - bool __more__ () const { return a && b; } - unsigned __len__ () const { return MIN (a.len (), b.len ()); } + bool __more__ () const { return bool (a) && bool (b); } + unsigned __len__ () const { return hb_min (a.len (), b.len ()); } void __next__ () { ++a; ++b; } void __forward__ (unsigned n) { a += n; b += n; } void __prev__ () { --a; --b; } void __rewind__ (unsigned n) { a -= n; b -= n; } + hb_zip_iter_t __end__ () const { return hb_zip_iter_t (a.end (), b.end ()); } + bool operator != (const hb_zip_iter_t& o) const + { return a != o.a && b != o.b; } private: A a; B b; }; -static const struct +struct { template - hb_zip_iter_t - operator () (A& a, B &b) const - { return hb_zip_iter_t (hb_iter (a), hb_iter (b)); } -} hb_zip HB_UNUSED; - -/* hb_enumerate */ - -template -struct hb_enumerate_iter_t : - hb_iter_t, - hb_pair_t > -{ - hb_enumerate_iter_t (const Iter& it) : i (0), it (it) {} - - typedef hb_pair_t __item_t__; - static constexpr bool is_random_access_iterator = Iter::is_random_access_iterator; - static constexpr bool is_sorted_iterator = true; - __item_t__ __item__ () const { return __item_t__ (+i, *it); } - __item_t__ __item_at__ (unsigned j) const { return __item_t__ (i + j, it[j]); } - bool __more__ () const { return bool (it); } - unsigned __len__ () const { return it.len (); } - void __next__ () { ++i; ++it; } - void __forward__ (unsigned n) { i += n; it += n; } - void __prev__ () { --i; --it; } - void __rewind__ (unsigned n) { i -= n; it -= n; } - - private: - unsigned i; - Iter it; -}; -static const struct -{ - template - hb_enumerate_iter_t - operator () (Iterable& it) const - { return hb_enumerate_iter_t (hb_iter (it)); } -} hb_enumerate HB_UNUSED; + hb_requires (hb_is_iterable (A) && hb_is_iterable (B))> + hb_zip_iter_t, hb_iter_type> + operator () (A&& a, B&& b) const + { return hb_zip_iter_t, hb_iter_type> (hb_iter (a), hb_iter (b)); } +} +HB_FUNCOBJ (hb_zip); /* hb_apply() */ @@ -463,18 +550,17 @@ struct hb_apply_t hb_apply_t (Appl a) : a (a) {} template - void - operator () (Iter it) const + hb_requires (hb_is_iterator (Iter))> + void operator () (Iter it) { for (; it; ++it) - a (*it); + (void) hb_invoke (a, *it); } private: Appl a; }; -static const struct +struct { template hb_apply_t operator () (Appl&& a) const @@ -483,19 +569,91 @@ static const struct template hb_apply_t operator () (Appl *a) const { return hb_apply_t (*a); } -} hb_apply HB_UNUSED; +} +HB_FUNCOBJ (hb_apply); + +/* hb_iota()/hb_range() */ + +template +struct hb_counter_iter_t : + hb_iter_t, T> +{ + hb_counter_iter_t (T start, T end_, S step) : v (start), end_ (end_for (start, end_, step)), step (step) {} + + typedef T __item_t__; + static constexpr bool is_random_access_iterator = true; + static constexpr bool is_sorted_iterator = true; + __item_t__ __item__ () const { return +v; } + __item_t__ __item_at__ (unsigned j) const { return v + j * step; } + bool __more__ () const { return v != end_; } + unsigned __len__ () const { return !step ? UINT_MAX : (end_ - v) / step; } + void __next__ () { v += step; } + void __forward__ (unsigned n) { v += n * step; } + void __prev__ () { v -= step; } + void __rewind__ (unsigned n) { v -= n * step; } + hb_counter_iter_t __end__ () const { return hb_counter_iter_t (end_, end_, step); } + bool operator != (const hb_counter_iter_t& o) const + { return v != o.v || end_ != o.end_ || step != o.step; } + + private: + static inline T end_for (T start, T end_, S step) + { + if (!step) + return end_; + auto res = (end_ - start) % step; + if (!res) + return end_; + end_ += step - res; + return end_; + } + + private: + T v; + T end_; + S step; +}; +struct +{ + template hb_counter_iter_t + operator () (T start = 0u, S&& step = 1u) const + { return hb_counter_iter_t (start, step >= 0 ? hb_int_max (T) : hb_int_min (T), step); } +} +HB_FUNCOBJ (hb_iota); +struct +{ + template hb_counter_iter_t + operator () (T end = (unsigned) -1) const + { return hb_counter_iter_t (0, end, 1u); } + + template hb_counter_iter_t + operator () (T start, T end, S&& step = 1u) const + { return hb_counter_iter_t (start, end, step); } +} +HB_FUNCOBJ (hb_range); + +/* hb_enumerate */ + +struct +{ + template + auto operator () (Iterable&& it, Index start = 0u) const HB_AUTO_RETURN + ( hb_zip (hb_iota (start), it) ) +} +HB_FUNCOBJ (hb_enumerate); + /* hb_sink() */ template struct hb_sink_t { - hb_sink_t (Sink&& s) : s (s) {} + hb_sink_t (Sink s) : s (s) {} template - void - operator () (Iter it) const + hb_requires (hb_is_iterator (Iter))> + void operator () (Iter it) { for (; it; ++it) s << *it; @@ -504,7 +662,7 @@ struct hb_sink_t private: Sink s; }; -static const struct +struct { template hb_sink_t operator () (Sink&& s) const @@ -513,33 +671,33 @@ static const struct template hb_sink_t operator () (Sink *s) const { return hb_sink_t (*s); } -} hb_sink HB_UNUSED; +} +HB_FUNCOBJ (hb_sink); /* hb-drain: hb_sink to void / blackhole / /dev/null. */ -static const struct +struct { template - void - operator () (Iter it) const + hb_requires (hb_is_iterator (Iter))> + void operator () (Iter it) const { for (; it; ++it) (void) *it; } -} hb_drain HB_UNUSED; +} +HB_FUNCOBJ (hb_drain); /* hb_unzip(): unzip and sink to two sinks. */ template struct hb_unzip_t { - hb_unzip_t (Sink1&& s1, Sink2&& s2) : s1 (s1), s2 (s2) {} + hb_unzip_t (Sink1 s1, Sink2 s2) : s1 (s1), s2 (s2) {} template - void - operator () (Iter it) const + hb_requires (hb_is_iterator (Iter))> + void operator () (Iter it) { for (; it; ++it) { @@ -553,7 +711,7 @@ struct hb_unzip_t Sink1 s1; Sink2 s2; }; -static const struct +struct { template hb_unzip_t operator () (Sink1&& s1, Sink2&& s2) const @@ -562,59 +720,70 @@ static const struct template hb_unzip_t operator () (Sink1 *s1, Sink2 *s2) const { return hb_unzip_t (*s1, *s2); } -} hb_unzip HB_UNUSED; +} +HB_FUNCOBJ (hb_unzip); /* hb-all, hb-any, hb-none. */ -static const struct +struct { template - bool - operator () (Iterable&& c) const + typename Pred = decltype ((hb_identity)), + typename Proj = decltype ((hb_identity)), + hb_requires (hb_is_iterable (Iterable))> + bool operator () (Iterable&& c, + Pred&& p = hb_identity, + Proj&& f = hb_identity) const { for (auto it = hb_iter (c); it; ++it) - if (!*it) + if (!hb_match (hb_forward (p), hb_get (hb_forward (f), *it))) return false; return true; } -} hb_all HB_UNUSED; - -static const struct +} +HB_FUNCOBJ (hb_all); +struct { template - bool - operator () (Iterable&& c) const + typename Pred = decltype ((hb_identity)), + typename Proj = decltype ((hb_identity)), + hb_requires (hb_is_iterable (Iterable))> + bool operator () (Iterable&& c, + Pred&& p = hb_identity, + Proj&& f = hb_identity) const { for (auto it = hb_iter (c); it; ++it) - if (*it) + if (hb_match (hb_forward (p), hb_get (hb_forward (f), *it))) return true; return false; } -} hb_any HB_UNUSED; - -static const struct +} +HB_FUNCOBJ (hb_any); +struct { template - bool - operator () (Iterable&& c) const + typename Pred = decltype ((hb_identity)), + typename Proj = decltype ((hb_identity)), + hb_requires (hb_is_iterable (Iterable))> + bool operator () (Iterable&& c, + Pred&& p = hb_identity, + Proj&& f = hb_identity) const { for (auto it = hb_iter (c); it; ++it) - if (*it) + if (hb_match (hb_forward (p), hb_get (hb_forward (f), *it))) return false; return true; } -} hb_none HB_UNUSED; +} +HB_FUNCOBJ (hb_none); /* * Algorithms operating on iterators. */ template + hb_requires (hb_is_iterable (C))> inline void hb_fill (C& c, const V &v) { diff --git a/src/hb-map.hh b/src/hb-map.hh index b99fb8f4b..26e4930a5 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -34,19 +34,17 @@ * hb_hashmap_t */ -/* TODO if K/V is signed integer, -1 is not a good default. - * Don't know how to get to -MAX using bit work. */ template + K kINVALID = hb_is_pointer (K) ? 0 : hb_is_signed (K) ? hb_int_min (K) : (K) -1, + V vINVALID = hb_is_pointer (V) ? 0 : hb_is_signed (V) ? hb_int_min (V) : (V) -1> struct hb_hashmap_t { HB_DELETE_COPY_ASSIGN (hb_hashmap_t); hb_hashmap_t () { init (); } ~hb_hashmap_t () { fini (); } - static_assert (hb_is_integer (K) || hb_is_pointer (K), ""); - static_assert (hb_is_integer (V) || hb_is_pointer (V), ""); + static_assert (hb_is_integral (K) || hb_is_pointer (K), ""); + static_assert (hb_is_integral (V) || hb_is_pointer (V), ""); /* TODO If key type is a pointer, keep hash in item_t and use to: * 1. avoid rehashing when resizing table, and @@ -59,11 +57,12 @@ struct hb_hashmap_t void clear () { key = kINVALID; value = vINVALID; } - bool operator == (K o) { return hb_deref_pointer (key) == hb_deref_pointer (o); } + bool operator == (K o) { return hb_deref (key) == hb_deref (o); } bool operator == (const item_t &o) { return *this == o.key; } bool is_unused () const { return key == kINVALID; } bool is_tombstone () const { return key != kINVALID && value == vINVALID; } bool is_real () const { return key != kINVALID && value != vINVALID; } + hb_pair_t get_pair() const { return hb_pair_t (key, value); } }; hb_object_header_t header; @@ -122,7 +121,7 @@ struct hb_hashmap_t return false; } + hb_iter (new_items, new_size) - | hb_apply ([] (item_t &_) { _.clear (); }) /* TODO make pointer-to-methods invokable. */ + | hb_apply (&item_t::clear) ; unsigned int old_size = mask + 1; @@ -183,7 +182,12 @@ struct hb_hashmap_t static constexpr V SENTINEL = vINVALID; typedef V value_t; value_t operator [] (K k) const { return get (k); } - bool has (K k) const { return (*this)[k] != SENTINEL; } + bool has (K k, V *vp = nullptr) const + { + V v = (*this)[k]; + if (vp) *vp = v; + return v != SENTINEL; + } /* Projection. */ V operator () (K k) const { return get (k); } @@ -193,7 +197,7 @@ struct hb_hashmap_t return; if (items) + hb_iter (items, mask + 1) - | hb_apply ([] (item_t &_) { _.clear (); }) /* TODO make pointer-to-methods invokable. */ + | hb_apply (&item_t::clear) ; population = occupancy = 0; @@ -203,6 +207,34 @@ struct hb_hashmap_t unsigned int get_population () const { return population; } + /* + * Iterator + */ + auto iter () const HB_AUTO_RETURN + ( + + hb_array (items, mask ? mask + 1 : 0) + | hb_filter (&item_t::is_real) + | hb_map (&item_t::get_pair) + ) + auto keys () const HB_AUTO_RETURN + ( + + hb_array (items, mask ? mask + 1 : 0) + | hb_filter (&item_t::is_real) + | hb_map (&item_t::key) + | hb_map (hb_ridentity) + ) + auto values () const HB_AUTO_RETURN + ( + + hb_array (items, mask ? mask + 1 : 0) + | hb_filter (&item_t::is_real) + | hb_map (&item_t::value) + | hb_map (hb_ridentity) + ) + + /* Sink interface. */ + hb_hashmap_t& operator << (const hb_pair_t& v) + { set (v.first, v.second); return *this; } + protected: unsigned int bucket_for (K key) const @@ -213,9 +245,9 @@ struct hb_hashmap_t while (!items[i].is_unused ()) { if (items[i] == key) - return i; + return i; if (tombstone == (unsigned) -1 && items[i].is_tombstone ()) - tombstone = i; + tombstone = i; i = (i + ++step) & mask; } return tombstone == (unsigned) -1 ? i : tombstone; diff --git a/src/hb-meta.hh b/src/hb-meta.hh index c0095637e..df8ebd175 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -34,111 +34,367 @@ * C++ template meta-programming & fundamentals used with them. */ +/* Void! For when we need a expression-type of void. */ +struct hb_empty_t {}; -template static inline T* -hb_addressof (const T& arg) +/* https://en.cppreference.com/w/cpp/types/void_t */ +template struct _hb_void_t { typedef void type; }; +template using hb_void_t = typename _hb_void_t::type; + +template struct _hb_head_t { typedef Head type; }; +template using hb_head_t = typename _hb_head_t::type; + +template struct hb_integral_constant { static constexpr T value = v; }; +template using hb_bool_constant = hb_integral_constant; +using hb_true_type = hb_bool_constant; +using hb_false_type = hb_bool_constant; + + +/* Basic type SFINAE. */ + +template struct hb_enable_if {}; +template struct hb_enable_if { typedef T type; }; +#define hb_enable_if(Cond) typename hb_enable_if<(Cond)>::type* = nullptr +/* Concepts/Requires alias: */ +#define hb_requires(Cond) hb_enable_if((Cond)) + +template struct hb_is_same : hb_false_type {}; +template struct hb_is_same : hb_true_type {}; +#define hb_is_same(T, T2) hb_is_same::value + +/* Function overloading SFINAE and priority. */ + +#define HB_RETURN(Ret, E) -> hb_head_t { return (E); } +#define HB_AUTO_RETURN(E) -> decltype ((E)) { return (E); } +#define HB_VOID_RETURN(E) -> hb_void_t { (E); } + +template struct hb_priority : hb_priority {}; +template <> struct hb_priority<0> {}; +#define hb_prioritize hb_priority<16> () + +#define HB_FUNCOBJ(x) static_const x HB_UNUSED + + +template struct hb_type_identity_t { typedef T type; }; +template using hb_type_identity = typename hb_type_identity_t::type; + +struct { + template + T* operator () (T& arg) const + { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" - /* https://en.cppreference.com/w/cpp/memory/addressof */ - return reinterpret_cast( - &const_cast( - reinterpret_cast(arg))); + /* https://en.cppreference.com/w/cpp/memory/addressof */ + return reinterpret_cast ( + &const_cast ( + reinterpret_cast (arg))); #pragma GCC diagnostic pop + } } +HB_FUNCOBJ (hb_addressof); template static inline T hb_declval (); #define hb_declval(T) (hb_declval ()) -template struct hb_match_const { typedef T type; enum { value = false }; }; -template struct hb_match_const { typedef T type; enum { value = true }; }; -#define hb_remove_const(T) typename hb_match_const::type +template struct hb_match_const : hb_type_identity_t, hb_bool_constant{}; +template struct hb_match_const : hb_type_identity_t, hb_bool_constant {}; +template using hb_remove_const = typename hb_match_const::type; +template using hb_add_const = const T; #define hb_is_const(T) hb_match_const::value -template struct hb_match_reference { typedef T type; enum { value = false }; }; -template struct hb_match_reference { typedef T type; enum { value = true }; }; -#define hb_remove_reference(T) typename hb_match_reference::type +template struct hb_match_reference : hb_type_identity_t, hb_bool_constant{}; +template struct hb_match_reference : hb_type_identity_t, hb_bool_constant {}; +template struct hb_match_reference : hb_type_identity_t, hb_bool_constant {}; +template using hb_remove_reference = typename hb_match_reference::type; +template auto _hb_try_add_lvalue_reference (hb_priority<1>) -> hb_type_identity; +template auto _hb_try_add_lvalue_reference (hb_priority<0>) -> hb_type_identity; +template using hb_add_lvalue_reference = decltype (_hb_try_add_lvalue_reference (hb_prioritize)); +template auto _hb_try_add_rvalue_reference (hb_priority<1>) -> hb_type_identity; +template auto _hb_try_add_rvalue_reference (hb_priority<0>) -> hb_type_identity; +template using hb_add_rvalue_reference = decltype (_hb_try_add_rvalue_reference (hb_prioritize)); #define hb_is_reference(T) hb_match_reference::value -template struct hb_match_pointer { typedef T type; enum { value = false }; }; -template struct hb_match_pointer { typedef T type; enum { value = true }; }; -#define hb_remove_pointer(T) typename hb_match_pointer::type +template struct hb_match_pointer : hb_type_identity_t, hb_bool_constant{}; +template struct hb_match_pointer : hb_type_identity_t, hb_bool_constant {}; +template using hb_remove_pointer = typename hb_match_pointer::type; +template auto _hb_try_add_pointer (hb_priority<1>) -> hb_type_identity*>; +template auto _hb_try_add_pointer (hb_priority<1>) -> hb_type_identity; +template using hb_add_pointer = decltype (_hb_try_add_pointer (hb_prioritize)); #define hb_is_pointer(T) hb_match_pointer::value -static const struct -{ - template - T operator () (T v) const { return v; } - template - T& operator () (T *v) const { return *v; } -} hb_deref_pointer HB_UNUSED; +/* TODO Add feature-parity to std::decay. */ +template using hb_decay = hb_remove_const>; + + +template +struct _hb_conditional { typedef T type; }; +template +struct _hb_conditional { typedef F type; }; +template +using hb_conditional = typename _hb_conditional::type; + + +template +struct hb_is_convertible +{ + private: + static constexpr bool from_void = hb_is_same (void, hb_decay); + static constexpr bool to_void = hb_is_same (void, hb_decay ); + static constexpr bool either_void = from_void || to_void; + static constexpr bool both_void = from_void && to_void; + + static hb_true_type impl2 (hb_conditional); + + template + static auto impl (hb_priority<1>) -> decltype (impl2 (hb_declval (T))); + template + static hb_false_type impl (hb_priority<0>); + public: + static constexpr bool value = both_void || + (!either_void && + decltype (impl> (hb_prioritize))::value); +}; +#define hb_is_convertible(From,To) hb_is_convertible::value + +template +using hb_is_base_of = hb_is_convertible *, hb_decay *>; +#define hb_is_base_of(Base,Derived) hb_is_base_of::value + +template +using hb_is_cr_convertible = hb_bool_constant< + hb_is_same (hb_decay, hb_decay) && + (!hb_is_const (From) || hb_is_const (To)) && + (!hb_is_reference (To) || hb_is_const (To) || hb_is_reference (To)) +>; +#define hb_is_cr_convertible(From,To) hb_is_cr_convertible::value /* std::move and std::forward */ template -hb_remove_reference (T)&& hb_move (T&& t) { return (hb_remove_reference (T)&&) (t); } +static hb_remove_reference&& hb_move (T&& t) { return (hb_remove_reference&&) (t); } template -T&& hb_forward (hb_remove_reference (T)& t) { return (T&&) t; } +static T&& hb_forward (hb_remove_reference& t) { return (T&&) t; } template -T&& hb_forward (hb_remove_reference (T)&& t) { return (T&&) t; } +static T&& hb_forward (hb_remove_reference&& t) { return (T&&) t; } +struct +{ + template auto + operator () (T&& v) const HB_AUTO_RETURN (hb_forward (v)) -/* Void! For when we need a expression-type of void. */ -struct hb_void_t { typedef void value; }; + template auto + operator () (T *v) const HB_AUTO_RETURN (*v) +} +HB_FUNCOBJ (hb_deref); -/* Bool! For when we need to evaluate type-dependent expressions - * in a template argument. */ -template struct hb_bool_tt { enum { value = b }; }; -typedef hb_bool_tt hb_true_t; -typedef hb_bool_tt hb_false_t; +struct +{ + template auto + operator () (T&& v) const HB_AUTO_RETURN (hb_forward (v)) -template -struct hb_enable_if {}; -template -struct hb_enable_if { typedef T type; }; -#define hb_enable_if(Cond) typename hb_enable_if<(Cond)>::type* = nullptr + template auto + operator () (T& v) const HB_AUTO_RETURN (hb_addressof (v)) +} +HB_FUNCOBJ (hb_ref); -template -struct hb_is_same : hb_false_t {}; template -struct hb_is_same : hb_true_t {}; -#define hb_is_same(T, T2) hb_is_same::value +struct hb_reference_wrapper +{ + hb_reference_wrapper (T v) : v (v) {} + bool operator == (const hb_reference_wrapper& o) const { return v == o.v; } + bool operator != (const hb_reference_wrapper& o) const { return v != o.v; } + operator T () const { return v; } + T get () const { return v; } + T v; +}; +template +struct hb_reference_wrapper +{ + hb_reference_wrapper (T& v) : v (hb_addressof (v)) {} + bool operator == (const hb_reference_wrapper& o) const { return v == o.v; } + bool operator != (const hb_reference_wrapper& o) const { return v != o.v; } + operator T& () const { return *v; } + T& get () const { return *v; } + T* v; +}; -/* - * Meta-functions. - */ +template +using hb_is_integral = hb_bool_constant< + hb_is_same (hb_decay, char) || + hb_is_same (hb_decay, signed char) || + hb_is_same (hb_decay, unsigned char) || + hb_is_same (hb_decay, signed int) || + hb_is_same (hb_decay, unsigned int) || + hb_is_same (hb_decay, signed short) || + hb_is_same (hb_decay, unsigned short) || + hb_is_same (hb_decay, signed long) || + hb_is_same (hb_decay, unsigned long) || + hb_is_same (hb_decay, signed long long) || + hb_is_same (hb_decay, unsigned long long) || + false +>; +#define hb_is_integral(T) hb_is_integral::value +template +using hb_is_floating_point = hb_bool_constant< + hb_is_same (hb_decay, float) || + hb_is_same (hb_decay, double) || + hb_is_same (hb_decay, long double) || + false +>; +#define hb_is_floating_point(T) hb_is_floating_point::value +template +using hb_is_arithmetic = hb_bool_constant< + hb_is_integral (T) || + hb_is_floating_point (T) || + false +>; +#define hb_is_arithmetic(T) hb_is_arithmetic::value -template struct hb_is_signed; -/* https://github.com/harfbuzz/harfbuzz/issues/1535 */ -template <> struct hb_is_signed { enum { value = true }; }; -template <> struct hb_is_signed { enum { value = true }; }; -template <> struct hb_is_signed { enum { value = true }; }; -template <> struct hb_is_signed { enum { value = true }; }; -template <> struct hb_is_signed { enum { value = false }; }; -template <> struct hb_is_signed { enum { value = false }; }; -template <> struct hb_is_signed { enum { value = false }; }; -template <> struct hb_is_signed { enum { value = false }; }; + +template +using hb_is_signed = hb_conditional, + hb_false_type>; #define hb_is_signed(T) hb_is_signed::value +template +using hb_is_unsigned = hb_conditional, + hb_false_type>; +#define hb_is_unsigned(T) hb_is_unsigned::value -template struct hb_signedness_int; -template <> struct hb_signedness_int { typedef unsigned int value; }; -template <> struct hb_signedness_int { typedef signed int value; }; -#define hb_signedness_int(T) hb_signedness_int::value +template struct hb_int_min; +template <> struct hb_int_min : hb_integral_constant {}; +template <> struct hb_int_min : hb_integral_constant {}; +template <> struct hb_int_min : hb_integral_constant {}; +template <> struct hb_int_min : hb_integral_constant {}; +template <> struct hb_int_min : hb_integral_constant {}; +template <> struct hb_int_min : hb_integral_constant {}; +template <> struct hb_int_min : hb_integral_constant {}; +template <> struct hb_int_min : hb_integral_constant {}; +template <> struct hb_int_min : hb_integral_constant {}; +template <> struct hb_int_min : hb_integral_constant {}; +template <> struct hb_int_min : hb_integral_constant {}; +#define hb_int_min(T) hb_int_min::value +template struct hb_int_max; +template <> struct hb_int_max : hb_integral_constant {}; +template <> struct hb_int_max : hb_integral_constant {}; +template <> struct hb_int_max : hb_integral_constant {}; +template <> struct hb_int_max : hb_integral_constant {}; +template <> struct hb_int_max : hb_integral_constant {}; +template <> struct hb_int_max : hb_integral_constant {}; +template <> struct hb_int_max : hb_integral_constant {}; +template <> struct hb_int_max : hb_integral_constant {}; +template <> struct hb_int_max : hb_integral_constant {}; +template <> struct hb_int_max : hb_integral_constant {}; +template <> struct hb_int_max : hb_integral_constant {}; +#define hb_int_max(T) hb_int_max::value -template struct hb_is_integer { enum { value = false }; }; -template <> struct hb_is_integer { enum { value = true }; }; -template <> struct hb_is_integer { enum { value = true }; }; -template <> struct hb_is_integer { enum { value = true }; }; -template <> struct hb_is_integer { enum { value = true }; }; -template <> struct hb_is_integer { enum { value = true }; }; -template <> struct hb_is_integer { enum { value = true }; }; -template <> struct hb_is_integer { enum { value = true }; }; -template <> struct hb_is_integer { enum { value = true }; }; -template <> struct hb_is_integer { enum { value = true }; }; -template <> struct hb_is_integer { enum { value = true }; }; -template <> struct hb_is_integer { enum { value = true }; }; -#define hb_is_integer(T) hb_is_integer::value + + +template +struct _hb_is_destructible : hb_false_type {}; +template +struct _hb_is_destructible> : hb_true_type {}; +template +using hb_is_destructible = _hb_is_destructible; +#define hb_is_destructible(T) hb_is_destructible::value + +template +struct _hb_is_constructible : hb_false_type {}; +template +struct _hb_is_constructible, Ts...> : hb_true_type {}; +template +using hb_is_constructible = _hb_is_constructible; +#define hb_is_constructible(...) hb_is_constructible<__VA_ARGS__>::value + +template +using hb_is_default_constructible = hb_is_constructible; +#define hb_is_default_constructible(T) hb_is_default_constructible::value + +template +using hb_is_copy_constructible = hb_is_constructible>>; +#define hb_is_copy_constructible(T) hb_is_copy_constructible::value + +template +using hb_is_move_constructible = hb_is_constructible>>; +#define hb_is_move_constructible(T) hb_is_move_constructible::value + +template +struct _hb_is_assignable : hb_false_type {}; +template +struct _hb_is_assignable> : hb_true_type {}; +template +using hb_is_assignable = _hb_is_assignable; +#define hb_is_assignable(T,U) hb_is_assignable::value + +template +using hb_is_copy_assignable = hb_is_assignable, + hb_add_lvalue_reference>>; +#define hb_is_copy_assignable(T) hb_is_copy_assignable::value + +template +using hb_is_move_assignable = hb_is_assignable, + hb_add_rvalue_reference>; +#define hb_is_move_assignable(T) hb_is_move_assignable::value + +/* Trivial versions. */ + +template union hb_trivial { T value; }; + +/* Don't know how to do the following. */ +template +using hb_is_trivially_destructible= hb_is_destructible>; +#define hb_is_trivially_destructible(T) hb_is_trivially_destructible::value + +/* Don't know how to do the following. */ +//template +//using hb_is_trivially_constructible= hb_is_constructible, hb_trivial...>; +//#define hb_is_trivially_constructible(...) hb_is_trivially_constructible<__VA_ARGS__>::value + +template +using hb_is_trivially_default_constructible= hb_is_default_constructible>; +#define hb_is_trivially_default_constructible(T) hb_is_trivially_default_constructible::value + +template +using hb_is_trivially_copy_constructible= hb_is_copy_constructible>; +#define hb_is_trivially_copy_constructible(T) hb_is_trivially_copy_constructible::value + +template +using hb_is_trivially_move_constructible= hb_is_move_constructible>; +#define hb_is_trivially_move_constructible(T) hb_is_trivially_move_constructible::value + +/* Don't know how to do the following. */ +//template +//using hb_is_trivially_assignable= hb_is_assignable, hb_trivial>; +//#define hb_is_trivially_assignable(T,U) hb_is_trivially_assignable::value + +template +using hb_is_trivially_copy_assignable= hb_is_copy_assignable>; +#define hb_is_trivially_copy_assignable(T) hb_is_trivially_copy_assignable::value + +template +using hb_is_trivially_move_assignable= hb_is_move_assignable>; +#define hb_is_trivially_move_assignable(T) hb_is_trivially_move_assignable::value + +template +using hb_is_trivially_copyable= hb_bool_constant< + hb_is_trivially_destructible (T) && + (!hb_is_move_assignable (T) || hb_is_trivially_move_assignable (T)) && + (!hb_is_move_constructible (T) || hb_is_trivially_move_constructible (T)) && + (!hb_is_copy_assignable (T) || hb_is_trivially_copy_assignable (T)) && + (!hb_is_copy_constructible (T) || hb_is_trivially_copy_constructible (T)) && + true +>; +#define hb_is_trivially_copyable(T) hb_is_trivially_copyable::value + +template +using hb_is_trivial= hb_bool_constant< + hb_is_trivially_copyable (T) && + hb_is_trivially_default_constructible (T) +>; +#define hb_is_trivial(T) hb_is_trivial::value #endif /* HB_META_HH */ diff --git a/src/hb-mutex.hh b/src/hb-mutex.hh index 35f1fded1..a760e7317 100644 --- a/src/hb-mutex.hh +++ b/src/hb-mutex.hh @@ -127,8 +127,6 @@ typedef int hb_mutex_impl_t; struct hb_mutex_t { - /* TODO Add tracing. */ - hb_mutex_impl_t m; void init () { hb_mutex_impl_init (&m); } diff --git a/src/hb-null.hh b/src/hb-null.hh index 9d23d50c3..674b4dffc 100644 --- a/src/hb-null.hh +++ b/src/hb-null.hh @@ -37,7 +37,7 @@ /* Global nul-content Null pool. Enlarge as necessary. */ -#define HB_NULL_POOL_SIZE 9880 +#define HB_NULL_POOL_SIZE 384 /* Use SFINAE to sniff whether T has min_size; in which case return T::null_size, * otherwise return sizeof(T). */ @@ -46,16 +46,13 @@ * https://stackoverflow.com/questions/7776448/sfinae-tried-with-bool-gives-compiler-error-template-argument-tvalue-invol */ -template -struct _hb_null_size -{ enum { value = sizeof (T) }; }; +template +struct _hb_null_size : hb_integral_constant {}; template -struct _hb_null_size > -{ enum { value = T::null_size }; }; +struct _hb_null_size> : hb_integral_constant {}; template -struct hb_null_size -{ enum { value = _hb_null_size::value }; }; +using hb_null_size = _hb_null_size; #define hb_null_size(T) hb_null_size::value /* These doesn't belong here, but since is copy/paste from above, put it here. */ @@ -63,16 +60,12 @@ struct hb_null_size /* hb_static_size (T) * Returns T::static_size if T::min_size is defined, or sizeof (T) otherwise. */ -template -struct _hb_static_size -{ enum { value = sizeof (T) }; }; +template +struct _hb_static_size : hb_integral_constant {}; template -struct _hb_static_size > -{ enum { value = T::static_size }; }; - +struct _hb_static_size> : hb_integral_constant {}; template -struct hb_static_size -{ enum { value = _hb_static_size::value }; }; +using hb_static_size = _hb_static_size; #define hb_static_size(T) hb_static_size::value @@ -95,7 +88,7 @@ struct Null { template struct NullHelper { - typedef hb_remove_const (hb_remove_reference (QType)) Type; + typedef hb_remove_const> Type; static const Type & get_null () { return Null::get_null (); } }; #define Null(Type) NullHelper::get_null () @@ -148,7 +141,7 @@ static inline Type& Crap () { template struct CrapHelper { - typedef hb_remove_const (hb_remove_reference (QType)) Type; + typedef hb_remove_const> Type; static Type & get_crap () { return Crap (); } }; #define Crap(Type) CrapHelper::get_crap () @@ -171,7 +164,7 @@ struct CrapOrNullHelper { template struct hb_nonnull_ptr_t { - typedef hb_remove_pointer (P) T; + typedef hb_remove_pointer

T; hb_nonnull_ptr_t (T *v_ = nullptr) : v (v_) {} T * operator = (T *v_) { return v = v_; } diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh index 03d27c118..5318c7fca 100644 --- a/src/hb-open-file.hh +++ b/src/hb-open-file.hh @@ -56,7 +56,7 @@ typedef struct TableRecord { int cmp (Tag t) const { return -t.cmp (tag); } - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const TableRecord *a = (const TableRecord *) pa; const TableRecord *b = (const TableRecord *) pb; @@ -86,15 +86,15 @@ typedef struct OffsetTable const TableRecord& get_table (unsigned int i) const { return tables[i]; } unsigned int get_table_tags (unsigned int start_offset, - unsigned int *table_count, /* IN/OUT */ - hb_tag_t *table_tags /* OUT */) const + unsigned int *table_count, /* IN/OUT */ + hb_tag_t *table_tags /* OUT */) const { if (table_count) { if (start_offset >= tables.len) *table_count = 0; else - *table_count = MIN (*table_count, tables.len - start_offset); + *table_count = hb_min (*table_count, tables.len - start_offset); const TableRecord *sub_tables = tables.arrayZ + start_offset; unsigned int count = *table_count; @@ -222,7 +222,7 @@ struct TTCHeaderVersion1 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ FixedVersion<>version; /* Version of the TTC Header (1.0), * 0x00010000u */ - LArrayOf > + LArrayOf> table; /* Array of offsets to the OffsetTable for each font * from the beginning of the file */ public: @@ -334,7 +334,7 @@ struct ResourceTypeRecord protected: Tag tag; /* Resource type. */ HBUINT16 resCountM1; /* Number of resources minus 1. */ - NNOffsetTo > + NNOffsetTo> resourcesZ; /* Offset from beginning of resource type list * to reference item list for this type. */ public: @@ -390,7 +390,7 @@ struct ResourceMap HBUINT32 reserved1; /* Reserved for handle to next resource map */ HBUINT16 resreved2; /* Reserved for file reference number */ HBUINT16 attrs; /* Resource fork attribute */ - NNOffsetTo > + NNOffsetTo> typeList; /* Offset from beginning of map to * resource type list */ Offset16 nameList; /* Offset from beginning of map to @@ -422,7 +422,7 @@ struct ResourceForkHeader } protected: - LNNOffsetTo > + LNNOffsetTo> data; /* Offset from beginning of resource fork * to resource data */ LNNOffsetTo diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index c4707294f..57b22a8e3 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -57,13 +57,14 @@ template struct IntType { typedef Type type; - typedef typename hb_signedness_int (hb_is_signed (Type)) wide_type; + typedef hb_conditional wide_type; IntType& operator = (wide_type i) { v = i; return *this; } operator wide_type () const { return v; } bool operator == (const IntType &o) const { return (Type) v == (Type) o.v; } bool operator != (const IntType &o) const { return !(*this == o); } - static int cmp (const IntType *a, const IntType *b) { return b->cmp (*a); } + HB_INTERNAL static int cmp (const IntType *a, const IntType *b) + { return b->cmp (*a); } template int cmp (Type2 a) const { @@ -109,7 +110,7 @@ struct F2DOT14 : HBINT16 F2DOT14& operator = (uint16_t i ) { HBINT16::operator= (i); return *this; } // 16384 means 1<<14 float to_float () const { return ((int32_t) v) / 16384.f; } - void set_float (float f) { v = round (f * 16384.f); } + void set_float (float f) { v = roundf (f * 16384.f); } public: DEFINE_SIZE_STATIC (2); }; @@ -120,7 +121,7 @@ struct Fixed : HBINT32 Fixed& operator = (uint32_t i) { HBINT32::operator= (i); return *this; } // 65536 means 1<<16 float to_float () const { return ((int32_t) v) / 65536.f; } - void set_float (float f) { v = round (f * 65536.f); } + void set_float (float f) { v = roundf (f * 65536.f); } public: DEFINE_SIZE_STATIC (4); }; @@ -181,7 +182,7 @@ struct Offset : Type void *serialize (hb_serialize_context_t *c, const void *base) { void *t = c->start_embed (); - *this = (char *) t - (char *) base; /* TODO(serialize) Overflow? */ + c->check_assign (*this, (unsigned) ((char *) t - (char *) base)); return t; } @@ -262,6 +263,9 @@ struct _hb_has_null template struct OffsetTo : Offset { + HB_DELETE_COPY_ASSIGN (OffsetTo); + OffsetTo () = default; + OffsetTo& operator = (typename OffsetType::type i) { OffsetType::operator= (i); return *this; } const Type& operator () (const void *base) const @@ -280,18 +284,18 @@ struct OffsetTo : Offset return * (Type *) Offset::serialize (c, base); } - template - bool serialize_subset (hb_subset_context_t *c, const T &src, const void *base) + template + bool serialize_subset (hb_subset_context_t *c, const Type &src, const void *base, Ts&&... ds) { *this = 0; - if (has_null && &src == &Null (T)) + if (has_null && &src == _hb_has_null::get_null ()) return false; auto *s = c->serializer; s->push (); - bool ret = src.subset (c); + bool ret = c->dispatch (src, hb_forward (ds)...); if (ret || !has_null) s->add_link (*this, s->pop_pack (), base); @@ -301,6 +305,23 @@ struct OffsetTo : Offset return ret; } + /* TODO: Somehow merge this with previous function into a serialize_dispatch(). */ + template + bool serialize_copy (hb_serialize_context_t *c, const Type &src, const void *base, Ts&&... ds) + { + *this = 0; + if (has_null && &src == _hb_has_null::get_null ()) + return false; + + c->push (); + + bool ret = c->copy (src, hb_forward (ds)...); + + c->add_link (*this, c->pop_pack (), base); + + return ret; + } + bool sanitize_shallow (hb_sanitize_context_t *c, const void *base) const { TRACE_SANITIZE (this); @@ -310,39 +331,13 @@ struct OffsetTo : Offset return_trace (true); } - bool sanitize (hb_sanitize_context_t *c, const void *base) const + template + bool sanitize (hb_sanitize_context_t *c, const void *base, Ts&&... ds) const { TRACE_SANITIZE (this); return_trace (sanitize_shallow (c, base) && (this->is_null () || - StructAtOffset (base, *this).sanitize (c) || - neuter (c))); - } - template - bool sanitize (hb_sanitize_context_t *c, const void *base, T1 d1) const - { - TRACE_SANITIZE (this); - return_trace (sanitize_shallow (c, base) && - (this->is_null () || - StructAtOffset (base, *this).sanitize (c, d1) || - neuter (c))); - } - template - bool sanitize (hb_sanitize_context_t *c, const void *base, T1 d1, T2 d2) const - { - TRACE_SANITIZE (this); - return_trace (sanitize_shallow (c, base) && - (this->is_null () || - StructAtOffset (base, *this).sanitize (c, d1, d2) || - neuter (c))); - } - template - bool sanitize (hb_sanitize_context_t *c, const void *base, T1 d1, T2 d2, T3 d3) const - { - TRACE_SANITIZE (this); - return_trace (sanitize_shallow (c, base) && - (this->is_null () || - StructAtOffset (base, *this).sanitize (c, d1, d2, d3) || + c->dispatch (StructAtOffset (base, *this), hb_forward (ds)...) || neuter (c))); } @@ -417,38 +412,42 @@ struct UnsizedArrayOf void qsort (unsigned int len, unsigned int start = 0, unsigned int end = (unsigned int) -1) { as_array (len).qsort (start, end); } - bool sanitize (hb_sanitize_context_t *c, unsigned int count) const + bool serialize (hb_serialize_context_t *c, unsigned int items_len) { - 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)); - + TRACE_SERIALIZE (this); + if (unlikely (!c->extend (*this, items_len))) return_trace (false); return_trace (true); } - bool sanitize (hb_sanitize_context_t *c, unsigned int count, const void *base) const + template + bool serialize (hb_serialize_context_t *c, Iterator items) { - 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); + TRACE_SERIALIZE (this); + unsigned count = items.len (); + if (unlikely (!serialize (c, count))) return_trace (false); + /* TODO Umm. Just exhaust the iterator instead? Being extra + * cautious right now.. */ + for (unsigned i = 0; i < count; i++, ++items) + arrayZ[i] = *items; return_trace (true); } - template - bool sanitize (hb_sanitize_context_t *c, unsigned int count, const void *base, T user_data) const + + UnsizedArrayOf* copy (hb_serialize_context_t *c, unsigned count) const + { + TRACE_SERIALIZE (this); + auto *out = c->start_embed (this); + if (unlikely (!as_array (count).copy (c))) return_trace (nullptr); + return_trace (out); + } + + template + bool sanitize (hb_sanitize_context_t *c, unsigned int count, Ts&&... ds) const { TRACE_SANITIZE (this); if (unlikely (!sanitize_shallow (c, count))) return_trace (false); + if (!sizeof... (Ts) && hb_is_trivially_copyable (Type)) return_trace (true); for (unsigned int i = 0; i < count; i++) - if (unlikely (!arrayZ[i].sanitize (c, base, user_data))) + if (unlikely (!c->dispatch (arrayZ[i], hb_forward (ds)...))) return_trace (false); return_trace (true); } @@ -467,7 +466,7 @@ struct UnsizedArrayOf /* Unsized array of offset's */ template -using UnsizedOffsetArrayOf = UnsizedArrayOf >; +using UnsizedOffsetArrayOf = UnsizedArrayOf>; /* Unsized array of offsets relative to the beginning of the array itself. */ template @@ -488,17 +487,12 @@ struct UnsizedOffsetListOf : UnsizedOffsetArrayOf return this+*p; } - - bool sanitize (hb_sanitize_context_t *c, unsigned int count) const + template + bool sanitize (hb_sanitize_context_t *c, unsigned int count, Ts&&... ds) const { TRACE_SANITIZE (this); - return_trace ((UnsizedOffsetArrayOf::sanitize (c, count, this))); - } - template - 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))); + return_trace ((UnsizedOffsetArrayOf + ::sanitize (c, count, this, hb_forward (ds)...))); } }; @@ -578,12 +572,12 @@ struct ArrayOf { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - len = items_len; /* TODO(serialize) Overflow? */ + c->check_assign (len, items_len); if (unlikely (!c->extend (*this))) return_trace (false); return_trace (true); } template + hb_requires (hb_is_source_of (Iterator, Type))> bool serialize (hb_serialize_context_t *c, Iterator items) { TRACE_SERIALIZE (this); @@ -591,45 +585,30 @@ struct ArrayOf if (unlikely (!serialize (c, count))) return_trace (false); /* TODO Umm. Just exhaust the iterator instead? Being extra * cautious right now.. */ - for (unsigned i = 0; i < count; i++, items++) + for (unsigned i = 0; i < count; i++, ++items) arrayZ[i] = *items; return_trace (true); } - bool sanitize (hb_sanitize_context_t *c) const + ArrayOf* copy (hb_serialize_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 && arrayZ[0].sanitize (c)); - - return_trace (true); + TRACE_SERIALIZE (this); + auto *out = c->start_embed (this); + if (unlikely (!c->extend_min (out))) return_trace (nullptr); + c->check_assign (out->len, len); + if (unlikely (!as_array ().copy (c))) return_trace (nullptr); + return_trace (out); } - bool sanitize (hb_sanitize_context_t *c, const void *base) const + + template + bool sanitize (hb_sanitize_context_t *c, Ts&&... ds) const { TRACE_SANITIZE (this); if (unlikely (!sanitize_shallow (c))) return_trace (false); + if (!sizeof... (Ts) && hb_is_trivially_copyable (Type)) return_trace (true); unsigned int count = len; for (unsigned int i = 0; i < count; i++) - if (unlikely (!arrayZ[i].sanitize (c, base))) - return_trace (false); - return_trace (true); - } - template - bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const - { - TRACE_SANITIZE (this); - if (unlikely (!sanitize_shallow (c))) return_trace (false); - unsigned int count = len; - for (unsigned int i = 0; i < count; i++) - if (unlikely (!arrayZ[i].sanitize (c, base, user_data))) + if (unlikely (!c->dispatch (arrayZ[i], hb_forward (ds)...))) return_trace (false); return_trace (true); } @@ -662,9 +641,9 @@ using PString = ArrayOf; /* Array of Offset's */ template -using OffsetArrayOf = ArrayOf >; +using OffsetArrayOf = ArrayOf>; template -using LOffsetArrayOf = ArrayOf >; +using LOffsetArrayOf = ArrayOf>; template using LOffsetLArrayOf = ArrayOf, HBUINT32>; @@ -696,16 +675,11 @@ struct OffsetListOf : OffsetArrayOf return_trace (true); } - bool sanitize (hb_sanitize_context_t *c) const + template + bool sanitize (hb_sanitize_context_t *c, Ts&&... ds) const { TRACE_SANITIZE (this); - return_trace (OffsetArrayOf::sanitize (c, this)); - } - template - bool sanitize (hb_sanitize_context_t *c, T user_data) const - { - TRACE_SANITIZE (this); - return_trace (OffsetArrayOf::sanitize (c, this, user_data)); + return_trace (OffsetArrayOf::sanitize (c, this, hb_forward (ds)...)); } }; @@ -737,27 +711,23 @@ struct HeadlessArrayOf { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - lenP1 = items.length + 1; /* TODO(serialize) Overflow? */ + c->check_assign (lenP1, items.length + 1); if (unlikely (!c->extend (*this))) return_trace (false); for (unsigned int i = 0; i < items.length; i++) arrayZ[i] = items[i]; return_trace (true); } - bool sanitize (hb_sanitize_context_t *c) const + template + bool sanitize (hb_sanitize_context_t *c, Ts&&... ds) 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 && arrayZ[0].sanitize (c)); - + if (!sizeof... (Ts) && hb_is_trivially_copyable (Type)) return_trace (true); + unsigned int count = lenP1 ? lenP1 - 1 : 0; + for (unsigned int i = 0; i < count; i++) + if (unlikely (!c->dispatch (arrayZ[i], hb_forward (ds)...))) + return_trace (false); return_trace (true); } @@ -797,14 +767,14 @@ struct ArrayOfM1 unsigned int get_size () const { return lenM1.static_size + (lenM1 + 1) * Type::static_size; } - template - bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const + template + bool sanitize (hb_sanitize_context_t *c, Ts&&... ds) const { TRACE_SANITIZE (this); if (unlikely (!sanitize_shallow (c))) return_trace (false); unsigned int count = lenM1 + 1; for (unsigned int i = 0; i < count; i++) - if (unlikely (!arrayZ[i].sanitize (c, base, user_data))) + if (unlikely (!c->dispatch (arrayZ[i], hb_forward (ds)...))) return_trace (false); return_trace (true); } @@ -855,7 +825,7 @@ struct SortedArrayOf : ArrayOf return_trace (ret); } template + hb_requires (hb_is_sorted_source_of (Iterator, Type))> bool serialize (hb_serialize_context_t *c, Iterator items) { TRACE_SERIALIZE (this); @@ -863,7 +833,6 @@ struct SortedArrayOf : ArrayOf return_trace (ret); } - template Type &bsearch (const T &x, Type ¬_found = Crap (Type)) { return *as_array ().bsearch (x, ¬_found); } @@ -896,7 +865,7 @@ struct BinSearchHeader { len = v; assert (len == v); - entrySelector = MAX (1u, hb_bit_storage (v)) - 1; + entrySelector = hb_max (1u, hb_bit_storage (v)) - 1; searchRange = 16 * (1u << entrySelector); rangeShift = v * 16 > searchRange ? 16 * v - searchRange @@ -915,7 +884,7 @@ struct BinSearchHeader }; template -using BinSearchArrayOf = SortedArrayOf >; +using BinSearchArrayOf = SortedArrayOf>; struct VarSizedBinSearchHeader @@ -980,40 +949,15 @@ struct VarSizedBinSearchArrayOf unsigned int get_size () const { return header.static_size + header.nUnits * header.unitSize; } - 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 (&bytesZ, 0).sanitize (c)); - - return_trace (true); - } - bool sanitize (hb_sanitize_context_t *c, const void *base) const + template + bool sanitize (hb_sanitize_context_t *c, Ts&&... ds) const { TRACE_SANITIZE (this); if (unlikely (!sanitize_shallow (c))) return_trace (false); + if (!sizeof... (Ts) && hb_is_trivially_copyable (Type)) return_trace (true); unsigned int count = get_length (); for (unsigned int i = 0; i < count; i++) - if (unlikely (!(*this)[i].sanitize (c, base))) - return_trace (false); - return_trace (true); - } - template - bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const - { - TRACE_SANITIZE (this); - if (unlikely (!sanitize_shallow (c))) return_trace (false); - unsigned int count = get_length (); - for (unsigned int i = 0; i < count; i++) - if (unlikely (!(*this)[i].sanitize (c, base, user_data))) + if (unlikely (!(*this)[i].sanitize (c, hb_forward (ds)...))) return_trace (false); return_trace (true); } diff --git a/src/hb-ot-cff-common.hh b/src/hb-ot-cff-common.hh index e7ac0bac2..5d80943b7 100644 --- a/src/hb-ot-cff-common.hh +++ b/src/hb-ot-cff-common.hh @@ -167,7 +167,7 @@ struct CFFIndex byteArray.resize (buffArray.length); for (unsigned int i = 0; i < byteArray.length; i++) { - byteArray[i] = byte_str_t (buffArray[i].arrayZ (), buffArray[i].length); + byteArray[i] = byte_str_t (buffArray[i].arrayZ, buffArray[i].length); } bool result = this->serialize (c, offSize_, byteArray); byteArray.fini (); diff --git a/src/hb-ot-cff1-table.cc b/src/hb-ot-cff1-table.cc index 8773c05a2..2844f3ca4 100644 --- a/src/hb-ot-cff1-table.cc +++ b/src/hb-ot-cff1-table.cc @@ -165,8 +165,8 @@ struct bounds_t { void init () { - min.set_int (0x7FFFFFFF, 0x7FFFFFFF); - max.set_int (-0x80000000, -0x80000000); + min.set_int (INT_MAX, INT_MAX); + max.set_int (INT_MIN, INT_MIN); } void update (const point_t &pt) @@ -305,6 +305,11 @@ bool _get_bounds (const OT::cff1::accelerator_t *cff, hb_codepoint_t glyph, boun bool OT::cff1::accelerator_t::get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const { +#ifdef HB_NO_OT_FONT_CFF + /* XXX Remove check when this code moves to .hh file. */ + return true; +#endif + bounds_t bounds; if (!_get_bounds (this, glyph, bounds)) diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index 7fbda905e..f7ec00c34 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -110,7 +110,8 @@ struct Encoding1 { { if (glyph <= ranges[i].nLeft) { - return (hb_codepoint_t)ranges[i].first + glyph; + hb_codepoint_t code = (hb_codepoint_t) ranges[i].first + glyph; + return (likely (code < 0x100) ? code: CFF_UNDEF_CODE); } glyph -= (ranges[i].nLeft + 1); } diff --git a/src/hb-ot-cff2-table.cc b/src/hb-ot-cff2-table.cc index 7daa53656..a1aaef636 100644 --- a/src/hb-ot-cff2-table.cc +++ b/src/hb-ot-cff2-table.cc @@ -34,10 +34,10 @@ struct extents_param_t void init () { path_open = false; - min_x.set_int (0x7FFFFFFF); - min_y.set_int (0x7FFFFFFF); - max_x.set_int (-0x80000000); - max_y.set_int (-0x80000000); + min_x.set_int (INT_MAX); + min_y.set_int (INT_MAX); + max_x.set_int (INT_MIN); + max_y.set_int (INT_MIN); } void start_path () { path_open = true; } @@ -99,6 +99,11 @@ bool OT::cff2::accelerator_t::get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const { +#ifdef HB_NO_OT_FONT_CFF + /* XXX Remove check when this code moves to .hh file. */ + return true; +#endif + if (unlikely (!is_valid () || (glyph >= num_glyphs))) return false; unsigned int num_coords; diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index add5325a4..cec78d77c 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -93,7 +93,7 @@ struct CmapSubtableFormat4 this->length = get_sub_table_size (segments); this->segCountX2 = segments.length * 2; - this->entrySelector = MAX (1u, hb_bit_storage (segments.length)) - 1; + this->entrySelector = hb_max (1u, hb_bit_storage (segments.length)) - 1; this->searchRange = 2 * (1u << this->entrySelector); this->rangeShift = segments.length * 2 > this->searchRange ? 2 * segments.length - this->searchRange @@ -142,7 +142,7 @@ struct CmapSubtableFormat4 for (unsigned int j = 0; j < num_codepoints; j++) { hb_codepoint_t cp = segments[i].start_code + j; - hb_codepoint_t new_gid; + hb_codepoint_t new_gid = 0; if (unlikely (!plan->new_gid_for_codepoint (cp, &new_gid))) return_trace (false); glyph_id_array[j] = new_gid; @@ -183,7 +183,7 @@ struct CmapSubtableFormat4 hb_codepoint_t cp = HB_SET_VALUE_INVALID; while (plan->unicodes->next (&cp)) { - hb_codepoint_t new_gid; + hb_codepoint_t new_gid = 0; if (unlikely (!plan->new_gid_for_codepoint (cp, &new_gid))) { DEBUG_MSG(SUBSET, nullptr, "Unable to find new gid for %04x", cp); @@ -285,7 +285,7 @@ struct CmapSubtableFormat4 *glyph = gid; return true; } - static bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph) + HB_INTERNAL static bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph) { return ((const accelerator_t *) obj)->get_glyph (codepoint, glyph); } @@ -348,7 +348,7 @@ struct CmapSubtableFormat4 /* Some broken fonts have too long of a "length" value. * If that is the case, just change the value to truncate * the subtable at the end of the blob. */ - uint16_t new_length = (uint16_t) MIN ((uintptr_t) 65535, + uint16_t new_length = (uint16_t) hb_min ((uintptr_t) 65535, (uintptr_t) (c->end - (char *) this)); if (!c->try_set (&length, new_length)) @@ -478,7 +478,7 @@ struct CmapSubtableLongSegmented { for (unsigned int i = 0; i < this->groups.len; i++) { out->add_range (this->groups[i].startCharCode, - MIN ((hb_codepoint_t) this->groups[i].endCharCode, + hb_min ((hb_codepoint_t) this->groups[i].endCharCode, (hb_codepoint_t) HB_UNICODE_MAX)); } } @@ -542,7 +542,7 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented hb_codepoint_t cp = HB_SET_VALUE_INVALID; while (plan->unicodes->next (&cp)) { - hb_codepoint_t new_gid; + hb_codepoint_t new_gid = 0; if (unlikely (!plan->new_gid_for_codepoint (cp, &new_gid))) { DEBUG_MSG(SUBSET, nullptr, "Unable to find new gid for %04x", cp); @@ -623,7 +623,7 @@ struct DefaultUVS : SortedArrayOf for (unsigned int i = 0; i < count; i++) { hb_codepoint_t first = arrayZ[i].startUnicodeValue; - hb_codepoint_t last = MIN ((hb_codepoint_t) (first + arrayZ[i].additionalCount), + hb_codepoint_t last = hb_min ((hb_codepoint_t) (first + arrayZ[i].additionalCount), (hb_codepoint_t) HB_UNICODE_MAX); out->add_range (first, last); } @@ -904,7 +904,7 @@ struct cmap // Write out format 4 sub table { CmapSubtable &subtable = format4_plat0_rec.subtable.serialize (&c, table); - format4_plat3_rec.subtable = format4_plat0_rec.subtable; + format4_plat3_rec.subtable = (unsigned int) format4_plat0_rec.subtable; subtable.u.format = 4; CmapSubtableFormat4 &format4 = subtable.u.format4; @@ -1096,18 +1096,18 @@ struct cmap hb_codepoint_t *glyph); template - static bool get_glyph_from (const void *obj, - hb_codepoint_t codepoint, - hb_codepoint_t *glyph) + HB_INTERNAL static bool get_glyph_from (const void *obj, + hb_codepoint_t codepoint, + hb_codepoint_t *glyph) { const Type *typed_obj = (const Type *) obj; return typed_obj->get_glyph (codepoint, glyph); } template - static bool get_glyph_from_symbol (const void *obj, - hb_codepoint_t codepoint, - hb_codepoint_t *glyph) + HB_INTERNAL static bool get_glyph_from_symbol (const void *obj, + hb_codepoint_t codepoint, + hb_codepoint_t *glyph) { const Type *typed_obj = (const Type *) obj; if (likely (typed_obj->get_glyph (codepoint, glyph))) diff --git a/src/hb-ot-color-cbdt-table.hh b/src/hb-ot-color-cbdt-table.hh index 333ceaaba..7955cf651 100644 --- a/src/hb-ot-color-cbdt-table.hh +++ b/src/hb-ot-color-cbdt-table.hh @@ -144,7 +144,7 @@ struct IndexSubtableFormat1Or3 } IndexSubtableHeader header; - UnsizedArrayOf > + UnsizedArrayOf> offsetArrayZ; public: DEFINE_SIZE_ARRAY(8, offsetArrayZ); @@ -349,15 +349,15 @@ struct CBLC if (unlikely (!count)) return Null(BitmapSizeTable); - unsigned int requested_ppem = MAX (font->x_ppem, font->y_ppem); + unsigned int requested_ppem = hb_max (font->x_ppem, font->y_ppem); if (!requested_ppem) requested_ppem = 1<<30; /* Choose largest strike. */ unsigned int best_i = 0; - unsigned int best_ppem = MAX (sizeTables[0].ppemX, sizeTables[0].ppemY); + unsigned int best_ppem = hb_max (sizeTables[0].ppemX, sizeTables[0].ppemY); for (unsigned int i = 1; i < count; i++) { - unsigned int ppem = MAX (sizeTables[i].ppemX, sizeTables[i].ppemY); + unsigned int ppem = hb_max (sizeTables[i].ppemX, sizeTables[i].ppemY); if ((requested_ppem <= ppem && ppem < best_ppem) || (requested_ppem > best_ppem && ppem > best_ppem)) { @@ -442,12 +442,12 @@ struct CBDT } /* Convert to font units. */ - double x_scale = upem / (double) strike.ppemX; - double y_scale = upem / (double) strike.ppemY; - extents->x_bearing = round (extents->x_bearing * x_scale); - extents->y_bearing = round (extents->y_bearing * y_scale); - extents->width = round (extents->width * x_scale); - extents->height = round (extents->height * y_scale); + float x_scale = upem / (float) strike.ppemX; + float y_scale = upem / (float) strike.ppemY; + extents->x_bearing = roundf (extents->x_bearing * x_scale); + extents->y_bearing = roundf (extents->y_bearing * y_scale); + extents->width = roundf (extents->width * x_scale); + extents->height = roundf (extents->height * y_scale); return true; } diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh index a57911ad0..90f89d583 100644 --- a/src/hb-ot-color-colr-table.hh +++ b/src/hb-ot-color-colr-table.hh @@ -125,9 +125,9 @@ struct COLR protected: HBUINT16 version; /* Table version number (starts at 0). */ HBUINT16 numBaseGlyphs; /* Number of Base Glyph Records. */ - LNNOffsetTo > + LNNOffsetTo> baseGlyphsZ; /* Offset to Base Glyph records. */ - LNNOffsetTo > + LNNOffsetTo> layersZ; /* Offset to Layer Records. */ HBUINT16 numLayers; /* Number of Layer Records. */ public: diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh index 407049350..9ec2957ea 100644 --- a/src/hb-ot-color-cpal-table.hh +++ b/src/hb-ot-color-cpal-table.hh @@ -87,15 +87,15 @@ struct CPALV1Tail } protected: - LNNOffsetTo > + LNNOffsetTo> paletteFlagsZ; /* Offset from the beginning of CPAL table to * the Palette Type Array. Set to 0 if no array * is provided. */ - LNNOffsetTo > + LNNOffsetTo> paletteLabelsZ; /* Offset from the beginning of CPAL table to * the palette labels array. Set to 0 if no * array is provided. */ - LNNOffsetTo > + LNNOffsetTo> colorLabelsZ; /* Offset from the beginning of CPAL table to * the color labels array. Set to 0 * if no array is provided. */ @@ -144,7 +144,7 @@ struct CPAL { hb_array_t segment_colors = palette_colors.sub_array (start_offset, *color_count); /* Always return numColors colors per palette even if it has out-of-bounds start index. */ - unsigned int count = MIN (MAX (numColors - start_offset, 0), *color_count); + unsigned int count = hb_min ((unsigned) hb_max ((int) (numColors - start_offset), 0), *color_count); *color_count = count; for (unsigned int i = 0; i < count; i++) colors[i] = segment_colors[i]; /* Bound-checked read. */ @@ -176,7 +176,7 @@ struct CPAL HBUINT16 numPalettes; /* Number of palettes in the table. */ HBUINT16 numColorRecords; /* Total number of color records, combined for * all palettes. */ - LNNOffsetTo > + LNNOffsetTo> colorRecordsZ; /* Offset from the beginning of CPAL table to * the first ColorRecord. */ UnsizedArrayOf diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh index f6bdbb3dd..9b725c46e 100644 --- a/src/hb-ot-color-sbix-table.hh +++ b/src/hb-ot-color-sbix-table.hh @@ -121,7 +121,7 @@ struct SBIXStrike HBUINT16 resolution; /* The device pixel density (in PPI) for which this * strike was designed. (E.g., 96 PPI, 192 PPI.) */ protected: - UnsizedArrayOf > + UnsizedArrayOf> imageOffsetsZ; /* Offset from the beginning of the strike data header * to bitmap data for an individual glyph ID. */ public: @@ -175,7 +175,7 @@ struct sbix if (unlikely (!count)) return Null(SBIXStrike); - unsigned int requested_ppem = MAX (font->x_ppem, font->y_ppem); + unsigned int requested_ppem = hb_max (font->x_ppem, font->y_ppem); if (!requested_ppem) requested_ppem = 1<<30; /* Choose largest strike. */ /* TODO Add DPI sensitivity as well? */ @@ -242,11 +242,11 @@ struct sbix /* Convert to font units. */ if (strike_ppem) { - double scale = font->face->get_upem () / (double) strike_ppem; - extents->x_bearing = round (extents->x_bearing * scale); - extents->y_bearing = round (extents->y_bearing * scale); - extents->width = round (extents->width * scale); - extents->height = round (extents->height * scale); + float scale = font->face->get_upem () / (float) strike_ppem; + extents->x_bearing = roundf (extents->x_bearing * scale); + extents->y_bearing = roundf (extents->y_bearing * scale); + extents->width = roundf (extents->width * scale); + extents->height = roundf (extents->height * scale); } hb_blob_destroy (blob); diff --git a/src/hb-ot-color-svg-table.hh b/src/hb-ot-color-svg-table.hh index 6e8eddf24..926d61e0f 100644 --- a/src/hb-ot-color-svg-table.hh +++ b/src/hb-ot-color-svg-table.hh @@ -62,7 +62,7 @@ struct SVGDocumentIndexEntry * this index entry. */ HBUINT16 endGlyphID; /* The last glyph ID in the range described by * this index entry. Must be >= startGlyphID. */ - LNNOffsetTo > + LNNOffsetTo> svgDoc; /* Offset from the beginning of the SVG Document Index * to an SVG document. Must be non-zero. */ HBUINT32 svgDocLength; /* Length of the SVG document. @@ -107,7 +107,7 @@ struct SVG protected: HBUINT16 version; /* Table version (starting at 0). */ - LOffsetTo > + LOffsetTo> svgDocEntries; /* Offset (relative to the start of the SVG table) to the * SVG Documents Index. Must be non-zero. */ /* Array of SVG Document Index Entries. */ diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc index badf0ecbc..20c602cdc 100644 --- a/src/hb-ot-color.cc +++ b/src/hb-ot-color.cc @@ -70,6 +70,9 @@ hb_bool_t hb_ot_color_has_palettes (hb_face_t *face) { +#ifdef HB_NO_COLOR + return false; +#endif return face->table.CPAL->has_data (); } @@ -86,6 +89,9 @@ hb_ot_color_has_palettes (hb_face_t *face) unsigned int hb_ot_color_palette_get_count (hb_face_t *face) { +#ifdef HB_NO_COLOR + return 0; +#endif return face->table.CPAL->get_palette_count (); } @@ -109,6 +115,9 @@ hb_ot_name_id_t hb_ot_color_palette_get_name_id (hb_face_t *face, unsigned int palette_index) { +#ifdef HB_NO_COLOR + return HB_OT_NAME_ID_INVALID; +#endif return face->table.CPAL->get_palette_name_id (palette_index); } @@ -131,6 +140,9 @@ hb_ot_name_id_t hb_ot_color_palette_color_get_name_id (hb_face_t *face, unsigned int color_index) { +#ifdef HB_NO_COLOR + return HB_OT_NAME_ID_INVALID; +#endif return face->table.CPAL->get_color_name_id (color_index); } @@ -149,6 +161,9 @@ hb_ot_color_palette_flags_t hb_ot_color_palette_get_flags (hb_face_t *face, unsigned int palette_index) { +#ifdef HB_NO_COLOR + return HB_OT_COLOR_PALETTE_FLAG_DEFAULT; +#endif return face->table.CPAL->get_palette_flags (palette_index); } @@ -180,6 +195,11 @@ hb_ot_color_palette_get_colors (hb_face_t *face, unsigned int *colors_count /* IN/OUT. May be NULL. */, hb_color_t *colors /* OUT. May be NULL. */) { +#ifdef HB_NO_COLOR + if (colors_count) + *colors_count = 0; + return 0; +#endif return face->table.CPAL->get_palette_colors (palette_index, start_offset, colors_count, colors); } @@ -201,6 +221,9 @@ hb_ot_color_palette_get_colors (hb_face_t *face, hb_bool_t hb_ot_color_has_layers (hb_face_t *face) { +#ifdef HB_NO_COLOR + return false; +#endif return face->table.COLR->has_data (); } @@ -209,9 +232,9 @@ hb_ot_color_has_layers (hb_face_t *face) * @face: #hb_face_t to work upon * @glyph: The glyph index to query * @start_offset: offset of the first layer to retrieve - * @count: (inout) (optional): Input = the maximum number of layers to return; + * @layer_count: (inout) (optional): Input = the maximum number of layers to return; * Output = the actual number of layers returned (may be zero) - * @layers: (out) (array length=count) (nullable): The array of layers found + * @layers: (out) (array length=layer_count) (nullable): The array of layers found * * Fetches a list of all color layers for the specified glyph index in the specified * face. The list returned will begin at the offset provided. @@ -224,10 +247,15 @@ unsigned int hb_ot_color_glyph_get_layers (hb_face_t *face, hb_codepoint_t glyph, unsigned int start_offset, - unsigned int *count, /* IN/OUT. May be NULL. */ + unsigned int *layer_count, /* IN/OUT. May be NULL. */ hb_ot_color_layer_t *layers /* OUT. May be NULL. */) { - return face->table.COLR->get_glyph_layers (glyph, start_offset, count, layers); +#ifdef HB_NO_COLOR + if (layer_count) + *layer_count = 0; + return 0; +#endif + return face->table.COLR->get_glyph_layers (glyph, start_offset, layer_count, layers); } @@ -248,6 +276,9 @@ hb_ot_color_glyph_get_layers (hb_face_t *face, hb_bool_t hb_ot_color_has_svg (hb_face_t *face) { +#ifdef HB_NO_COLOR + return false; +#endif return face->table.SVG->has_data (); } @@ -265,6 +296,9 @@ hb_ot_color_has_svg (hb_face_t *face) hb_blob_t * hb_ot_color_glyph_reference_svg (hb_face_t *face, hb_codepoint_t glyph) { +#ifdef HB_NO_COLOR + return hb_blob_get_empty (); +#endif return face->table.SVG->reference_blob_for_glyph (glyph); } @@ -286,6 +320,9 @@ hb_ot_color_glyph_reference_svg (hb_face_t *face, hb_codepoint_t glyph) hb_bool_t hb_ot_color_has_png (hb_face_t *face) { +#ifdef HB_NO_COLOR + return false; +#endif return face->table.CBDT->has_data () || face->table.sbix->has_data (); } @@ -305,6 +342,10 @@ hb_ot_color_has_png (hb_face_t *face) hb_blob_t * hb_ot_color_glyph_reference_png (hb_font_t *font, hb_codepoint_t glyph) { +#ifdef HB_NO_COLOR + return hb_blob_get_empty (); +#endif + hb_blob_t *blob = hb_blob_get_empty (); if (font->face->table.sbix->has_data ()) diff --git a/src/hb-ot-color.h b/src/hb-ot-color.h index bc6c844e1..63ef20a1a 100644 --- a/src/hb-ot-color.h +++ b/src/hb-ot-color.h @@ -110,7 +110,7 @@ HB_EXTERN unsigned int hb_ot_color_glyph_get_layers (hb_face_t *face, hb_codepoint_t glyph, unsigned int start_offset, - unsigned int *count, /* IN/OUT. May be NULL. */ + unsigned int *layer_count, /* IN/OUT. May be NULL. */ hb_ot_color_layer_t *layers /* OUT. May be NULL. */); /* diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 94a9fdc47..3344c4b6b 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -180,15 +180,20 @@ hb_ot_get_glyph_extents (hb_font_t *font, void *user_data HB_UNUSED) { const hb_ot_face_t *ot_face = (const hb_ot_face_t *) font_data; - bool ret = ot_face->sbix->get_extents (font, glyph, extents); - if (!ret) - ret = ot_face->glyf->get_extents (glyph, extents); - if (!ret) - ret = ot_face->cff1->get_extents (glyph, extents); - if (!ret) - ret = ot_face->cff2->get_extents (font, glyph, extents); - if (!ret) - ret = ot_face->CBDT->get_extents (font, glyph, extents); + bool ret = false; + +#if !defined(HB_NO_OT_FONT_BITMAP) && !defined(HB_NO_COLOR) + if (!ret) ret = ot_face->sbix->get_extents (font, glyph, extents); +#endif + if (!ret) ret = ot_face->glyf->get_extents (glyph, extents); +#ifndef HB_NO_OT_FONT_CFF + if (!ret) ret = ot_face->cff1->get_extents (glyph, extents); + if (!ret) ret = ot_face->cff2->get_extents (font, glyph, extents); +#endif +#if !defined(HB_NO_OT_FONT_BITMAP) && !defined(HB_NO_COLOR) + if (!ret) ret = ot_face->CBDT->get_extents (font, glyph, extents); +#endif + // TODO Hook up side-bearings variations. extents->x_bearing = font->em_scale_x (extents->x_bearing); extents->y_bearing = font->em_scale_y (extents->y_bearing); diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index b595e5efe..f7629eca3 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -58,7 +58,7 @@ struct loca public: DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always * check the size externally, allow Null() object of it by - * defining it MIN() instead. */ + * defining it _MIN instead. */ }; @@ -241,7 +241,7 @@ struct glyf loca_table = hb_sanitize_context_t ().reference_table (face); glyf_table = hb_sanitize_context_t ().reference_table (face); - num_glyphs = MAX (1u, loca_table.get_length () / (short_offset ? 2 : 4)) - 1; + num_glyphs = hb_max (1u, loca_table.get_length () / (short_offset ? 2 : 4)) - 1; } void fini () @@ -283,7 +283,7 @@ struct glyf /* based on FontTools _g_l_y_f.py::trim */ bool remove_padding (unsigned int start_offset, - unsigned int *end_offset) const + unsigned int *end_offset) const { if (*end_offset - start_offset < GlyphHeader::static_size) return true; @@ -451,10 +451,10 @@ struct glyf const GlyphHeader &glyph_header = StructAtOffset (glyf_table, start_offset); - extents->x_bearing = MIN (glyph_header.xMin, glyph_header.xMax); - extents->y_bearing = MAX (glyph_header.yMin, glyph_header.yMax); - extents->width = MAX (glyph_header.xMin, glyph_header.xMax) - extents->x_bearing; - extents->height = MIN (glyph_header.yMin, glyph_header.yMax) - extents->y_bearing; + extents->x_bearing = hb_min (glyph_header.xMin, glyph_header.xMax); + extents->y_bearing = hb_max (glyph_header.yMin, glyph_header.yMax); + extents->width = hb_max (glyph_header.xMin, glyph_header.xMax) - extents->x_bearing; + extents->height = hb_min (glyph_header.yMin, glyph_header.yMax) - extents->y_bearing; return true; } @@ -471,7 +471,7 @@ struct glyf public: DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always * check the size externally, allow Null() object of it by - * defining it MIN() instead. */ + * defining it _MIN instead. */ }; struct glyf_accelerator_t : glyf::accelerator_t {}; diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh index 847b32657..dc36d0ab5 100644 --- a/src/hb-ot-hdmx-table.hh +++ b/src/hb-ot-hdmx-table.hh @@ -41,71 +41,31 @@ namespace OT { struct DeviceRecord { - struct SubsetView - { - const DeviceRecord *source_device_record; - unsigned int sizeDeviceRecord; - hb_subset_plan_t *subset_plan; - - void init (const DeviceRecord *source_device_record, - unsigned int sizeDeviceRecord, - hb_subset_plan_t *subset_plan) - { - this->source_device_record = source_device_record; - this->sizeDeviceRecord = sizeDeviceRecord; - this->subset_plan = subset_plan; - } - - unsigned int len () const - { return this->subset_plan->num_output_glyphs (); } - - const HBUINT8* operator [] (unsigned int new_gid) const - { - if (unlikely (new_gid >= len ())) return nullptr; - - hb_codepoint_t old_gid; - if (!this->subset_plan->old_gid_for_new_gid (new_gid, &old_gid)) - return &Null(HBUINT8); - - if (old_gid >= sizeDeviceRecord - DeviceRecord::min_size) - return nullptr; - return &(this->source_device_record->widthsZ[old_gid]); - } - }; - - static unsigned int get_size (unsigned int count) + static unsigned int get_size (unsigned count) { return hb_ceil_to_4 (min_size + count * HBUINT8::static_size); } - bool serialize (hb_serialize_context_t *c, const SubsetView &subset_view) + template + bool serialize (hb_serialize_context_t *c, unsigned pixelSize, Iterator it) { TRACE_SERIALIZE (this); - unsigned int size = get_size (subset_view.len ()); - if (unlikely (!c->allocate_size (size))) - { - DEBUG_MSG(SUBSET, nullptr, "Couldn't allocate enough space for DeviceRecord: %d.", - size); - return_trace (false); - } + unsigned length = it.len (); - this->pixelSize = subset_view.source_device_record->pixelSize; - this->maxWidth = subset_view.source_device_record->maxWidth; + if (unlikely (!c->extend (*this, length))) return_trace (false); - for (unsigned int i = 0; i < subset_view.len (); i++) - { - const HBUINT8 *width = subset_view[i]; - if (!width) - { - DEBUG_MSG(SUBSET, nullptr, "HDMX width for new gid %d is missing.", i); - return_trace (false); - } - widthsZ[i] = *width; - } + this->pixelSize = pixelSize; + this->maxWidth = + + it + | hb_reduce (hb_max, 0u); + + + it + | hb_sink (widthsZ.as_array (length)); return_trace (true); } - bool sanitize (hb_sanitize_context_t *c, unsigned int sizeDeviceRecord) const + bool sanitize (hb_sanitize_context_t *c, unsigned sizeDeviceRecord) const { TRACE_SANITIZE (this); return_trace (likely (c->check_struct (this) && @@ -135,62 +95,63 @@ struct hdmx return StructAtOffset (&this->firstDeviceRecord, i * sizeDeviceRecord); } - bool serialize (hb_serialize_context_t *c, const hdmx *source_hdmx, hb_subset_plan_t *plan) + template + bool serialize (hb_serialize_context_t *c, unsigned version, Iterator it) { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min ((*this)))) return_trace (false); - this->version = source_hdmx->version; - this->numRecords = source_hdmx->numRecords; - this->sizeDeviceRecord = DeviceRecord::get_size (plan->num_output_glyphs ()); + this->version = version; + this->numRecords = it.len (); + this->sizeDeviceRecord = DeviceRecord::get_size (it ? (*it).second.len () : 0); - for (unsigned int i = 0; i < source_hdmx->numRecords; i++) - { - DeviceRecord::SubsetView subset_view; - subset_view.init (&(*source_hdmx)[i], source_hdmx->sizeDeviceRecord, plan); + + it + | hb_apply ([&] (const hb_item_type& _) { + c->start_embed ()->serialize (c, _.first, _.second); + }) + ; - if (!c->start_embed ()->serialize (c, subset_view)) - return_trace (false); - } + return_trace (c->successful); + } + + bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + + hdmx *hdmx_prime = c->serializer->start_embed (); + if (unlikely (!hdmx_prime)) return_trace (false); + + auto it = + + hb_range ((unsigned) numRecords) + | hb_map ([&] (unsigned _) + { + const DeviceRecord *device_record = + &StructAtOffset (&firstDeviceRecord, + _ * sizeDeviceRecord); + auto row = + + hb_range (c->plan->num_output_glyphs ()) + | hb_map (c->plan->reverse_glyph_map) + | hb_map ([=] (hb_codepoint_t _) + { + if (c->plan->is_empty_glyph (_)) + return Null(HBUINT8); + return device_record->widthsZ.as_array (get_num_glyphs ()) [_]; + }) + ; + return hb_pair ((unsigned) device_record->pixelSize, +row); + }) + ; + + hdmx_prime->serialize (c->serializer, version, it); return_trace (true); } - static size_t get_subsetted_size (const hdmx *source_hdmx, hb_subset_plan_t *plan) + unsigned get_num_glyphs () const { - return min_size + source_hdmx->numRecords * DeviceRecord::get_size (plan->num_output_glyphs ()); - } - - bool subset (hb_subset_plan_t *plan) const - { - size_t dest_size = get_subsetted_size (this, plan); - hdmx *dest = (hdmx *) malloc (dest_size); - if (unlikely (!dest)) - { - DEBUG_MSG(SUBSET, nullptr, "Unable to alloc %lu for hdmx subset output.", (unsigned long) dest_size); - return false; - } - - hb_serialize_context_t c (dest, dest_size); - hdmx *hdmx_prime = c.start_serialize (); - if (!hdmx_prime || !hdmx_prime->serialize (&c, this, plan)) - { - free (dest); - DEBUG_MSG(SUBSET, nullptr, "Failed to serialize write new hdmx."); - return false; - } - c.end_serialize (); - - hb_blob_t *hdmx_prime_blob = hb_blob_create ((const char *) dest, - dest_size, - HB_MEMORY_MODE_READONLY, - dest, - free); - bool result = plan->add_table (HB_OT_TAG_hdmx, hdmx_prime_blob); - hb_blob_destroy (hdmx_prime_blob); - - return result; + return sizeDeviceRecord - DeviceRecord::min_size; } bool sanitize (hb_sanitize_context_t *c) const diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 5dff981ef..b3a97109b 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -240,7 +240,7 @@ struct hmtxvmtx return default_advance; } - return table->longMetricZ[MIN (glyph, (uint32_t) num_advances - 1)].advance; + return table->longMetricZ[hb_min (glyph, (uint32_t) num_advances - 1)].advance; } unsigned int get_advance (hb_codepoint_t glyph, diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index ec6a3c84c..ae2bcc92d 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -47,9 +47,9 @@ struct KernSubTableFormat3 int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const { hb_array_t kernValue = kernValueZ.as_array (kernValueCount); - hb_array_t leftClass = StructAfter > (kernValue).as_array (glyphCount); - hb_array_t rightClass = StructAfter > (leftClass).as_array (glyphCount); - hb_array_t kernIndex = StructAfter > (rightClass).as_array (leftClassCount * rightClassCount); + hb_array_t leftClass = StructAfter> (kernValue).as_array (glyphCount); + hb_array_t rightClass = StructAfter> (leftClass).as_array (glyphCount); + hb_array_t kernIndex = StructAfter> (rightClass).as_array (leftClassCount * rightClassCount); unsigned int leftC = leftClass[left]; unsigned int rightC = rightClass[right]; @@ -121,16 +121,20 @@ struct KernSubTable } } - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { unsigned int subtable_type = get_type (); TRACE_DISPATCH (this, subtable_type); switch (subtable_type) { case 0: return_trace (c->dispatch (u.format0)); - case 1: return_trace (u.header.apple ? c->dispatch (u.format1) : c->default_return_value ()); +#ifndef HB_NO_SHAPE_AAT + case 1: return_trace (u.header.apple ? c->dispatch (u.format1, hb_forward (ds)...) : c->default_return_value ()); +#endif case 2: return_trace (c->dispatch (u.format2)); - case 3: return_trace (u.header.apple ? c->dispatch (u.format3) : c->default_return_value ()); +#ifndef HB_NO_SHAPE_AAT + case 3: return_trace (u.header.apple ? c->dispatch (u.format3, hb_forward (ds)...) : c->default_return_value ()); +#endif default: return_trace (c->default_return_value ()); } } @@ -278,7 +282,9 @@ struct kern { switch (get_type ()) { case 0: return u.ot.has_state_machine (); +#ifndef HB_NO_SHAPE_AAT case 1: return u.aat.has_state_machine (); +#endif default:return false; } } @@ -287,7 +293,9 @@ struct kern { switch (get_type ()) { case 0: return u.ot.has_cross_stream (); +#ifndef HB_NO_SHAPE_AAT case 1: return u.aat.has_cross_stream (); +#endif default:return false; } } @@ -296,7 +304,9 @@ struct kern { switch (get_type ()) { case 0: return u.ot.get_h_kerning (left, right); +#ifndef HB_NO_SHAPE_AAT case 1: return u.aat.get_h_kerning (left, right); +#endif default:return 0; } } @@ -304,14 +314,16 @@ struct kern bool apply (AAT::hb_aat_apply_context_t *c) const { return dispatch (c); } - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { unsigned int subtable_type = get_type (); TRACE_DISPATCH (this, subtable_type); switch (subtable_type) { - case 0: return_trace (c->dispatch (u.ot)); - case 1: return_trace (c->dispatch (u.aat)); + case 0: return_trace (c->dispatch (u.ot, hb_forward (ds)...)); +#ifndef HB_NO_SHAPE_AAT + case 1: return_trace (c->dispatch (u.aat, hb_forward (ds)...)); +#endif default: return_trace (c->default_return_value ()); } } @@ -328,7 +340,9 @@ struct kern HBUINT32 version32; HBUINT16 major; KernOT ot; +#ifndef HB_NO_SHAPE_AAT KernAAT aat; +#endif } u; public: DEFINE_SIZE_UNION (4, version32); diff --git a/src/hb-ot-layout-base-table.hh b/src/hb-ot-layout-base-table.hh index dd0fba1ff..091236294 100644 --- a/src/hb-ot-layout-base-table.hh +++ b/src/hb-ot-layout-base-table.hh @@ -153,7 +153,7 @@ struct BaseCoord struct FeatMinMaxRecord { - static int cmp (const void *key_, const void *entry_) + HB_INTERNAL static int cmp (const void *key_, const void *entry_) { hb_tag_t key = * (hb_tag_t *) key_; const FeatMinMaxRecord &entry = * (const FeatMinMaxRecord *) entry_; @@ -271,7 +271,7 @@ struct BaseValues struct BaseLangSysRecord { - static int cmp (const void *key_, const void *entry_) + HB_INTERNAL static int cmp (const void *key_, const void *entry_) { hb_tag_t key = * (hb_tag_t *) key_; const BaseLangSysRecord &entry = * (const BaseLangSysRecord *) entry_; @@ -345,7 +345,7 @@ struct BaseScript struct BaseScriptList; struct BaseScriptRecord { - static int cmp (const void *key_, const void *entry_) + HB_INTERNAL static int cmp (const void *key_, const void *entry_) { hb_tag_t key = * (hb_tag_t *) key_; const BaseScriptRecord &entry = * (const BaseScriptRecord *) entry_; @@ -447,7 +447,7 @@ struct Axis } protected: - OffsetTo > + OffsetTo> baseTagList; /* Offset to BaseTagList table, from beginning * of Axis table (may be NULL) * Array of 4-byte baseline identification tags — must diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 8882efd68..017895891 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -103,7 +103,7 @@ struct Record }; template -struct RecordArrayOf : SortedArrayOf > +struct RecordArrayOf : SortedArrayOf> { const OffsetTo& get_offset (unsigned int i) const { return (*this)[i].offset; } @@ -138,7 +138,7 @@ struct RecordListOf : RecordArrayOf bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - struct RecordListOf *out = c->serializer->embed (*this); + auto *out = c->serializer->embed (*this); if (unlikely (!out)) return_trace (false); unsigned int count = this->len; for (unsigned int i = 0; i < count; i++) @@ -229,10 +229,10 @@ struct LangSys return reqFeatureIndex;; } - bool subset (hb_subset_context_t *c) const + LangSys* copy (hb_serialize_context_t *c) const { - TRACE_SUBSET (this); - return_trace (c->serializer->embed (*this)); + TRACE_SERIALIZE (this); + return_trace (c->embed (*this)); } bool sanitize (hb_sanitize_context_t *c, @@ -277,12 +277,12 @@ struct Script bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - struct Script *out = c->serializer->embed (*this); + auto *out = c->serializer->embed (*this); if (unlikely (!out)) return_trace (false); - out->defaultLangSys.serialize_subset (c, this+defaultLangSys, out); + out->defaultLangSys.serialize_copy (c->serializer, this+defaultLangSys, out); unsigned int count = langSys.len; for (unsigned int i = 0; i < count; i++) - out->langSys.arrayZ[i].offset.serialize_subset (c, this+langSys[i].offset, out); + out->langSys.arrayZ[i].offset.serialize_copy (c->serializer, this+langSys[i].offset, out); return_trace (true); } @@ -559,7 +559,7 @@ struct Feature bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - struct Feature *out = c->serializer->embed (*this); + auto *out = c->serializer->embed (*this); if (unlikely (!out)) return_trace (false); out->featureParams = 0; /* TODO(subset) FeatureParams. */ return_trace (true); @@ -583,25 +583,25 @@ struct Feature * Adobe tools, only the 'size' feature had FeatureParams defined. */ - OffsetTo orig_offset = featureParams; + if (likely (featureParams.is_null ())) + return_trace (true); + + unsigned int orig_offset = featureParams; if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))) return_trace (false); - if (likely (orig_offset.is_null ())) - return_trace (true); - if (featureParams == 0 && closure && closure->tag == HB_TAG ('s','i','z','e') && closure->list_base && closure->list_base < this) { - unsigned int new_offset_int = (unsigned int) orig_offset - + unsigned int new_offset_int = orig_offset - (((char *) this) - ((char *) closure->list_base)); OffsetTo new_offset; - /* Check that it did not overflow. */ + /* Check that it would not overflow. */ new_offset = new_offset_int; if (new_offset == new_offset_int && - c->try_set (&featureParams, new_offset) && + c->try_set (&featureParams, new_offset_int) && !featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE)) return_trace (false); } @@ -647,16 +647,19 @@ struct Lookup { unsigned int get_subtable_count () const { return subTable.len; } - template - const TSubTable& get_subtable (unsigned int i) const - { return this+CastR > (subTable)[i]; } - template const OffsetArrayOf& get_subtables () const - { return CastR > (subTable); } + { return CastR> (subTable); } template OffsetArrayOf& get_subtables () - { return CastR > (subTable); } + { return CastR> (subTable); } + + template + const TSubTable& get_subtable (unsigned int i) const + { return this+get_subtables ()[i]; } + template + TSubTable& get_subtable (unsigned int i) + { return this+get_subtables ()[i]; } unsigned int get_size () const { @@ -682,14 +685,14 @@ struct Lookup return flag; } - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { unsigned int lookup_type = get_type (); TRACE_DISPATCH (this, lookup_type); unsigned int count = get_subtable_count (); for (unsigned int i = 0; i < count; i++) { - typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type); + typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type, hb_forward (ds)...); if (c->stop_sublookup_iteration (r)) return_trace (r); } @@ -715,28 +718,11 @@ struct Lookup return_trace (true); } - /* Older compilers need this to NOT be locally defined in a function. */ - template - struct SubTableSubsetWrapper - { - SubTableSubsetWrapper (const TSubTable &subtable_, - unsigned int lookup_type_) : - subtable (subtable_), - lookup_type (lookup_type_) {} - - bool subset (hb_subset_context_t *c) const - { return subtable.dispatch (c, lookup_type); } - - private: - const TSubTable &subtable; - unsigned int lookup_type; - }; - template bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - struct Lookup *out = c->serializer->embed (*this); + auto *out = c->serializer->embed (*this); if (unlikely (!out)) return_trace (false); /* Subset the actual subtables. */ @@ -746,23 +732,11 @@ struct Lookup OffsetArrayOf& out_subtables = out->get_subtables (); unsigned int count = subTable.len; for (unsigned int i = 0; i < count; i++) - { - SubTableSubsetWrapper wrapper (this+subtables[i], get_type ()); - - out_subtables[i].serialize_subset (c, wrapper, out); - } + out_subtables[i].serialize_subset (c, this+subtables[i], out, get_type ()); return_trace (true); } - /* Older compilers need this to NOT be locally defined in a function. */ - template - struct SubTableSanitizeWrapper : TSubTable - { - bool sanitize (hb_sanitize_context_t *c, unsigned int lookup_type) const - { return this->dispatch (c, lookup_type); } - }; - template bool sanitize (hb_sanitize_context_t *c) const { @@ -774,16 +748,21 @@ struct Lookup if (!markFilteringSet.sanitize (c)) return_trace (false); } - if (unlikely (!CastR > > (subTable) - .sanitize (c, this, get_type ()))) + if (unlikely (!get_subtables ().sanitize (c, this, get_type ()))) return_trace (false); - if (unlikely (get_type () == TSubTable::Extension)) + if (unlikely (get_type () == TSubTable::Extension && !c->get_edit_count ())) { /* The spec says all subtables of an Extension lookup should * have the same type, which shall not be the Extension type * itself (but we already checked for that). - * This is specially important if one has a reverse type! */ + * This is specially important if one has a reverse type! + * + * We only do this if sanitizer edit_count is zero. Otherwise, + * some of the subtables might have become insane after they + * were sanity-checked by the edits of subsequent subtables. + * https://bugs.chromium.org/p/chromium/issues/detail?id=960331 + */ unsigned int type = get_subtable (0).u.extension.get_type (); unsigned int count = get_subtable_count (); for (unsigned int i = 1; i < count; i++) @@ -791,7 +770,6 @@ struct Lookup return_trace (false); } return_trace (true); - return_trace (true); } private: @@ -826,7 +804,7 @@ struct CoverageFormat1 } template + hb_requires (hb_is_sorted_source_of (Iterator, hb_codepoint_t))> bool serialize (hb_serialize_context_t *c, Iterator glyphs) { TRACE_SERIALIZE (this); @@ -864,6 +842,8 @@ struct CoverageFormat1 bool more () const { return i < c->glyphArray.len; } void next () { i++; } hb_codepoint_t get_glyph () const { return c->glyphArray[i]; } + bool operator != (const iter_t& o) const + { return i != o.i || c != o.c; } private: const struct CoverageFormat1 *c; @@ -893,7 +873,7 @@ struct CoverageFormat2 } template + hb_requires (hb_is_sorted_source_of (Iterator, hb_codepoint_t))> bool serialize (hb_serialize_context_t *c, Iterator glyphs) { TRACE_SERIALIZE (this); @@ -904,30 +884,36 @@ struct CoverageFormat2 rangeRecord.len = 0; return_trace (true); } - /* TODO(iter) Port to non-random-access iterator interface. */ - unsigned int count = glyphs.len (); - unsigned int num_ranges = 1; - for (unsigned int i = 1; i < count; i++) - if (glyphs[i - 1] + 1 != glyphs[i]) - num_ranges++; - rangeRecord.len = num_ranges; - if (unlikely (!c->extend (rangeRecord))) return_trace (false); + /* TODO(iter) Write more efficiently? */ - unsigned int range = 0; - rangeRecord[range].start = glyphs[0]; - rangeRecord[range].value = 0; - for (unsigned int i = 1; i < count; i++) + unsigned num_ranges = 0; + hb_codepoint_t last = (hb_codepoint_t) -2; + for (auto g: glyphs) { - if (glyphs[i - 1] + 1 != glyphs[i]) - { - rangeRecord[range].end = glyphs[i - 1]; - range++; - rangeRecord[range].start = glyphs[i]; - rangeRecord[range].value = i; - } + if (last + 1 != g) + num_ranges++; + last = g; } - rangeRecord[range].end = glyphs[count - 1]; + + if (unlikely (!rangeRecord.serialize (c, num_ranges))) return_trace (false); + + unsigned count = 0; + unsigned range = (unsigned) -1; + last = (hb_codepoint_t) -2; + for (auto g: glyphs) + { + if (last + 1 != g) + { + range++; + rangeRecord[range].start = g; + rangeRecord[range].value = count; + } + rangeRecord[range].end = g; + last = g; + count++; + } + return_trace (true); } @@ -1016,6 +1002,8 @@ struct CoverageFormat2 j++; } hb_codepoint_t get_glyph () const { return j; } + bool operator != (const iter_t& o) const + { return i != o.i || j != o.j || c != o.c; } private: const struct CoverageFormat2 *c; @@ -1055,18 +1043,22 @@ struct Coverage } template + hb_requires (hb_is_sorted_source_of (Iterator, hb_codepoint_t))> bool serialize (hb_serialize_context_t *c, Iterator glyphs) { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - /* TODO(iter) Port to non-random-access iterator interface. */ - unsigned int count = glyphs.len (); - unsigned int num_ranges = 1; - for (unsigned int i = 1; i < count; i++) - if (glyphs[i - 1] + 1 != glyphs[i]) - num_ranges++; + unsigned count = 0; + unsigned num_ranges = 0; + hb_codepoint_t last = (hb_codepoint_t) -2; + for (auto g: glyphs) + { + if (last + 1 != g) + num_ranges++; + last = g; + count++; + } u.format = count * 2 < num_ranges * 3 ? 1 : 2; switch (u.format) @@ -1165,6 +1157,16 @@ struct Coverage default:return 0; } } + bool operator != (const iter_t& o) const + { + if (format != o.format) return true; + switch (format) + { + case 1: return u.format1 != o.u.format1; + case 2: return u.format2 != o.u.format2; + default:return false; + } + } private: unsigned int format; @@ -1222,7 +1224,7 @@ struct ClassDefFormat1 hb_codepoint_t glyph_max = +glyphs | hb_reduce (hb_max, 0u); startGlyph = glyph_min; - classValue.len = glyph_max - glyph_min + 1; + c->check_assign (classValue.len, glyph_max - glyph_min + 1); if (unlikely (!c->extend (classValue))) return_trace (false); for (unsigned int i = 0; i < glyphs.length; i++) @@ -1999,10 +2001,10 @@ struct FeatureVariations return (this+record.substitutions).find_substitute (feature_index); } - bool subset (hb_subset_context_t *c) const + FeatureVariations* copy (hb_serialize_context_t *c) const { - TRACE_SUBSET (this); - return_trace (c->serializer->embed (*this)); + TRACE_SERIALIZE (this); + return_trace (c->embed (*this)); } bool sanitize (hb_sanitize_context_t *c) const diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index dc8b9b847..ac1bddb2e 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -220,7 +220,7 @@ struct LigGlyph { if (caret_count) { - hb_array_t > array = carets.sub_array (start_offset, caret_count); + hb_array_t > array = carets.sub_array (start_offset, caret_count); unsigned int count = array.length; for (unsigned int i = 0; i < count; i++) caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph_id, var_store); @@ -296,7 +296,7 @@ struct MarkGlyphSetsFormat1 protected: HBUINT16 format; /* Format identifier--format = 1 */ - ArrayOf > + ArrayOf> coverage; /* Array of long offsets to mark set * coverage tables */ public: @@ -439,7 +439,7 @@ struct GDEF bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - struct GDEF *out = c->serializer->embed (*this); + auto *out = c->serializer->embed (*this); if (unlikely (!out)) return_trace (false); out->glyphClassDef.serialize_subset (c, this+glyphClassDef, out); diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 795853af5..45de78138 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -173,15 +173,15 @@ struct ValueFormat : HBUINT16 return true; } - static OffsetTo& get_device (Value* value) - { return *CastP > (value); } - static const OffsetTo& get_device (const Value* value, bool *worked=nullptr) + HB_INTERNAL static OffsetTo& get_device (Value* value) + { return *CastP> (value); } + HB_INTERNAL static const OffsetTo& get_device (const Value* value, bool *worked=nullptr) { if (worked) *worked |= bool (*value); - return *CastP > (value); + return *CastP> (value); } - static const HBINT16& get_short (const Value* value, bool *worked=nullptr) + HB_INTERNAL static const HBINT16& get_short (const Value* value, bool *worked=nullptr) { if (worked) *worked |= bool (*value); return *CastP (value); @@ -393,7 +393,7 @@ struct AnchorMatrix HBUINT16 rows; /* Number of rows */ protected: - UnsizedArrayOf > + UnsizedArrayOf> matrixZ; /* Matrix of offsets to Anchor tables-- * from beginning of AnchorMatrix table */ public: @@ -446,8 +446,8 @@ struct MarkArray : ArrayOf /* Array of MarkRecords--in Coverage orde 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 = round (base_x - mark_x); - o.y_offset = round (base_y - mark_y); + o.x_offset = roundf (base_x - mark_x); + o.y_offset = roundf (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; @@ -576,14 +576,14 @@ struct SinglePosFormat2 struct SinglePos { - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); - case 2: return_trace (c->dispatch (u.format2)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); + case 2: return_trace (c->dispatch (u.format2, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -907,14 +907,14 @@ struct PairPosFormat2 struct PairPos { - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); - case 2: return_trace (c->dispatch (u.format2)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); + case 2: return_trace (c->dispatch (u.format2, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -993,32 +993,32 @@ struct CursivePosFormat1 /* Main-direction adjustment */ switch (c->direction) { case HB_DIRECTION_LTR: - pos[i].x_advance = round (exit_x) + pos[i].x_offset; + pos[i].x_advance = roundf (exit_x) + pos[i].x_offset; - d = round (entry_x) + pos[j].x_offset; + d = roundf (entry_x) + pos[j].x_offset; pos[j].x_advance -= d; pos[j].x_offset -= d; break; case HB_DIRECTION_RTL: - d = round (exit_x) + pos[i].x_offset; + d = roundf (exit_x) + pos[i].x_offset; pos[i].x_advance -= d; pos[i].x_offset -= d; - pos[j].x_advance = round (entry_x) + pos[j].x_offset; + pos[j].x_advance = roundf (entry_x) + pos[j].x_offset; break; case HB_DIRECTION_TTB: - pos[i].y_advance = round (exit_y) + pos[i].y_offset; + pos[i].y_advance = roundf (exit_y) + pos[i].y_offset; - d = round (entry_y) + pos[j].y_offset; + d = roundf (entry_y) + pos[j].y_offset; pos[j].y_advance -= d; pos[j].y_offset -= d; break; case HB_DIRECTION_BTT: - d = round (exit_y) + pos[i].y_offset; + d = roundf (exit_y) + pos[i].y_offset; pos[i].y_advance -= d; pos[i].y_offset -= d; - pos[j].y_advance = round (entry_y); + pos[j].y_advance = roundf (entry_y); break; case HB_DIRECTION_INVALID: default: @@ -1092,13 +1092,13 @@ struct CursivePosFormat1 struct CursivePos { - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -1208,13 +1208,13 @@ struct MarkBasePosFormat1 struct MarkBasePos { - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -1287,7 +1287,7 @@ struct MarkLigPosFormat1 unsigned int mark_id = _hb_glyph_info_get_lig_id (&buffer->cur()); unsigned int mark_comp = _hb_glyph_info_get_lig_comp (&buffer->cur()); if (lig_id && lig_id == mark_id && mark_comp > 0) - comp_index = MIN (comp_count, _hb_glyph_info_get_lig_comp (&buffer->cur())) - 1; + comp_index = hb_min (comp_count, _hb_glyph_info_get_lig_comp (&buffer->cur())) - 1; else comp_index = comp_count - 1; @@ -1333,13 +1333,13 @@ struct MarkLigPosFormat1 struct MarkLigPos { - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -1455,13 +1455,13 @@ struct MarkMarkPosFormat1 struct MarkMarkPos { - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -1507,20 +1507,20 @@ struct PosLookupSubTable Extension = 9 }; - template - typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const + template + typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type, Ts&&... ds) const { TRACE_DISPATCH (this, lookup_type); switch (lookup_type) { - case Single: return_trace (u.single.dispatch (c)); - case Pair: return_trace (u.pair.dispatch (c)); - case Cursive: return_trace (u.cursive.dispatch (c)); - case MarkBase: return_trace (u.markBase.dispatch (c)); - case MarkLig: return_trace (u.markLig.dispatch (c)); - case MarkMark: return_trace (u.markMark.dispatch (c)); - case Context: return_trace (u.context.dispatch (c)); - case ChainContext: return_trace (u.chainContext.dispatch (c)); - case Extension: return_trace (u.extension.dispatch (c)); + case Single: return_trace (u.single.dispatch (c, hb_forward (ds)...)); + case Pair: return_trace (u.pair.dispatch (c, hb_forward (ds)...)); + case Cursive: return_trace (u.cursive.dispatch (c, hb_forward (ds)...)); + case MarkBase: return_trace (u.markBase.dispatch (c, hb_forward (ds)...)); + case MarkLig: return_trace (u.markLig.dispatch (c, hb_forward (ds)...)); + case MarkMark: return_trace (u.markMark.dispatch (c, hb_forward (ds)...)); + case Context: return_trace (u.context.dispatch (c, hb_forward (ds)...)); + case ChainContext: return_trace (u.chainContext.dispatch (c, hb_forward (ds)...)); + case Extension: return_trace (u.extension.dispatch (c, hb_forward (ds)...)); default: return_trace (c->default_return_value ()); } } @@ -1576,14 +1576,14 @@ struct PosLookup : Lookup dispatch (&c); } - static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); + HB_INTERNAL static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); template static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); - template - typename context_t::return_t dispatch (context_t *c) const - { return Lookup::dispatch (c); } + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const + { return Lookup::dispatch (c, hb_forward (ds)...); } bool subset (hb_subset_context_t *c) const { return Lookup::subset (c); } diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 6c82bf203..a6e9a7534 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -85,12 +85,12 @@ struct SingleSubstFormat1 bool serialize (hb_serialize_context_t *c, hb_sorted_array_t glyphs, - int delta) + unsigned delta) { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs))) return_trace (false); - deltaGlyphID = delta; /* TODO(serialize) overflow? */ + c->check_assign (deltaGlyphID, delta); return_trace (true); } @@ -127,8 +127,8 @@ struct SingleSubstFormat1 OffsetTo coverage; /* Offset to Coverage table--from * beginning of Substitution table */ - HBINT16 deltaGlyphID; /* Add to original GlyphID to get - * substitute GlyphID */ + HBUINT16 deltaGlyphID; /* Add to original GlyphID to get + * substitute GlyphID, modulo 0x10000 */ public: DEFINE_SIZE_STATIC (6); }; @@ -231,15 +231,14 @@ struct SingleSubst { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (u.format))) return_trace (false); - unsigned int format = 2; - int delta = 0; + unsigned format = 2; + unsigned delta = 0; if (glyphs.length) { format = 1; - /* TODO(serialize) check for wrap-around */ - delta = substitutes[0] - glyphs[0]; + delta = (unsigned) (substitutes[0] - glyphs[0]) & 0xFFFF; for (unsigned int i = 1; i < glyphs.length; i++) - if (delta != (int) (substitutes[i] - glyphs[i])) { + if (delta != ((unsigned) (substitutes[i] - glyphs[i]) & 0xFFFF)) { format = 2; break; } @@ -252,14 +251,14 @@ struct SingleSubst } } - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); - case 2: return_trace (c->dispatch (u.format2)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); + case 2: return_trace (c->dispatch (u.format2, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -441,13 +440,13 @@ struct MultipleSubst } } - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -485,7 +484,7 @@ struct AlternateSet unsigned int shift = hb_ctz (lookup_mask); unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift); - /* If alt_index is MAX, randomize feature if it is the rand feature. */ + /* If alt_index is MAX_VALUE, randomize feature if it is the rand feature. */ if (alt_index == HB_OT_MAP_MAX_VALUE && c->random) alt_index = c->random_number () % count + 1; @@ -615,13 +614,13 @@ struct AlternateSubst } } - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -793,7 +792,7 @@ struct LigatureSet if (unlikely (!ligature.serialize (c, ligatures.length))) return_trace (false); for (unsigned int i = 0; i < ligatures.length; i++) { - unsigned int component_count = MAX (component_count_list[i] - 1, 0); + unsigned int component_count = (unsigned) hb_max ((int) component_count_list[i] - 1, 0); if (unlikely (!ligature[i].serialize (c, this) .serialize (c, ligatures[i], @@ -946,13 +945,13 @@ struct LigatureSubst } } - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -984,7 +983,7 @@ struct ReverseChainSingleSubstFormat1 if (!(this+coverage).intersects (glyphs)) return false; - const OffsetArrayOf &lookahead = StructAfter > (backtrack); + const OffsetArrayOf &lookahead = StructAfter> (backtrack); unsigned int count; @@ -1005,8 +1004,8 @@ struct ReverseChainSingleSubstFormat1 { if (!intersects (c->glyphs)) return; - const OffsetArrayOf &lookahead = StructAfter > (backtrack); - const ArrayOf &substitute = StructAfter > (lookahead); + const OffsetArrayOf &lookahead = StructAfter> (backtrack); + const ArrayOf &substitute = StructAfter> (lookahead); + hb_zip (this+coverage, substitute) | hb_filter (*c->glyphs, hb_first) @@ -1025,12 +1024,12 @@ struct ReverseChainSingleSubstFormat1 for (unsigned int i = 0; i < count; i++) if (unlikely (!(this+backtrack[i]).add_coverage (c->before))) return; - const OffsetArrayOf &lookahead = StructAfter > (backtrack); + const OffsetArrayOf &lookahead = StructAfter> (backtrack); count = lookahead.len; for (unsigned int i = 0; i < count; i++) if (unlikely (!(this+lookahead[i]).add_coverage (c->after))) return; - const ArrayOf &substitute = StructAfter > (lookahead); + const ArrayOf &substitute = StructAfter> (lookahead); count = substitute.len; c->output->add_array (substitute.arrayZ, substitute.len); } @@ -1049,8 +1048,8 @@ struct ReverseChainSingleSubstFormat1 unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); - const OffsetArrayOf &lookahead = StructAfter > (backtrack); - const ArrayOf &substitute = StructAfter > (lookahead); + const OffsetArrayOf &lookahead = StructAfter> (backtrack); + const ArrayOf &substitute = StructAfter> (lookahead); unsigned int start_index = 0, end_index = 0; if (match_backtrack (c, @@ -1085,10 +1084,10 @@ struct ReverseChainSingleSubstFormat1 TRACE_SANITIZE (this); if (!(coverage.sanitize (c, this) && backtrack.sanitize (c, this))) return_trace (false); - const OffsetArrayOf &lookahead = StructAfter > (backtrack); + const OffsetArrayOf &lookahead = StructAfter> (backtrack); if (!lookahead.sanitize (c, this)) return_trace (false); - const ArrayOf &substitute = StructAfter > (lookahead); + const ArrayOf &substitute = StructAfter> (lookahead); return_trace (substitute.sanitize (c)); } @@ -1114,13 +1113,13 @@ struct ReverseChainSingleSubstFormat1 struct ReverseChainSingleSubst { - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -1154,19 +1153,19 @@ struct SubstLookupSubTable ReverseChainSingle = 8 }; - template - typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const + template + typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type, Ts&&... ds) const { TRACE_DISPATCH (this, lookup_type); switch (lookup_type) { - case Single: return_trace (u.single.dispatch (c)); - case Multiple: return_trace (u.multiple.dispatch (c)); - case Alternate: return_trace (u.alternate.dispatch (c)); - case Ligature: return_trace (u.ligature.dispatch (c)); - case Context: return_trace (u.context.dispatch (c)); - case ChainContext: return_trace (u.chainContext.dispatch (c)); - case Extension: return_trace (u.extension.dispatch (c)); - case ReverseChainSingle: return_trace (u.reverseChainContextSingle.dispatch (c)); + case Single: return_trace (u.single.dispatch (c, hb_forward (ds)...)); + case Multiple: return_trace (u.multiple.dispatch (c, hb_forward (ds)...)); + case Alternate: return_trace (u.alternate.dispatch (c, hb_forward (ds)...)); + case Ligature: return_trace (u.ligature.dispatch (c, hb_forward (ds)...)); + case Context: return_trace (u.context.dispatch (c, hb_forward (ds)...)); + case ChainContext: return_trace (u.chainContext.dispatch (c, hb_forward (ds)...)); + case Extension: return_trace (u.extension.dispatch (c, hb_forward (ds)...)); + case ReverseChainSingle: return_trace (u.reverseChainContextSingle.dispatch (c, hb_forward (ds)...)); default: return_trace (c->default_return_value ()); } } @@ -1194,7 +1193,7 @@ struct SubstLookup : Lookup const SubTable& get_subtable (unsigned int i) const { return Lookup::get_subtable (i); } - static bool lookup_type_is_reverse (unsigned int lookup_type) + HB_INTERNAL static bool lookup_type_is_reverse (unsigned int lookup_type) { return lookup_type == SubTable::ReverseChainSingle; } bool is_reverse () const @@ -1252,7 +1251,7 @@ struct SubstLookup : Lookup return dispatch (c); } - static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); + HB_INTERNAL static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); SubTable& serialize_subtable (hb_serialize_context_t *c, unsigned int i) @@ -1315,12 +1314,12 @@ struct SubstLookup : Lookup } template - static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); + HB_INTERNAL static typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); - static hb_closure_context_t::return_t dispatch_closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index) + HB_INTERNAL static hb_closure_context_t::return_t dispatch_closure_recurse_func (hb_closure_context_t *c, unsigned int lookup_index) { if (!c->should_visit_lookup (lookup_index)) - return hb_void_t (); + return hb_empty_t (); hb_closure_context_t::return_t ret = dispatch_recurse_func (c, lookup_index); @@ -1332,9 +1331,9 @@ struct SubstLookup : Lookup return ret; } - template - typename context_t::return_t dispatch (context_t *c) const - { return Lookup::dispatch (c); } + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const + { return Lookup::dispatch (c, hb_forward (ds)...); } bool subset (hb_subset_context_t *c) const { return Lookup::subset (c); } diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 96777dead..5946db7c4 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -59,13 +59,13 @@ struct hb_intersects_context_t : }; struct hb_closure_context_t : - hb_dispatch_context_t + hb_dispatch_context_t { const char *get_name () { return "CLOSURE"; } typedef return_t (*recurse_func_t) (hb_closure_context_t *c, unsigned int lookup_index); template - return_t dispatch (const T &obj) { obj.closure (this); return hb_void_t (); } - static return_t default_return_value () { return hb_void_t (); } + return_t dispatch (const T &obj) { obj.closure (this); return hb_empty_t (); } + static return_t default_return_value () { return hb_empty_t (); } void recurse (unsigned int lookup_index) { if (unlikely (nesting_level_left == 0 || !recurse_func)) @@ -151,13 +151,13 @@ struct hb_would_apply_context_t : struct hb_collect_glyphs_context_t : - hb_dispatch_context_t + hb_dispatch_context_t { const char *get_name () { return "COLLECT_GLYPHS"; } typedef return_t (*recurse_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index); template - return_t dispatch (const T &obj) { obj.collect_glyphs (this); return hb_void_t (); } - static return_t default_return_value () { return hb_void_t (); } + return_t dispatch (const T &obj) { obj.collect_glyphs (this); return hb_empty_t (); } + static return_t default_return_value () { return hb_empty_t (); } void recurse (unsigned int lookup_index) { if (unlikely (nesting_level_left == 0 || !recurse_func)) @@ -286,7 +286,7 @@ struct hb_ot_apply_context_t : }; may_match_t may_match (const hb_glyph_info_t &info, - const HBUINT16 *glyph_data) const + const HBUINT16 *glyph_data) const { if (!(info.mask & mask) || (syllable && syllable != info.syllable ())) @@ -610,10 +610,10 @@ struct hb_ot_apply_context_t : struct hb_get_subtables_context_t : - hb_dispatch_context_t + hb_dispatch_context_t { template - static bool apply_to (const void *obj, OT::hb_ot_apply_context_t *c) + HB_INTERNAL static 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); @@ -652,9 +652,9 @@ struct hb_get_subtables_context_t : { hb_applicable_t *entry = array.push(); entry->init (obj, apply_to); - return hb_void_t (); + return hb_empty_t (); } - static return_t default_return_value () { return hb_void_t (); } + static return_t default_return_value () { return hb_empty_t (); } hb_get_subtables_context_t (array_t &array_) : array (array_), @@ -849,7 +849,7 @@ static inline bool match_input (hb_ot_apply_context_t *c, if (ligbase == LIGBASE_NOT_CHECKED) { bool found = false; - const hb_glyph_info_t *out = buffer->out_info; + const auto *out = buffer->out_info; unsigned int j = buffer->out_len; while (j && _hb_glyph_info_get_lig_id (&out[j - 1]) == first_lig_id) { @@ -973,7 +973,7 @@ static inline bool ligate_input (hb_ot_apply_context_t *c, if (this_comp == 0) this_comp = last_num_components; unsigned int new_lig_comp = components_so_far - last_num_components + - MIN (this_comp, last_num_components); + hb_min (this_comp, last_num_components); _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp); } buffer->next_glyph (); @@ -995,7 +995,7 @@ static inline bool ligate_input (hb_ot_apply_context_t *c, if (!this_comp) break; unsigned int new_lig_comp = components_so_far - last_num_components + - MIN (this_comp, last_num_components); + hb_min (this_comp, last_num_components); _hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp); } else break; @@ -1173,7 +1173,7 @@ static inline bool apply_lookup (hb_ot_apply_context_t *c, else { /* NOTE: delta is negative. */ - delta = MAX (delta, (int) next - (int) count); + delta = hb_max (delta, (int) next - (int) count); next -= delta; } @@ -1299,7 +1299,7 @@ struct Rule void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const { - const UnsizedArrayOf &lookupRecord = StructAfter > + const UnsizedArrayOf &lookupRecord = StructAfter> (inputZ.as_array ((inputCount ? inputCount - 1 : 0))); context_closure_lookup (c, inputCount, inputZ.arrayZ, @@ -1310,7 +1310,7 @@ struct Rule void collect_glyphs (hb_collect_glyphs_context_t *c, ContextCollectGlyphsLookupContext &lookup_context) const { - const UnsizedArrayOf &lookupRecord = StructAfter > + const UnsizedArrayOf &lookupRecord = StructAfter> (inputZ.as_array (inputCount ? inputCount - 1 : 0)); context_collect_glyphs_lookup (c, inputCount, inputZ.arrayZ, @@ -1321,7 +1321,7 @@ struct Rule bool would_apply (hb_would_apply_context_t *c, ContextApplyLookupContext &lookup_context) const { - const UnsizedArrayOf &lookupRecord = StructAfter > + const UnsizedArrayOf &lookupRecord = StructAfter> (inputZ.as_array (inputCount ? inputCount - 1 : 0)); return context_would_apply_lookup (c, inputCount, inputZ.arrayZ, @@ -1333,7 +1333,7 @@ struct Rule ContextApplyLookupContext &lookup_context) const { TRACE_APPLY (this); - const UnsizedArrayOf &lookupRecord = StructAfter > + const UnsizedArrayOf &lookupRecord = StructAfter> (inputZ.as_array (inputCount ? inputCount - 1 : 0)); return_trace (context_apply_lookup (c, inputCount, inputZ.arrayZ, lookupCount, lookupRecord.arrayZ, lookup_context)); } @@ -1751,7 +1751,7 @@ struct ContextFormat3 HBUINT16 glyphCount; /* Number of glyphs in the input glyph * sequence */ HBUINT16 lookupCount; /* Number of LookupRecords */ - UnsizedArrayOf > + UnsizedArrayOf> coverageZ; /* Array of offsets to Coverage * table in glyph sequence order */ /*UnsizedArrayOf @@ -1763,15 +1763,15 @@ struct ContextFormat3 struct Context { - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); - case 2: return_trace (c->dispatch (u.format2)); - case 3: return_trace (c->dispatch (u.format3)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); + case 2: return_trace (c->dispatch (u.format2, hb_forward (ds)...)); + case 3: return_trace (c->dispatch (u.format3, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -1923,8 +1923,8 @@ struct ChainRule { bool intersects (const hb_set_t *glyphs, ChainContextClosureLookupContext &lookup_context) const { - const HeadlessArrayOf &input = StructAfter > (backtrack); - const ArrayOf &lookahead = StructAfter > (input); + const HeadlessArrayOf &input = StructAfter> (backtrack); + const ArrayOf &lookahead = StructAfter> (input); return chain_context_intersects (glyphs, backtrack.len, backtrack.arrayZ, input.lenP1, input.arrayZ, @@ -1935,9 +1935,9 @@ struct ChainRule void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const { - const HeadlessArrayOf &input = StructAfter > (backtrack); - const ArrayOf &lookahead = StructAfter > (input); - const ArrayOf &lookup = StructAfter > (lookahead); + const HeadlessArrayOf &input = StructAfter> (backtrack); + const ArrayOf &lookahead = StructAfter> (input); + const ArrayOf &lookup = StructAfter> (lookahead); chain_context_closure_lookup (c, backtrack.len, backtrack.arrayZ, input.lenP1, input.arrayZ, @@ -1949,9 +1949,9 @@ struct ChainRule void collect_glyphs (hb_collect_glyphs_context_t *c, ChainContextCollectGlyphsLookupContext &lookup_context) const { - const HeadlessArrayOf &input = StructAfter > (backtrack); - const ArrayOf &lookahead = StructAfter > (input); - const ArrayOf &lookup = StructAfter > (lookahead); + const HeadlessArrayOf &input = StructAfter> (backtrack); + const ArrayOf &lookahead = StructAfter> (input); + const ArrayOf &lookup = StructAfter> (lookahead); chain_context_collect_glyphs_lookup (c, backtrack.len, backtrack.arrayZ, input.lenP1, input.arrayZ, @@ -1963,9 +1963,9 @@ struct ChainRule bool would_apply (hb_would_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const { - const HeadlessArrayOf &input = StructAfter > (backtrack); - const ArrayOf &lookahead = StructAfter > (input); - const ArrayOf &lookup = StructAfter > (lookahead); + const HeadlessArrayOf &input = StructAfter> (backtrack); + const ArrayOf &lookahead = StructAfter> (input); + const ArrayOf &lookup = StructAfter> (lookahead); return chain_context_would_apply_lookup (c, backtrack.len, backtrack.arrayZ, input.lenP1, input.arrayZ, @@ -1976,9 +1976,9 @@ struct ChainRule 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 ArrayOf &lookup = StructAfter > (lookahead); + 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.arrayZ, input.lenP1, input.arrayZ, @@ -1990,11 +1990,11 @@ 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); + const ArrayOf &lookup = StructAfter> (lookahead); return_trace (lookup.sanitize (c)); } @@ -2330,12 +2330,12 @@ struct ChainContextFormat3 { bool intersects (const hb_set_t *glyphs) const { - const OffsetArrayOf &input = StructAfter > (backtrack); + const OffsetArrayOf &input = StructAfter> (backtrack); if (!(this+input[0]).intersects (glyphs)) return false; - const OffsetArrayOf &lookahead = StructAfter > (input); + const OffsetArrayOf &lookahead = StructAfter> (input); struct ChainContextClosureLookupContext lookup_context = { {intersects_coverage}, {this, this, this} @@ -2349,13 +2349,13 @@ struct ChainContextFormat3 void closure (hb_closure_context_t *c) const { - const OffsetArrayOf &input = StructAfter > (backtrack); + const OffsetArrayOf &input = StructAfter> (backtrack); if (!(this+input[0]).intersects (c->glyphs)) return; - const OffsetArrayOf &lookahead = StructAfter > (input); - const ArrayOf &lookup = StructAfter > (lookahead); + const OffsetArrayOf &lookahead = StructAfter> (input); + const ArrayOf &lookup = StructAfter> (lookahead); struct ChainContextClosureLookupContext lookup_context = { {intersects_coverage}, {this, this, this} @@ -2370,12 +2370,12 @@ struct ChainContextFormat3 void collect_glyphs (hb_collect_glyphs_context_t *c) const { - const OffsetArrayOf &input = StructAfter > (backtrack); + const OffsetArrayOf &input = StructAfter> (backtrack); (this+input[0]).add_coverage (c->input); - const OffsetArrayOf &lookahead = StructAfter > (input); - const ArrayOf &lookup = StructAfter > (lookahead); + const OffsetArrayOf &lookahead = StructAfter> (input); + const ArrayOf &lookup = StructAfter> (lookahead); struct ChainContextCollectGlyphsLookupContext lookup_context = { {collect_coverage}, {this, this, this} @@ -2390,9 +2390,9 @@ struct ChainContextFormat3 bool would_apply (hb_would_apply_context_t *c) const { - const OffsetArrayOf &input = StructAfter > (backtrack); - const OffsetArrayOf &lookahead = StructAfter > (input); - const ArrayOf &lookup = StructAfter > (lookahead); + const OffsetArrayOf &input = StructAfter> (backtrack); + const OffsetArrayOf &lookahead = StructAfter> (input); + const ArrayOf &lookup = StructAfter> (lookahead); struct ChainContextApplyLookupContext lookup_context = { {match_coverage}, {this, this, this} @@ -2406,20 +2406,20 @@ struct ChainContextFormat3 const Coverage &get_coverage () const { - const OffsetArrayOf &input = StructAfter > (backtrack); + const OffsetArrayOf &input = StructAfter> (backtrack); return this+input[0]; } bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); - const OffsetArrayOf &input = StructAfter > (backtrack); + const OffsetArrayOf &input = StructAfter> (backtrack); unsigned int index = (this+input[0]).get_coverage (c->buffer->cur().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); - const OffsetArrayOf &lookahead = StructAfter > (input); - const ArrayOf &lookup = StructAfter > (lookahead); + const OffsetArrayOf &lookahead = StructAfter> (input); + const ArrayOf &lookup = StructAfter> (lookahead); struct ChainContextApplyLookupContext lookup_context = { {match_coverage}, {this, this, this} @@ -2442,12 +2442,12 @@ struct ChainContextFormat3 { TRACE_SANITIZE (this); if (!backtrack.sanitize (c, this)) return_trace (false); - const OffsetArrayOf &input = StructAfter > (backtrack); + const OffsetArrayOf &input = StructAfter> (backtrack); if (!input.sanitize (c, this)) return_trace (false); if (!input.len) return_trace (false); /* To be consistent with Context. */ - const OffsetArrayOf &lookahead = StructAfter > (input); + const OffsetArrayOf &lookahead = StructAfter> (input); if (!lookahead.sanitize (c, this)) return_trace (false); - const ArrayOf &lookup = StructAfter > (lookahead); + const ArrayOf &lookup = StructAfter> (lookahead); return_trace (lookup.sanitize (c)); } @@ -2474,15 +2474,15 @@ struct ChainContextFormat3 struct ChainContext { - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (c->dispatch (u.format1)); - case 2: return_trace (c->dispatch (u.format2)); - case 3: return_trace (c->dispatch (u.format3)); + case 1: return_trace (c->dispatch (u.format1, hb_forward (ds)...)); + case 2: return_trace (c->dispatch (u.format2, hb_forward (ds)...)); + case 3: return_trace (c->dispatch (u.format3, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -2504,18 +2504,14 @@ struct ExtensionFormat1 template const X& get_subtable () const - { - unsigned int offset = extensionOffset; - if (unlikely (!offset)) return Null(typename T::SubTable); - return StructAtOffset (this, offset); - } + { return this + CastR> (extensionOffset); } - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, format); if (unlikely (!c->may_dispatch (this, this))) return_trace (c->no_dispatch_return_value ()); - return_trace (get_subtable ().dispatch (c, get_type ())); + return_trace (get_subtable ().dispatch (c, get_type (), hb_forward (ds)...)); } /* This is called from may_dispatch() above with hb_sanitize_context_t. */ @@ -2523,7 +2519,6 @@ struct ExtensionFormat1 { TRACE_SANITIZE (this); return_trace (c->check_struct (this) && - extensionOffset != 0 && extensionLookupType != T::SubTable::Extension); } @@ -2532,7 +2527,7 @@ struct ExtensionFormat1 HBUINT16 extensionLookupType; /* Lookup type of subtable referenced * by ExtensionOffset (i.e. the * extension subtable). */ - HBUINT32 extensionOffset; /* Offset to the extension subtable, + Offset32 extensionOffset; /* Offset to the extension subtable, * of lookup type subtable. */ public: DEFINE_SIZE_STATIC (8); @@ -2557,13 +2552,13 @@ struct Extension } } - template - typename context_t::return_t dispatch (context_t *c) const + template + typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const { TRACE_DISPATCH (this, u.format); if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ()); switch (u.format) { - case 1: return_trace (u.format1.dispatch (c)); + case 1: return_trace (u.format1.dispatch (c, hb_forward (ds)...)); default:return_trace (c->default_return_value ()); } } @@ -2666,7 +2661,7 @@ struct GSUBGPOS bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - struct GSUBGPOS *out = c->serializer->embed (*this); + auto *out = c->serializer->embed (*this); if (unlikely (!out)) return_trace (false); out->scriptList.serialize_subset (c, this+scriptList, out); @@ -2674,13 +2669,13 @@ struct GSUBGPOS typedef OffsetListOf TLookupList; /* TODO Use intersects() to count how many subtables survive? */ - CastR > (out->lookupList) + CastR> (out->lookupList) .serialize_subset (c, - this+CastR > (lookupList), + this+CastR> (lookupList), out); if (version.to_int () >= 0x00010001u) - out->featureVars.serialize_subset (c, this+featureVars, out); + out->featureVars.serialize_copy (c->serializer, this+featureVars, out); return_trace (true); } @@ -2700,7 +2695,7 @@ struct GSUBGPOS likely (version.major == 1) && scriptList.sanitize (c, this) && featureList.sanitize (c, this) && - CastR > (lookupList).sanitize (c, this) && + CastR> (lookupList).sanitize (c, this) && (version.to_int () < 0x00010001u || featureVars.sanitize (c, this))); } diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 1e2d159b5..f5c11d8b3 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -138,7 +138,7 @@ bool OT::GDEF::is_blacklisted (hb_blob_t *blob, hb_face_t *face) const { -#if defined(HB_NO_OT_LAYOUT_BLACKLIST) +#ifdef HB_NO_OT_LAYOUT_BLACKLIST return false; #endif /* The ugly business of blacklisting individual fonts' tables happen here! @@ -335,6 +335,12 @@ hb_ot_layout_get_attach_points (hb_face_t *face, unsigned int *point_count /* IN/OUT */, unsigned int *point_array /* OUT */) { +#ifdef HB_NO_LAYOUT_UNUSED + if (point_count) + *point_count = 0; + return 0; +#endif + return face->table.GDEF->table->get_attach_points (glyph, start_offset, point_count, @@ -364,6 +370,12 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font, unsigned int *caret_count /* IN/OUT */, hb_position_t *caret_array /* OUT */) { +#ifdef HB_NO_LAYOUT_UNUSED + if (caret_count) + *caret_count = 0; + return 0; +#endif + unsigned int result_caret_count = 0; unsigned int result = font->face->table.GDEF->table->get_lig_carets (font, direction, glyph, start_offset, &result_caret_count, caret_array); if (result) @@ -384,7 +396,7 @@ bool OT::GSUB::is_blacklisted (hb_blob_t *blob HB_UNUSED, hb_face_t *face) const { -#if defined(HB_NO_OT_LAYOUT_BLACKLIST) +#ifdef HB_NO_OT_LAYOUT_BLACKLIST return false; #endif /* Mac OS X prefers morx over GSUB. It also ships with various Indic fonts, @@ -412,7 +424,7 @@ bool OT::GPOS::is_blacklisted (hb_blob_t *blob HB_UNUSED, hb_face_t *face HB_UNUSED) const { -#if defined(HB_NO_OT_LAYOUT_BLACKLIST) +#ifdef HB_NO_OT_LAYOUT_BLACKLIST return false; #endif return false; @@ -500,6 +512,7 @@ hb_ot_layout_table_find_script (hb_face_t *face, return false; } +#ifndef HB_DISABLE_DEPRECATED /** * hb_ot_layout_table_choose_script: * @face: #hb_face_t to work upon @@ -521,6 +534,7 @@ hb_ot_layout_table_choose_script (hb_face_t *face, for (t = script_tags; *t; t++); return hb_ot_layout_table_select_script (face, table_tag, t - script_tags, script_tags, script_index, chosen_script); } +#endif /** * hb_ot_layout_table_select_script: @@ -672,6 +686,7 @@ hb_ot_layout_script_get_language_tags (hb_face_t *face, } +#ifndef HB_DISABLE_DEPRECATED /** * hb_ot_layout_script_find_language: * @face: #hb_face_t to work upon @@ -685,6 +700,8 @@ hb_ot_layout_script_get_language_tags (hb_face_t *face, * * Return value: true if the language tag is found, false otherwise * + * Since: ?? + * Deprecated: ?? **/ hb_bool_t hb_ot_layout_script_find_language (hb_face_t *face, @@ -700,6 +717,7 @@ hb_ot_layout_script_find_language (hb_face_t *face, &language_tag, language_index); } +#endif /** @@ -716,7 +734,6 @@ hb_ot_layout_script_find_language (hb_face_t *face, * * Return value: true if the language tag is found, false otherwise * - * * Since: 2.0.0 **/ hb_bool_t @@ -1735,7 +1752,7 @@ hb_ot_layout_feature_get_characters (hb_face_t *face, unsigned int len = 0; if (char_count && characters && start_offset < cv_params.characters.len) { - len = MIN (cv_params.characters.len - start_offset, *char_count); + len = hb_min (cv_params.characters.len - start_offset, *char_count); for (unsigned int i = 0; i < len; ++i) characters[i] = cv_params.characters[start_offset + i]; } diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h index 359ee1b6f..3b9a78eaf 100644 --- a/src/hb-ot-layout.h +++ b/src/hb-ot-layout.h @@ -94,7 +94,7 @@ HB_EXTERN hb_bool_t hb_ot_layout_has_glyph_classes (hb_face_t *face); /** - * hb_ot_layout_get_glyph_class: + * hb_ot_layout_glyph_class_t: * @HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED: Glyphs not matching the other classifications * @HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH: Spacing, single characters, capable of accepting marks * @HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE: Glyphs that represent ligation of multiple characters diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc index ef0bcc716..92d70bb41 100644 --- a/src/hb-ot-map.cc +++ b/src/hb-ot-map.cc @@ -188,12 +188,12 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, feature_infos[j].default_value = feature_infos[i].default_value; } else { feature_infos[j].flags &= ~F_GLOBAL; - feature_infos[j].max_value = MAX (feature_infos[j].max_value, feature_infos[i].max_value); + feature_infos[j].max_value = hb_max (feature_infos[j].max_value, feature_infos[i].max_value); /* Inherit default_value from j */ } feature_infos[j].flags |= (feature_infos[i].flags & F_HAS_FALLBACK); - feature_infos[j].stage[0] = MIN (feature_infos[j].stage[0], feature_infos[i].stage[0]); - feature_infos[j].stage[1] = MIN (feature_infos[j].stage[1], feature_infos[i].stage[1]); + feature_infos[j].stage[0] = hb_min (feature_infos[j].stage[0], feature_infos[i].stage[0]); + feature_infos[j].stage[1] = hb_min (feature_infos[j].stage[1], feature_infos[i].stage[1]); } feature_infos.shrink (j + 1); } @@ -213,34 +213,34 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m, bits_needed = 0; else /* Limit bits per feature. */ - bits_needed = MIN(HB_OT_MAP_MAX_BITS, hb_bit_storage (info->max_value)); + bits_needed = hb_min (HB_OT_MAP_MAX_BITS, hb_bit_storage (info->max_value)); if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t)) continue; /* Feature disabled, or not enough bits. */ - hb_bool_t found = false; + bool found = false; unsigned int feature_index[2]; for (unsigned int table_index = 0; table_index < 2; table_index++) { if (required_feature_tag[table_index] == info->tag) required_feature_stage[table_index] = info->stage[table_index]; - found |= hb_ot_layout_language_find_feature (face, - table_tags[table_index], - script_index[table_index], - language_index[table_index], - info->tag, - &feature_index[table_index]); + found |= (bool) hb_ot_layout_language_find_feature (face, + table_tags[table_index], + script_index[table_index], + language_index[table_index], + info->tag, + &feature_index[table_index]); } if (!found && (info->flags & F_GLOBAL_SEARCH)) { for (unsigned int table_index = 0; table_index < 2; table_index++) { - found |= hb_ot_layout_table_find_feature (face, - table_tags[table_index], - info->tag, - &feature_index[table_index]); + found |= (bool) hb_ot_layout_table_find_feature (face, + table_tags[table_index], + info->tag, + &feature_index[table_index]); } } if (!found && !(info->flags & F_HAS_FALLBACK)) diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index 132da55c7..dd6778638 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -68,7 +68,7 @@ struct hb_ot_map_t unsigned short random : 1; hb_mask_t mask; - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const lookup_map_t *a = (const lookup_map_t *) pa; const lookup_map_t *b = (const lookup_map_t *) pb; @@ -247,7 +247,7 @@ struct hb_ot_map_builder_t unsigned int default_value; /* for non-global features, what should the unset glyphs take */ unsigned int stage[2]; /* GSUB/GPOS */ - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const feature_info_t *a = (const feature_info_t *) pa; const feature_info_t *b = (const feature_info_t *) pb; diff --git a/src/hb-ot-math-table.hh b/src/hb-ot-math-table.hh index 62bf072e9..dd6226404 100644 --- a/src/hb-ot-math-table.hh +++ b/src/hb-ot-math-table.hh @@ -664,7 +664,7 @@ struct MathVariants /* Array of offsets to MathGlyphConstruction tables - from the beginning of the MathVariants table, for shapes growing in vertical/horizontal direction. */ - UnsizedArrayOf > + UnsizedArrayOf> glyphConstruction; public: diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index df17371fb..7f2792327 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -62,6 +62,10 @@ hb_bool_t hb_ot_math_has_data (hb_face_t *face) { +#ifdef HB_NO_MATH + return false; +#endif + return face->table.MATH->has_data (); } @@ -86,6 +90,10 @@ hb_position_t hb_ot_math_get_constant (hb_font_t *font, hb_ot_math_constant_t constant) { +#ifdef HB_NO_MATH + return 0; +#endif + return font->face->table.MATH->get_constant(constant, font); } @@ -105,6 +113,10 @@ hb_position_t hb_ot_math_get_glyph_italics_correction (hb_font_t *font, hb_codepoint_t glyph) { +#ifdef HB_NO_MATH + return 0; +#endif + return font->face->table.MATH->get_glyph_info().get_italics_correction (glyph, font); } @@ -131,6 +143,10 @@ hb_position_t hb_ot_math_get_glyph_top_accent_attachment (hb_font_t *font, hb_codepoint_t glyph) { +#ifdef HB_NO_MATH + return 0; +#endif + return font->face->table.MATH->get_glyph_info().get_top_accent_attachment (glyph, font); } @@ -149,6 +165,10 @@ hb_bool_t hb_ot_math_is_glyph_extended_shape (hb_face_t *face, hb_codepoint_t glyph) { +#ifdef HB_NO_MATH + return false; +#endif + return face->table.MATH->get_glyph_info().is_extended_shape (glyph); } @@ -177,6 +197,10 @@ hb_ot_math_get_glyph_kerning (hb_font_t *font, hb_ot_math_kern_t kern, hb_position_t correction_height) { +#ifdef HB_NO_MATH + return 0; +#endif + return font->face->table.MATH->get_glyph_info().get_kerning (glyph, kern, correction_height, @@ -214,6 +238,12 @@ hb_ot_math_get_glyph_variants (hb_font_t *font, unsigned int *variants_count, /* IN/OUT */ hb_ot_math_glyph_variant_t *variants /* OUT */) { +#ifdef HB_NO_MATH + if (variants_count) + *variants_count = 0; + return 0; +#endif + return font->face->table.MATH->get_variants().get_glyph_variants (glyph, direction, font, start_offset, variants_count, @@ -242,6 +272,10 @@ hb_position_t hb_ot_math_get_min_connector_overlap (hb_font_t *font, hb_direction_t direction) { +#ifdef HB_NO_MATH + return 0; +#endif + return font->face->table.MATH->get_variants().get_min_connector_overlap (direction, font); } @@ -279,6 +313,12 @@ hb_ot_math_get_glyph_assembly (hb_font_t *font, hb_ot_math_glyph_part_t *parts, /* OUT */ hb_position_t *italics_correction /* OUT */) { +#ifdef HB_NO_MATH + if (parts_count) + *parts_count = 0; + return 0; +#endif + return font->face->table.MATH->get_variants().get_glyph_parts (glyph, direction, font, diff --git a/src/hb-ot-name-language.cc b/src/hb-ot-name-language-static.hh similarity index 98% rename from src/hb-ot-name-language.cc rename to src/hb-ot-name-language-static.hh index 0e37e0acb..580e7637b 100644 --- a/src/hb-ot-name-language.cc +++ b/src/hb-ot-name-language-static.hh @@ -24,6 +24,9 @@ * Google Author(s): Behdad Esfahbod */ +#ifndef HB_OT_NAME_LANGUAGE_STATIC_HH +#define HB_OT_NAME_LANGUAGE_STATIC_HH + #include "hb-ot-name-language.hh" /* Following two tables were generated by joining FreeType, FontConfig, @@ -427,6 +430,9 @@ _hb_ot_name_language_for (unsigned int code, const hb_ot_language_map_t *array, unsigned int len) { +#ifdef HB_NO_OT_NAME_LANGUAGE + return HB_LANGUAGE_INVALID; +#endif const hb_ot_language_map_t *entry = (const hb_ot_language_map_t *) hb_bsearch (&code, array, @@ -455,3 +461,5 @@ _hb_ot_name_language_for_mac_code (unsigned int code) hb_mac_language_map, ARRAY_LENGTH (hb_mac_language_map)); } + +#endif /* HB_OT_NAME_LANGUAGE_STATIC_HH */ diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index c8ababd7b..332f48533 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -51,6 +51,7 @@ struct NameRecord { hb_language_t language (hb_face_t *face) const { +#ifndef HB_NO_OT_NAME_LANGUAGE unsigned int p = platformID; unsigned int l = languageID; @@ -60,9 +61,12 @@ struct NameRecord if (p == 1) return _hb_ot_name_language_for_mac_code (l); +#ifndef HB_NO_OT_NAME_LANGUAGE_AAT if (p == 0) return _hb_aat_language_get (face, l); +#endif +#endif return HB_LANGUAGE_INVALID; } @@ -93,11 +97,21 @@ struct NameRecord return UNSUPPORTED; } + NameRecord* copy (hb_serialize_context_t *c, + const void *src_base, + const void *dst_base) const + { + TRACE_SERIALIZE (this); + auto *out = c->embed (this); + if (unlikely (!out)) return_trace (nullptr); + out->offset.serialize_copy (c, src_base + offset, dst_base, length); + return_trace (out); + } + bool sanitize (hb_sanitize_context_t *c, const void *base) const { TRACE_SANITIZE (this); - /* We can check from base all the way up to the end of string... */ - return_trace (c->check_struct (this) && c->check_range ((char *) base, (unsigned int) length + offset)); + return_trace (c->check_struct (this) && offset.sanitize (c, base, length)); } HBUINT16 platformID; /* Platform ID. */ @@ -105,7 +119,8 @@ struct NameRecord 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). */ + NNOffsetTo> + offset; /* String offset from start of storage area (in bytes). */ public: DEFINE_SIZE_STATIC (12); }; @@ -156,15 +171,58 @@ struct name unsigned int get_size () const { return min_size + count * nameRecordZ.item_size; } + template + bool serialize (hb_serialize_context_t *c, + Iterator it, + const void *src_string_pool) + { + TRACE_SERIALIZE (this); + + if (unlikely (!c->extend_min ((*this)))) return_trace (false); + + this->format = 0; + this->count = it.len (); + + auto snap = c->snapshot (); + this->nameRecordZ.serialize (c, this->count); + this->stringOffset = c->length (); + c->revert (snap); + + const void *dst_string_pool = &(this + this->stringOffset); + + + it + | hb_apply ([&] (const NameRecord& _) { c->copy (_, src_string_pool, dst_string_pool); }) + ; + + if (unlikely (c->ran_out_of_room)) return_trace (false); + + assert (this->stringOffset == c->length ()); + + return_trace (true); + } + + bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + + name *name_prime = c->serializer->start_embed (); + if (unlikely (!name_prime)) return_trace (false); + + auto it = + + nameRecordZ.as_array (count) + | hb_filter (c->plan->name_ids, &NameRecord::nameID) + ; + + name_prime->serialize (c->serializer, it, hb_addressof (this + stringOffset)); + return_trace (name_prime->count); + } + bool sanitize_records (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); const void *string_pool = (this+stringOffset).arrayZ; - unsigned int _count = count; - /* Move to run-time?! */ - for (unsigned int i = 0; i < _count; i++) - if (!nameRecordZ[i].sanitize (c, string_pool)) return_trace (false); - return_trace (true); + return_trace (nameRecordZ.sanitize (c, count, string_pool)); } bool sanitize (hb_sanitize_context_t *c) const @@ -173,7 +231,8 @@ struct name return_trace (c->check_struct (this) && likely (format == 0 || format == 1) && c->check_array (nameRecordZ.arrayZ, count) && - c->check_range (this, stringOffset)); + c->check_range (this, stringOffset) && + sanitize_records (c)); } struct accelerator_t @@ -263,7 +322,7 @@ struct name /* We only implement format 0 for now. */ HBUINT16 format; /* Format selector (=0/1). */ HBUINT16 count; /* Number of name records. */ - NNOffsetTo > + NNOffsetTo> stringOffset; /* Offset to start of string storage (from start of table). */ UnsizedArrayOf nameRecordZ; /* The name records where count is the number of records. */ diff --git a/src/hb-ot-name.cc b/src/hb-ot-name.cc index 907ae6ab5..f7cd427ac 100644 --- a/src/hb-ot-name.cc +++ b/src/hb-ot-name.cc @@ -58,6 +58,11 @@ const hb_ot_name_entry_t * hb_ot_name_list_names (hb_face_t *face, unsigned int *num_entries /* OUT */) { +#ifdef HB_NO_NAME + if (num_entries) + *num_entries = 0; + return 0; +#endif const OT::name_accelerator_t &name = *face->table.name; if (num_entries) *num_entries = name.names.length; return (const hb_ot_name_entry_t *) name.names; @@ -167,6 +172,11 @@ hb_ot_name_get_utf8 (hb_face_t *face, unsigned int *text_size /* IN/OUT */, char *text /* OUT */) { +#ifdef HB_NO_NAME + if (text_size) + *text_size = 0; + return 0; +#endif return hb_ot_name_get_utf (face, name_id, language, text_size, (hb_utf8_t::codepoint_t *) text); } @@ -194,6 +204,11 @@ hb_ot_name_get_utf16 (hb_face_t *face, unsigned int *text_size /* IN/OUT */, uint16_t *text /* OUT */) { +#ifdef HB_NO_NAME + if (text_size) + *text_size = 0; + return 0; +#endif return hb_ot_name_get_utf (face, name_id, language, text_size, text); } @@ -220,5 +235,10 @@ hb_ot_name_get_utf32 (hb_face_t *face, unsigned int *text_size /* IN/OUT */, uint32_t *text /* OUT */) { +#ifdef HB_NO_NAME + if (text_size) + *text_size = 0; + return 0; +#endif return hb_ot_name_get_utf (face, name_id, language, text_size, text); } diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index 21aa94dad..12e08316a 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -131,7 +131,7 @@ struct post hb_bytes_t s = find_glyph_name (glyph); if (!s.length) return false; if (!buf_len) return true; - unsigned int len = MIN (buf_len - 1, s.length); + unsigned int len = hb_min (buf_len - 1, s.length); strncpy (buf, s.arrayZ, len); buf[len] = '\0'; return true; diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 4daf2a666..3212e0c96 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -383,7 +383,7 @@ arabic_fallback_shape (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { -#if defined(HB_NO_OT_SHAPE_COMPLEX_ARABIC_FALLBACK) +#ifdef HB_NO_OT_SHAPE_COMPLEX_ARABIC_FALLBACK return; #endif diff --git a/src/hb-ot-shape-complex-hebrew.cc b/src/hb-ot-shape-complex-hebrew.cc index db8801814..14989730f 100644 --- a/src/hb-ot-shape-complex-hebrew.cc +++ b/src/hb-ot-shape-complex-hebrew.cc @@ -70,7 +70,7 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c, bool found = (bool) c->unicode->compose (a, b, ab); -#if defined(HB_NO_OT_SHAPE_COMPLEX_HEBREW_FALLBACK) +#ifdef HB_NO_OT_SHAPE_COMPLEX_HEBREW_FALLBACK return found; #endif diff --git a/src/hb-ot-shape-complex-indic-machine.hh b/src/hb-ot-shape-complex-indic-machine.hh index 08b90e913..dbab7e042 100644 --- a/src/hb-ot-shape-complex-indic-machine.hh +++ b/src/hb-ot-shape-complex-indic-machine.hh @@ -1,30 +1,28 @@ - -#line 1 "hb-ot-shape-complex-indic-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 - */ +* 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_INDIC_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH @@ -32,952 +30,1226 @@ #include "hb.hh" -#line 36 "hb-ot-shape-complex-indic-machine.hh" static const unsigned char _indic_syllable_machine_trans_keys[] = { - 8u, 8u, 4u, 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, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, - 4u, 8u, 4u, 13u, 8u, 8u, 4u, 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, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, - 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 8u, 8u, 4u, 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, 13u, 4u, 8u, 4u, 13u, - 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 8u, 8u, 4u, 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, 13u, 4u, 8u, - 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 13u, - 5u, 8u, 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, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 10u, 5u, 10u, - 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 3u, 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, 4u, 10u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, - 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 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, 10u, 5u, 10u, 5u, 10u, 10u, 10u, - 10u, 10u, 10u, 10u, 5u, 10u, 3u, 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, - 4u, 10u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, - 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 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, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, - 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 4u, 10u, 3u, 17u, 3u, 17u, - 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 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, 10u, 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 3u, 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, 4u, 10u, 3u, 17u, 3u, 17u, 1u, 16u, - 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, - 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 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, 5u, 10u, 5u, 10u, 10u, 10u, - 10u, 10u, 10u, 10u, 5u, 10u, 1u, 16u, 0 + 7u, 7u, 3u, 7u, 4u, 6u, 6u, 6u, + 4u, 7u, 4u, 6u, 6u, 6u, 4u, 7u, + 4u, 6u, 6u, 6u, 4u, 7u, 4u, 6u, + 6u, 6u, 3u, 7u, 5u, 5u, 14u, 14u, + 3u, 7u, 5u, 5u, 14u, 14u, 3u, 7u, + 5u, 5u, 14u, 14u, 3u, 7u, 5u, 5u, + 14u, 14u, 3u, 12u, 3u, 7u, 3u, 12u, + 3u, 7u, 3u, 12u, 3u, 7u, 3u, 12u, + 3u, 7u, 3u, 12u, 7u, 7u, 3u, 7u, + 4u, 6u, 6u, 6u, 4u, 7u, 4u, 6u, + 6u, 6u, 4u, 7u, 4u, 6u, 6u, 6u, + 4u, 7u, 4u, 6u, 6u, 6u, 3u, 7u, + 5u, 5u, 14u, 14u, 3u, 7u, 5u, 5u, + 14u, 14u, 3u, 7u, 5u, 5u, 14u, 14u, + 3u, 7u, 5u, 5u, 14u, 14u, 3u, 12u, + 3u, 7u, 3u, 12u, 3u, 7u, 3u, 12u, + 3u, 7u, 3u, 12u, 3u, 7u, 3u, 12u, + 7u, 7u, 3u, 7u, 4u, 6u, 6u, 6u, + 4u, 7u, 4u, 6u, 6u, 6u, 4u, 7u, + 4u, 6u, 6u, 6u, 4u, 7u, 4u, 6u, + 6u, 6u, 3u, 7u, 5u, 5u, 14u, 14u, + 3u, 7u, 5u, 5u, 14u, 14u, 3u, 7u, + 5u, 5u, 14u, 14u, 3u, 7u, 5u, 5u, + 14u, 14u, 3u, 12u, 3u, 7u, 3u, 12u, + 3u, 7u, 3u, 12u, 3u, 7u, 3u, 12u, + 3u, 7u, 7u, 7u, 3u, 7u, 4u, 6u, + 6u, 6u, 4u, 7u, 4u, 6u, 6u, 6u, + 4u, 7u, 4u, 6u, 6u, 6u, 4u, 7u, + 4u, 6u, 6u, 6u, 3u, 7u, 5u, 5u, + 14u, 14u, 3u, 7u, 5u, 5u, 14u, 14u, + 3u, 7u, 5u, 5u, 14u, 14u, 3u, 7u, + 5u, 5u, 14u, 14u, 3u, 12u, 3u, 7u, + 3u, 12u, 3u, 7u, 3u, 12u, 3u, 7u, + 3u, 12u, 3u, 7u, 3u, 12u, 3u, 12u, + 4u, 7u, 7u, 7u, 0u, 17u, 2u, 15u, + 2u, 15u, 3u, 15u, 0u, 14u, 2u, 15u, + 2u, 15u, 3u, 15u, 0u, 14u, 2u, 15u, + 2u, 15u, 3u, 15u, 0u, 14u, 2u, 15u, + 2u, 15u, 3u, 15u, 0u, 14u, 2u, 15u, + 2u, 15u, 3u, 15u, 4u, 9u, 4u, 9u, + 4u, 9u, 9u, 9u, 9u, 9u, 9u, 9u, + 4u, 9u, 2u, 9u, 4u, 9u, 2u, 9u, + 3u, 9u, 4u, 9u, 2u, 9u, 3u, 9u, + 4u, 9u, 2u, 9u, 3u, 9u, 4u, 9u, + 2u, 9u, 3u, 9u, 3u, 9u, 2u, 15u, + 2u, 15u, 0u, 14u, 0u, 14u, 0u, 14u, + 2u, 15u, 2u, 15u, 0u, 14u, 0u, 14u, + 0u, 14u, 2u, 15u, 2u, 15u, 0u, 14u, + 0u, 14u, 0u, 14u, 2u, 15u, 2u, 15u, + 0u, 14u, 0u, 14u, 0u, 14u, 2u, 15u, + 2u, 15u, 2u, 15u, 2u, 15u, 3u, 15u, + 0u, 14u, 2u, 15u, 2u, 15u, 3u, 15u, + 0u, 14u, 2u, 15u, 2u, 15u, 3u, 15u, + 0u, 14u, 2u, 15u, 2u, 15u, 3u, 15u, + 0u, 14u, 2u, 15u, 2u, 15u, 3u, 15u, + 4u, 9u, 4u, 9u, 4u, 9u, 9u, 9u, + 9u, 9u, 9u, 9u, 4u, 9u, 2u, 9u, + 4u, 9u, 2u, 9u, 3u, 9u, 4u, 9u, + 2u, 9u, 3u, 9u, 4u, 9u, 2u, 9u, + 3u, 9u, 4u, 9u, 2u, 9u, 3u, 9u, + 3u, 9u, 2u, 15u, 2u, 15u, 0u, 14u, + 0u, 14u, 0u, 14u, 2u, 15u, 2u, 15u, + 0u, 14u, 0u, 14u, 0u, 14u, 2u, 15u, + 2u, 15u, 0u, 14u, 0u, 14u, 0u, 14u, + 2u, 15u, 2u, 15u, 0u, 14u, 0u, 14u, + 0u, 14u, 3u, 7u, 2u, 15u, 2u, 15u, + 3u, 15u, 0u, 14u, 2u, 15u, 2u, 15u, + 3u, 15u, 0u, 14u, 2u, 15u, 2u, 15u, + 3u, 15u, 0u, 14u, 2u, 15u, 2u, 15u, + 3u, 15u, 0u, 14u, 2u, 15u, 2u, 15u, + 3u, 15u, 4u, 9u, 4u, 9u, 4u, 9u, + 9u, 9u, 9u, 9u, 9u, 9u, 4u, 9u, + 2u, 9u, 4u, 9u, 2u, 9u, 3u, 9u, + 4u, 9u, 2u, 9u, 3u, 9u, 4u, 9u, + 2u, 9u, 3u, 9u, 4u, 9u, 2u, 9u, + 3u, 9u, 3u, 9u, 2u, 15u, 2u, 15u, + 0u, 14u, 0u, 14u, 0u, 14u, 2u, 15u, + 2u, 15u, 0u, 14u, 0u, 14u, 0u, 14u, + 2u, 15u, 2u, 15u, 0u, 14u, 0u, 14u, + 0u, 14u, 2u, 15u, 2u, 15u, 0u, 14u, + 0u, 14u, 0u, 14u, 3u, 12u, 2u, 15u, + 3u, 7u, 2u, 15u, 2u, 15u, 3u, 15u, + 0u, 14u, 2u, 15u, 2u, 15u, 3u, 15u, + 0u, 14u, 2u, 15u, 2u, 15u, 3u, 15u, + 0u, 14u, 2u, 15u, 2u, 15u, 3u, 15u, + 0u, 14u, 2u, 15u, 2u, 15u, 3u, 15u, + 4u, 9u, 4u, 9u, 4u, 9u, 9u, 9u, + 9u, 9u, 9u, 9u, 4u, 9u, 2u, 9u, + 4u, 9u, 2u, 9u, 3u, 9u, 4u, 9u, + 2u, 9u, 3u, 9u, 4u, 9u, 2u, 9u, + 3u, 9u, 4u, 9u, 2u, 9u, 3u, 9u, + 3u, 9u, 2u, 15u, 2u, 15u, 0u, 14u, + 0u, 14u, 0u, 14u, 2u, 15u, 2u, 15u, + 0u, 14u, 0u, 14u, 0u, 14u, 2u, 15u, + 2u, 15u, 0u, 14u, 0u, 14u, 0u, 14u, + 2u, 15u, 2u, 15u, 0u, 14u, 0u, 14u, + 0u, 14u, 2u, 15u, 0u, 15u, 2u, 15u, + 0u, 15u, 3u, 12u, 4u, 9u, 9u, 9u, + 9u, 9u, 9u, 9u, 4u, 9u, 0u, 14u, + 2u, 9u, 4u, 9u, 4u, 9u, 9u, 9u, + 9u, 9u, 9u, 9u, 4u, 9u, 0u, 14u, + 0u }; -static const char _indic_syllable_machine_key_spans[] = { - 1, 5, 3, 1, 4, 3, 1, 4, - 3, 1, 4, 3, 1, 5, 1, 1, - 5, 1, 1, 5, 1, 1, 5, 1, - 1, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 1, 5, 3, 1, 4, 3, - 1, 4, 3, 1, 4, 3, 1, 5, - 1, 1, 5, 1, 1, 5, 1, 1, - 5, 1, 1, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 1, 5, 3, 1, - 4, 3, 1, 4, 3, 1, 4, 3, - 1, 5, 1, 1, 5, 1, 1, 5, - 1, 1, 5, 1, 1, 10, 5, 10, - 5, 10, 5, 10, 5, 1, 5, 3, - 1, 4, 3, 1, 4, 3, 1, 4, - 3, 1, 5, 1, 1, 5, 1, 1, - 5, 1, 1, 5, 1, 1, 10, 5, - 10, 5, 10, 5, 10, 5, 10, 10, - 4, 1, 19, 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, 6, 8, - 7, 6, 8, 7, 6, 8, 7, 6, - 8, 7, 7, 15, 15, 16, 16, 16, - 15, 15, 16, 16, 16, 15, 15, 16, - 16, 16, 15, 15, 16, 16, 16, 15, - 15, 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, 6, 8, 7, 6, - 8, 7, 6, 8, 7, 6, 8, 7, - 7, 15, 15, 16, 16, 16, 15, 15, - 16, 16, 16, 15, 15, 16, 16, 16, - 15, 15, 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, 6, 8, 7, 6, 8, 7, 6, - 8, 7, 6, 8, 7, 7, 15, 15, - 16, 16, 16, 15, 15, 16, 16, 16, - 15, 15, 16, 16, 16, 15, 15, 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, - 6, 6, 6, 1, 1, 1, 6, 8, - 6, 8, 7, 6, 8, 7, 6, 8, - 7, 6, 8, 7, 7, 15, 15, 16, - 16, 16, 15, 15, 16, 16, 16, 15, - 15, 16, 16, 16, 15, 15, 16, 16, - 16, 15, 17, 15, 17, 10, 6, 1, - 1, 1, 6, 16, 8, 6, 6, 1, - 1, 1, 6, 16 +static const char _indic_syllable_machine_char_class[] = { + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 8, 13, 14, + 15, 16, 17, 0 }; static const short _indic_syllable_machine_index_offsets[] = { - 0, 2, 8, 12, 14, 19, 23, 25, - 30, 34, 36, 41, 45, 47, 53, 55, - 57, 63, 65, 67, 73, 75, 77, 83, - 85, 87, 98, 104, 115, 121, 132, 138, - 149, 155, 166, 168, 174, 178, 180, 185, - 189, 191, 196, 200, 202, 207, 211, 213, - 219, 221, 223, 229, 231, 233, 239, 241, - 243, 249, 251, 253, 264, 270, 281, 287, - 298, 304, 315, 321, 332, 334, 340, 344, - 346, 351, 355, 357, 362, 366, 368, 373, - 377, 379, 385, 387, 389, 395, 397, 399, - 405, 407, 409, 415, 417, 419, 430, 436, - 447, 453, 464, 470, 481, 487, 489, 495, - 499, 501, 506, 510, 512, 517, 521, 523, - 528, 532, 534, 540, 542, 544, 550, 552, - 554, 560, 562, 564, 570, 572, 574, 585, - 591, 602, 608, 619, 625, 636, 642, 653, - 664, 669, 671, 691, 707, 723, 738, 755, - 771, 787, 802, 819, 835, 851, 866, 883, - 899, 915, 930, 947, 963, 979, 994, 1001, - 1008, 1015, 1017, 1019, 1021, 1028, 1037, 1044, - 1053, 1061, 1068, 1077, 1085, 1092, 1101, 1109, - 1116, 1125, 1133, 1141, 1157, 1173, 1190, 1207, - 1224, 1240, 1256, 1273, 1290, 1307, 1323, 1339, - 1356, 1373, 1390, 1406, 1422, 1439, 1456, 1473, - 1489, 1505, 1521, 1537, 1552, 1569, 1585, 1601, - 1616, 1633, 1649, 1665, 1680, 1697, 1713, 1729, - 1744, 1761, 1777, 1793, 1808, 1815, 1822, 1829, - 1831, 1833, 1835, 1842, 1851, 1858, 1867, 1875, - 1882, 1891, 1899, 1906, 1915, 1923, 1930, 1939, - 1947, 1955, 1971, 1987, 2004, 2021, 2038, 2054, - 2070, 2087, 2104, 2121, 2137, 2153, 2170, 2187, - 2204, 2220, 2236, 2253, 2270, 2287, 2293, 2309, - 2325, 2340, 2357, 2373, 2389, 2404, 2421, 2437, - 2453, 2468, 2485, 2501, 2517, 2532, 2549, 2565, - 2581, 2596, 2603, 2610, 2617, 2619, 2621, 2623, - 2630, 2639, 2646, 2655, 2663, 2670, 2679, 2687, - 2694, 2703, 2711, 2718, 2727, 2735, 2743, 2759, - 2775, 2792, 2809, 2826, 2842, 2858, 2875, 2892, - 2909, 2925, 2941, 2958, 2975, 2992, 3008, 3024, - 3041, 3058, 3075, 3086, 3102, 3108, 3124, 3140, - 3155, 3172, 3188, 3204, 3219, 3236, 3252, 3268, - 3283, 3300, 3316, 3332, 3347, 3364, 3380, 3396, - 3411, 3418, 3425, 3432, 3434, 3436, 3438, 3445, - 3454, 3461, 3470, 3478, 3485, 3494, 3502, 3509, - 3518, 3526, 3533, 3542, 3550, 3558, 3574, 3590, - 3607, 3624, 3641, 3657, 3673, 3690, 3707, 3724, - 3740, 3756, 3773, 3790, 3807, 3823, 3839, 3856, - 3873, 3890, 3906, 3924, 3940, 3958, 3969, 3976, - 3978, 3980, 3982, 3989, 4006, 4015, 4022, 4029, - 4031, 4033, 4035, 4042 + 0, 1, 6, 9, 10, 14, 17, 18, + 22, 25, 26, 30, 33, 34, 39, 40, + 41, 46, 47, 48, 53, 54, 55, 60, + 61, 62, 72, 77, 87, 92, 102, 107, + 117, 122, 132, 133, 138, 141, 142, 146, + 149, 150, 154, 157, 158, 162, 165, 166, + 171, 172, 173, 178, 179, 180, 185, 186, + 187, 192, 193, 194, 204, 209, 219, 224, + 234, 239, 249, 254, 264, 265, 270, 273, + 274, 278, 281, 282, 286, 289, 290, 294, + 297, 298, 303, 304, 305, 310, 311, 312, + 317, 318, 319, 324, 325, 326, 336, 341, + 351, 356, 366, 371, 381, 386, 387, 392, + 395, 396, 400, 403, 404, 408, 411, 412, + 416, 419, 420, 425, 426, 427, 432, 433, + 434, 439, 440, 441, 446, 447, 448, 458, + 463, 473, 478, 488, 493, 503, 508, 518, + 528, 532, 533, 551, 565, 579, 592, 607, + 621, 635, 648, 663, 677, 691, 704, 719, + 733, 747, 760, 775, 789, 803, 816, 822, + 828, 834, 835, 836, 837, 843, 851, 857, + 865, 872, 878, 886, 893, 899, 907, 914, + 920, 928, 935, 942, 956, 970, 985, 1000, + 1015, 1029, 1043, 1058, 1073, 1088, 1102, 1116, + 1131, 1146, 1161, 1175, 1189, 1204, 1219, 1234, + 1248, 1262, 1276, 1290, 1303, 1318, 1332, 1346, + 1359, 1374, 1388, 1402, 1415, 1430, 1444, 1458, + 1471, 1486, 1500, 1514, 1527, 1533, 1539, 1545, + 1546, 1547, 1548, 1554, 1562, 1568, 1576, 1583, + 1589, 1597, 1604, 1610, 1618, 1625, 1631, 1639, + 1646, 1653, 1667, 1681, 1696, 1711, 1726, 1740, + 1754, 1769, 1784, 1799, 1813, 1827, 1842, 1857, + 1872, 1886, 1900, 1915, 1930, 1945, 1950, 1964, + 1978, 1991, 2006, 2020, 2034, 2047, 2062, 2076, + 2090, 2103, 2118, 2132, 2146, 2159, 2174, 2188, + 2202, 2215, 2221, 2227, 2233, 2234, 2235, 2236, + 2242, 2250, 2256, 2264, 2271, 2277, 2285, 2292, + 2298, 2306, 2313, 2319, 2327, 2334, 2341, 2355, + 2369, 2384, 2399, 2414, 2428, 2442, 2457, 2472, + 2487, 2501, 2515, 2530, 2545, 2560, 2574, 2588, + 2603, 2618, 2633, 2643, 2657, 2662, 2676, 2690, + 2703, 2718, 2732, 2746, 2759, 2774, 2788, 2802, + 2815, 2830, 2844, 2858, 2871, 2886, 2900, 2914, + 2927, 2933, 2939, 2945, 2946, 2947, 2948, 2954, + 2962, 2968, 2976, 2983, 2989, 2997, 3004, 3010, + 3018, 3025, 3031, 3039, 3046, 3053, 3067, 3081, + 3096, 3111, 3126, 3140, 3154, 3169, 3184, 3199, + 3213, 3227, 3242, 3257, 3272, 3286, 3300, 3315, + 3330, 3345, 3359, 3375, 3389, 3405, 3415, 3421, + 3422, 3423, 3424, 3430, 3445, 3453, 3459, 3465, + 3466, 3467, 3468, 3474, 0 }; static const short _indic_syllable_machine_indicies[] = { - 1, 0, 2, 3, 3, 4, 1, 0, - 5, 5, 4, 0, 4, 0, 6, 6, - 7, 1, 0, 8, 8, 7, 0, 7, - 0, 9, 9, 10, 1, 0, 11, 11, - 10, 0, 10, 0, 12, 12, 13, 1, - 0, 14, 14, 13, 0, 13, 0, 15, - 0, 0, 0, 1, 0, 16, 0, 17, - 0, 18, 12, 12, 13, 1, 0, 19, - 0, 20, 0, 21, 9, 9, 10, 1, - 0, 22, 0, 23, 0, 24, 6, 6, - 7, 1, 0, 25, 0, 26, 0, 2, - 3, 3, 4, 1, 0, 0, 0, 0, - 27, 0, 28, 3, 3, 4, 1, 0, - 28, 3, 3, 4, 1, 0, 0, 0, - 0, 29, 0, 30, 3, 3, 4, 1, - 0, 30, 3, 3, 4, 1, 0, 0, - 0, 0, 31, 0, 32, 3, 3, 4, - 1, 0, 32, 3, 3, 4, 1, 0, - 0, 0, 0, 33, 0, 34, 3, 3, - 4, 1, 0, 34, 3, 3, 4, 1, - 0, 0, 0, 0, 35, 0, 37, 36, - 38, 39, 39, 40, 37, 36, 41, 41, - 40, 36, 40, 36, 42, 42, 43, 37, - 36, 44, 44, 43, 36, 43, 36, 45, - 45, 46, 37, 36, 47, 47, 46, 36, - 46, 36, 48, 48, 49, 37, 36, 50, - 50, 49, 36, 49, 36, 51, 36, 36, - 36, 37, 36, 52, 36, 53, 36, 54, - 48, 48, 49, 37, 36, 55, 36, 56, - 36, 57, 45, 45, 46, 37, 36, 58, - 36, 59, 36, 60, 42, 42, 43, 37, - 36, 61, 36, 62, 36, 38, 39, 39, - 40, 37, 36, 36, 36, 36, 63, 36, - 64, 39, 39, 40, 37, 36, 64, 39, - 39, 40, 37, 36, 36, 36, 36, 65, - 36, 66, 39, 39, 40, 37, 36, 66, - 39, 39, 40, 37, 36, 36, 36, 36, - 67, 36, 68, 39, 39, 40, 37, 36, - 68, 39, 39, 40, 37, 36, 36, 36, - 36, 69, 36, 70, 39, 39, 40, 37, - 36, 70, 39, 39, 40, 37, 36, 36, - 36, 36, 71, 36, 73, 72, 74, 75, - 75, 76, 73, 72, 78, 78, 76, 77, - 76, 77, 79, 79, 80, 73, 72, 81, - 81, 80, 72, 80, 72, 82, 82, 83, - 73, 72, 84, 84, 83, 72, 83, 72, - 85, 85, 86, 73, 72, 87, 87, 86, - 72, 86, 72, 88, 72, 72, 72, 73, - 72, 89, 72, 90, 72, 91, 85, 85, - 86, 73, 72, 92, 72, 93, 72, 94, - 82, 82, 83, 73, 72, 95, 72, 96, - 72, 97, 79, 79, 80, 73, 72, 98, - 72, 99, 72, 74, 75, 75, 76, 73, - 72, 72, 72, 72, 100, 72, 101, 75, - 75, 76, 73, 72, 101, 75, 75, 76, - 73, 72, 72, 72, 72, 102, 72, 103, - 75, 75, 76, 73, 72, 103, 75, 75, - 76, 73, 72, 72, 72, 72, 104, 72, - 105, 75, 75, 76, 73, 72, 105, 75, - 75, 76, 73, 72, 72, 72, 72, 106, - 72, 107, 75, 75, 76, 73, 72, 109, - 108, 110, 111, 111, 112, 109, 108, 113, - 113, 112, 108, 112, 108, 114, 114, 115, - 109, 108, 116, 116, 115, 108, 115, 108, - 117, 117, 118, 109, 108, 119, 119, 118, - 108, 118, 108, 120, 120, 121, 109, 108, - 122, 122, 121, 108, 121, 108, 123, 108, - 108, 108, 109, 108, 124, 108, 125, 108, - 126, 120, 120, 121, 109, 108, 127, 108, - 128, 108, 129, 117, 117, 118, 109, 108, - 130, 108, 131, 108, 132, 114, 114, 115, - 109, 108, 133, 108, 134, 108, 110, 111, - 111, 112, 109, 108, 108, 108, 108, 135, - 108, 136, 111, 111, 112, 109, 108, 136, - 111, 111, 112, 109, 108, 108, 108, 108, - 137, 108, 138, 111, 111, 112, 109, 108, - 138, 111, 111, 112, 109, 108, 108, 108, - 108, 139, 108, 140, 111, 111, 112, 109, - 108, 140, 111, 111, 112, 109, 108, 108, - 108, 108, 141, 108, 142, 111, 111, 112, - 109, 108, 142, 111, 111, 112, 109, 108, - 108, 108, 108, 143, 108, 107, 75, 75, - 76, 73, 72, 72, 72, 72, 144, 72, - 78, 78, 76, 1, 0, 146, 145, 148, - 149, 150, 151, 152, 153, 76, 73, 147, - 154, 155, 155, 144, 147, 156, 157, 158, - 159, 160, 147, 162, 163, 164, 165, 4, - 1, 161, 166, 161, 161, 35, 161, 161, - 161, 167, 161, 168, 163, 169, 169, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 163, 169, 169, 4, 1, - 161, 166, 161, 161, 161, 161, 161, 161, - 167, 161, 170, 161, 161, 161, 17, 171, - 161, 1, 161, 166, 161, 161, 161, 161, - 161, 170, 161, 172, 173, 174, 175, 4, - 1, 161, 166, 161, 161, 33, 161, 161, - 161, 167, 161, 176, 173, 177, 177, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 173, 177, 177, 4, 1, - 161, 166, 161, 161, 161, 161, 161, 161, - 167, 161, 178, 161, 161, 161, 17, 179, - 161, 1, 161, 166, 161, 161, 161, 161, - 161, 178, 161, 180, 181, 182, 183, 4, - 1, 161, 166, 161, 161, 31, 161, 161, - 161, 167, 161, 184, 181, 185, 185, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 181, 185, 185, 4, 1, - 161, 166, 161, 161, 161, 161, 161, 161, - 167, 161, 186, 161, 161, 161, 17, 187, - 161, 1, 161, 166, 161, 161, 161, 161, - 161, 186, 161, 188, 189, 190, 191, 4, - 1, 161, 166, 161, 161, 29, 161, 161, - 161, 167, 161, 192, 189, 193, 193, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 189, 193, 193, 4, 1, - 161, 166, 161, 161, 161, 161, 161, 161, - 167, 161, 194, 161, 161, 161, 17, 195, - 161, 1, 161, 166, 161, 161, 161, 161, - 161, 194, 161, 196, 197, 198, 199, 4, - 1, 161, 166, 161, 161, 27, 161, 161, - 161, 167, 161, 200, 197, 201, 201, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 197, 201, 201, 4, 1, - 161, 166, 161, 161, 161, 161, 161, 161, - 167, 161, 17, 202, 161, 1, 161, 166, - 161, 203, 203, 161, 1, 161, 166, 161, - 204, 161, 161, 205, 161, 166, 161, 166, - 161, 206, 161, 207, 161, 204, 161, 161, - 161, 161, 166, 161, 17, 161, 203, 203, - 161, 1, 161, 166, 161, 203, 202, 161, - 1, 161, 166, 161, 208, 26, 209, 210, - 7, 1, 161, 166, 161, 26, 209, 210, - 7, 1, 161, 166, 161, 209, 209, 7, - 1, 161, 166, 161, 211, 23, 212, 213, - 10, 1, 161, 166, 161, 23, 212, 213, - 10, 1, 161, 166, 161, 212, 212, 10, - 1, 161, 166, 161, 214, 20, 215, 216, - 13, 1, 161, 166, 161, 20, 215, 216, - 13, 1, 161, 166, 161, 215, 215, 13, - 1, 161, 166, 161, 217, 17, 203, 218, - 161, 1, 161, 166, 161, 17, 203, 218, - 161, 1, 161, 166, 161, 197, 201, 201, - 4, 1, 161, 166, 161, 196, 197, 201, - 201, 4, 1, 161, 166, 161, 161, 161, - 161, 161, 161, 167, 161, 196, 197, 198, - 201, 4, 1, 161, 166, 161, 161, 27, - 161, 161, 161, 167, 161, 194, 161, 219, - 161, 203, 203, 161, 1, 161, 166, 161, - 161, 161, 161, 161, 194, 161, 194, 161, - 161, 161, 203, 203, 161, 1, 161, 166, - 161, 161, 161, 161, 161, 194, 161, 194, - 161, 161, 161, 203, 195, 161, 1, 161, - 166, 161, 161, 161, 161, 161, 194, 161, - 188, 189, 193, 193, 4, 1, 161, 166, - 161, 161, 161, 161, 161, 161, 167, 161, - 188, 189, 190, 193, 4, 1, 161, 166, - 161, 161, 29, 161, 161, 161, 167, 161, - 186, 161, 220, 161, 203, 203, 161, 1, - 161, 166, 161, 161, 161, 161, 161, 186, - 161, 186, 161, 161, 161, 203, 203, 161, - 1, 161, 166, 161, 161, 161, 161, 161, - 186, 161, 186, 161, 161, 161, 203, 187, - 161, 1, 161, 166, 161, 161, 161, 161, - 161, 186, 161, 180, 181, 185, 185, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 180, 181, 182, 185, 4, - 1, 161, 166, 161, 161, 31, 161, 161, - 161, 167, 161, 178, 161, 221, 161, 203, - 203, 161, 1, 161, 166, 161, 161, 161, - 161, 161, 178, 161, 178, 161, 161, 161, - 203, 203, 161, 1, 161, 166, 161, 161, - 161, 161, 161, 178, 161, 178, 161, 161, - 161, 203, 179, 161, 1, 161, 166, 161, - 161, 161, 161, 161, 178, 161, 172, 173, - 177, 177, 4, 1, 161, 166, 161, 161, - 161, 161, 161, 161, 167, 161, 172, 173, - 174, 177, 4, 1, 161, 166, 161, 161, - 33, 161, 161, 161, 167, 161, 170, 161, - 222, 161, 203, 203, 161, 1, 161, 166, - 161, 161, 161, 161, 161, 170, 161, 170, - 161, 161, 161, 203, 203, 161, 1, 161, - 166, 161, 161, 161, 161, 161, 170, 161, - 170, 161, 161, 161, 203, 171, 161, 1, - 161, 166, 161, 161, 161, 161, 161, 170, - 161, 162, 163, 169, 169, 4, 1, 161, - 166, 161, 161, 161, 161, 161, 161, 167, - 161, 162, 163, 164, 169, 4, 1, 161, - 166, 161, 161, 35, 161, 161, 161, 167, - 161, 224, 225, 226, 227, 40, 37, 223, - 228, 223, 223, 71, 223, 223, 223, 229, - 223, 230, 225, 231, 227, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 225, 231, 227, 40, 37, 223, 228, - 223, 223, 223, 223, 223, 223, 229, 223, - 232, 223, 223, 223, 53, 233, 223, 37, - 223, 228, 223, 223, 223, 223, 223, 232, - 223, 234, 235, 236, 237, 40, 37, 223, - 228, 223, 223, 69, 223, 223, 223, 229, - 223, 238, 235, 239, 239, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 235, 239, 239, 40, 37, 223, 228, - 223, 223, 223, 223, 223, 223, 229, 223, - 240, 223, 223, 223, 53, 241, 223, 37, - 223, 228, 223, 223, 223, 223, 223, 240, - 223, 242, 243, 244, 245, 40, 37, 223, - 228, 223, 223, 67, 223, 223, 223, 229, - 223, 246, 243, 247, 247, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 243, 247, 247, 40, 37, 223, 228, - 223, 223, 223, 223, 223, 223, 229, 223, - 248, 223, 223, 223, 53, 249, 223, 37, - 223, 228, 223, 223, 223, 223, 223, 248, - 223, 250, 251, 252, 253, 40, 37, 223, - 228, 223, 223, 65, 223, 223, 223, 229, - 223, 254, 251, 255, 255, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 251, 255, 255, 40, 37, 223, 228, - 223, 223, 223, 223, 223, 223, 229, 223, - 256, 223, 223, 223, 53, 257, 223, 37, - 223, 228, 223, 223, 223, 223, 223, 256, - 223, 258, 259, 260, 261, 40, 37, 223, - 228, 223, 223, 63, 223, 223, 223, 229, - 223, 262, 259, 263, 263, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 259, 263, 263, 40, 37, 223, 228, - 223, 223, 223, 223, 223, 223, 229, 223, - 53, 264, 223, 37, 223, 228, 223, 265, - 265, 223, 37, 223, 228, 223, 266, 223, - 223, 267, 223, 228, 223, 228, 223, 268, - 223, 269, 223, 266, 223, 223, 223, 223, - 228, 223, 53, 223, 265, 265, 223, 37, - 223, 228, 223, 265, 264, 223, 37, 223, - 228, 223, 270, 62, 271, 272, 43, 37, - 223, 228, 223, 62, 271, 272, 43, 37, - 223, 228, 223, 271, 271, 43, 37, 223, - 228, 223, 273, 59, 274, 275, 46, 37, - 223, 228, 223, 59, 274, 275, 46, 37, - 223, 228, 223, 274, 274, 46, 37, 223, - 228, 223, 276, 56, 277, 278, 49, 37, - 223, 228, 223, 56, 277, 278, 49, 37, - 223, 228, 223, 277, 277, 49, 37, 223, - 228, 223, 279, 53, 265, 280, 223, 37, - 223, 228, 223, 53, 265, 280, 223, 37, - 223, 228, 223, 259, 263, 263, 40, 37, - 223, 228, 223, 258, 259, 263, 263, 40, - 37, 223, 228, 223, 223, 223, 223, 223, - 223, 229, 223, 258, 259, 260, 263, 40, - 37, 223, 228, 223, 223, 63, 223, 223, - 223, 229, 223, 256, 223, 281, 223, 265, - 265, 223, 37, 223, 228, 223, 223, 223, - 223, 223, 256, 223, 256, 223, 223, 223, - 265, 265, 223, 37, 223, 228, 223, 223, - 223, 223, 223, 256, 223, 256, 223, 223, - 223, 265, 257, 223, 37, 223, 228, 223, - 223, 223, 223, 223, 256, 223, 250, 251, - 255, 255, 40, 37, 223, 228, 223, 223, - 223, 223, 223, 223, 229, 223, 250, 251, - 252, 255, 40, 37, 223, 228, 223, 223, - 65, 223, 223, 223, 229, 223, 248, 223, - 282, 223, 265, 265, 223, 37, 223, 228, - 223, 223, 223, 223, 223, 248, 223, 248, - 223, 223, 223, 265, 265, 223, 37, 223, - 228, 223, 223, 223, 223, 223, 248, 223, - 248, 223, 223, 223, 265, 249, 223, 37, - 223, 228, 223, 223, 223, 223, 223, 248, - 223, 242, 243, 247, 247, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 242, 243, 244, 247, 40, 37, 223, - 228, 223, 223, 67, 223, 223, 223, 229, - 223, 240, 223, 283, 223, 265, 265, 223, - 37, 223, 228, 223, 223, 223, 223, 223, - 240, 223, 240, 223, 223, 223, 265, 265, - 223, 37, 223, 228, 223, 223, 223, 223, - 223, 240, 223, 240, 223, 223, 223, 265, - 241, 223, 37, 223, 228, 223, 223, 223, - 223, 223, 240, 223, 234, 235, 239, 239, - 40, 37, 223, 228, 223, 223, 223, 223, - 223, 223, 229, 223, 234, 235, 236, 239, - 40, 37, 223, 228, 223, 223, 69, 223, - 223, 223, 229, 223, 232, 223, 284, 223, - 265, 265, 223, 37, 223, 228, 223, 223, - 223, 223, 223, 232, 223, 232, 223, 223, - 223, 265, 265, 223, 37, 223, 228, 223, - 223, 223, 223, 223, 232, 223, 232, 223, - 223, 223, 265, 233, 223, 37, 223, 228, - 223, 223, 223, 223, 223, 232, 223, 70, - 39, 39, 40, 37, 223, 224, 225, 231, - 227, 40, 37, 223, 228, 223, 223, 223, - 223, 223, 223, 229, 223, 286, 151, 287, - 287, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 151, 287, 287, - 76, 73, 285, 154, 285, 285, 285, 285, - 285, 285, 158, 285, 288, 285, 285, 285, - 90, 289, 285, 73, 285, 154, 285, 285, - 285, 285, 285, 288, 285, 290, 291, 292, - 293, 76, 73, 285, 154, 285, 285, 106, - 285, 285, 285, 158, 285, 294, 291, 295, - 295, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 291, 295, 295, - 76, 73, 285, 154, 285, 285, 285, 285, - 285, 285, 158, 285, 296, 285, 285, 285, - 90, 297, 285, 73, 285, 154, 285, 285, - 285, 285, 285, 296, 285, 298, 299, 300, - 301, 76, 73, 285, 154, 285, 285, 104, - 285, 285, 285, 158, 285, 302, 299, 303, - 303, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 299, 303, 303, - 76, 73, 285, 154, 285, 285, 285, 285, - 285, 285, 158, 285, 304, 285, 285, 285, - 90, 305, 285, 73, 285, 154, 285, 285, - 285, 285, 285, 304, 285, 306, 307, 308, - 309, 76, 73, 285, 154, 285, 285, 102, - 285, 285, 285, 158, 285, 310, 307, 311, - 311, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 307, 311, 311, - 76, 73, 285, 154, 285, 285, 285, 285, - 285, 285, 158, 285, 312, 285, 285, 285, - 90, 313, 285, 73, 285, 154, 285, 285, - 285, 285, 285, 312, 285, 314, 315, 316, - 317, 76, 73, 285, 154, 285, 285, 100, - 285, 285, 285, 158, 285, 318, 315, 319, - 319, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 315, 319, 319, - 76, 73, 285, 154, 285, 285, 285, 285, - 285, 285, 158, 285, 90, 320, 285, 73, - 285, 154, 285, 321, 321, 285, 73, 285, - 154, 285, 322, 285, 285, 323, 285, 154, - 285, 154, 285, 324, 285, 325, 285, 322, - 285, 285, 285, 285, 154, 285, 90, 285, - 321, 321, 285, 73, 285, 154, 285, 321, - 320, 285, 73, 285, 154, 285, 326, 99, - 327, 328, 80, 73, 285, 154, 285, 99, - 327, 328, 80, 73, 285, 154, 285, 327, - 327, 80, 73, 285, 154, 285, 329, 96, - 330, 331, 83, 73, 285, 154, 285, 96, - 330, 331, 83, 73, 285, 154, 285, 330, - 330, 83, 73, 285, 154, 285, 332, 93, - 333, 334, 86, 73, 285, 154, 285, 93, - 333, 334, 86, 73, 285, 154, 285, 333, - 333, 86, 73, 285, 154, 285, 335, 90, - 321, 336, 285, 73, 285, 154, 285, 90, - 321, 336, 285, 73, 285, 154, 285, 315, - 319, 319, 76, 73, 285, 154, 285, 314, - 315, 319, 319, 76, 73, 285, 154, 285, - 285, 285, 285, 285, 285, 158, 285, 314, - 315, 316, 319, 76, 73, 285, 154, 285, - 285, 100, 285, 285, 285, 158, 285, 312, - 285, 337, 285, 321, 321, 285, 73, 285, - 154, 285, 285, 285, 285, 285, 312, 285, - 312, 285, 285, 285, 321, 321, 285, 73, - 285, 154, 285, 285, 285, 285, 285, 312, - 285, 312, 285, 285, 285, 321, 313, 285, - 73, 285, 154, 285, 285, 285, 285, 285, - 312, 285, 306, 307, 311, 311, 76, 73, - 285, 154, 285, 285, 285, 285, 285, 285, - 158, 285, 306, 307, 308, 311, 76, 73, - 285, 154, 285, 285, 102, 285, 285, 285, - 158, 285, 304, 285, 338, 285, 321, 321, - 285, 73, 285, 154, 285, 285, 285, 285, - 285, 304, 285, 304, 285, 285, 285, 321, - 321, 285, 73, 285, 154, 285, 285, 285, - 285, 285, 304, 285, 304, 285, 285, 285, - 321, 305, 285, 73, 285, 154, 285, 285, - 285, 285, 285, 304, 285, 298, 299, 303, - 303, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 298, 299, 300, - 303, 76, 73, 285, 154, 285, 285, 104, - 285, 285, 285, 158, 285, 296, 285, 339, - 285, 321, 321, 285, 73, 285, 154, 285, - 285, 285, 285, 285, 296, 285, 296, 285, - 285, 285, 321, 321, 285, 73, 285, 154, - 285, 285, 285, 285, 285, 296, 285, 296, - 285, 285, 285, 321, 297, 285, 73, 285, - 154, 285, 285, 285, 285, 285, 296, 285, - 290, 291, 295, 295, 76, 73, 285, 154, - 285, 285, 285, 285, 285, 285, 158, 285, - 290, 291, 292, 295, 76, 73, 285, 154, - 285, 285, 106, 285, 285, 285, 158, 285, - 288, 285, 340, 285, 321, 321, 285, 73, - 285, 154, 285, 285, 285, 285, 285, 288, - 285, 288, 285, 285, 285, 321, 321, 285, - 73, 285, 154, 285, 285, 285, 285, 285, - 288, 285, 288, 285, 285, 285, 321, 289, - 285, 73, 285, 154, 285, 285, 285, 285, - 285, 288, 285, 107, 75, 75, 76, 73, - 341, 341, 341, 341, 144, 341, 150, 151, - 287, 287, 76, 73, 285, 154, 285, 285, - 285, 285, 285, 285, 158, 285, 107, 75, - 75, 76, 73, 341, 343, 344, 345, 346, - 112, 109, 342, 347, 342, 342, 143, 342, - 342, 342, 348, 342, 349, 344, 346, 346, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 344, 346, 346, 112, - 109, 342, 347, 342, 342, 342, 342, 342, - 342, 348, 342, 350, 342, 342, 342, 125, - 351, 342, 109, 342, 347, 342, 342, 342, - 342, 342, 350, 342, 352, 353, 354, 355, - 112, 109, 342, 347, 342, 342, 141, 342, - 342, 342, 348, 342, 356, 353, 357, 357, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 353, 357, 357, 112, - 109, 342, 347, 342, 342, 342, 342, 342, - 342, 348, 342, 358, 342, 342, 342, 125, - 359, 342, 109, 342, 347, 342, 342, 342, - 342, 342, 358, 342, 360, 361, 362, 363, - 112, 109, 342, 347, 342, 342, 139, 342, - 342, 342, 348, 342, 364, 361, 365, 365, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 361, 365, 365, 112, - 109, 342, 347, 342, 342, 342, 342, 342, - 342, 348, 342, 366, 342, 342, 342, 125, - 367, 342, 109, 342, 347, 342, 342, 342, - 342, 342, 366, 342, 368, 369, 370, 371, - 112, 109, 342, 347, 342, 342, 137, 342, - 342, 342, 348, 342, 372, 369, 373, 373, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 369, 373, 373, 112, - 109, 342, 347, 342, 342, 342, 342, 342, - 342, 348, 342, 374, 342, 342, 342, 125, - 375, 342, 109, 342, 347, 342, 342, 342, - 342, 342, 374, 342, 376, 377, 378, 379, - 112, 109, 342, 347, 342, 342, 135, 342, - 342, 342, 348, 342, 380, 377, 381, 381, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 377, 381, 381, 112, - 109, 342, 347, 342, 342, 342, 342, 342, - 342, 348, 342, 125, 382, 342, 109, 342, - 347, 342, 383, 383, 342, 109, 342, 347, - 342, 384, 342, 342, 385, 342, 347, 342, - 347, 342, 386, 342, 387, 342, 384, 342, - 342, 342, 342, 347, 342, 125, 342, 383, - 383, 342, 109, 342, 347, 342, 383, 382, - 342, 109, 342, 347, 342, 388, 134, 389, - 390, 115, 109, 342, 347, 342, 134, 389, - 390, 115, 109, 342, 347, 342, 389, 389, - 115, 109, 342, 347, 342, 391, 131, 392, - 393, 118, 109, 342, 347, 342, 131, 392, - 393, 118, 109, 342, 347, 342, 392, 392, - 118, 109, 342, 347, 342, 394, 128, 395, - 396, 121, 109, 342, 347, 342, 128, 395, - 396, 121, 109, 342, 347, 342, 395, 395, - 121, 109, 342, 347, 342, 397, 125, 383, - 398, 342, 109, 342, 347, 342, 125, 383, - 398, 342, 109, 342, 347, 342, 377, 381, - 381, 112, 109, 342, 347, 342, 376, 377, - 381, 381, 112, 109, 342, 347, 342, 342, - 342, 342, 342, 342, 348, 342, 376, 377, - 378, 381, 112, 109, 342, 347, 342, 342, - 135, 342, 342, 342, 348, 342, 374, 342, - 399, 342, 383, 383, 342, 109, 342, 347, - 342, 342, 342, 342, 342, 374, 342, 374, - 342, 342, 342, 383, 383, 342, 109, 342, - 347, 342, 342, 342, 342, 342, 374, 342, - 374, 342, 342, 342, 383, 375, 342, 109, - 342, 347, 342, 342, 342, 342, 342, 374, - 342, 368, 369, 373, 373, 112, 109, 342, - 347, 342, 342, 342, 342, 342, 342, 348, - 342, 368, 369, 370, 373, 112, 109, 342, - 347, 342, 342, 137, 342, 342, 342, 348, - 342, 366, 342, 400, 342, 383, 383, 342, - 109, 342, 347, 342, 342, 342, 342, 342, - 366, 342, 366, 342, 342, 342, 383, 383, - 342, 109, 342, 347, 342, 342, 342, 342, - 342, 366, 342, 366, 342, 342, 342, 383, - 367, 342, 109, 342, 347, 342, 342, 342, - 342, 342, 366, 342, 360, 361, 365, 365, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 360, 361, 362, 365, - 112, 109, 342, 347, 342, 342, 139, 342, - 342, 342, 348, 342, 358, 342, 401, 342, - 383, 383, 342, 109, 342, 347, 342, 342, - 342, 342, 342, 358, 342, 358, 342, 342, - 342, 383, 383, 342, 109, 342, 347, 342, - 342, 342, 342, 342, 358, 342, 358, 342, - 342, 342, 383, 359, 342, 109, 342, 347, - 342, 342, 342, 342, 342, 358, 342, 352, - 353, 357, 357, 112, 109, 342, 347, 342, - 342, 342, 342, 342, 342, 348, 342, 352, - 353, 354, 357, 112, 109, 342, 347, 342, - 342, 141, 342, 342, 342, 348, 342, 350, - 342, 402, 342, 383, 383, 342, 109, 342, - 347, 342, 342, 342, 342, 342, 350, 342, - 350, 342, 342, 342, 383, 383, 342, 109, - 342, 347, 342, 342, 342, 342, 342, 350, - 342, 350, 342, 342, 342, 383, 351, 342, - 109, 342, 347, 342, 342, 342, 342, 342, - 350, 342, 343, 344, 346, 346, 112, 109, - 342, 347, 342, 342, 342, 342, 342, 342, - 348, 342, 148, 149, 150, 151, 403, 287, - 76, 73, 285, 154, 155, 155, 144, 285, - 285, 148, 158, 285, 162, 404, 164, 165, - 4, 1, 161, 166, 161, 161, 35, 161, - 161, 161, 167, 161, 170, 149, 150, 151, - 405, 406, 76, 407, 161, 408, 161, 155, - 144, 161, 161, 170, 158, 161, 107, 409, - 409, 76, 407, 161, 166, 161, 161, 144, - 161, 410, 161, 161, 411, 161, 408, 161, - 408, 161, 412, 161, 207, 161, 410, 161, - 161, 161, 161, 408, 161, 170, 161, 222, - 107, 409, 409, 76, 407, 161, 166, 161, - 161, 161, 161, 161, 170, 161, 414, 413, - 415, 415, 413, 146, 413, 416, 413, 415, - 415, 413, 146, 413, 416, 413, 417, 413, - 413, 418, 413, 416, 413, 416, 413, 419, - 413, 420, 413, 417, 413, 413, 413, 413, - 416, 413, 148, 341, 341, 341, 341, 341, - 341, 341, 341, 341, 155, 341, 341, 341, - 341, 148, 341, 0 + 1, 2, 3, 3, 4, 1, 5, 5, + 4, 4, 6, 6, 7, 1, 8, 8, + 7, 7, 9, 9, 10, 1, 11, 11, + 10, 10, 12, 12, 13, 1, 14, 14, + 13, 13, 15, 0, 0, 0, 1, 16, + 17, 18, 12, 12, 13, 1, 19, 20, + 21, 9, 9, 10, 1, 22, 23, 24, + 6, 6, 7, 1, 25, 26, 2, 3, + 3, 4, 1, 0, 0, 0, 0, 27, + 28, 3, 3, 4, 1, 28, 3, 3, + 4, 1, 0, 0, 0, 0, 29, 30, + 3, 3, 4, 1, 30, 3, 3, 4, + 1, 0, 0, 0, 0, 31, 32, 3, + 3, 4, 1, 32, 3, 3, 4, 1, + 0, 0, 0, 0, 33, 34, 3, 3, + 4, 1, 34, 3, 3, 4, 1, 0, + 0, 0, 0, 35, 37, 38, 39, 39, + 40, 37, 41, 41, 40, 40, 42, 42, + 43, 37, 44, 44, 43, 43, 45, 45, + 46, 37, 47, 47, 46, 46, 48, 48, + 49, 37, 50, 50, 49, 49, 51, 36, + 36, 36, 37, 52, 53, 54, 48, 48, + 49, 37, 55, 56, 57, 45, 45, 46, + 37, 58, 59, 60, 42, 42, 43, 37, + 61, 62, 38, 39, 39, 40, 37, 36, + 36, 36, 36, 63, 64, 39, 39, 40, + 37, 64, 39, 39, 40, 37, 36, 36, + 36, 36, 65, 66, 39, 39, 40, 37, + 66, 39, 39, 40, 37, 36, 36, 36, + 36, 67, 68, 39, 39, 40, 37, 68, + 39, 39, 40, 37, 36, 36, 36, 36, + 69, 70, 39, 39, 40, 37, 70, 39, + 39, 40, 37, 36, 36, 36, 36, 71, + 73, 74, 75, 75, 76, 73, 78, 78, + 76, 76, 79, 79, 80, 73, 81, 81, + 80, 80, 82, 82, 83, 73, 84, 84, + 83, 83, 85, 85, 86, 73, 87, 87, + 86, 86, 88, 72, 72, 72, 73, 89, + 90, 91, 85, 85, 86, 73, 92, 93, + 94, 82, 82, 83, 73, 95, 96, 97, + 79, 79, 80, 73, 98, 99, 74, 75, + 75, 76, 73, 72, 72, 72, 72, 100, + 101, 75, 75, 76, 73, 101, 75, 75, + 76, 73, 72, 72, 72, 72, 102, 103, + 75, 75, 76, 73, 103, 75, 75, 76, + 73, 72, 72, 72, 72, 104, 105, 75, + 75, 76, 73, 105, 75, 75, 76, 73, + 72, 72, 72, 72, 106, 107, 75, 75, + 76, 73, 109, 110, 111, 111, 112, 109, + 113, 113, 112, 112, 114, 114, 115, 109, + 116, 116, 115, 115, 117, 117, 118, 109, + 119, 119, 118, 118, 120, 120, 121, 109, + 122, 122, 121, 121, 123, 108, 108, 108, + 109, 124, 125, 126, 120, 120, 121, 109, + 127, 128, 129, 117, 117, 118, 109, 130, + 131, 132, 114, 114, 115, 109, 133, 134, + 110, 111, 111, 112, 109, 108, 108, 108, + 108, 135, 136, 111, 111, 112, 109, 136, + 111, 111, 112, 109, 108, 108, 108, 108, + 137, 138, 111, 111, 112, 109, 138, 111, + 111, 112, 109, 108, 108, 108, 108, 139, + 140, 111, 111, 112, 109, 140, 111, 111, + 112, 109, 108, 108, 108, 108, 141, 142, + 111, 111, 112, 109, 142, 111, 111, 112, + 109, 108, 108, 108, 108, 143, 107, 75, + 75, 76, 73, 72, 72, 72, 72, 144, + 78, 78, 76, 1, 146, 148, 149, 150, + 151, 152, 153, 76, 73, 147, 154, 155, + 155, 144, 156, 157, 158, 159, 160, 162, + 163, 164, 165, 4, 1, 161, 166, 161, + 161, 35, 161, 161, 167, 168, 163, 169, + 169, 4, 1, 161, 166, 161, 161, 161, + 161, 161, 167, 163, 169, 169, 4, 1, + 161, 166, 161, 161, 161, 161, 161, 167, + 170, 161, 161, 161, 17, 171, 161, 1, + 161, 166, 161, 161, 161, 161, 170, 172, + 173, 174, 175, 4, 1, 161, 166, 161, + 161, 33, 161, 161, 167, 176, 173, 177, + 177, 4, 1, 161, 166, 161, 161, 161, + 161, 161, 167, 173, 177, 177, 4, 1, + 161, 166, 161, 161, 161, 161, 161, 167, + 178, 161, 161, 161, 17, 179, 161, 1, + 161, 166, 161, 161, 161, 161, 178, 180, + 181, 182, 183, 4, 1, 161, 166, 161, + 161, 31, 161, 161, 167, 184, 181, 185, + 185, 4, 1, 161, 166, 161, 161, 161, + 161, 161, 167, 181, 185, 185, 4, 1, + 161, 166, 161, 161, 161, 161, 161, 167, + 186, 161, 161, 161, 17, 187, 161, 1, + 161, 166, 161, 161, 161, 161, 186, 188, + 189, 190, 191, 4, 1, 161, 166, 161, + 161, 29, 161, 161, 167, 192, 189, 193, + 193, 4, 1, 161, 166, 161, 161, 161, + 161, 161, 167, 189, 193, 193, 4, 1, + 161, 166, 161, 161, 161, 161, 161, 167, + 194, 161, 161, 161, 17, 195, 161, 1, + 161, 166, 161, 161, 161, 161, 194, 196, + 197, 198, 199, 4, 1, 161, 166, 161, + 161, 27, 161, 161, 167, 200, 197, 201, + 201, 4, 1, 161, 166, 161, 161, 161, + 161, 161, 167, 197, 201, 201, 4, 1, + 161, 166, 161, 161, 161, 161, 161, 167, + 17, 202, 161, 1, 161, 166, 203, 203, + 161, 1, 161, 166, 204, 161, 161, 205, + 161, 166, 166, 206, 207, 204, 161, 161, + 161, 161, 166, 17, 161, 203, 203, 161, + 1, 161, 166, 203, 202, 161, 1, 161, + 166, 208, 26, 209, 210, 7, 1, 161, + 166, 26, 209, 210, 7, 1, 161, 166, + 209, 209, 7, 1, 161, 166, 211, 23, + 212, 213, 10, 1, 161, 166, 23, 212, + 213, 10, 1, 161, 166, 212, 212, 10, + 1, 161, 166, 214, 20, 215, 216, 13, + 1, 161, 166, 20, 215, 216, 13, 1, + 161, 166, 215, 215, 13, 1, 161, 166, + 217, 17, 203, 218, 161, 1, 161, 166, + 17, 203, 218, 161, 1, 161, 166, 197, + 201, 201, 4, 1, 161, 166, 196, 197, + 201, 201, 4, 1, 161, 166, 161, 161, + 161, 161, 161, 167, 196, 197, 198, 201, + 4, 1, 161, 166, 161, 161, 27, 161, + 161, 167, 194, 161, 219, 161, 203, 203, + 161, 1, 161, 166, 161, 161, 161, 161, + 194, 194, 161, 161, 161, 203, 203, 161, + 1, 161, 166, 161, 161, 161, 161, 194, + 194, 161, 161, 161, 203, 195, 161, 1, + 161, 166, 161, 161, 161, 161, 194, 188, + 189, 193, 193, 4, 1, 161, 166, 161, + 161, 161, 161, 161, 167, 188, 189, 190, + 193, 4, 1, 161, 166, 161, 161, 29, + 161, 161, 167, 186, 161, 220, 161, 203, + 203, 161, 1, 161, 166, 161, 161, 161, + 161, 186, 186, 161, 161, 161, 203, 203, + 161, 1, 161, 166, 161, 161, 161, 161, + 186, 186, 161, 161, 161, 203, 187, 161, + 1, 161, 166, 161, 161, 161, 161, 186, + 180, 181, 185, 185, 4, 1, 161, 166, + 161, 161, 161, 161, 161, 167, 180, 181, + 182, 185, 4, 1, 161, 166, 161, 161, + 31, 161, 161, 167, 178, 161, 221, 161, + 203, 203, 161, 1, 161, 166, 161, 161, + 161, 161, 178, 178, 161, 161, 161, 203, + 203, 161, 1, 161, 166, 161, 161, 161, + 161, 178, 178, 161, 161, 161, 203, 179, + 161, 1, 161, 166, 161, 161, 161, 161, + 178, 172, 173, 177, 177, 4, 1, 161, + 166, 161, 161, 161, 161, 161, 167, 172, + 173, 174, 177, 4, 1, 161, 166, 161, + 161, 33, 161, 161, 167, 170, 161, 222, + 161, 203, 203, 161, 1, 161, 166, 161, + 161, 161, 161, 170, 170, 161, 161, 161, + 203, 203, 161, 1, 161, 166, 161, 161, + 161, 161, 170, 170, 161, 161, 161, 203, + 171, 161, 1, 161, 166, 161, 161, 161, + 161, 170, 162, 163, 169, 169, 4, 1, + 161, 166, 161, 161, 161, 161, 161, 167, + 162, 163, 164, 169, 4, 1, 161, 166, + 161, 161, 35, 161, 161, 167, 224, 225, + 226, 227, 40, 37, 223, 228, 223, 223, + 71, 223, 223, 229, 230, 225, 231, 227, + 40, 37, 223, 228, 223, 223, 223, 223, + 223, 229, 225, 231, 227, 40, 37, 223, + 228, 223, 223, 223, 223, 223, 229, 232, + 223, 223, 223, 53, 233, 223, 37, 223, + 228, 223, 223, 223, 223, 232, 234, 235, + 236, 237, 40, 37, 223, 228, 223, 223, + 69, 223, 223, 229, 238, 235, 239, 239, + 40, 37, 223, 228, 223, 223, 223, 223, + 223, 229, 235, 239, 239, 40, 37, 223, + 228, 223, 223, 223, 223, 223, 229, 240, + 223, 223, 223, 53, 241, 223, 37, 223, + 228, 223, 223, 223, 223, 240, 242, 243, + 244, 245, 40, 37, 223, 228, 223, 223, + 67, 223, 223, 229, 246, 243, 247, 247, + 40, 37, 223, 228, 223, 223, 223, 223, + 223, 229, 243, 247, 247, 40, 37, 223, + 228, 223, 223, 223, 223, 223, 229, 248, + 223, 223, 223, 53, 249, 223, 37, 223, + 228, 223, 223, 223, 223, 248, 250, 251, + 252, 253, 40, 37, 223, 228, 223, 223, + 65, 223, 223, 229, 254, 251, 255, 255, + 40, 37, 223, 228, 223, 223, 223, 223, + 223, 229, 251, 255, 255, 40, 37, 223, + 228, 223, 223, 223, 223, 223, 229, 256, + 223, 223, 223, 53, 257, 223, 37, 223, + 228, 223, 223, 223, 223, 256, 258, 259, + 260, 261, 40, 37, 223, 228, 223, 223, + 63, 223, 223, 229, 262, 259, 263, 263, + 40, 37, 223, 228, 223, 223, 223, 223, + 223, 229, 259, 263, 263, 40, 37, 223, + 228, 223, 223, 223, 223, 223, 229, 53, + 264, 223, 37, 223, 228, 265, 265, 223, + 37, 223, 228, 266, 223, 223, 267, 223, + 228, 228, 268, 269, 266, 223, 223, 223, + 223, 228, 53, 223, 265, 265, 223, 37, + 223, 228, 265, 264, 223, 37, 223, 228, + 270, 62, 271, 272, 43, 37, 223, 228, + 62, 271, 272, 43, 37, 223, 228, 271, + 271, 43, 37, 223, 228, 273, 59, 274, + 275, 46, 37, 223, 228, 59, 274, 275, + 46, 37, 223, 228, 274, 274, 46, 37, + 223, 228, 276, 56, 277, 278, 49, 37, + 223, 228, 56, 277, 278, 49, 37, 223, + 228, 277, 277, 49, 37, 223, 228, 279, + 53, 265, 280, 223, 37, 223, 228, 53, + 265, 280, 223, 37, 223, 228, 259, 263, + 263, 40, 37, 223, 228, 258, 259, 263, + 263, 40, 37, 223, 228, 223, 223, 223, + 223, 223, 229, 258, 259, 260, 263, 40, + 37, 223, 228, 223, 223, 63, 223, 223, + 229, 256, 223, 281, 223, 265, 265, 223, + 37, 223, 228, 223, 223, 223, 223, 256, + 256, 223, 223, 223, 265, 265, 223, 37, + 223, 228, 223, 223, 223, 223, 256, 256, + 223, 223, 223, 265, 257, 223, 37, 223, + 228, 223, 223, 223, 223, 256, 250, 251, + 255, 255, 40, 37, 223, 228, 223, 223, + 223, 223, 223, 229, 250, 251, 252, 255, + 40, 37, 223, 228, 223, 223, 65, 223, + 223, 229, 248, 223, 282, 223, 265, 265, + 223, 37, 223, 228, 223, 223, 223, 223, + 248, 248, 223, 223, 223, 265, 265, 223, + 37, 223, 228, 223, 223, 223, 223, 248, + 248, 223, 223, 223, 265, 249, 223, 37, + 223, 228, 223, 223, 223, 223, 248, 242, + 243, 247, 247, 40, 37, 223, 228, 223, + 223, 223, 223, 223, 229, 242, 243, 244, + 247, 40, 37, 223, 228, 223, 223, 67, + 223, 223, 229, 240, 223, 283, 223, 265, + 265, 223, 37, 223, 228, 223, 223, 223, + 223, 240, 240, 223, 223, 223, 265, 265, + 223, 37, 223, 228, 223, 223, 223, 223, + 240, 240, 223, 223, 223, 265, 241, 223, + 37, 223, 228, 223, 223, 223, 223, 240, + 234, 235, 239, 239, 40, 37, 223, 228, + 223, 223, 223, 223, 223, 229, 234, 235, + 236, 239, 40, 37, 223, 228, 223, 223, + 69, 223, 223, 229, 232, 223, 284, 223, + 265, 265, 223, 37, 223, 228, 223, 223, + 223, 223, 232, 232, 223, 223, 223, 265, + 265, 223, 37, 223, 228, 223, 223, 223, + 223, 232, 232, 223, 223, 223, 265, 233, + 223, 37, 223, 228, 223, 223, 223, 223, + 232, 70, 39, 39, 40, 37, 224, 225, + 231, 227, 40, 37, 223, 228, 223, 223, + 223, 223, 223, 229, 286, 151, 287, 287, + 76, 73, 285, 154, 285, 285, 285, 285, + 285, 158, 151, 287, 287, 76, 73, 285, + 154, 285, 285, 285, 285, 285, 158, 288, + 285, 285, 285, 90, 289, 285, 73, 285, + 154, 285, 285, 285, 285, 288, 290, 291, + 292, 293, 76, 73, 285, 154, 285, 285, + 106, 285, 285, 158, 294, 291, 295, 295, + 76, 73, 285, 154, 285, 285, 285, 285, + 285, 158, 291, 295, 295, 76, 73, 285, + 154, 285, 285, 285, 285, 285, 158, 296, + 285, 285, 285, 90, 297, 285, 73, 285, + 154, 285, 285, 285, 285, 296, 298, 299, + 300, 301, 76, 73, 285, 154, 285, 285, + 104, 285, 285, 158, 302, 299, 303, 303, + 76, 73, 285, 154, 285, 285, 285, 285, + 285, 158, 299, 303, 303, 76, 73, 285, + 154, 285, 285, 285, 285, 285, 158, 304, + 285, 285, 285, 90, 305, 285, 73, 285, + 154, 285, 285, 285, 285, 304, 306, 307, + 308, 309, 76, 73, 285, 154, 285, 285, + 102, 285, 285, 158, 310, 307, 311, 311, + 76, 73, 285, 154, 285, 285, 285, 285, + 285, 158, 307, 311, 311, 76, 73, 285, + 154, 285, 285, 285, 285, 285, 158, 312, + 285, 285, 285, 90, 313, 285, 73, 285, + 154, 285, 285, 285, 285, 312, 314, 315, + 316, 317, 76, 73, 285, 154, 285, 285, + 100, 285, 285, 158, 318, 315, 319, 319, + 76, 73, 285, 154, 285, 285, 285, 285, + 285, 158, 315, 319, 319, 76, 73, 285, + 154, 285, 285, 285, 285, 285, 158, 90, + 320, 285, 73, 285, 154, 321, 321, 285, + 73, 285, 154, 322, 285, 285, 323, 285, + 154, 154, 324, 325, 322, 285, 285, 285, + 285, 154, 90, 285, 321, 321, 285, 73, + 285, 154, 321, 320, 285, 73, 285, 154, + 326, 99, 327, 328, 80, 73, 285, 154, + 99, 327, 328, 80, 73, 285, 154, 327, + 327, 80, 73, 285, 154, 329, 96, 330, + 331, 83, 73, 285, 154, 96, 330, 331, + 83, 73, 285, 154, 330, 330, 83, 73, + 285, 154, 332, 93, 333, 334, 86, 73, + 285, 154, 93, 333, 334, 86, 73, 285, + 154, 333, 333, 86, 73, 285, 154, 335, + 90, 321, 336, 285, 73, 285, 154, 90, + 321, 336, 285, 73, 285, 154, 315, 319, + 319, 76, 73, 285, 154, 314, 315, 319, + 319, 76, 73, 285, 154, 285, 285, 285, + 285, 285, 158, 314, 315, 316, 319, 76, + 73, 285, 154, 285, 285, 100, 285, 285, + 158, 312, 285, 337, 285, 321, 321, 285, + 73, 285, 154, 285, 285, 285, 285, 312, + 312, 285, 285, 285, 321, 321, 285, 73, + 285, 154, 285, 285, 285, 285, 312, 312, + 285, 285, 285, 321, 313, 285, 73, 285, + 154, 285, 285, 285, 285, 312, 306, 307, + 311, 311, 76, 73, 285, 154, 285, 285, + 285, 285, 285, 158, 306, 307, 308, 311, + 76, 73, 285, 154, 285, 285, 102, 285, + 285, 158, 304, 285, 338, 285, 321, 321, + 285, 73, 285, 154, 285, 285, 285, 285, + 304, 304, 285, 285, 285, 321, 321, 285, + 73, 285, 154, 285, 285, 285, 285, 304, + 304, 285, 285, 285, 321, 305, 285, 73, + 285, 154, 285, 285, 285, 285, 304, 298, + 299, 303, 303, 76, 73, 285, 154, 285, + 285, 285, 285, 285, 158, 298, 299, 300, + 303, 76, 73, 285, 154, 285, 285, 104, + 285, 285, 158, 296, 285, 339, 285, 321, + 321, 285, 73, 285, 154, 285, 285, 285, + 285, 296, 296, 285, 285, 285, 321, 321, + 285, 73, 285, 154, 285, 285, 285, 285, + 296, 296, 285, 285, 285, 321, 297, 285, + 73, 285, 154, 285, 285, 285, 285, 296, + 290, 291, 295, 295, 76, 73, 285, 154, + 285, 285, 285, 285, 285, 158, 290, 291, + 292, 295, 76, 73, 285, 154, 285, 285, + 106, 285, 285, 158, 288, 285, 340, 285, + 321, 321, 285, 73, 285, 154, 285, 285, + 285, 285, 288, 288, 285, 285, 285, 321, + 321, 285, 73, 285, 154, 285, 285, 285, + 285, 288, 288, 285, 285, 285, 321, 289, + 285, 73, 285, 154, 285, 285, 285, 285, + 288, 107, 75, 75, 76, 73, 341, 341, + 341, 341, 144, 150, 151, 287, 287, 76, + 73, 285, 154, 285, 285, 285, 285, 285, + 158, 107, 75, 75, 76, 73, 343, 344, + 345, 346, 112, 109, 342, 347, 342, 342, + 143, 342, 342, 348, 349, 344, 346, 346, + 112, 109, 342, 347, 342, 342, 342, 342, + 342, 348, 344, 346, 346, 112, 109, 342, + 347, 342, 342, 342, 342, 342, 348, 350, + 342, 342, 342, 125, 351, 342, 109, 342, + 347, 342, 342, 342, 342, 350, 352, 353, + 354, 355, 112, 109, 342, 347, 342, 342, + 141, 342, 342, 348, 356, 353, 357, 357, + 112, 109, 342, 347, 342, 342, 342, 342, + 342, 348, 353, 357, 357, 112, 109, 342, + 347, 342, 342, 342, 342, 342, 348, 358, + 342, 342, 342, 125, 359, 342, 109, 342, + 347, 342, 342, 342, 342, 358, 360, 361, + 362, 363, 112, 109, 342, 347, 342, 342, + 139, 342, 342, 348, 364, 361, 365, 365, + 112, 109, 342, 347, 342, 342, 342, 342, + 342, 348, 361, 365, 365, 112, 109, 342, + 347, 342, 342, 342, 342, 342, 348, 366, + 342, 342, 342, 125, 367, 342, 109, 342, + 347, 342, 342, 342, 342, 366, 368, 369, + 370, 371, 112, 109, 342, 347, 342, 342, + 137, 342, 342, 348, 372, 369, 373, 373, + 112, 109, 342, 347, 342, 342, 342, 342, + 342, 348, 369, 373, 373, 112, 109, 342, + 347, 342, 342, 342, 342, 342, 348, 374, + 342, 342, 342, 125, 375, 342, 109, 342, + 347, 342, 342, 342, 342, 374, 376, 377, + 378, 379, 112, 109, 342, 347, 342, 342, + 135, 342, 342, 348, 380, 377, 381, 381, + 112, 109, 342, 347, 342, 342, 342, 342, + 342, 348, 377, 381, 381, 112, 109, 342, + 347, 342, 342, 342, 342, 342, 348, 125, + 382, 342, 109, 342, 347, 383, 383, 342, + 109, 342, 347, 384, 342, 342, 385, 342, + 347, 347, 386, 387, 384, 342, 342, 342, + 342, 347, 125, 342, 383, 383, 342, 109, + 342, 347, 383, 382, 342, 109, 342, 347, + 388, 134, 389, 390, 115, 109, 342, 347, + 134, 389, 390, 115, 109, 342, 347, 389, + 389, 115, 109, 342, 347, 391, 131, 392, + 393, 118, 109, 342, 347, 131, 392, 393, + 118, 109, 342, 347, 392, 392, 118, 109, + 342, 347, 394, 128, 395, 396, 121, 109, + 342, 347, 128, 395, 396, 121, 109, 342, + 347, 395, 395, 121, 109, 342, 347, 397, + 125, 383, 398, 342, 109, 342, 347, 125, + 383, 398, 342, 109, 342, 347, 377, 381, + 381, 112, 109, 342, 347, 376, 377, 381, + 381, 112, 109, 342, 347, 342, 342, 342, + 342, 342, 348, 376, 377, 378, 381, 112, + 109, 342, 347, 342, 342, 135, 342, 342, + 348, 374, 342, 399, 342, 383, 383, 342, + 109, 342, 347, 342, 342, 342, 342, 374, + 374, 342, 342, 342, 383, 383, 342, 109, + 342, 347, 342, 342, 342, 342, 374, 374, + 342, 342, 342, 383, 375, 342, 109, 342, + 347, 342, 342, 342, 342, 374, 368, 369, + 373, 373, 112, 109, 342, 347, 342, 342, + 342, 342, 342, 348, 368, 369, 370, 373, + 112, 109, 342, 347, 342, 342, 137, 342, + 342, 348, 366, 342, 400, 342, 383, 383, + 342, 109, 342, 347, 342, 342, 342, 342, + 366, 366, 342, 342, 342, 383, 383, 342, + 109, 342, 347, 342, 342, 342, 342, 366, + 366, 342, 342, 342, 383, 367, 342, 109, + 342, 347, 342, 342, 342, 342, 366, 360, + 361, 365, 365, 112, 109, 342, 347, 342, + 342, 342, 342, 342, 348, 360, 361, 362, + 365, 112, 109, 342, 347, 342, 342, 139, + 342, 342, 348, 358, 342, 401, 342, 383, + 383, 342, 109, 342, 347, 342, 342, 342, + 342, 358, 358, 342, 342, 342, 383, 383, + 342, 109, 342, 347, 342, 342, 342, 342, + 358, 358, 342, 342, 342, 383, 359, 342, + 109, 342, 347, 342, 342, 342, 342, 358, + 352, 353, 357, 357, 112, 109, 342, 347, + 342, 342, 342, 342, 342, 348, 352, 353, + 354, 357, 112, 109, 342, 347, 342, 342, + 141, 342, 342, 348, 350, 342, 402, 342, + 383, 383, 342, 109, 342, 347, 342, 342, + 342, 342, 350, 350, 342, 342, 342, 383, + 383, 342, 109, 342, 347, 342, 342, 342, + 342, 350, 350, 342, 342, 342, 383, 351, + 342, 109, 342, 347, 342, 342, 342, 342, + 350, 343, 344, 346, 346, 112, 109, 342, + 347, 342, 342, 342, 342, 342, 348, 148, + 149, 150, 151, 403, 287, 76, 73, 285, + 154, 155, 155, 144, 285, 148, 158, 162, + 404, 164, 165, 4, 1, 161, 166, 161, + 161, 35, 161, 161, 167, 170, 149, 150, + 151, 405, 406, 76, 407, 161, 408, 161, + 155, 144, 161, 170, 158, 107, 409, 409, + 76, 407, 161, 166, 161, 161, 144, 410, + 161, 161, 411, 161, 408, 408, 412, 207, + 410, 161, 161, 161, 161, 408, 170, 161, + 222, 107, 409, 409, 76, 407, 161, 166, + 161, 161, 161, 161, 170, 414, 413, 415, + 415, 413, 146, 413, 416, 415, 415, 413, + 146, 413, 416, 417, 413, 413, 418, 413, + 416, 416, 419, 420, 417, 413, 413, 413, + 413, 416, 148, 341, 341, 341, 341, 341, + 341, 341, 341, 341, 155, 341, 341, 341, + 148, 0 }; -static const short _indic_syllable_machine_trans_targs[] = { - 138, 160, 166, 2, 167, 3, 5, 170, - 6, 8, 173, 9, 11, 176, 12, 14, - 15, 159, 17, 18, 175, 20, 21, 172, - 23, 24, 169, 179, 183, 184, 188, 189, - 193, 194, 198, 199, 138, 222, 228, 36, - 229, 37, 39, 232, 40, 42, 235, 43, - 45, 238, 46, 48, 49, 221, 51, 52, - 237, 54, 55, 234, 57, 58, 231, 241, - 245, 246, 250, 251, 255, 256, 260, 262, - 138, 283, 289, 70, 290, 138, 71, 73, - 293, 74, 76, 296, 77, 79, 299, 80, - 82, 83, 282, 85, 86, 298, 88, 89, - 295, 91, 92, 292, 302, 306, 307, 311, - 312, 316, 317, 321, 138, 346, 352, 103, - 353, 104, 106, 356, 107, 109, 359, 110, - 112, 362, 113, 115, 116, 345, 118, 119, - 361, 121, 122, 358, 124, 125, 355, 365, - 369, 370, 374, 375, 379, 380, 384, 385, - 323, 138, 398, 138, 139, 201, 263, 265, - 322, 324, 285, 325, 386, 387, 301, 396, - 403, 138, 140, 142, 33, 200, 162, 178, - 141, 32, 143, 196, 144, 146, 31, 195, - 145, 30, 147, 191, 148, 150, 29, 190, - 149, 28, 151, 186, 152, 154, 27, 185, - 153, 26, 155, 181, 156, 158, 25, 180, - 157, 1, 165, 0, 161, 164, 163, 138, - 168, 4, 22, 171, 7, 19, 174, 10, - 16, 177, 13, 182, 187, 192, 197, 138, - 202, 204, 67, 261, 224, 240, 203, 66, - 205, 258, 206, 208, 65, 257, 207, 64, - 209, 253, 210, 212, 63, 252, 211, 62, - 213, 248, 214, 216, 61, 247, 215, 60, - 217, 243, 218, 220, 59, 242, 219, 35, - 227, 34, 223, 226, 225, 138, 230, 38, - 56, 233, 41, 53, 236, 44, 50, 239, - 47, 244, 249, 254, 259, 138, 264, 100, - 266, 319, 267, 269, 99, 318, 268, 98, - 270, 314, 271, 273, 97, 313, 272, 96, - 274, 309, 275, 277, 95, 308, 276, 94, - 278, 304, 279, 281, 93, 303, 280, 69, - 288, 68, 284, 287, 286, 138, 291, 72, - 90, 294, 75, 87, 297, 78, 84, 300, - 81, 305, 310, 315, 320, 138, 138, 326, - 328, 134, 133, 348, 364, 327, 329, 382, - 330, 332, 132, 381, 331, 131, 333, 377, - 334, 336, 130, 376, 335, 129, 337, 372, - 338, 340, 128, 371, 339, 127, 341, 367, - 342, 344, 126, 366, 343, 102, 351, 101, - 347, 350, 349, 138, 354, 105, 123, 357, - 108, 120, 360, 111, 117, 363, 114, 368, - 373, 378, 383, 135, 388, 389, 395, 390, - 392, 136, 391, 394, 393, 138, 397, 137, - 400, 399, 402, 401, 138 +static const short _indic_syllable_machine_index_defaults[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 72, 72, 77, 77, + 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 72, + 0, 145, 147, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 223, 223, 223, 223, 223, 223, 223, + 223, 223, 223, 223, 223, 223, 223, 223, + 223, 223, 223, 223, 223, 223, 223, 223, + 223, 223, 223, 223, 223, 223, 223, 223, + 223, 223, 223, 223, 223, 223, 223, 223, + 223, 223, 223, 223, 223, 223, 223, 223, + 223, 223, 223, 223, 223, 223, 223, 223, + 223, 223, 223, 223, 223, 223, 223, 285, + 285, 285, 285, 285, 285, 285, 285, 285, + 285, 285, 285, 285, 285, 285, 285, 285, + 285, 285, 285, 285, 285, 285, 285, 285, + 285, 285, 285, 285, 285, 285, 285, 285, + 285, 285, 285, 285, 285, 285, 285, 285, + 285, 285, 285, 285, 285, 285, 285, 285, + 285, 285, 285, 285, 285, 285, 285, 285, + 285, 285, 341, 285, 341, 342, 342, 342, + 342, 342, 342, 342, 342, 342, 342, 342, + 342, 342, 342, 342, 342, 342, 342, 342, + 342, 342, 342, 342, 342, 342, 342, 342, + 342, 342, 342, 342, 342, 342, 342, 342, + 342, 342, 342, 342, 342, 342, 342, 342, + 342, 342, 342, 342, 342, 342, 342, 342, + 342, 342, 342, 342, 342, 342, 342, 342, + 342, 342, 285, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 413, 413, 413, 413, + 413, 413, 413, 341, 0 }; -static const char _indic_syllable_machine_trans_actions[] = { - 1, 0, 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, 3, 0, 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, - 4, 0, 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, 6, 2, 6, 2, - 6, 2, 6, 2, 7, 0, 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, - 6, 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, - 2, 0, 0, 2, 0, 0, 2, 0, - 0, 2, 0, 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, 2, 0, - 0, 2, 0, 0, 2, 0, 0, 2, - 0, 2, 2, 2, 2, 17, 6, 0, - 6, 2, 6, 0, 0, 6, 6, 0, - 6, 2, 6, 0, 0, 6, 6, 0, - 6, 2, 6, 0, 0, 6, 6, 0, - 6, 2, 6, 0, 0, 6, 6, 0, - 2, 0, 0, 0, 0, 18, 2, 0, - 0, 2, 0, 0, 2, 0, 0, 2, - 0, 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, 2, 0, 0, 2, - 0, 0, 2, 0, 0, 2, 0, 2, - 2, 2, 2, 0, 0, 22, 22, 0, - 0, 0, 0, 0, 0, 23, 2, 0, - 0, 0, 0, 0, 24 +static const char _indic_syllable_machine_trans_cond_spaces[] = { + -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, -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, -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, -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, -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, -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, -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, -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, + -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, -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, -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, -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, -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, -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, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 0 +}; + +static const short _indic_syllable_machine_cond_targs[] = { + 138, 160, 166, 2, 167, 3, 5, 170, + 6, 8, 173, 9, 11, 176, 12, 14, + 15, 159, 17, 18, 175, 20, 21, 172, + 23, 24, 169, 179, 183, 184, 188, 189, + 193, 194, 198, 199, 138, 222, 228, 36, + 229, 37, 39, 232, 40, 42, 235, 43, + 45, 238, 46, 48, 49, 221, 51, 52, + 237, 54, 55, 234, 57, 58, 231, 241, + 245, 246, 250, 251, 255, 256, 260, 262, + 138, 283, 289, 70, 290, 138, 71, 73, + 293, 74, 76, 296, 77, 79, 299, 80, + 82, 83, 282, 85, 86, 298, 88, 89, + 295, 91, 92, 292, 302, 306, 307, 311, + 312, 316, 317, 321, 138, 346, 352, 103, + 353, 104, 106, 356, 107, 109, 359, 110, + 112, 362, 113, 115, 116, 345, 118, 119, + 361, 121, 122, 358, 124, 125, 355, 365, + 369, 370, 374, 375, 379, 380, 384, 385, + 323, 138, 398, 138, 139, 201, 263, 265, + 322, 324, 285, 325, 386, 387, 301, 396, + 403, 138, 140, 142, 33, 200, 162, 178, + 141, 32, 143, 196, 144, 146, 31, 195, + 145, 30, 147, 191, 148, 150, 29, 190, + 149, 28, 151, 186, 152, 154, 27, 185, + 153, 26, 155, 181, 156, 158, 25, 180, + 157, 1, 165, 0, 161, 164, 163, 138, + 168, 4, 22, 171, 7, 19, 174, 10, + 16, 177, 13, 182, 187, 192, 197, 138, + 202, 204, 67, 261, 224, 240, 203, 66, + 205, 258, 206, 208, 65, 257, 207, 64, + 209, 253, 210, 212, 63, 252, 211, 62, + 213, 248, 214, 216, 61, 247, 215, 60, + 217, 243, 218, 220, 59, 242, 219, 35, + 227, 34, 223, 226, 225, 138, 230, 38, + 56, 233, 41, 53, 236, 44, 50, 239, + 47, 244, 249, 254, 259, 138, 264, 100, + 266, 319, 267, 269, 99, 318, 268, 98, + 270, 314, 271, 273, 97, 313, 272, 96, + 274, 309, 275, 277, 95, 308, 276, 94, + 278, 304, 279, 281, 93, 303, 280, 69, + 288, 68, 284, 287, 286, 138, 291, 72, + 90, 294, 75, 87, 297, 78, 84, 300, + 81, 305, 310, 315, 320, 138, 138, 326, + 328, 134, 133, 348, 364, 327, 329, 382, + 330, 332, 132, 381, 331, 131, 333, 377, + 334, 336, 130, 376, 335, 129, 337, 372, + 338, 340, 128, 371, 339, 127, 341, 367, + 342, 344, 126, 366, 343, 102, 351, 101, + 347, 350, 349, 138, 354, 105, 123, 357, + 108, 120, 360, 111, 117, 363, 114, 368, + 373, 378, 383, 135, 388, 389, 395, 390, + 392, 136, 391, 394, 393, 138, 397, 137, + 400, 399, 402, 401, 138, 0 +}; + +static const char _indic_syllable_machine_cond_actions[] = { + 1, 0, 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, 3, 0, 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, + 4, 0, 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, 6, 2, 6, 2, + 6, 2, 6, 2, 7, 0, 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, + 6, 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, + 2, 0, 0, 2, 0, 0, 2, 0, + 0, 2, 0, 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, 2, 0, + 0, 2, 0, 0, 2, 0, 0, 2, + 0, 2, 2, 2, 2, 17, 6, 0, + 6, 2, 6, 0, 0, 6, 6, 0, + 6, 2, 6, 0, 0, 6, 6, 0, + 6, 2, 6, 0, 0, 6, 6, 0, + 6, 2, 6, 0, 0, 6, 6, 0, + 2, 0, 0, 0, 0, 18, 2, 0, + 0, 2, 0, 0, 2, 0, 0, 2, + 0, 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, 2, 0, 0, 2, + 0, 0, 2, 0, 0, 2, 0, 2, + 2, 2, 2, 0, 0, 22, 22, 0, + 0, 0, 0, 0, 0, 23, 2, 0, + 0, 0, 0, 0, 24, 0 }; 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, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 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[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 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, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 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, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 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_eof_cond_spaces[] = { + -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, -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, -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, -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, -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, -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, -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, + -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, -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, -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, -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, -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, -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, -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, 0 +}; + +static const char _indic_syllable_machine_eof_cond_key_offs[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 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_eof_cond_key_lens[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 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_eof_cond_keys[] = { + 0 }; 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, 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, 73, 73, 78, 78, - 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, 73, - 1, 146, 0, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 342, 286, 342, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 286, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 414, 414, 414, 414, - 414, 414, 414, 342 + 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, 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, 73, 73, 78, 78, + 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, 73, + 1, 146, 0, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 286, + 286, 286, 286, 286, 286, 286, 286, 286, + 286, 286, 286, 286, 286, 286, 286, 286, + 286, 286, 286, 286, 286, 286, 286, 286, + 286, 286, 286, 286, 286, 286, 286, 286, + 286, 286, 286, 286, 286, 286, 286, 286, + 286, 286, 286, 286, 286, 286, 286, 286, + 286, 286, 286, 286, 286, 286, 286, 286, + 286, 286, 342, 286, 342, 343, 343, 343, + 343, 343, 343, 343, 343, 343, 343, 343, + 343, 343, 343, 343, 343, 343, 343, 343, + 343, 343, 343, 343, 343, 343, 343, 343, + 343, 343, 343, 343, 343, 343, 343, 343, + 343, 343, 343, 343, 343, 343, 343, 343, + 343, 343, 343, 343, 343, 343, 343, 343, + 343, 343, 343, 343, 343, 343, 343, 343, + 343, 343, 286, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 414, 414, 414, 414, + 414, 414, 414, 342, 0 +}; + +static const char _indic_syllable_machine_nfa_targs[] = { + 0, 0 +}; + +static const char _indic_syllable_machine_nfa_offsets[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 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_nfa_push_actions[] = { + 0, 0 +}; + +static const char _indic_syllable_machine_nfa_pop_trans[] = { + 0, 0 }; static const int indic_syllable_machine_start = 138; @@ -987,209 +1259,333 @@ static const int indic_syllable_machine_error = -1; static const int indic_syllable_machine_en_main = 138; -#line 36 "hb-ot-shape-complex-indic-machine.rl" -#line 93 "hb-ot-shape-complex-indic-machine.rl" - - #define found_syllable(syllable_type) \ - HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ - for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - syllable_serial++; \ - if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ - } HB_STMT_END +HB_STMT_START { \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ + info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + 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, te, act; - int cs; - hb_glyph_info_t *info = buffer->info; - -#line 1014 "hb-ot-shape-complex-indic-machine.hh" + unsigned int p, pe, eof, ts, te, act; + int cs; + hb_glyph_info_t *info = buffer->info; + { - cs = indic_syllable_machine_start; - ts = 0; - te = 0; - act = 0; + cs = (int)indic_syllable_machine_start; + ts = 0; + te = 0; + act = 0; } - -#line 113 "hb-ot-shape-complex-indic-machine.rl" - - - p = 0; - pe = eof = buffer->len; - - unsigned int syllable_serial = 1; - -#line 1030 "hb-ot-shape-complex-indic-machine.hh" + + + p=0; + pe = eof = buffer->len; + + unsigned int syllable_serial=1; + { - int _slen; - int _trans; - const unsigned char *_keys; - const short *_inds; - if ( p == pe ) - goto _test_eof; -_resume: - switch ( _indic_syllable_machine_from_state_actions[cs] ) { - case 10: -#line 1 "NONE" - {ts = p;} - break; -#line 1044 "hb-ot-shape-complex-indic-machine.hh" + int _cpc; + int _klen;const char * _cekeys;unsigned int _trans = 0;const unsigned char * _keys;const short * _inds; { + if ( p == pe ) + goto _test_eof; + _resume: { + switch ( _indic_syllable_machine_from_state_actions[cs] ) { + case 10: { + { + #line 1 "NONE" + {ts = p;}} + + break; } + } + + _keys = ( _indic_syllable_machine_trans_keys + ((cs<<1))); + _inds = ( _indic_syllable_machine_indicies + (_indic_syllable_machine_index_offsets[cs])); + + if ( (info[p].indic_category()) <= 19 && (info[p].indic_category()) >= 1 ) + { + int _ic = (int)_indic_syllable_machine_char_class[(int)(info[p].indic_category()) - 1]; + if ( _ic <= (int)(*( _keys+1)) && _ic >= (int)(*( _keys)) ) + _trans = (unsigned int)(*( _inds + (int)( _ic - (int)(*( _keys)) ) )); + else + _trans = (unsigned int)_indic_syllable_machine_index_defaults[cs]; + } + else { + _trans = (unsigned int)_indic_syllable_machine_index_defaults[cs]; + } + + goto _match_cond; + } + _match_cond: { + cs = (int)_indic_syllable_machine_cond_targs[_trans]; + + if ( _indic_syllable_machine_cond_actions[_trans] == 0 ) + goto _again; + + switch ( _indic_syllable_machine_cond_actions[_trans] ) { + case 2: { + { + #line 1 "NONE" + {te = p+1;}} + + break; } + case 14: { + { + #line 84 "hb-ot-shape-complex-indic-machine.rl" + {te = p+1;{ + #line 84 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (consonant_syllable); }}} + + break; } + case 16: { + { + #line 85 "hb-ot-shape-complex-indic-machine.rl" + {te = p+1;{ + #line 85 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (vowel_syllable); }}} + + break; } + case 21: { + { + #line 86 "hb-ot-shape-complex-indic-machine.rl" + {te = p+1;{ + #line 86 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (standalone_cluster); }}} + + break; } + case 24: { + { + #line 87 "hb-ot-shape-complex-indic-machine.rl" + {te = p+1;{ + #line 87 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (symbol_cluster); }}} + + break; } + case 18: { + { + #line 88 "hb-ot-shape-complex-indic-machine.rl" + {te = p+1;{ + #line 88 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (broken_cluster); }}} + + break; } + case 11: { + { + #line 89 "hb-ot-shape-complex-indic-machine.rl" + {te = p+1;{ + #line 89 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (non_indic_cluster); }}} + + break; } + case 13: { + { + #line 84 "hb-ot-shape-complex-indic-machine.rl" + {te = p;p = p - 1;{ + #line 84 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (consonant_syllable); }}} + + break; } + case 15: { + { + #line 85 "hb-ot-shape-complex-indic-machine.rl" + {te = p;p = p - 1;{ + #line 85 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (vowel_syllable); }}} + + break; } + case 20: { + { + #line 86 "hb-ot-shape-complex-indic-machine.rl" + {te = p;p = p - 1;{ + #line 86 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (standalone_cluster); }}} + + break; } + case 23: { + { + #line 87 "hb-ot-shape-complex-indic-machine.rl" + {te = p;p = p - 1;{ + #line 87 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (symbol_cluster); }}} + + break; } + case 17: { + { + #line 88 "hb-ot-shape-complex-indic-machine.rl" + {te = p;p = p - 1;{ + #line 88 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (broken_cluster); }}} + + break; } + case 19: { + { + #line 89 "hb-ot-shape-complex-indic-machine.rl" + {te = p;p = p - 1;{ + #line 89 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (non_indic_cluster); }}} + + break; } + case 1: { + { + #line 84 "hb-ot-shape-complex-indic-machine.rl" + {p = ((te))-1; + { + #line 84 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (consonant_syllable); }}} + + break; } + case 3: { + { + #line 85 "hb-ot-shape-complex-indic-machine.rl" + {p = ((te))-1; + { + #line 85 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (vowel_syllable); }}} + + break; } + case 7: { + { + #line 86 "hb-ot-shape-complex-indic-machine.rl" + {p = ((te))-1; + { + #line 86 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (standalone_cluster); }}} + + break; } + case 8: { + { + #line 87 "hb-ot-shape-complex-indic-machine.rl" + {p = ((te))-1; + { + #line 87 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (symbol_cluster); }}} + + break; } + case 4: { + { + #line 88 "hb-ot-shape-complex-indic-machine.rl" + {p = ((te))-1; + { + #line 88 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (broken_cluster); }}} + + break; } + case 5: { + { + #line 1 "NONE" + {switch( act ) { + case 1: { + p = ((te))-1; + { + #line 84 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (consonant_syllable); } break; } + case 5: { + p = ((te))-1; + { + #line 88 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (broken_cluster); } break; } + case 6: { + p = ((te))-1; + { + #line 89 "hb-ot-shape-complex-indic-machine.rl" + found_syllable (non_indic_cluster); } break; } + }} + } + + break; } + case 22: { + { + #line 1 "NONE" + {te = p+1;}} + { + #line 84 "hb-ot-shape-complex-indic-machine.rl" + {act = 1;}} + + break; } + case 6: { + { + #line 1 "NONE" + {te = p+1;}} + { + #line 88 "hb-ot-shape-complex-indic-machine.rl" + {act = 5;}} + + break; } + case 12: { + { + #line 1 "NONE" + {te = p+1;}} + { + #line 89 "hb-ot-shape-complex-indic-machine.rl" + {act = 6;}} + + break; } + } + + + } + _again: { + switch ( _indic_syllable_machine_to_state_actions[cs] ) { + case 9: { + { + #line 1 "NONE" + {ts = 0;}} + + break; } + } + + p += 1; + if ( p != pe ) + goto _resume; + } + _test_eof: { {} + if ( p == eof ) + { + if ( _indic_syllable_machine_eof_cond_spaces[cs] != -1 ) { + _cekeys = ( _indic_syllable_machine_eof_cond_keys + (_indic_syllable_machine_eof_cond_key_offs[cs])); + _klen = (int)_indic_syllable_machine_eof_cond_key_lens[cs]; + _cpc = 0; + { + const char *_lower = _cekeys; + const char *_upper = _cekeys + _klen - 1; + const char *_mid; + while ( 1 ) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( _cpc < (int)(*( _mid)) ) + _upper = _mid - 1; + else if ( _cpc > (int)(*( _mid)) ) + _lower = _mid + 1; + else { + goto _ok; + } + } + cs = -1; + goto _out; + } + _ok: {} + } + if ( _indic_syllable_machine_eof_trans[cs] > 0 ) { + _trans = (unsigned int)_indic_syllable_machine_eof_trans[cs] - 1; + goto _match_cond; + } + } + + } + _out: { {} + } + } } - - _keys = _indic_syllable_machine_trans_keys + (cs<<1); - _inds = _indic_syllable_machine_indicies + _indic_syllable_machine_index_offsets[cs]; - - _slen = _indic_syllable_machine_key_spans[cs]; - _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].indic_category()) && - ( info[p].indic_category()) <= _keys[1] ? - ( info[p].indic_category()) - _keys[0] : _slen ]; - -_eof_trans: - cs = _indic_syllable_machine_trans_targs[_trans]; - - if ( _indic_syllable_machine_trans_actions[_trans] == 0 ) - goto _again; - - switch ( _indic_syllable_machine_trans_actions[_trans] ) { - case 2: -#line 1 "NONE" - {te = p+1;} - break; - case 14: -#line 84 "hb-ot-shape-complex-indic-machine.rl" - {te = p+1;{ found_syllable (consonant_syllable); }} - break; - case 16: -#line 85 "hb-ot-shape-complex-indic-machine.rl" - {te = p+1;{ found_syllable (vowel_syllable); }} - break; - case 21: -#line 86 "hb-ot-shape-complex-indic-machine.rl" - {te = p+1;{ found_syllable (standalone_cluster); }} - break; - case 24: -#line 87 "hb-ot-shape-complex-indic-machine.rl" - {te = p+1;{ found_syllable (symbol_cluster); }} - break; - case 18: -#line 88 "hb-ot-shape-complex-indic-machine.rl" - {te = p+1;{ found_syllable (broken_cluster); }} - break; - case 11: -#line 89 "hb-ot-shape-complex-indic-machine.rl" - {te = p+1;{ found_syllable (non_indic_cluster); }} - break; - case 13: -#line 84 "hb-ot-shape-complex-indic-machine.rl" - {te = p;p--;{ found_syllable (consonant_syllable); }} - break; - case 15: -#line 85 "hb-ot-shape-complex-indic-machine.rl" - {te = p;p--;{ found_syllable (vowel_syllable); }} - break; - case 20: -#line 86 "hb-ot-shape-complex-indic-machine.rl" - {te = p;p--;{ found_syllable (standalone_cluster); }} - break; - case 23: -#line 87 "hb-ot-shape-complex-indic-machine.rl" - {te = p;p--;{ found_syllable (symbol_cluster); }} - break; - case 17: -#line 88 "hb-ot-shape-complex-indic-machine.rl" - {te = p;p--;{ found_syllable (broken_cluster); }} - break; - case 19: -#line 89 "hb-ot-shape-complex-indic-machine.rl" - {te = p;p--;{ found_syllable (non_indic_cluster); }} - break; - case 1: -#line 84 "hb-ot-shape-complex-indic-machine.rl" - {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} - break; - case 3: -#line 85 "hb-ot-shape-complex-indic-machine.rl" - {{p = ((te))-1;}{ found_syllable (vowel_syllable); }} - break; - case 7: -#line 86 "hb-ot-shape-complex-indic-machine.rl" - {{p = ((te))-1;}{ found_syllable (standalone_cluster); }} - break; - case 8: -#line 87 "hb-ot-shape-complex-indic-machine.rl" - {{p = ((te))-1;}{ found_syllable (symbol_cluster); }} - break; - case 4: -#line 88 "hb-ot-shape-complex-indic-machine.rl" - {{p = ((te))-1;}{ found_syllable (broken_cluster); }} - break; - case 5: -#line 1 "NONE" - { switch( act ) { - case 1: - {{p = ((te))-1;} found_syllable (consonant_syllable); } - break; - case 5: - {{p = ((te))-1;} found_syllable (broken_cluster); } - break; - case 6: - {{p = ((te))-1;} found_syllable (non_indic_cluster); } - break; - } - } - break; - case 22: -#line 1 "NONE" - {te = p+1;} -#line 84 "hb-ot-shape-complex-indic-machine.rl" - {act = 1;} - break; - case 6: -#line 1 "NONE" - {te = p+1;} -#line 88 "hb-ot-shape-complex-indic-machine.rl" - {act = 5;} - break; - case 12: -#line 1 "NONE" - {te = p+1;} -#line 89 "hb-ot-shape-complex-indic-machine.rl" - {act = 6;} - break; -#line 1167 "hb-ot-shape-complex-indic-machine.hh" - } - -_again: - switch ( _indic_syllable_machine_to_state_actions[cs] ) { - case 9: -#line 1 "NONE" - {ts = 0;} - break; -#line 1176 "hb-ot-shape-complex-indic-machine.hh" - } - - if ( ++p != pe ) - goto _resume; - _test_eof: {} - if ( p == eof ) - { - if ( _indic_syllable_machine_eof_trans[cs] > 0 ) { - _trans = _indic_syllable_machine_eof_trans[cs] - 1; - goto _eof_trans; - } - } - - } - -#line 121 "hb-ot-shape-complex-indic-machine.rl" - + } #endif /* HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH */ diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 1fd8fc670..7befbf630 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -645,7 +645,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, /* Reorder characters */ for (unsigned int i = start; i < base; i++) - info[i].indic_position() = MIN (POS_PRE_C, (indic_position_t) info[i].indic_position()); + info[i].indic_position() = hb_min (POS_PRE_C, (indic_position_t) info[i].indic_position()); if (base < end) info[base].indic_position() = POS_BASE_C; @@ -801,7 +801,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, unsigned int j = start + info[i].syllable(); while (j != i) { - max = MAX (max, j); + max = hb_max (max, j); unsigned int next = start + info[j].syllable(); info[j].syllable() = 255; /* So we don't process j later again. */ j = next; @@ -1008,7 +1008,6 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, 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->successful && @@ -1232,14 +1231,14 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, /* 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)); + buffer->merge_clusters (new_pos, hb_min (end, base + 1)); new_pos--; } } else { for (unsigned int i = start; i < base; i++) if (info[i].indic_position () == POS_PRE_M) { - buffer->merge_clusters (i, MIN (end, base + 1)); + buffer->merge_clusters (i, hb_min (end, base + 1)); break; } } diff --git a/src/hb-ot-shape-complex-khmer-machine.hh b/src/hb-ot-shape-complex-khmer-machine.hh index 65e0ffc85..034b65750 100644 --- a/src/hb-ot-shape-complex-khmer-machine.hh +++ b/src/hb-ot-shape-complex-khmer-machine.hh @@ -1,30 +1,28 @@ - -#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 - */ +* 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 @@ -32,180 +30,185 @@ #include "hb.hh" -#line 36 "hb-ot-shape-complex-khmer-machine.hh" static const unsigned char _khmer_syllable_machine_trans_keys[] = { - 5u, 26u, 5u, 21u, 5u, 26u, 5u, 21u, 1u, 16u, 5u, 21u, 5u, 26u, 5u, 21u, - 5u, 26u, 5u, 21u, 5u, 21u, 5u, 26u, 5u, 21u, 1u, 16u, 5u, 21u, 5u, 26u, - 5u, 21u, 5u, 26u, 5u, 21u, 5u, 26u, 1u, 29u, 5u, 29u, 5u, 29u, 5u, 29u, - 22u, 22u, 5u, 22u, 5u, 29u, 5u, 29u, 5u, 29u, 1u, 16u, 5u, 26u, 5u, 29u, - 5u, 29u, 22u, 22u, 5u, 22u, 5u, 29u, 5u, 29u, 1u, 16u, 5u, 29u, 5u, 29u, - 0 + 2u, 8u, 2u, 6u, 2u, 8u, 2u, 6u, + 0u, 0u, 2u, 6u, 2u, 8u, 2u, 6u, + 2u, 8u, 2u, 6u, 2u, 6u, 2u, 8u, + 2u, 6u, 0u, 0u, 2u, 6u, 2u, 8u, + 2u, 6u, 2u, 8u, 2u, 6u, 2u, 8u, + 0u, 11u, 2u, 11u, 2u, 11u, 2u, 11u, + 7u, 7u, 2u, 7u, 2u, 11u, 2u, 11u, + 2u, 11u, 0u, 0u, 2u, 8u, 2u, 11u, + 2u, 11u, 7u, 7u, 2u, 7u, 2u, 11u, + 2u, 11u, 0u, 0u, 2u, 11u, 2u, 11u, + 0u }; -static const char _khmer_syllable_machine_key_spans[] = { - 22, 17, 22, 17, 16, 17, 22, 17, - 22, 17, 17, 22, 17, 16, 17, 22, - 17, 22, 17, 22, 29, 25, 25, 25, - 1, 18, 25, 25, 25, 16, 22, 25, - 25, 1, 18, 25, 25, 16, 25, 25 +static const char _khmer_syllable_machine_char_class[] = { + 0, 0, 1, 1, 2, 2, 1, 1, + 1, 1, 3, 3, 1, 4, 1, 0, + 1, 1, 1, 5, 6, 7, 1, 1, + 1, 8, 9, 10, 11, 0 }; static const short _khmer_syllable_machine_index_offsets[] = { - 0, 23, 41, 64, 82, 99, 117, 140, - 158, 181, 199, 217, 240, 258, 275, 293, - 316, 334, 357, 375, 398, 428, 454, 480, - 506, 508, 527, 553, 579, 605, 622, 645, - 671, 697, 699, 718, 744, 770, 787, 813 + 0, 7, 12, 19, 24, 25, 30, 37, + 42, 49, 54, 59, 66, 71, 72, 77, + 84, 89, 96, 101, 108, 120, 130, 140, + 150, 151, 157, 167, 177, 187, 188, 195, + 205, 215, 216, 222, 232, 242, 243, 253, + 0 }; static const char _khmer_syllable_machine_indicies[] = { - 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, - 3, 0, 0, 0, 0, 4, 0, 1, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 0, 4, 0, - 5, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 4, 0, 6, 6, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 6, 0, 7, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 0, 9, 9, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 10, 0, 0, - 0, 0, 4, 0, 9, 9, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 10, 0, 11, 11, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12, 0, - 0, 0, 0, 4, 0, 11, 11, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 12, 0, 14, - 14, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 15, - 13, 14, 14, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 15, 16, 16, 16, 16, 17, 16, - 18, 18, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 17, 16, 19, 19, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 19, 16, 20, 20, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 21, 16, 22, 22, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 23, 16, 16, - 16, 16, 17, 16, 22, 22, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 23, 16, 24, 24, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 25, 16, - 16, 16, 16, 17, 16, 24, 24, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 25, 16, 14, - 14, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 26, 15, - 16, 16, 16, 16, 17, 16, 28, 28, - 27, 27, 29, 29, 27, 27, 27, 27, - 2, 2, 27, 30, 27, 28, 27, 27, - 27, 27, 15, 19, 27, 27, 27, 17, - 23, 25, 21, 27, 32, 32, 31, 31, - 31, 31, 31, 31, 31, 33, 31, 31, - 31, 31, 31, 2, 3, 6, 31, 31, - 31, 4, 10, 12, 8, 31, 34, 34, - 31, 31, 31, 31, 31, 31, 31, 35, - 31, 31, 31, 31, 31, 31, 3, 6, - 31, 31, 31, 4, 10, 12, 8, 31, - 5, 5, 31, 31, 31, 31, 31, 31, - 31, 35, 31, 31, 31, 31, 31, 31, - 4, 6, 31, 31, 31, 31, 31, 31, - 8, 31, 6, 31, 7, 7, 31, 31, - 31, 31, 31, 31, 31, 35, 31, 31, - 31, 31, 31, 31, 8, 6, 31, 36, - 36, 31, 31, 31, 31, 31, 31, 31, - 35, 31, 31, 31, 31, 31, 31, 10, - 6, 31, 31, 31, 4, 31, 31, 8, - 31, 37, 37, 31, 31, 31, 31, 31, - 31, 31, 35, 31, 31, 31, 31, 31, - 31, 12, 6, 31, 31, 31, 4, 10, - 31, 8, 31, 34, 34, 31, 31, 31, - 31, 31, 31, 31, 33, 31, 31, 31, - 31, 31, 31, 3, 6, 31, 31, 31, - 4, 10, 12, 8, 31, 28, 28, 31, - 31, 31, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 28, 31, 14, 14, - 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 15, 38, - 38, 38, 38, 17, 38, 40, 40, 39, - 39, 39, 39, 39, 39, 39, 41, 39, - 39, 39, 39, 39, 39, 15, 19, 39, - 39, 39, 17, 23, 25, 21, 39, 18, - 18, 39, 39, 39, 39, 39, 39, 39, - 41, 39, 39, 39, 39, 39, 39, 17, - 19, 39, 39, 39, 39, 39, 39, 21, - 39, 19, 39, 20, 20, 39, 39, 39, - 39, 39, 39, 39, 41, 39, 39, 39, - 39, 39, 39, 21, 19, 39, 42, 42, - 39, 39, 39, 39, 39, 39, 39, 41, - 39, 39, 39, 39, 39, 39, 23, 19, - 39, 39, 39, 17, 39, 39, 21, 39, - 43, 43, 39, 39, 39, 39, 39, 39, - 39, 41, 39, 39, 39, 39, 39, 39, - 25, 19, 39, 39, 39, 17, 23, 39, - 21, 39, 44, 44, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, - 39, 44, 39, 45, 45, 39, 39, 39, - 39, 39, 39, 39, 30, 39, 39, 39, - 39, 39, 26, 15, 19, 39, 39, 39, - 17, 23, 25, 21, 39, 40, 40, 39, - 39, 39, 39, 39, 39, 39, 30, 39, - 39, 39, 39, 39, 39, 15, 19, 39, - 39, 39, 17, 23, 25, 21, 39, 0 + 1, 0, 0, 2, 3, 0, 4, 1, + 0, 0, 0, 3, 1, 0, 0, 0, + 3, 0, 4, 5, 0, 0, 0, 4, + 6, 7, 0, 0, 0, 8, 9, 0, + 0, 0, 10, 0, 4, 9, 0, 0, + 0, 10, 11, 0, 0, 0, 12, 0, + 4, 11, 0, 0, 0, 12, 14, 13, + 13, 13, 15, 14, 16, 16, 16, 15, + 16, 17, 18, 16, 16, 16, 17, 19, + 20, 16, 16, 16, 21, 22, 16, 16, + 16, 23, 16, 17, 22, 16, 16, 16, + 23, 24, 16, 16, 16, 25, 16, 17, + 24, 16, 16, 16, 25, 14, 16, 16, + 26, 15, 16, 17, 28, 27, 29, 2, + 30, 27, 15, 19, 17, 23, 25, 21, + 32, 31, 33, 2, 3, 6, 4, 10, + 12, 8, 34, 31, 35, 31, 3, 6, + 4, 10, 12, 8, 5, 31, 35, 31, + 4, 6, 31, 31, 31, 8, 6, 7, + 31, 35, 31, 8, 6, 36, 31, 35, + 31, 10, 6, 4, 31, 31, 8, 37, + 31, 35, 31, 12, 6, 4, 10, 31, + 8, 34, 31, 33, 31, 3, 6, 4, + 10, 12, 8, 28, 14, 38, 38, 38, + 15, 38, 17, 40, 39, 41, 39, 15, + 19, 17, 23, 25, 21, 18, 39, 41, + 39, 17, 19, 39, 39, 39, 21, 19, + 20, 39, 41, 39, 21, 19, 42, 39, + 41, 39, 23, 19, 17, 39, 39, 21, + 43, 39, 41, 39, 25, 19, 17, 23, + 39, 21, 44, 45, 39, 30, 26, 15, + 19, 17, 23, 25, 21, 40, 39, 30, + 39, 15, 19, 17, 23, 25, 21, 0 }; -static const char _khmer_syllable_machine_trans_targs[] = { - 20, 1, 28, 22, 23, 3, 24, 5, - 25, 7, 26, 9, 27, 20, 10, 31, - 20, 32, 12, 33, 14, 34, 16, 35, - 18, 36, 39, 20, 21, 30, 37, 20, - 0, 29, 2, 4, 6, 8, 20, 20, - 11, 13, 15, 17, 38, 19 +static const char _khmer_syllable_machine_index_defaults[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 13, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 27, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 38, 39, + 39, 39, 39, 39, 39, 39, 39, 39, + 0 }; -static const char _khmer_syllable_machine_trans_actions[] = { - 1, 0, 2, 2, 2, 0, 0, 0, - 2, 0, 2, 0, 2, 3, 0, 4, - 5, 2, 0, 0, 0, 2, 0, 2, - 0, 2, 4, 8, 2, 9, 0, 10, - 0, 0, 0, 0, 0, 0, 11, 12, - 0, 0, 0, 0, 4, 0 +static const char _khmer_syllable_machine_trans_cond_spaces[] = { + -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, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 0 +}; + +static const char _khmer_syllable_machine_cond_targs[] = { + 20, 1, 28, 22, 23, 3, 24, 5, + 25, 7, 26, 9, 27, 20, 10, 31, + 20, 32, 12, 33, 14, 34, 16, 35, + 18, 36, 39, 20, 21, 30, 37, 20, + 0, 29, 2, 4, 6, 8, 20, 20, + 11, 13, 15, 17, 38, 19, 0 +}; + +static const char _khmer_syllable_machine_cond_actions[] = { + 1, 0, 2, 2, 2, 0, 0, 0, + 2, 0, 2, 0, 2, 3, 0, 4, + 5, 2, 0, 0, 0, 2, 0, 2, + 0, 2, 4, 8, 2, 9, 0, 10, + 0, 0, 0, 0, 0, 0, 11, 12, + 0, 0, 0, 0, 4, 0, 0 }; static const char _khmer_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, 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, 6, 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, 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, 7, 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, 1, 1, 1, - 1, 1, 14, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 0, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 39, 40, - 40, 40, 40, 40, 40, 40, 40, 40 +static const char _khmer_syllable_machine_eof_cond_spaces[] = { + -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, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 0 +}; + +static const char _khmer_syllable_machine_eof_cond_key_offs[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 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_eof_cond_key_lens[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 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_eof_cond_keys[] = { + 0 +}; + +static const char _khmer_syllable_machine_eof_trans[] = { + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 14, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 0, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 39, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 0 +}; + +static const char _khmer_syllable_machine_nfa_targs[] = { + 0, 0 +}; + +static const char _khmer_syllable_machine_nfa_offsets[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 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_nfa_push_actions[] = { + 0, 0 +}; + +static const char _khmer_syllable_machine_nfa_pop_trans[] = { + 0, 0 }; static const int khmer_syllable_machine_start = 20; @@ -215,156 +218,228 @@ static const int khmer_syllable_machine_error = -1; static const int khmer_syllable_machine_en_main = 20; -#line 36 "hb-ot-shape-complex-khmer-machine.rl" -#line 80 "hb-ot-shape-complex-khmer-machine.rl" - - #define found_syllable(syllable_type) \ - HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ - for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - syllable_serial++; \ - if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ - } HB_STMT_END +HB_STMT_START { \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ + info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + 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, te, act HB_UNUSED; - int cs; - hb_glyph_info_t *info = buffer->info; - -#line 242 "hb-ot-shape-complex-khmer-machine.hh" + unsigned int p, pe, eof, ts, te, act HB_UNUSED; + int cs; + hb_glyph_info_t *info = buffer->info; + { - cs = khmer_syllable_machine_start; - ts = 0; - te = 0; - act = 0; + cs = (int)khmer_syllable_machine_start; + ts = 0; + te = 0; + act = 0; } - -#line 100 "hb-ot-shape-complex-khmer-machine.rl" - - - p = 0; - pe = eof = buffer->len; - - unsigned int syllable_serial = 1; - -#line 258 "hb-ot-shape-complex-khmer-machine.hh" + + + p=0; + pe = eof = buffer->len; + + unsigned int syllable_serial=1; + { - 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 7: -#line 1 "NONE" - {ts = p;} - break; -#line 272 "hb-ot-shape-complex-khmer-machine.hh" + int _cpc; + int _klen;const char * _cekeys;unsigned int _trans = 0;const unsigned char * _keys;const char * _inds; { + if ( p == pe ) + goto _test_eof; + _resume: { + switch ( _khmer_syllable_machine_from_state_actions[cs] ) { + case 7: { + { + #line 1 "NONE" + {ts = p;}} + + break; } + } + + _keys = ( _khmer_syllable_machine_trans_keys + ((cs<<1))); + _inds = ( _khmer_syllable_machine_indicies + (_khmer_syllable_machine_index_offsets[cs])); + + if ( (info[p].khmer_category()) <= 29 && (info[p].khmer_category()) >= 1 ) + { + int _ic = (int)_khmer_syllable_machine_char_class[(int)(info[p].khmer_category()) - 1]; + if ( _ic <= (int)(*( _keys+1)) && _ic >= (int)(*( _keys)) ) + _trans = (unsigned int)(*( _inds + (int)( _ic - (int)(*( _keys)) ) )); + else + _trans = (unsigned int)_khmer_syllable_machine_index_defaults[cs]; + } + else { + _trans = (unsigned int)_khmer_syllable_machine_index_defaults[cs]; + } + + goto _match_cond; + } + _match_cond: { + cs = (int)_khmer_syllable_machine_cond_targs[_trans]; + + if ( _khmer_syllable_machine_cond_actions[_trans] == 0 ) + goto _again; + + switch ( _khmer_syllable_machine_cond_actions[_trans] ) { + case 2: { + { + #line 1 "NONE" + {te = p+1;}} + + break; } + case 8: { + { + #line 76 "hb-ot-shape-complex-khmer-machine.rl" + {te = p+1;{ + #line 76 "hb-ot-shape-complex-khmer-machine.rl" + found_syllable (non_khmer_cluster); }}} + + break; } + case 10: { + { + #line 74 "hb-ot-shape-complex-khmer-machine.rl" + {te = p;p = p - 1;{ + #line 74 "hb-ot-shape-complex-khmer-machine.rl" + found_syllable (consonant_syllable); }}} + + break; } + case 12: { + { + #line 75 "hb-ot-shape-complex-khmer-machine.rl" + {te = p;p = p - 1;{ + #line 75 "hb-ot-shape-complex-khmer-machine.rl" + found_syllable (broken_cluster); }}} + + break; } + case 11: { + { + #line 76 "hb-ot-shape-complex-khmer-machine.rl" + {te = p;p = p - 1;{ + #line 76 "hb-ot-shape-complex-khmer-machine.rl" + found_syllable (non_khmer_cluster); }}} + + break; } + case 1: { + { + #line 74 "hb-ot-shape-complex-khmer-machine.rl" + {p = ((te))-1; + { + #line 74 "hb-ot-shape-complex-khmer-machine.rl" + found_syllable (consonant_syllable); }}} + + break; } + case 5: { + { + #line 75 "hb-ot-shape-complex-khmer-machine.rl" + {p = ((te))-1; + { + #line 75 "hb-ot-shape-complex-khmer-machine.rl" + found_syllable (broken_cluster); }}} + + break; } + case 3: { + { + #line 1 "NONE" + {switch( act ) { + case 2: { + p = ((te))-1; + { + #line 75 "hb-ot-shape-complex-khmer-machine.rl" + found_syllable (broken_cluster); } break; } + case 3: { + p = ((te))-1; + { + #line 76 "hb-ot-shape-complex-khmer-machine.rl" + found_syllable (non_khmer_cluster); } break; } + }} + } + + break; } + case 4: { + { + #line 1 "NONE" + {te = p+1;}} + { + #line 75 "hb-ot-shape-complex-khmer-machine.rl" + {act = 2;}} + + break; } + case 9: { + { + #line 1 "NONE" + {te = p+1;}} + { + #line 76 "hb-ot-shape-complex-khmer-machine.rl" + {act = 3;}} + + break; } + } + + + } + _again: { + switch ( _khmer_syllable_machine_to_state_actions[cs] ) { + case 6: { + { + #line 1 "NONE" + {ts = 0;}} + + break; } + } + + p += 1; + if ( p != pe ) + goto _resume; + } + _test_eof: { {} + if ( p == eof ) + { + if ( _khmer_syllable_machine_eof_cond_spaces[cs] != -1 ) { + _cekeys = ( _khmer_syllable_machine_eof_cond_keys + (_khmer_syllable_machine_eof_cond_key_offs[cs])); + _klen = (int)_khmer_syllable_machine_eof_cond_key_lens[cs]; + _cpc = 0; + { + const char *_lower = _cekeys; + const char *_upper = _cekeys + _klen - 1; + const char *_mid; + while ( 1 ) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( _cpc < (int)(*( _mid)) ) + _upper = _mid - 1; + else if ( _cpc > (int)(*( _mid)) ) + _lower = _mid + 1; + else { + goto _ok; + } + } + cs = -1; + goto _out; + } + _ok: {} + } + if ( _khmer_syllable_machine_eof_trans[cs] > 0 ) { + _trans = (unsigned int)_khmer_syllable_machine_eof_trans[cs] - 1; + goto _match_cond; + } + } + + } + _out: { {} + } + } } - - _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 76 "hb-ot-shape-complex-khmer-machine.rl" - {te = p+1;{ found_syllable (non_khmer_cluster); }} - break; - case 10: -#line 74 "hb-ot-shape-complex-khmer-machine.rl" - {te = p;p--;{ found_syllable (consonant_syllable); }} - break; - case 12: -#line 75 "hb-ot-shape-complex-khmer-machine.rl" - {te = p;p--;{ found_syllable (broken_cluster); }} - break; - case 11: -#line 76 "hb-ot-shape-complex-khmer-machine.rl" - {te = p;p--;{ found_syllable (non_khmer_cluster); }} - break; - case 1: -#line 74 "hb-ot-shape-complex-khmer-machine.rl" - {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} - break; - case 5: -#line 75 "hb-ot-shape-complex-khmer-machine.rl" - {{p = ((te))-1;}{ found_syllable (broken_cluster); }} - break; - case 3: -#line 1 "NONE" - { switch( act ) { - case 2: - {{p = ((te))-1;} found_syllable (broken_cluster); } - break; - case 3: - {{p = ((te))-1;} found_syllable (non_khmer_cluster); } - break; - } - } - break; - case 4: -#line 1 "NONE" - {te = p+1;} -#line 75 "hb-ot-shape-complex-khmer-machine.rl" - {act = 2;} - break; - case 9: -#line 1 "NONE" - {te = p+1;} -#line 76 "hb-ot-shape-complex-khmer-machine.rl" - {act = 3;} - break; -#line 342 "hb-ot-shape-complex-khmer-machine.hh" - } - -_again: - switch ( _khmer_syllable_machine_to_state_actions[cs] ) { - case 6: -#line 1 "NONE" - {ts = 0;} - break; -#line 351 "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 108 "hb-ot-shape-complex-khmer-machine.rl" - + } #endif /* HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH */ diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index 5746651d6..4c8847762 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -368,7 +368,8 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, if (unlikely (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE)) return; - /* Note: This loop is extra overhead, but should not be measurable. */ + /* Note: This loop is extra overhead, but should not be measurable. + * TODO Use a buffer scratch flag to remove the loop. */ bool has_broken_syllables = false; unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; @@ -407,7 +408,6 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, 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->successful && diff --git a/src/hb-ot-shape-complex-myanmar-machine.hh b/src/hb-ot-shape-complex-myanmar-machine.hh index 0c19e4f68..f40a47999 100644 --- a/src/hb-ot-shape-complex-myanmar-machine.hh +++ b/src/hb-ot-shape-complex-myanmar-machine.hh @@ -1,30 +1,28 @@ - -#line 1 "hb-ot-shape-complex-myanmar-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 - */ +* 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_MYANMAR_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH @@ -32,239 +30,276 @@ #include "hb.hh" -#line 36 "hb-ot-shape-complex-myanmar-machine.hh" static const unsigned char _myanmar_syllable_machine_trans_keys[] = { - 1u, 32u, 3u, 30u, 5u, 29u, 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, - 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 16u, 3u, 29u, 3u, 29u, 3u, 29u, - 3u, 29u, 3u, 29u, 3u, 30u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 5u, 29u, - 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, 3u, 29u, 3u, 29u, 3u, 29u, - 3u, 29u, 3u, 30u, 3u, 29u, 1u, 32u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, - 3u, 29u, 3u, 30u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 32u, 8u, 8u, - 0 + 0u, 21u, 1u, 20u, 3u, 19u, 3u, 5u, + 3u, 19u, 1u, 15u, 3u, 15u, 3u, 15u, + 1u, 19u, 1u, 19u, 1u, 19u, 1u, 19u, + 0u, 8u, 1u, 19u, 1u, 19u, 1u, 19u, + 1u, 19u, 1u, 19u, 1u, 20u, 1u, 19u, + 1u, 19u, 1u, 19u, 1u, 19u, 3u, 19u, + 3u, 5u, 3u, 19u, 1u, 15u, 3u, 15u, + 3u, 15u, 1u, 19u, 1u, 19u, 1u, 19u, + 1u, 19u, 0u, 8u, 1u, 20u, 1u, 19u, + 1u, 19u, 1u, 19u, 1u, 19u, 1u, 19u, + 1u, 20u, 1u, 19u, 1u, 19u, 1u, 19u, + 1u, 19u, 1u, 20u, 1u, 19u, 0u, 20u, + 0u, 8u, 5u, 5u, 0u }; -static const char _myanmar_syllable_machine_key_spans[] = { - 32, 28, 25, 4, 25, 23, 21, 21, - 27, 27, 27, 27, 16, 27, 27, 27, - 27, 27, 28, 27, 27, 27, 27, 25, - 4, 25, 23, 21, 21, 27, 27, 27, - 27, 28, 27, 32, 27, 27, 27, 27, - 27, 28, 27, 27, 27, 27, 32, 1 +static const char _myanmar_syllable_machine_char_class[] = { + 0, 0, 1, 2, 3, 3, 4, 5, + 4, 6, 7, 4, 4, 4, 4, 8, + 4, 9, 10, 4, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 7, + 0 }; static const short _myanmar_syllable_machine_index_offsets[] = { - 0, 33, 62, 88, 93, 119, 143, 165, - 187, 215, 243, 271, 299, 316, 344, 372, - 400, 428, 456, 485, 513, 541, 569, 597, - 623, 628, 654, 678, 700, 722, 750, 778, - 806, 834, 863, 891, 924, 952, 980, 1008, - 1036, 1064, 1093, 1121, 1149, 1177, 1205, 1238 + 0, 22, 42, 59, 62, 79, 94, 107, + 120, 139, 158, 177, 196, 205, 224, 243, + 262, 281, 300, 320, 339, 358, 377, 396, + 413, 416, 433, 448, 461, 474, 493, 512, + 531, 550, 559, 579, 598, 617, 636, 655, + 674, 694, 713, 732, 751, 770, 790, 809, + 830, 839, 0 }; static const char _myanmar_syllable_machine_indicies[] = { - 1, 1, 2, 3, 4, 4, 0, 5, - 0, 6, 1, 0, 0, 0, 0, 7, - 0, 8, 9, 0, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 1, - 0, 22, 23, 24, 24, 21, 25, 21, - 26, 21, 21, 21, 21, 21, 21, 21, - 27, 21, 21, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 21, 24, 24, - 21, 25, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 38, 21, 21, 21, 21, - 21, 21, 32, 21, 21, 21, 36, 21, - 24, 24, 21, 25, 21, 24, 24, 21, - 25, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 32, 21, 21, 21, 36, 21, 39, - 21, 24, 24, 21, 25, 21, 32, 21, - 21, 21, 21, 21, 21, 21, 40, 21, - 21, 21, 21, 21, 21, 32, 21, 24, - 24, 21, 25, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 40, 21, 21, 21, - 21, 21, 21, 32, 21, 24, 24, 21, - 25, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 32, 21, 22, 21, 24, 24, 21, - 25, 21, 26, 21, 21, 21, 21, 21, - 21, 21, 41, 21, 21, 41, 21, 21, - 21, 32, 42, 21, 21, 36, 21, 22, - 21, 24, 24, 21, 25, 21, 26, 21, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 32, 21, 21, - 21, 36, 21, 22, 21, 24, 24, 21, - 25, 21, 26, 21, 21, 21, 21, 21, - 21, 21, 41, 21, 21, 21, 21, 21, - 21, 32, 42, 21, 21, 36, 21, 22, - 21, 24, 24, 21, 25, 21, 26, 21, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 32, 42, 21, - 21, 36, 21, 1, 1, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 1, 21, 22, 21, 24, 24, - 21, 25, 21, 26, 21, 21, 21, 21, - 21, 21, 21, 27, 21, 21, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 21, - 22, 21, 24, 24, 21, 25, 21, 26, - 21, 21, 21, 21, 21, 21, 21, 43, - 21, 21, 21, 21, 21, 21, 32, 33, - 34, 35, 36, 21, 22, 21, 24, 24, - 21, 25, 21, 26, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 32, 33, 34, 35, 36, 21, - 22, 21, 24, 24, 21, 25, 21, 26, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 32, 33, - 34, 21, 36, 21, 22, 21, 24, 24, - 21, 25, 21, 26, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 32, 21, 34, 21, 36, 21, - 22, 21, 24, 24, 21, 25, 21, 26, - 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 32, 33, - 34, 35, 36, 43, 21, 22, 21, 24, - 24, 21, 25, 21, 26, 21, 21, 21, - 21, 21, 21, 21, 43, 21, 21, 28, - 21, 30, 21, 32, 33, 34, 35, 36, - 21, 22, 21, 24, 24, 21, 25, 21, - 26, 21, 21, 21, 21, 21, 21, 21, - 43, 21, 21, 28, 21, 21, 21, 32, - 33, 34, 35, 36, 21, 22, 21, 24, - 24, 21, 25, 21, 26, 21, 21, 21, - 21, 21, 21, 21, 43, 21, 21, 28, - 29, 30, 21, 32, 33, 34, 35, 36, - 21, 22, 23, 24, 24, 21, 25, 21, - 26, 21, 21, 21, 21, 21, 21, 21, - 27, 21, 21, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 21, 3, 3, 44, - 5, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 45, 44, 44, 44, 44, 44, - 44, 14, 44, 44, 44, 18, 44, 3, - 3, 44, 5, 44, 3, 3, 44, 5, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - 14, 44, 44, 44, 18, 44, 46, 44, - 3, 3, 44, 5, 44, 14, 44, 44, - 44, 44, 44, 44, 44, 47, 44, 44, - 44, 44, 44, 44, 14, 44, 3, 3, - 44, 5, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 47, 44, 44, 44, 44, - 44, 44, 14, 44, 3, 3, 44, 5, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - 14, 44, 2, 44, 3, 3, 44, 5, - 44, 6, 44, 44, 44, 44, 44, 44, - 44, 48, 44, 44, 48, 44, 44, 44, - 14, 49, 44, 44, 18, 44, 2, 44, - 3, 3, 44, 5, 44, 6, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 14, 44, 44, 44, - 18, 44, 2, 44, 3, 3, 44, 5, - 44, 6, 44, 44, 44, 44, 44, 44, - 44, 48, 44, 44, 44, 44, 44, 44, - 14, 49, 44, 44, 18, 44, 2, 44, - 3, 3, 44, 5, 44, 6, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 14, 49, 44, 44, - 18, 44, 22, 23, 24, 24, 21, 25, - 21, 26, 21, 21, 21, 21, 21, 21, - 21, 50, 21, 21, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 21, 22, - 51, 24, 24, 21, 25, 21, 26, 21, - 21, 21, 21, 21, 21, 21, 27, 21, - 21, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 21, 1, 1, 2, 3, 3, - 3, 44, 5, 44, 6, 1, 44, 44, - 44, 44, 1, 44, 8, 44, 44, 10, - 11, 12, 13, 14, 15, 16, 17, 18, - 19, 44, 1, 44, 2, 44, 3, 3, - 44, 5, 44, 6, 44, 44, 44, 44, - 44, 44, 44, 8, 44, 44, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 44, - 2, 44, 3, 3, 44, 5, 44, 6, - 44, 44, 44, 44, 44, 44, 44, 52, - 44, 44, 44, 44, 44, 44, 14, 15, - 16, 17, 18, 44, 2, 44, 3, 3, - 44, 5, 44, 6, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 14, 15, 16, 17, 18, 44, - 2, 44, 3, 3, 44, 5, 44, 6, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 14, 15, - 16, 44, 18, 44, 2, 44, 3, 3, - 44, 5, 44, 6, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 14, 44, 16, 44, 18, 44, - 2, 44, 3, 3, 44, 5, 44, 6, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 14, 15, - 16, 17, 18, 52, 44, 2, 44, 3, - 3, 44, 5, 44, 6, 44, 44, 44, - 44, 44, 44, 44, 52, 44, 44, 10, - 44, 12, 44, 14, 15, 16, 17, 18, - 44, 2, 44, 3, 3, 44, 5, 44, - 6, 44, 44, 44, 44, 44, 44, 44, - 52, 44, 44, 10, 44, 44, 44, 14, - 15, 16, 17, 18, 44, 2, 44, 3, - 3, 44, 5, 44, 6, 44, 44, 44, - 44, 44, 44, 44, 52, 44, 44, 10, - 11, 12, 44, 14, 15, 16, 17, 18, - 44, 2, 3, 3, 3, 44, 5, 44, - 6, 44, 44, 44, 44, 44, 44, 44, - 8, 44, 44, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 44, 1, 1, 53, - 53, 53, 53, 53, 53, 53, 53, 1, - 53, 53, 53, 53, 1, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 1, 53, 54, 53, + 1, 2, 3, 4, 0, 5, 6, 1, + 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 22, 23, + 24, 21, 25, 26, 21, 21, 27, 21, + 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 24, 21, 25, 21, 21, 21, + 38, 21, 21, 21, 21, 21, 32, 21, + 21, 21, 36, 24, 21, 25, 24, 21, + 25, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 32, 21, 21, 21, 36, 39, + 21, 24, 21, 25, 32, 21, 21, 40, + 21, 21, 21, 21, 21, 32, 24, 21, + 25, 21, 21, 21, 40, 21, 21, 21, + 21, 21, 32, 24, 21, 25, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 32, + 22, 21, 24, 21, 25, 26, 21, 21, + 41, 21, 41, 21, 21, 21, 32, 42, + 21, 21, 36, 22, 21, 24, 21, 25, + 26, 21, 21, 21, 21, 21, 21, 21, + 21, 32, 21, 21, 21, 36, 22, 21, + 24, 21, 25, 26, 21, 21, 41, 21, + 21, 21, 21, 21, 32, 42, 21, 21, + 36, 22, 21, 24, 21, 25, 26, 21, + 21, 21, 21, 21, 21, 21, 21, 32, + 42, 21, 21, 36, 1, 21, 21, 21, + 21, 21, 21, 21, 1, 22, 21, 24, + 21, 25, 26, 21, 21, 27, 21, 28, + 29, 30, 31, 32, 33, 34, 35, 36, + 22, 21, 24, 21, 25, 26, 21, 21, + 43, 21, 21, 21, 21, 21, 32, 33, + 34, 35, 36, 22, 21, 24, 21, 25, + 26, 21, 21, 21, 21, 21, 21, 21, + 21, 32, 33, 34, 35, 36, 22, 21, + 24, 21, 25, 26, 21, 21, 21, 21, + 21, 21, 21, 21, 32, 33, 34, 21, + 36, 22, 21, 24, 21, 25, 26, 21, + 21, 21, 21, 21, 21, 21, 21, 32, + 21, 34, 21, 36, 22, 21, 24, 21, + 25, 26, 21, 21, 21, 21, 21, 21, + 21, 21, 32, 33, 34, 35, 36, 43, + 22, 21, 24, 21, 25, 26, 21, 21, + 43, 21, 28, 21, 30, 21, 32, 33, + 34, 35, 36, 22, 21, 24, 21, 25, + 26, 21, 21, 43, 21, 28, 21, 21, + 21, 32, 33, 34, 35, 36, 22, 21, + 24, 21, 25, 26, 21, 21, 43, 21, + 28, 29, 30, 21, 32, 33, 34, 35, + 36, 22, 23, 24, 21, 25, 26, 21, + 21, 27, 21, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 45, 44, 5, 44, + 44, 44, 46, 44, 44, 44, 44, 44, + 14, 44, 44, 44, 18, 45, 44, 5, + 45, 44, 5, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 14, 44, 44, 44, + 18, 47, 44, 45, 44, 5, 14, 44, + 44, 48, 44, 44, 44, 44, 44, 14, + 45, 44, 5, 44, 44, 44, 48, 44, + 44, 44, 44, 44, 14, 45, 44, 5, + 44, 44, 44, 44, 44, 44, 44, 44, + 44, 14, 2, 44, 45, 44, 5, 6, + 44, 44, 49, 44, 49, 44, 44, 44, + 14, 50, 44, 44, 18, 2, 44, 45, + 44, 5, 6, 44, 44, 44, 44, 44, + 44, 44, 44, 14, 44, 44, 44, 18, + 2, 44, 45, 44, 5, 6, 44, 44, + 49, 44, 44, 44, 44, 44, 14, 50, + 44, 44, 18, 2, 44, 45, 44, 5, + 6, 44, 44, 44, 44, 44, 44, 44, + 44, 14, 50, 44, 44, 18, 51, 44, + 44, 44, 44, 44, 44, 44, 51, 2, + 3, 45, 44, 5, 6, 44, 44, 8, + 44, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 2, 44, 45, 44, 5, + 6, 44, 44, 8, 44, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 2, 44, + 45, 44, 5, 6, 44, 44, 52, 44, + 44, 44, 44, 44, 14, 15, 16, 17, + 18, 2, 44, 45, 44, 5, 6, 44, + 44, 44, 44, 44, 44, 44, 44, 14, + 15, 16, 17, 18, 2, 44, 45, 44, + 5, 6, 44, 44, 44, 44, 44, 44, + 44, 44, 14, 15, 16, 44, 18, 2, + 44, 45, 44, 5, 6, 44, 44, 44, + 44, 44, 44, 44, 44, 14, 44, 16, + 44, 18, 2, 44, 45, 44, 5, 6, + 44, 44, 44, 44, 44, 44, 44, 44, + 14, 15, 16, 17, 18, 52, 2, 44, + 45, 44, 5, 6, 44, 44, 52, 44, + 10, 44, 12, 44, 14, 15, 16, 17, + 18, 2, 44, 45, 44, 5, 6, 44, + 44, 52, 44, 10, 44, 44, 44, 14, + 15, 16, 17, 18, 2, 44, 45, 44, + 5, 6, 44, 44, 52, 44, 10, 11, + 12, 44, 14, 15, 16, 17, 18, 2, + 3, 45, 44, 5, 6, 44, 44, 8, + 44, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 22, 23, 24, 21, 25, 26, + 21, 21, 53, 21, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 22, 54, + 24, 21, 25, 26, 21, 21, 27, 21, + 28, 29, 30, 31, 32, 33, 34, 35, + 36, 1, 2, 3, 45, 44, 5, 6, + 1, 1, 8, 44, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 1, 55, + 55, 55, 55, 55, 55, 1, 1, 56, 0 }; -static const char _myanmar_syllable_machine_trans_targs[] = { - 0, 1, 23, 0, 0, 24, 30, 33, - 36, 46, 37, 42, 43, 44, 26, 39, - 40, 41, 29, 45, 47, 0, 2, 12, - 0, 3, 9, 13, 14, 19, 20, 21, - 5, 16, 17, 18, 8, 22, 4, 6, - 7, 10, 11, 15, 0, 25, 27, 28, - 31, 32, 34, 35, 38, 0, 0 +static const char _myanmar_syllable_machine_index_defaults[] = { + 0, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 44, + 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 21, 21, 44, + 55, 55, 0 }; -static const char _myanmar_syllable_machine_trans_actions[] = { - 3, 0, 0, 4, 5, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 6, 0, 0, - 7, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 8, 0, 0, 0, - 0, 0, 0, 0, 0, 9, 10 +static const char _myanmar_syllable_machine_trans_cond_spaces[] = { + -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, -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, 0 +}; + +static const char _myanmar_syllable_machine_cond_targs[] = { + 0, 1, 23, 33, 0, 24, 30, 45, + 35, 48, 36, 41, 42, 43, 26, 38, + 39, 40, 29, 44, 49, 0, 2, 12, + 0, 3, 9, 13, 14, 19, 20, 21, + 5, 16, 17, 18, 8, 22, 4, 6, + 7, 10, 11, 15, 0, 0, 25, 27, + 28, 31, 32, 34, 37, 46, 47, 0, + 0, 0 +}; + +static const char _myanmar_syllable_machine_cond_actions[] = { + 3, 0, 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 0, 0, + 6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 9, + 10, 0 }; static const char _myanmar_syllable_machine_to_state_actions[] = { - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 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 _myanmar_syllable_machine_from_state_actions[] = { - 2, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + 2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 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 _myanmar_syllable_machine_eof_trans[] = { - 0, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 45, - 45, 45, 45, 45, 45, 45, 45, 45, - 45, 22, 22, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 54, 54 +static const char _myanmar_syllable_machine_eof_cond_spaces[] = { + -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, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 0 +}; + +static const char _myanmar_syllable_machine_eof_cond_key_offs[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 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 _myanmar_syllable_machine_eof_cond_key_lens[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 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 _myanmar_syllable_machine_eof_cond_keys[] = { + 0 +}; + +static const char _myanmar_syllable_machine_eof_trans[] = { + 0, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 45, + 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 22, 22, 45, + 56, 56, 0 +}; + +static const char _myanmar_syllable_machine_nfa_targs[] = { + 0, 0 +}; + +static const char _myanmar_syllable_machine_nfa_offsets[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 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 _myanmar_syllable_machine_nfa_push_actions[] = { + 0, 0 +}; + +static const char _myanmar_syllable_machine_nfa_pop_trans[] = { + 0, 0 }; static const int myanmar_syllable_machine_start = 0; @@ -274,136 +309,199 @@ static const int myanmar_syllable_machine_error = -1; static const int myanmar_syllable_machine_en_main = 0; -#line 36 "hb-ot-shape-complex-myanmar-machine.rl" -#line 94 "hb-ot-shape-complex-myanmar-machine.rl" - - #define found_syllable(syllable_type) \ - HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ - for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - syllable_serial++; \ - if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ - } HB_STMT_END +HB_STMT_START { \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ + info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + 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, te, act HB_UNUSED; - int cs; - hb_glyph_info_t *info = buffer->info; - -#line 301 "hb-ot-shape-complex-myanmar-machine.hh" + unsigned int p, pe, eof, ts, te, act HB_UNUSED; + int cs; + hb_glyph_info_t *info = buffer->info; + { - cs = myanmar_syllable_machine_start; - ts = 0; - te = 0; - act = 0; + cs = (int)myanmar_syllable_machine_start; + ts = 0; + te = 0; } - -#line 114 "hb-ot-shape-complex-myanmar-machine.rl" - - - p = 0; - pe = eof = buffer->len; - - unsigned int syllable_serial = 1; - -#line 317 "hb-ot-shape-complex-myanmar-machine.hh" + + + p=0; + pe = eof = buffer->len; + + unsigned int syllable_serial=1; + { - int _slen; - int _trans; - const unsigned char *_keys; - const char *_inds; - if ( p == pe ) - goto _test_eof; -_resume: - switch ( _myanmar_syllable_machine_from_state_actions[cs] ) { - case 2: -#line 1 "NONE" - {ts = p;} - break; -#line 331 "hb-ot-shape-complex-myanmar-machine.hh" + int _cpc; + int _klen;const char * _cekeys;unsigned int _trans = 0;const unsigned char * _keys;const char * _inds; { + if ( p == pe ) + goto _test_eof; + _resume: { + switch ( _myanmar_syllable_machine_from_state_actions[cs] ) { + case 2: { + { + #line 1 "NONE" + {ts = p;}} + + break; } + } + + _keys = ( _myanmar_syllable_machine_trans_keys + ((cs<<1))); + _inds = ( _myanmar_syllable_machine_indicies + (_myanmar_syllable_machine_index_offsets[cs])); + + if ( (info[p].myanmar_category()) <= 32 && (info[p].myanmar_category()) >= 1 ) + { + int _ic = (int)_myanmar_syllable_machine_char_class[(int)(info[p].myanmar_category()) - 1]; + if ( _ic <= (int)(*( _keys+1)) && _ic >= (int)(*( _keys)) ) + _trans = (unsigned int)(*( _inds + (int)( _ic - (int)(*( _keys)) ) )); + else + _trans = (unsigned int)_myanmar_syllable_machine_index_defaults[cs]; + } + else { + _trans = (unsigned int)_myanmar_syllable_machine_index_defaults[cs]; + } + + goto _match_cond; + } + _match_cond: { + cs = (int)_myanmar_syllable_machine_cond_targs[_trans]; + + if ( _myanmar_syllable_machine_cond_actions[_trans] == 0 ) + goto _again; + + switch ( _myanmar_syllable_machine_cond_actions[_trans] ) { + case 6: { + { + #line 86 "hb-ot-shape-complex-myanmar-machine.rl" + {te = p+1;{ + #line 86 "hb-ot-shape-complex-myanmar-machine.rl" + found_syllable (consonant_syllable); }}} + + break; } + case 4: { + { + #line 87 "hb-ot-shape-complex-myanmar-machine.rl" + {te = p+1;{ + #line 87 "hb-ot-shape-complex-myanmar-machine.rl" + found_syllable (non_myanmar_cluster); }}} + + break; } + case 10: { + { + #line 88 "hb-ot-shape-complex-myanmar-machine.rl" + {te = p+1;{ + #line 88 "hb-ot-shape-complex-myanmar-machine.rl" + found_syllable (punctuation_cluster); }}} + + break; } + case 8: { + { + #line 89 "hb-ot-shape-complex-myanmar-machine.rl" + {te = p+1;{ + #line 89 "hb-ot-shape-complex-myanmar-machine.rl" + found_syllable (broken_cluster); }}} + + break; } + case 3: { + { + #line 90 "hb-ot-shape-complex-myanmar-machine.rl" + {te = p+1;{ + #line 90 "hb-ot-shape-complex-myanmar-machine.rl" + found_syllable (non_myanmar_cluster); }}} + + break; } + case 5: { + { + #line 86 "hb-ot-shape-complex-myanmar-machine.rl" + {te = p;p = p - 1;{ + #line 86 "hb-ot-shape-complex-myanmar-machine.rl" + found_syllable (consonant_syllable); }}} + + break; } + case 7: { + { + #line 89 "hb-ot-shape-complex-myanmar-machine.rl" + {te = p;p = p - 1;{ + #line 89 "hb-ot-shape-complex-myanmar-machine.rl" + found_syllable (broken_cluster); }}} + + break; } + case 9: { + { + #line 90 "hb-ot-shape-complex-myanmar-machine.rl" + {te = p;p = p - 1;{ + #line 90 "hb-ot-shape-complex-myanmar-machine.rl" + found_syllable (non_myanmar_cluster); }}} + + break; } + } + + + } + _again: { + switch ( _myanmar_syllable_machine_to_state_actions[cs] ) { + case 1: { + { + #line 1 "NONE" + {ts = 0;}} + + break; } + } + + p += 1; + if ( p != pe ) + goto _resume; + } + _test_eof: { {} + if ( p == eof ) + { + if ( _myanmar_syllable_machine_eof_cond_spaces[cs] != -1 ) { + _cekeys = ( _myanmar_syllable_machine_eof_cond_keys + (_myanmar_syllable_machine_eof_cond_key_offs[cs])); + _klen = (int)_myanmar_syllable_machine_eof_cond_key_lens[cs]; + _cpc = 0; + { + const char *_lower = _cekeys; + const char *_upper = _cekeys + _klen - 1; + const char *_mid; + while ( 1 ) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( _cpc < (int)(*( _mid)) ) + _upper = _mid - 1; + else if ( _cpc > (int)(*( _mid)) ) + _lower = _mid + 1; + else { + goto _ok; + } + } + cs = -1; + goto _out; + } + _ok: {} + } + if ( _myanmar_syllable_machine_eof_trans[cs] > 0 ) { + _trans = (unsigned int)_myanmar_syllable_machine_eof_trans[cs] - 1; + goto _match_cond; + } + } + + } + _out: { {} + } + } } - - _keys = _myanmar_syllable_machine_trans_keys + (cs<<1); - _inds = _myanmar_syllable_machine_indicies + _myanmar_syllable_machine_index_offsets[cs]; - - _slen = _myanmar_syllable_machine_key_spans[cs]; - _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].myanmar_category()) && - ( info[p].myanmar_category()) <= _keys[1] ? - ( info[p].myanmar_category()) - _keys[0] : _slen ]; - -_eof_trans: - cs = _myanmar_syllable_machine_trans_targs[_trans]; - - if ( _myanmar_syllable_machine_trans_actions[_trans] == 0 ) - goto _again; - - switch ( _myanmar_syllable_machine_trans_actions[_trans] ) { - case 7: -#line 86 "hb-ot-shape-complex-myanmar-machine.rl" - {te = p+1;{ found_syllable (consonant_syllable); }} - break; - case 5: -#line 87 "hb-ot-shape-complex-myanmar-machine.rl" - {te = p+1;{ found_syllable (non_myanmar_cluster); }} - break; - case 10: -#line 88 "hb-ot-shape-complex-myanmar-machine.rl" - {te = p+1;{ found_syllable (punctuation_cluster); }} - break; - case 4: -#line 89 "hb-ot-shape-complex-myanmar-machine.rl" - {te = p+1;{ found_syllable (broken_cluster); }} - break; - case 3: -#line 90 "hb-ot-shape-complex-myanmar-machine.rl" - {te = p+1;{ found_syllable (non_myanmar_cluster); }} - break; - case 6: -#line 86 "hb-ot-shape-complex-myanmar-machine.rl" - {te = p;p--;{ found_syllable (consonant_syllable); }} - break; - case 8: -#line 89 "hb-ot-shape-complex-myanmar-machine.rl" - {te = p;p--;{ found_syllable (broken_cluster); }} - break; - case 9: -#line 90 "hb-ot-shape-complex-myanmar-machine.rl" - {te = p;p--;{ found_syllable (non_myanmar_cluster); }} - break; -#line 381 "hb-ot-shape-complex-myanmar-machine.hh" - } - -_again: - switch ( _myanmar_syllable_machine_to_state_actions[cs] ) { - case 1: -#line 1 "NONE" - {ts = 0;} - break; -#line 390 "hb-ot-shape-complex-myanmar-machine.hh" - } - - if ( ++p != pe ) - goto _resume; - _test_eof: {} - if ( p == eof ) - { - if ( _myanmar_syllable_machine_eof_trans[cs] > 0 ) { - _trans = _myanmar_syllable_machine_eof_trans[cs] - 1; - goto _eof_trans; - } - } - - } - -#line 122 "hb-ot-shape-complex-myanmar-machine.rl" - + } #undef found_syllable diff --git a/src/hb-ot-shape-complex-myanmar-machine.rl b/src/hb-ot-shape-complex-myanmar-machine.rl index 7845a86d4..c4e300fda 100644 --- a/src/hb-ot-shape-complex-myanmar-machine.rl +++ b/src/hb-ot-shape-complex-myanmar-machine.rl @@ -75,9 +75,9 @@ post_vowel_group = VPst MH? As* VAbv* A* (DB As?)?; pwo_tone_group = PT A* DB? As?; complex_syllable_tail = As* medial_group main_vowel_group post_vowel_group* pwo_tone_group* V* j?; -syllable_tail = (H | complex_syllable_tail); +syllable_tail = (H (c|IV).VS?)* (H | complex_syllable_tail); -consonant_syllable = (k|CS)? (c|IV|D|GB).VS? (H (c|IV).VS?)* syllable_tail; +consonant_syllable = (k|CS)? (c|IV|D|GB).VS? syllable_tail; punctuation_cluster = P V; broken_cluster = k? VS? syllable_tail; other = any; diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index 70ab972c6..b1f6b65ef 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -301,7 +301,8 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, if (unlikely (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE)) return; - /* Note: This loop is extra overhead, but should not be measurable. */ + /* Note: This loop is extra overhead, but should not be measurable. + * TODO Use a buffer scratch flag to remove the loop. */ bool has_broken_syllables = false; unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; diff --git a/src/hb-ot-shape-complex-myanmar.hh b/src/hb-ot-shape-complex-myanmar.hh index 3e9537a64..9ec78ef89 100644 --- a/src/hb-ot-shape-complex-myanmar.hh +++ b/src/hb-ot-shape-complex-myanmar.hh @@ -146,7 +146,7 @@ set_myanmar_properties (hb_glyph_info_t &info) break; case 0xAA74u: case 0xAA75u: case 0xAA76u: - /* https://github.com/roozbehp/unicode-data/issues/3 */ + /* https://github.com/harfbuzz/harfbuzz/issues/218 */ cat = OT_C; break; } diff --git a/src/hb-ot-shape-complex-thai.cc b/src/hb-ot-shape-complex-thai.cc index 130ea1c98..22d4aa3ab 100644 --- a/src/hb-ot-shape-complex-thai.cc +++ b/src/hb-ot-shape-complex-thai.cc @@ -218,7 +218,7 @@ do_thai_pua_shaping (const hb_ot_shape_plan_t *plan HB_UNUSED, hb_buffer_t *buffer, hb_font_t *font) { -#if defined(HB_NO_OT_SHAPE_COMPLEX_THAI_FALLBACK) +#ifdef HB_NO_OT_SHAPE_COMPLEX_THAI_FALLBACK return; #endif diff --git a/src/hb-ot-shape-complex-use-machine.hh b/src/hb-ot-shape-complex-use-machine.hh index c9410e4e5..e4b1884cf 100644 --- a/src/hb-ot-shape-complex-use-machine.hh +++ b/src/hb-ot-shape-complex-use-machine.hh @@ -1,32 +1,30 @@ - -#line 1 "hb-ot-shape-complex-use-machine.rl" /* - * Copyright © 2015 Mozilla Foundation. - * Copyright © 2015 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. - * - * Mozilla Author(s): Jonathan Kew - * Google Author(s): Behdad Esfahbod - */ +* Copyright © 2015 Mozilla Foundation. +* Copyright © 2015 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. +* +* Mozilla Author(s): Jonathan Kew +* Google Author(s): Behdad Esfahbod +*/ #ifndef HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH @@ -34,314 +32,370 @@ #include "hb.hh" -#line 38 "hb-ot-shape-complex-use-machine.hh" static const unsigned char _use_syllable_machine_trans_keys[] = { - 12u, 44u, 1u, 15u, 1u, 1u, 12u, 44u, 0u, 44u, 21u, 21u, 8u, 44u, 8u, 44u, - 1u, 15u, 1u, 1u, 8u, 44u, 8u, 44u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, - 8u, 39u, 8u, 39u, 8u, 39u, 8u, 44u, 8u, 44u, 8u, 44u, 8u, 44u, 8u, 44u, - 8u, 44u, 8u, 44u, 8u, 44u, 1u, 39u, 8u, 44u, 13u, 21u, 4u, 4u, 13u, 13u, - 8u, 44u, 8u, 44u, 8u, 44u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, - 8u, 39u, 8u, 39u, 8u, 44u, 8u, 44u, 8u, 44u, 8u, 44u, 8u, 44u, 8u, 44u, - 8u, 44u, 8u, 44u, 1u, 39u, 1u, 15u, 12u, 44u, 1u, 44u, 8u, 44u, 21u, 42u, - 41u, 42u, 42u, 42u, 1u, 5u, 0 + 7u, 33u, 1u, 9u, 1u, 1u, 7u, 33u, + 0u, 33u, 12u, 12u, 5u, 33u, 5u, 33u, + 1u, 9u, 1u, 1u, 5u, 33u, 5u, 33u, + 5u, 29u, 5u, 17u, 5u, 17u, 5u, 17u, + 5u, 29u, 5u, 29u, 5u, 29u, 5u, 33u, + 5u, 33u, 5u, 33u, 5u, 33u, 5u, 33u, + 5u, 33u, 5u, 33u, 5u, 33u, 1u, 29u, + 5u, 33u, 8u, 12u, 3u, 3u, 8u, 8u, + 5u, 33u, 5u, 33u, 30u, 31u, 31u, 31u, + 5u, 33u, 5u, 33u, 5u, 33u, 5u, 29u, + 5u, 17u, 5u, 17u, 5u, 17u, 5u, 29u, + 5u, 29u, 5u, 29u, 5u, 33u, 5u, 33u, + 5u, 33u, 5u, 33u, 5u, 33u, 5u, 33u, + 5u, 33u, 5u, 33u, 1u, 29u, 1u, 9u, + 3u, 3u, 8u, 12u, 8u, 8u, 7u, 33u, + 1u, 33u, 5u, 33u, 30u, 31u, 31u, 31u, + 12u, 31u, 1u, 4u, 0u }; -static const char _use_syllable_machine_key_spans[] = { - 33, 15, 1, 33, 45, 1, 37, 37, - 15, 1, 37, 37, 32, 19, 19, 19, - 32, 32, 32, 37, 37, 37, 37, 37, - 37, 37, 37, 39, 37, 9, 1, 1, - 37, 37, 37, 32, 19, 19, 19, 32, - 32, 32, 37, 37, 37, 37, 37, 37, - 37, 37, 39, 15, 33, 44, 37, 22, - 2, 1, 5 +static const char _use_syllable_machine_char_class[] = { + 0, 1, 2, 0, 3, 4, 2, 2, + 5, 2, 2, 6, 7, 8, 2, 9, + 0, 0, 10, 11, 2, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 2, 27, 28, 29, + 2, 30, 31, 32, 33, 0 }; static const short _use_syllable_machine_index_offsets[] = { - 0, 34, 50, 52, 86, 132, 134, 172, - 210, 226, 228, 266, 304, 337, 357, 377, - 397, 430, 463, 496, 534, 572, 610, 648, - 686, 724, 762, 800, 840, 878, 888, 890, - 892, 930, 968, 1006, 1039, 1059, 1079, 1099, - 1132, 1165, 1198, 1236, 1274, 1312, 1350, 1388, - 1426, 1464, 1502, 1542, 1558, 1592, 1637, 1675, - 1698, 1701, 1703 + 0, 27, 36, 37, 64, 98, 99, 128, + 157, 166, 167, 196, 225, 250, 263, 276, + 289, 314, 339, 364, 393, 422, 451, 480, + 509, 538, 567, 596, 625, 654, 659, 660, + 661, 690, 719, 721, 722, 751, 780, 809, + 834, 847, 860, 873, 898, 923, 948, 977, + 1006, 1035, 1064, 1093, 1122, 1151, 1180, 1209, + 1218, 1219, 1224, 1225, 1252, 1285, 1314, 1316, + 1317, 1337, 0 }; static const char _use_syllable_machine_indicies[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 3, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 4, 2, 3, 2, 6, 5, 5, 5, + 0, 0, 1, 3, 2, 2, 2, 2, + 2, 2, 2, 4, 3, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 6, 5, 7, 8, - 9, 7, 10, 8, 9, 9, 11, 9, - 9, 3, 12, 9, 9, 13, 7, 7, - 14, 15, 9, 9, 16, 17, 18, 19, - 20, 21, 22, 16, 23, 24, 25, 26, - 27, 28, 9, 29, 30, 31, 9, 9, - 9, 32, 33, 9, 35, 34, 37, 36, - 36, 38, 1, 36, 36, 39, 36, 36, - 36, 36, 36, 40, 41, 42, 43, 44, - 45, 46, 47, 41, 48, 40, 49, 50, - 51, 52, 36, 53, 54, 55, 36, 36, - 36, 36, 56, 36, 37, 36, 36, 38, - 1, 36, 36, 39, 36, 36, 36, 36, - 36, 57, 41, 42, 43, 44, 45, 46, - 47, 41, 48, 49, 49, 50, 51, 52, - 36, 53, 54, 55, 36, 36, 36, 36, - 56, 36, 38, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, - 59, 58, 38, 58, 37, 36, 36, 38, - 1, 36, 36, 39, 36, 36, 36, 36, - 36, 36, 41, 42, 43, 44, 45, 46, - 47, 41, 48, 49, 49, 50, 51, 52, - 36, 53, 54, 55, 36, 36, 36, 36, - 56, 36, 37, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 41, 42, 43, 44, 45, 36, 36, 36, - 36, 36, 36, 50, 51, 52, 36, 53, - 54, 55, 36, 36, 36, 36, 42, 36, - 37, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 42, - 43, 44, 45, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 53, 54, 55, - 36, 37, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 43, 44, 45, 36, 37, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 44, 45, - 36, 37, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 45, 36, 37, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 43, 44, 45, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 53, 54, 55, 36, 37, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 43, 44, - 45, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 54, 55, 36, 37, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 43, - 44, 45, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 55, 36, - 37, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 42, - 43, 44, 45, 36, 36, 36, 36, 36, - 36, 50, 51, 52, 36, 53, 54, 55, - 36, 36, 36, 36, 42, 36, 37, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 42, 43, 44, - 45, 36, 36, 36, 36, 36, 36, 36, - 51, 52, 36, 53, 54, 55, 36, 36, - 36, 36, 42, 36, 37, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 42, 43, 44, 45, 36, - 36, 36, 36, 36, 36, 36, 36, 52, - 36, 53, 54, 55, 36, 36, 36, 36, - 42, 36, 37, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 41, 42, 43, 44, 45, 36, 47, 41, - 36, 36, 36, 50, 51, 52, 36, 53, - 54, 55, 36, 36, 36, 36, 42, 36, - 37, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 41, 42, - 43, 44, 45, 36, 60, 41, 36, 36, - 36, 50, 51, 52, 36, 53, 54, 55, - 36, 36, 36, 36, 42, 36, 37, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 41, 42, 43, 44, - 45, 36, 36, 41, 36, 36, 36, 50, - 51, 52, 36, 53, 54, 55, 36, 36, - 36, 36, 42, 36, 37, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 41, 42, 43, 44, 45, 46, - 47, 41, 36, 36, 36, 50, 51, 52, - 36, 53, 54, 55, 36, 36, 36, 36, - 42, 36, 37, 36, 36, 38, 1, 36, - 36, 39, 36, 36, 36, 36, 36, 36, - 41, 42, 43, 44, 45, 46, 47, 41, - 48, 36, 49, 50, 51, 52, 36, 53, - 54, 55, 36, 36, 36, 36, 56, 36, - 38, 58, 58, 58, 58, 58, 58, 37, - 58, 58, 58, 58, 58, 58, 59, 58, - 58, 58, 58, 58, 58, 58, 42, 43, - 44, 45, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 53, 54, 55, 58, - 37, 36, 36, 38, 1, 36, 36, 39, - 36, 36, 36, 36, 36, 36, 41, 42, - 43, 44, 45, 46, 47, 41, 48, 40, - 49, 50, 51, 52, 36, 53, 54, 55, - 36, 36, 36, 36, 56, 36, 62, 61, - 61, 61, 61, 61, 61, 61, 63, 61, - 10, 64, 62, 61, 11, 65, 65, 3, - 6, 65, 65, 66, 65, 65, 65, 65, - 65, 67, 16, 17, 18, 19, 20, 21, - 22, 16, 23, 25, 25, 26, 27, 28, - 65, 29, 30, 31, 65, 65, 65, 65, - 33, 65, 11, 65, 65, 3, 6, 65, - 65, 66, 65, 65, 65, 65, 65, 65, - 16, 17, 18, 19, 20, 21, 22, 16, - 23, 25, 25, 26, 27, 28, 65, 29, - 30, 31, 65, 65, 65, 65, 33, 65, - 11, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 16, 17, - 18, 19, 20, 65, 65, 65, 65, 65, - 65, 26, 27, 28, 65, 29, 30, 31, - 65, 65, 65, 65, 17, 65, 11, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 17, 18, 19, - 20, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 29, 30, 31, 65, 11, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 18, - 19, 20, 65, 11, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 19, 20, 65, 11, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 20, 65, 11, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 18, 19, 20, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 29, 30, 31, 65, 11, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 18, 19, 20, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 30, 31, 65, 11, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 18, 19, 20, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 31, 65, 11, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 17, 18, 19, - 20, 65, 65, 65, 65, 65, 65, 26, - 27, 28, 65, 29, 30, 31, 65, 65, - 65, 65, 17, 65, 11, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 17, 18, 19, 20, 65, - 65, 65, 65, 65, 65, 65, 27, 28, - 65, 29, 30, 31, 65, 65, 65, 65, - 17, 65, 11, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 17, 18, 19, 20, 65, 65, 65, - 65, 65, 65, 65, 65, 28, 65, 29, - 30, 31, 65, 65, 65, 65, 17, 65, - 11, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 16, 17, - 18, 19, 20, 65, 22, 16, 65, 65, - 65, 26, 27, 28, 65, 29, 30, 31, - 65, 65, 65, 65, 17, 65, 11, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 16, 17, 18, 19, - 20, 65, 68, 16, 65, 65, 65, 26, - 27, 28, 65, 29, 30, 31, 65, 65, - 65, 65, 17, 65, 11, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 16, 17, 18, 19, 20, 65, - 65, 16, 65, 65, 65, 26, 27, 28, - 65, 29, 30, 31, 65, 65, 65, 65, - 17, 65, 11, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 16, 17, 18, 19, 20, 21, 22, 16, - 65, 65, 65, 26, 27, 28, 65, 29, - 30, 31, 65, 65, 65, 65, 17, 65, - 11, 65, 65, 3, 6, 65, 65, 66, - 65, 65, 65, 65, 65, 65, 16, 17, - 18, 19, 20, 21, 22, 16, 23, 65, - 25, 26, 27, 28, 65, 29, 30, 31, - 65, 65, 65, 65, 33, 65, 3, 65, - 65, 65, 65, 65, 65, 11, 65, 65, - 65, 65, 65, 65, 4, 65, 65, 65, - 65, 65, 65, 65, 17, 18, 19, 20, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 29, 30, 31, 65, 3, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 4, 69, 6, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 6, 69, - 8, 65, 65, 65, 8, 65, 65, 11, - 65, 65, 3, 6, 65, 65, 66, 65, - 65, 65, 65, 65, 65, 16, 17, 18, - 19, 20, 21, 22, 16, 23, 24, 25, - 26, 27, 28, 65, 29, 30, 31, 65, - 65, 65, 65, 33, 65, 11, 65, 65, - 3, 6, 65, 65, 66, 65, 65, 65, - 65, 65, 65, 16, 17, 18, 19, 20, - 21, 22, 16, 23, 24, 25, 26, 27, - 28, 65, 29, 30, 31, 65, 65, 65, - 65, 33, 65, 71, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 71, - 72, 70, 71, 72, 70, 72, 70, 8, - 69, 69, 69, 8, 69, 0 + 5, 5, 5, 5, 5, 5, 5, 6, + 7, 8, 9, 10, 11, 12, 3, 13, + 14, 15, 16, 17, 9, 18, 19, 20, + 21, 22, 23, 24, 18, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 39, 41, 42, 1, 40, 43, + 40, 40, 44, 45, 46, 47, 48, 49, + 50, 51, 45, 52, 44, 53, 54, 55, + 56, 57, 58, 59, 40, 40, 40, 60, + 41, 42, 1, 40, 43, 40, 40, 61, + 45, 46, 47, 48, 49, 50, 51, 45, + 52, 53, 53, 54, 55, 56, 57, 58, + 59, 40, 40, 40, 60, 42, 62, 62, + 62, 62, 62, 62, 62, 63, 42, 41, + 42, 1, 40, 43, 40, 40, 40, 45, + 46, 47, 48, 49, 50, 51, 45, 52, + 53, 53, 54, 55, 56, 57, 58, 59, + 40, 40, 40, 60, 41, 40, 40, 40, + 40, 40, 40, 40, 45, 46, 47, 48, + 49, 40, 40, 40, 40, 40, 40, 54, + 55, 56, 57, 58, 59, 40, 40, 40, + 46, 41, 40, 40, 40, 40, 40, 40, + 40, 40, 46, 47, 48, 49, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 57, + 58, 59, 41, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 47, 48, 49, 41, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 48, 49, 41, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 49, 41, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 47, 48, 49, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 57, + 58, 59, 41, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 47, 48, 49, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 58, 59, 41, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 47, 48, 49, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 59, 41, 40, 40, 40, + 40, 40, 40, 40, 40, 46, 47, 48, + 49, 40, 40, 40, 40, 40, 40, 54, + 55, 56, 57, 58, 59, 40, 40, 40, + 46, 41, 40, 40, 40, 40, 40, 40, + 40, 40, 46, 47, 48, 49, 40, 40, + 40, 40, 40, 40, 40, 55, 56, 57, + 58, 59, 40, 40, 40, 46, 41, 40, + 40, 40, 40, 40, 40, 40, 40, 46, + 47, 48, 49, 40, 40, 40, 40, 40, + 40, 40, 40, 56, 57, 58, 59, 40, + 40, 40, 46, 41, 40, 40, 40, 40, + 40, 40, 40, 45, 46, 47, 48, 49, + 40, 51, 45, 40, 40, 40, 54, 55, + 56, 57, 58, 59, 40, 40, 40, 46, + 41, 40, 40, 40, 40, 40, 40, 40, + 45, 46, 47, 48, 49, 40, 64, 45, + 40, 40, 40, 54, 55, 56, 57, 58, + 59, 40, 40, 40, 46, 41, 40, 40, + 40, 40, 40, 40, 40, 45, 46, 47, + 48, 49, 40, 40, 45, 40, 40, 40, + 54, 55, 56, 57, 58, 59, 40, 40, + 40, 46, 41, 40, 40, 40, 40, 40, + 40, 40, 45, 46, 47, 48, 49, 50, + 51, 45, 40, 40, 40, 54, 55, 56, + 57, 58, 59, 40, 40, 40, 46, 41, + 42, 1, 40, 43, 40, 40, 40, 45, + 46, 47, 48, 49, 50, 51, 45, 52, + 40, 53, 54, 55, 56, 57, 58, 59, + 40, 40, 40, 60, 42, 62, 62, 62, + 41, 62, 62, 62, 63, 62, 62, 62, + 62, 46, 47, 48, 49, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 57, 58, + 59, 41, 42, 1, 40, 43, 40, 40, + 40, 45, 46, 47, 48, 49, 50, 51, + 45, 52, 44, 53, 54, 55, 56, 57, + 58, 59, 40, 40, 40, 60, 66, 65, + 65, 65, 67, 10, 66, 41, 42, 1, + 40, 43, 40, 40, 69, 45, 46, 47, + 48, 49, 50, 51, 45, 52, 44, 53, + 54, 55, 56, 57, 58, 59, 70, 71, + 40, 60, 41, 42, 1, 40, 43, 40, + 40, 40, 45, 46, 47, 48, 49, 50, + 51, 45, 52, 44, 53, 54, 55, 56, + 57, 58, 59, 70, 71, 40, 60, 70, + 71, 71, 12, 3, 6, 73, 74, 73, + 73, 75, 18, 19, 20, 21, 22, 23, + 24, 18, 25, 27, 27, 28, 29, 30, + 31, 32, 33, 73, 73, 73, 37, 12, + 3, 6, 73, 74, 73, 73, 73, 18, + 19, 20, 21, 22, 23, 24, 18, 25, + 27, 27, 28, 29, 30, 31, 32, 33, + 73, 73, 73, 37, 12, 73, 73, 73, + 73, 73, 73, 73, 18, 19, 20, 21, + 22, 73, 73, 73, 73, 73, 73, 28, + 29, 30, 31, 32, 33, 73, 73, 73, + 19, 12, 73, 73, 73, 73, 73, 73, + 73, 73, 19, 20, 21, 22, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 31, + 32, 33, 12, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 20, 21, 22, 12, + 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 21, 22, 12, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, + 22, 12, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 20, 21, 22, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 31, + 32, 33, 12, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 20, 21, 22, 73, + 73, 73, 73, 73, 73, 73, 73, 73, + 73, 32, 33, 12, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 20, 21, 22, + 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 33, 12, 73, 73, 73, + 73, 73, 73, 73, 73, 19, 20, 21, + 22, 73, 73, 73, 73, 73, 73, 28, + 29, 30, 31, 32, 33, 73, 73, 73, + 19, 12, 73, 73, 73, 73, 73, 73, + 73, 73, 19, 20, 21, 22, 73, 73, + 73, 73, 73, 73, 73, 29, 30, 31, + 32, 33, 73, 73, 73, 19, 12, 73, + 73, 73, 73, 73, 73, 73, 73, 19, + 20, 21, 22, 73, 73, 73, 73, 73, + 73, 73, 73, 30, 31, 32, 33, 73, + 73, 73, 19, 12, 73, 73, 73, 73, + 73, 73, 73, 18, 19, 20, 21, 22, + 73, 24, 18, 73, 73, 73, 28, 29, + 30, 31, 32, 33, 73, 73, 73, 19, + 12, 73, 73, 73, 73, 73, 73, 73, + 18, 19, 20, 21, 22, 73, 76, 18, + 73, 73, 73, 28, 29, 30, 31, 32, + 33, 73, 73, 73, 19, 12, 73, 73, + 73, 73, 73, 73, 73, 18, 19, 20, + 21, 22, 73, 73, 18, 73, 73, 73, + 28, 29, 30, 31, 32, 33, 73, 73, + 73, 19, 12, 73, 73, 73, 73, 73, + 73, 73, 18, 19, 20, 21, 22, 23, + 24, 18, 73, 73, 73, 28, 29, 30, + 31, 32, 33, 73, 73, 73, 19, 12, + 3, 6, 73, 74, 73, 73, 73, 18, + 19, 20, 21, 22, 23, 24, 18, 25, + 73, 27, 28, 29, 30, 31, 32, 33, + 73, 73, 73, 37, 3, 73, 73, 73, + 12, 73, 73, 73, 4, 73, 73, 73, + 73, 19, 20, 21, 22, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 31, 32, + 33, 3, 77, 77, 77, 77, 77, 77, + 77, 4, 78, 14, 73, 73, 73, 79, + 14, 6, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 6, 8, 73, 73, 8, + 12, 3, 6, 14, 74, 73, 73, 73, + 18, 19, 20, 21, 22, 23, 24, 18, + 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 73, 37, 12, 3, 6, + 73, 74, 73, 73, 73, 18, 19, 20, + 21, 22, 23, 24, 18, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 73, 73, + 73, 37, 34, 35, 35, 70, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 70, + 71, 8, 77, 77, 8, 0 }; -static const char _use_syllable_machine_trans_targs[] = { - 4, 8, 4, 32, 2, 4, 1, 5, - 6, 4, 29, 4, 51, 52, 53, 55, - 34, 35, 36, 37, 38, 45, 46, 48, - 54, 49, 42, 43, 44, 39, 40, 41, - 58, 50, 4, 4, 4, 4, 7, 0, - 28, 11, 12, 13, 14, 15, 22, 23, - 25, 26, 19, 20, 21, 16, 17, 18, - 27, 10, 4, 9, 24, 4, 30, 31, - 4, 4, 3, 33, 47, 4, 4, 56, - 57 +static const char _use_syllable_machine_index_defaults[] = { + 0, 2, 2, 5, 9, 38, 40, 40, + 62, 62, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 62, 40, 65, 68, 65, + 40, 40, 72, 72, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 77, + 73, 73, 73, 77, 73, 73, 73, 73, + 72, 77, 0 }; -static const char _use_syllable_machine_trans_actions[] = { - 1, 0, 2, 3, 0, 4, 0, 0, - 7, 8, 0, 9, 10, 10, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 3, 3, 0, 0, 0, 0, 0, 0, - 0, 3, 11, 12, 13, 14, 7, 0, - 7, 0, 0, 0, 0, 0, 0, 0, - 0, 7, 0, 0, 0, 0, 0, 0, - 0, 7, 15, 0, 0, 16, 0, 0, - 17, 18, 0, 3, 0, 19, 20, 0, +static const char _use_syllable_machine_trans_cond_spaces[] = { + -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, -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, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + 0 +}; + +static const char _use_syllable_machine_cond_targs[] = { + 4, 8, 4, 36, 2, 4, 1, 5, + 6, 4, 29, 32, 4, 55, 56, 59, + 60, 64, 38, 39, 40, 41, 42, 49, + 50, 52, 61, 53, 46, 47, 48, 43, + 44, 45, 62, 63, 65, 54, 4, 4, + 4, 4, 7, 0, 28, 11, 12, 13, + 14, 15, 22, 23, 25, 26, 19, 20, + 21, 16, 17, 18, 27, 10, 4, 9, + 24, 4, 30, 31, 4, 33, 34, 35, + 4, 4, 3, 37, 51, 4, 57, 58, + 0 +}; + +static const char _use_syllable_machine_cond_actions[] = { + 1, 0, 2, 3, 0, 4, 0, 0, + 7, 8, 0, 7, 9, 10, 0, 10, + 3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, 11, 12, + 13, 14, 7, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 7, 0, 0, + 0, 0, 0, 0, 0, 7, 15, 0, + 0, 16, 0, 0, 17, 7, 0, 0, + 18, 19, 0, 3, 0, 20, 0, 0, 0 }; static const char _use_syllable_machine_to_state_actions[] = { - 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, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 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, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0 }; -static const short _use_syllable_machine_eof_trans[] = { - 1, 3, 3, 6, 0, 35, 37, 37, - 59, 59, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 59, 37, 62, 65, 62, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 70, 70, 66, 66, 71, - 71, 71, 70 +static const char _use_syllable_machine_eof_cond_spaces[] = { + -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, -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, -1, -1, -1, -1, -1, -1, + -1, -1, 0 +}; + +static const char _use_syllable_machine_eof_cond_key_offs[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 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_eof_cond_key_lens[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 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_eof_cond_keys[] = { + 0 +}; + +static const char _use_syllable_machine_eof_trans[] = { + 1, 3, 3, 6, 0, 39, 41, 41, + 63, 63, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 63, 41, 66, 69, 66, + 41, 41, 73, 73, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 78, + 74, 74, 74, 78, 74, 74, 74, 74, + 73, 78, 0 +}; + +static const char _use_syllable_machine_nfa_targs[] = { + 0, 0 +}; + +static const char _use_syllable_machine_nfa_offsets[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 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_nfa_push_actions[] = { + 0, 0 +}; + +static const char _use_syllable_machine_nfa_pop_trans[] = { + 0, 0 }; static const int use_syllable_machine_start = 4; @@ -351,188 +405,292 @@ static const int use_syllable_machine_error = -1; static const int use_syllable_machine_en_main = 4; -#line 38 "hb-ot-shape-complex-use-machine.rl" -#line 143 "hb-ot-shape-complex-use-machine.rl" - - #define found_syllable(syllable_type) \ - HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ - for (unsigned int i = ts; i < te; i++) \ - info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - syllable_serial++; \ - if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ - } HB_STMT_END +HB_STMT_START { \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ + info[i].syllable() = (syllable_serial << 4) | syllable_type; \ + 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, te, act; - int cs; - hb_glyph_info_t *info = buffer->info; - -#line 378 "hb-ot-shape-complex-use-machine.hh" + unsigned int p, pe, eof, ts, te, act; + int cs; + hb_glyph_info_t *info = buffer->info; + { - cs = use_syllable_machine_start; - ts = 0; - te = 0; - act = 0; + cs = (int)use_syllable_machine_start; + ts = 0; + te = 0; + act = 0; } - -#line 163 "hb-ot-shape-complex-use-machine.rl" - - - p = 0; - pe = eof = buffer->len; - - unsigned int syllable_serial = 1; - -#line 394 "hb-ot-shape-complex-use-machine.hh" + + + p=0; + pe = eof = buffer->len; + + unsigned int syllable_serial=1; + { - int _slen; - int _trans; - const unsigned char *_keys; - const char *_inds; - if ( p == pe ) - goto _test_eof; -_resume: - switch ( _use_syllable_machine_from_state_actions[cs] ) { - case 6: -#line 1 "NONE" - {ts = p;} - break; -#line 408 "hb-ot-shape-complex-use-machine.hh" + int _cpc; + int _klen;const char * _cekeys;unsigned int _trans = 0;const unsigned char * _keys;const char * _inds; { + if ( p == pe ) + goto _test_eof; + _resume: { + switch ( _use_syllable_machine_from_state_actions[cs] ) { + case 6: { + { + #line 1 "NONE" + {ts = p;}} + + break; } + } + + _keys = ( _use_syllable_machine_trans_keys + ((cs<<1))); + _inds = ( _use_syllable_machine_indicies + (_use_syllable_machine_index_offsets[cs])); + + if ( (info[p].use_category()) <= 44 ) + { + int _ic = (int)_use_syllable_machine_char_class[(int)(info[p].use_category()) - 0]; + if ( _ic <= (int)(*( _keys+1)) && _ic >= (int)(*( _keys)) ) + _trans = (unsigned int)(*( _inds + (int)( _ic - (int)(*( _keys)) ) )); + else + _trans = (unsigned int)_use_syllable_machine_index_defaults[cs]; + } + else { + _trans = (unsigned int)_use_syllable_machine_index_defaults[cs]; + } + + goto _match_cond; + } + _match_cond: { + cs = (int)_use_syllable_machine_cond_targs[_trans]; + + if ( _use_syllable_machine_cond_actions[_trans] == 0 ) + goto _again; + + switch ( _use_syllable_machine_cond_actions[_trans] ) { + case 7: { + { + #line 1 "NONE" + {te = p+1;}} + + break; } + case 12: { + { + #line 135 "hb-ot-shape-complex-use-machine.rl" + {te = p+1;{ + #line 135 "hb-ot-shape-complex-use-machine.rl" + found_syllable (independent_cluster); }}} + + break; } + case 14: { + { + #line 137 "hb-ot-shape-complex-use-machine.rl" + {te = p+1;{ + #line 137 "hb-ot-shape-complex-use-machine.rl" + found_syllable (standard_cluster); }}} + + break; } + case 9: { + { + #line 141 "hb-ot-shape-complex-use-machine.rl" + {te = p+1;{ + #line 141 "hb-ot-shape-complex-use-machine.rl" + found_syllable (broken_cluster); }}} + + break; } + case 8: { + { + #line 142 "hb-ot-shape-complex-use-machine.rl" + {te = p+1;{ + #line 142 "hb-ot-shape-complex-use-machine.rl" + found_syllable (non_cluster); }}} + + break; } + case 11: { + { + #line 135 "hb-ot-shape-complex-use-machine.rl" + {te = p;p = p - 1;{ + #line 135 "hb-ot-shape-complex-use-machine.rl" + found_syllable (independent_cluster); }}} + + break; } + case 15: { + { + #line 136 "hb-ot-shape-complex-use-machine.rl" + {te = p;p = p - 1;{ + #line 136 "hb-ot-shape-complex-use-machine.rl" + found_syllable (virama_terminated_cluster); }}} + + break; } + case 13: { + { + #line 137 "hb-ot-shape-complex-use-machine.rl" + {te = p;p = p - 1;{ + #line 137 "hb-ot-shape-complex-use-machine.rl" + found_syllable (standard_cluster); }}} + + break; } + case 17: { + { + #line 138 "hb-ot-shape-complex-use-machine.rl" + {te = p;p = p - 1;{ + #line 138 "hb-ot-shape-complex-use-machine.rl" + found_syllable (number_joiner_terminated_cluster); }}} + + break; } + case 16: { + { + #line 139 "hb-ot-shape-complex-use-machine.rl" + {te = p;p = p - 1;{ + #line 139 "hb-ot-shape-complex-use-machine.rl" + found_syllable (numeral_cluster); }}} + + break; } + case 18: { + { + #line 140 "hb-ot-shape-complex-use-machine.rl" + {te = p;p = p - 1;{ + #line 140 "hb-ot-shape-complex-use-machine.rl" + found_syllable (symbol_cluster); }}} + + break; } + case 19: { + { + #line 141 "hb-ot-shape-complex-use-machine.rl" + {te = p;p = p - 1;{ + #line 141 "hb-ot-shape-complex-use-machine.rl" + found_syllable (broken_cluster); }}} + + break; } + case 20: { + { + #line 142 "hb-ot-shape-complex-use-machine.rl" + {te = p;p = p - 1;{ + #line 142 "hb-ot-shape-complex-use-machine.rl" + found_syllable (non_cluster); }}} + + break; } + case 1: { + { + #line 137 "hb-ot-shape-complex-use-machine.rl" + {p = ((te))-1; + { + #line 137 "hb-ot-shape-complex-use-machine.rl" + found_syllable (standard_cluster); }}} + + break; } + case 4: { + { + #line 141 "hb-ot-shape-complex-use-machine.rl" + {p = ((te))-1; + { + #line 141 "hb-ot-shape-complex-use-machine.rl" + found_syllable (broken_cluster); }}} + + break; } + case 2: { + { + #line 1 "NONE" + {switch( act ) { + case 7: { + p = ((te))-1; + { + #line 141 "hb-ot-shape-complex-use-machine.rl" + found_syllable (broken_cluster); } break; } + case 8: { + p = ((te))-1; + { + #line 142 "hb-ot-shape-complex-use-machine.rl" + found_syllable (non_cluster); } break; } + }} + } + + break; } + case 3: { + { + #line 1 "NONE" + {te = p+1;}} + { + #line 141 "hb-ot-shape-complex-use-machine.rl" + {act = 7;}} + + break; } + case 10: { + { + #line 1 "NONE" + {te = p+1;}} + { + #line 142 "hb-ot-shape-complex-use-machine.rl" + {act = 8;}} + + break; } + } + + + } + _again: { + switch ( _use_syllable_machine_to_state_actions[cs] ) { + case 5: { + { + #line 1 "NONE" + {ts = 0;}} + + break; } + } + + p += 1; + if ( p != pe ) + goto _resume; + } + _test_eof: { {} + if ( p == eof ) + { + if ( _use_syllable_machine_eof_cond_spaces[cs] != -1 ) { + _cekeys = ( _use_syllable_machine_eof_cond_keys + (_use_syllable_machine_eof_cond_key_offs[cs])); + _klen = (int)_use_syllable_machine_eof_cond_key_lens[cs]; + _cpc = 0; + { + const char *_lower = _cekeys; + const char *_upper = _cekeys + _klen - 1; + const char *_mid; + while ( 1 ) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( _cpc < (int)(*( _mid)) ) + _upper = _mid - 1; + else if ( _cpc > (int)(*( _mid)) ) + _lower = _mid + 1; + else { + goto _ok; + } + } + cs = -1; + goto _out; + } + _ok: {} + } + if ( _use_syllable_machine_eof_trans[cs] > 0 ) { + _trans = (unsigned int)_use_syllable_machine_eof_trans[cs] - 1; + goto _match_cond; + } + } + + } + _out: { {} + } + } } - - _keys = _use_syllable_machine_trans_keys + (cs<<1); - _inds = _use_syllable_machine_indicies + _use_syllable_machine_index_offsets[cs]; - - _slen = _use_syllable_machine_key_spans[cs]; - _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].use_category()) && - ( info[p].use_category()) <= _keys[1] ? - ( info[p].use_category()) - _keys[0] : _slen ]; - -_eof_trans: - cs = _use_syllable_machine_trans_targs[_trans]; - - if ( _use_syllable_machine_trans_actions[_trans] == 0 ) - goto _again; - - switch ( _use_syllable_machine_trans_actions[_trans] ) { - case 7: -#line 1 "NONE" - {te = p+1;} - break; - case 12: -#line 132 "hb-ot-shape-complex-use-machine.rl" - {te = p+1;{ found_syllable (independent_cluster); }} - break; - case 14: -#line 134 "hb-ot-shape-complex-use-machine.rl" - {te = p+1;{ found_syllable (standard_cluster); }} - break; - case 9: -#line 138 "hb-ot-shape-complex-use-machine.rl" - {te = p+1;{ found_syllable (broken_cluster); }} - break; - case 8: -#line 139 "hb-ot-shape-complex-use-machine.rl" - {te = p+1;{ found_syllable (non_cluster); }} - break; - case 11: -#line 132 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (independent_cluster); }} - break; - case 15: -#line 133 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (virama_terminated_cluster); }} - break; - case 13: -#line 134 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (standard_cluster); }} - break; - case 17: -#line 135 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (number_joiner_terminated_cluster); }} - break; - case 16: -#line 136 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (numeral_cluster); }} - break; - case 20: -#line 137 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (symbol_cluster); }} - break; - case 18: -#line 138 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (broken_cluster); }} - break; - case 19: -#line 139 "hb-ot-shape-complex-use-machine.rl" - {te = p;p--;{ found_syllable (non_cluster); }} - break; - case 1: -#line 134 "hb-ot-shape-complex-use-machine.rl" - {{p = ((te))-1;}{ found_syllable (standard_cluster); }} - break; - case 4: -#line 138 "hb-ot-shape-complex-use-machine.rl" - {{p = ((te))-1;}{ found_syllable (broken_cluster); }} - break; - case 2: -#line 1 "NONE" - { switch( act ) { - case 7: - {{p = ((te))-1;} found_syllable (broken_cluster); } - break; - case 8: - {{p = ((te))-1;} found_syllable (non_cluster); } - break; - } - } - break; - case 3: -#line 1 "NONE" - {te = p+1;} -#line 138 "hb-ot-shape-complex-use-machine.rl" - {act = 7;} - break; - case 10: -#line 1 "NONE" - {te = p+1;} -#line 139 "hb-ot-shape-complex-use-machine.rl" - {act = 8;} - break; -#line 510 "hb-ot-shape-complex-use-machine.hh" - } - -_again: - switch ( _use_syllable_machine_to_state_actions[cs] ) { - case 5: -#line 1 "NONE" - {ts = 0;} - break; -#line 519 "hb-ot-shape-complex-use-machine.hh" - } - - if ( ++p != pe ) - goto _resume; - _test_eof: {} - if ( p == eof ) - { - if ( _use_syllable_machine_eof_trans[cs] > 0 ) { - _trans = _use_syllable_machine_eof_trans[cs] - 1; - goto _eof_trans; - } - } - - } - -#line 171 "hb-ot-shape-complex-use-machine.rl" - + } #undef found_syllable diff --git a/src/hb-ot-shape-complex-use-machine.rl b/src/hb-ot-shape-complex-use-machine.rl index 7702cd94d..82803da0c 100644 --- a/src/hb-ot-shape-complex-use-machine.rl +++ b/src/hb-ot-shape-complex-use-machine.rl @@ -107,6 +107,9 @@ complex_syllable_tail = vowel_modifiers final_consonants ; +number_joiner_terminated_cluster_tail = (HN N VS?)* HN; +numeral_cluster_tail = (HN N VS?)+; +symbol_cluster_tail = SMAbv+ SMBlw* | SMBlw+; virama_terminated_cluster = (R|CS)? (B | GB) VS? @@ -119,12 +122,12 @@ standard_cluster = ; broken_cluster = R? - complex_syllable_tail + (complex_syllable_tail | number_joiner_terminated_cluster_tail | numeral_cluster_tail | symbol_cluster_tail) ; -number_joiner_terminated_cluster = N VS? (HN N VS?)* HN; -numeral_cluster = N VS? (HN N VS?)*; -symbol_cluster = S VS? SMAbv* SMBlw*; +number_joiner_terminated_cluster = N VS? number_joiner_terminated_cluster_tail; +numeral_cluster = N VS? numeral_cluster_tail?; +symbol_cluster = (S | GB) VS? symbol_cluster_tail?; independent_cluster = (IND | O | Rsv | WJ) VS?; other = any; diff --git a/src/hb-ot-shape-complex-use-table.cc b/src/hb-ot-shape-complex-use-table.cc index cb5c358cd..f47d5e847 100644 --- a/src/hb-ot-shape-complex-use-table.cc +++ b/src/hb-ot-shape-complex-use-table.cc @@ -318,8 +318,8 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1B20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1B30 */ B, B, B, B, CMAbv, VPst, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VPre, VPre, /* 1B40 */ VPst, VPst, VAbv, VAbv, H, B, B, B, B, B, B, B, O, O, O, O, - /* 1B50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, - /* 1B60 */ O, O, O, O, O, O, O, O, O, O, O, SMAbv, SMBlw, SMAbv, SMAbv, SMAbv, + /* 1B50 */ B, B, B, B, B, B, B, B, B, B, O, GB, GB, O, O, GB, + /* 1B60 */ O, S, GB, S, S, S, S, S, GB, S, S, SMAbv, SMBlw, SMAbv, SMAbv, SMAbv, /* 1B70 */ SMAbv, SMAbv, SMAbv, SMAbv, O, O, O, O, O, O, O, O, O, O, O, O, /* Sundanese */ diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index eecde6e85..cbaa519c4 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc @@ -294,7 +294,7 @@ setup_rphf_mask (const hb_ot_shape_plan_t *plan, foreach_syllable (buffer, start, end) { - unsigned int limit = info[start].use_category() == USE_R ? 1 : MIN (3u, end - start); + unsigned int limit = info[start].use_category() == USE_R ? 1 : hb_min (3u, end - start); for (unsigned int i = start; i < start + limit; i++) info[i].mask |= mask; } @@ -526,7 +526,8 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, if (unlikely (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE)) return; - /* Note: This loop is extra overhead, but should not be measurable. */ + /* Note: This loop is extra overhead, but should not be measurable. + * TODO Use a buffer scratch flag to remove the loop. */ bool has_broken_syllables = false; unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; @@ -560,7 +561,6 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, 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->successful && diff --git a/src/hb-ot-shape-complex-vowel-constraints.cc b/src/hb-ot-shape-complex-vowel-constraints.cc index 2eb313ae4..912ee35b4 100644 --- a/src/hb-ot-shape-complex-vowel-constraints.cc +++ b/src/hb-ot-shape-complex-vowel-constraints.cc @@ -34,7 +34,7 @@ _hb_preprocess_text_vowel_constraints (const hb_ot_shape_plan_t *plan HB_UNUSED, hb_buffer_t *buffer, hb_font_t *font HB_UNUSED) { -#if defined(HB_NO_OT_SHAPE_COMPLEX_VOWEL_CONSTRAINTS) +#ifdef HB_NO_OT_SHAPE_COMPLEX_VOWEL_CONSTRAINTS return; #endif if (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE) diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index b10eec666..573af8ec6 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -166,7 +166,7 @@ _hb_ot_shape_fallback_mark_position_recategorize_marks (const hb_ot_shape_plan_t hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) { -#if defined(HB_NO_OT_SHAPE_FALLBACK) +#ifdef HB_NO_OT_SHAPE_FALLBACK return; #endif @@ -438,7 +438,7 @@ _hb_ot_shape_fallback_mark_position (const hb_ot_shape_plan_t *plan, hb_buffer_t *buffer, bool adjust_offsets_when_zeroing) { -#if defined(HB_NO_OT_SHAPE_FALLBACK) +#ifdef HB_NO_OT_SHAPE_FALLBACK return; #endif @@ -456,6 +456,7 @@ _hb_ot_shape_fallback_mark_position (const hb_ot_shape_plan_t *plan, } +#ifndef HB_DISABLE_DEPRECATED struct hb_ot_shape_fallback_kern_driver_t { hb_ot_shape_fallback_kern_driver_t (hb_font_t *font_, @@ -474,6 +475,7 @@ struct hb_ot_shape_fallback_kern_driver_t hb_font_t *font; hb_direction_t direction; }; +#endif /* Performs font-assisted kerning. */ void @@ -481,10 +483,11 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { -#if defined(HB_NO_OT_SHAPE_FALLBACK) +#ifdef HB_NO_OT_SHAPE_FALLBACK return; #endif +#ifndef HB_DISABLE_DEPRECATED if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction) ? !font->has_glyph_h_kerning_func () : !font->has_glyph_v_kerning_func ()) @@ -501,6 +504,7 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, if (reverse) buffer->reverse (); +#endif } diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 7fff3059e..09b8a582a 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -58,6 +58,10 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, static bool _hb_apply_morx (hb_face_t *face) { +#ifdef HB_NO_SHAPE_AAT + return false; +#endif + if (hb_options ().aat && hb_aat_layout_has_substitution (face)) return true; @@ -83,8 +87,10 @@ hb_ot_shape_planner_t::hb_ot_shape_planner_t (hb_face_t *fac script_zero_marks = shaper->zero_width_marks != HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE; script_fallback_mark_positioning = shaper->fallback_position; +#ifndef HB_NO_SHAPE_AAT if (apply_morx) shaper = &_hb_ot_complex_shaper_default; +#endif } void @@ -94,8 +100,10 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, plan.props = props; plan.shaper = shaper; map.compile (plan.map, key); +#ifndef HB_NO_SHAPE_AAT if (apply_morx) aat_map.compile (plan.aat_map); +#endif plan.frac_mask = plan.map.get_1_mask (HB_TAG ('f','r','a','c')); plan.numr_mask = plan.map.get_1_mask (HB_TAG ('n','u','m','r')); @@ -130,12 +138,18 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, * Decide who does positioning. GPOS, kerx, kern, or fallback. */ - if (hb_options ().aat && hb_aat_layout_has_positioning (face)) + if (0) + ; +#ifndef HB_NO_SHAPE_AAT + else if (hb_options ().aat && hb_aat_layout_has_positioning (face)) plan.apply_kerx = true; +#endif else if (!apply_morx && !disable_gpos && hb_ot_layout_has_positioning (face)) plan.apply_gpos = true; +#ifndef HB_NO_SHAPE_AAT else if (hb_aat_layout_has_positioning (face)) plan.apply_kerx = true; +#endif if (!plan.apply_kerx && !has_gpos_kern) { @@ -202,9 +216,11 @@ void hb_ot_shape_plan_t::substitute (hb_font_t *font, hb_buffer_t *buffer) const { +#ifndef HB_NO_SHAPE_AAT if (unlikely (apply_morx)) hb_aat_layout_substitute (this, font, buffer); else +#endif map.substitute (this, font, buffer); } @@ -214,15 +230,19 @@ hb_ot_shape_plan_t::position (hb_font_t *font, { if (this->apply_gpos) map.position (this, font, buffer); +#ifndef HB_NO_SHAPE_AAT else if (this->apply_kerx) hb_aat_layout_position (this, font, buffer); +#endif else if (this->apply_kern) hb_ot_layout_kern (this, font, buffer); else _hb_ot_shape_fallback_kern (this, font, buffer); +#ifndef HB_NO_SHAPE_AAT if (this->apply_trak) hb_aat_layout_track (this, font, buffer); +#endif } @@ -318,6 +338,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, feature->value); } +#ifndef HB_NO_SHAPE_AAT if (planner->apply_morx) { hb_aat_map_builder_t *aat_map = &planner->aat_map; @@ -327,6 +348,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, aat_map->add_feature (feature->tag, feature->value); } } +#endif if (planner->shaper->override_features) planner->shaper->override_features (planner); @@ -761,8 +783,10 @@ static inline void hb_ot_substitute_post (const hb_ot_shape_context_t *c) { hb_ot_hide_default_ignorables (c->buffer, c->font); +#ifndef HB_NO_SHAPE_AAT if (c->plan->apply_morx) hb_aat_layout_remove_deleted_glyphs (c->buffer); +#endif if (c->plan->shaper->postprocess_glyphs) c->plan->shaper->postprocess_glyphs (c->plan, c->buffer, c->font); @@ -896,8 +920,10 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c) /* Finish off. Has to follow a certain order. */ hb_ot_layout_position_finish_advances (c->font, c->buffer); hb_ot_zero_width_default_ignorables (c->buffer); +#ifndef HB_NO_SHAPE_AAT if (c->plan->apply_morx) hb_aat_layout_zero_width_deleted_glyphs (c->buffer); +#endif hb_ot_layout_position_finish_offsets (c->font, c->buffer); /* The nil glyph_h_origin() func returns 0, so no need to apply it. */ @@ -962,12 +988,12 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c) c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT; if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR))) { - c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR, + c->buffer->max_len = hb_max (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR, (unsigned) HB_BUFFER_MAX_LEN_MIN); } if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR))) { - c->buffer->max_ops = MAX (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR, + c->buffer->max_ops = hb_max (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR, (unsigned) HB_BUFFER_MAX_OPS_MIN); } diff --git a/src/hb-ot-stat-table.hh b/src/hb-ot-stat-table.hh index 04a2ee99e..e29d1ced7 100644 --- a/src/hb-ot-stat-table.hh +++ b/src/hb-ot-stat-table.hh @@ -249,7 +249,7 @@ struct STAT * in the 'fvar' table. In all fonts, must * be greater than zero if axisValueCount * is greater than zero. */ - LNNOffsetTo > + LNNOffsetTo> designAxesOffset; /* Offset in bytes from the beginning of * the STAT table to the start of the design @@ -257,7 +257,7 @@ struct STAT * set to zero; if designAxisCount is greater * than zero, must be greater than zero. */ HBUINT16 axisValueCount; /* The number of axis value tables. */ - LNNOffsetTo > > + LNNOffsetTo>> offsetToAxisValueOffsets; /* Offset in bytes from the beginning of * the STAT table to the start of the design diff --git a/src/hb-ot-tag-table.hh b/src/hb-ot-tag-table.hh index 09e162718..d8fcd2fdb 100644 --- a/src/hb-ot-tag-table.hh +++ b/src/hb-ot-tag-table.hh @@ -7,1054 +7,1052 @@ * on files with these headers: * * - * File-Date: 2019-02-20 + * File-Date: 2019-04-03 */ #ifndef HB_OT_TAG_TABLE_HH #define HB_OT_TAG_TABLE_HH static const LangTag ot_languages[] = { - {"aa", {HB_TAG('A','F','R',' ')}}, /* Afar */ - {"aae", {HB_TAG('S','Q','I',' ')}}, /* Arbëreshë Albanian -> Albanian */ - {"aao", {HB_TAG('A','R','A',' ')}}, /* Algerian Saharan Arabic -> Arabic */ - {"aat", {HB_TAG('S','Q','I',' ')}}, /* Arvanitika Albanian -> Albanian */ - {"ab", {HB_TAG('A','B','K',' ')}}, /* Abkhazian */ - {"abh", {HB_TAG('A','R','A',' ')}}, /* Tajiki Arabic -> Arabic */ - {"abq", {HB_TAG('A','B','A',' ')}}, /* Abaza */ - {"abv", {HB_TAG('A','R','A',' ')}}, /* Baharna Arabic -> Arabic */ - {"acf", {HB_TAG('F','A','N',' ')}}, /* Saint Lucian Creole French -> French Antillean */ - {"ach", {HB_TAG('A','C','H',' ')}}, /* Acoli -> Acholi */ - {"acm", {HB_TAG('A','R','A',' ')}}, /* Mesopotamian Arabic -> Arabic */ - {"acq", {HB_TAG('A','R','A',' ')}}, /* Ta'izzi-Adeni Arabic -> Arabic */ - {"acr", {HB_TAG('A','C','R',' ')}}, /* Achi */ - {"acw", {HB_TAG('A','R','A',' ')}}, /* Hijazi Arabic -> Arabic */ - {"acx", {HB_TAG('A','R','A',' ')}}, /* Omani Arabic -> Arabic */ - {"acy", {HB_TAG('A','R','A',' ')}}, /* Cypriot Arabic -> Arabic */ - {"ada", {HB_TAG('D','N','G',' ')}}, /* Adangme -> Dangme */ - {"adf", {HB_TAG('A','R','A',' ')}}, /* Dhofari Arabic -> Arabic */ - {"adp", {HB_TAG('D','Z','N',' ')}}, /* Adap (retired code) -> Dzongkha */ - {"ady", {HB_TAG('A','D','Y',' ')}}, /* Adyghe */ - {"aeb", {HB_TAG('A','R','A',' ')}}, /* Tunisian Arabic -> Arabic */ - {"aec", {HB_TAG('A','R','A',' ')}}, /* Saidi Arabic -> Arabic */ - {"af", {HB_TAG('A','F','K',' ')}}, /* Afrikaans */ - {"afb", {HB_TAG('A','R','A',' ')}}, /* Gulf Arabic -> Arabic */ - {"ahg", {HB_TAG('A','G','W',' ')}}, /* Qimant -> Agaw */ - {"aht", {HB_TAG('A','T','H',' ')}}, /* Ahtena -> Athapaskan */ - {"aii", {HB_TAG('S','W','A',' '), /* Assyrian Neo-Aramaic -> Swadaya Aramaic */ - HB_TAG('S','Y','R',' ')}}, /* Assyrian Neo-Aramaic -> Syriac */ - {"aio", {HB_TAG('A','I','O',' ')}}, /* Aiton */ - {"aiw", {HB_TAG('A','R','I',' ')}}, /* Aari */ - {"ajp", {HB_TAG('A','R','A',' ')}}, /* South Levantine Arabic -> Arabic */ - {"ak", {HB_TAG('A','K','A',' '), /* Akan [macrolanguage] */ - HB_TAG('T','W','I',' ')}}, /* Akan [macrolanguage] -> Twi */ - {"aln", {HB_TAG('S','Q','I',' ')}}, /* Gheg Albanian -> Albanian */ - {"als", {HB_TAG('S','Q','I',' ')}}, /* Tosk Albanian -> Albanian */ - {"alt", {HB_TAG('A','L','T',' ')}}, /* Southern Altai -> Altai */ - {"am", {HB_TAG('A','M','H',' ')}}, /* Amharic */ - {"amf", {HB_TAG('H','B','N',' ')}}, /* Hamer-Banna -> Hammer-Banna */ - {"amw", {HB_TAG('S','Y','R',' ')}}, /* Western Neo-Aramaic -> Syriac */ - {"an", {HB_TAG('A','R','G',' ')}}, /* Aragonese */ - {"ang", {HB_TAG('A','N','G',' ')}}, /* Old English (ca. 450-1100) -> Anglo-Saxon */ - {"apc", {HB_TAG('A','R','A',' ')}}, /* North Levantine Arabic -> Arabic */ - {"apd", {HB_TAG('A','R','A',' ')}}, /* Sudanese Arabic -> Arabic */ - {"apj", {HB_TAG('A','T','H',' ')}}, /* Jicarilla Apache -> Athapaskan */ - {"apk", {HB_TAG('A','T','H',' ')}}, /* Kiowa Apache -> Athapaskan */ - {"apl", {HB_TAG('A','T','H',' ')}}, /* Lipan Apache -> Athapaskan */ - {"apm", {HB_TAG('A','T','H',' ')}}, /* Mescalero-Chiricahua Apache -> Athapaskan */ - {"apw", {HB_TAG('A','T','H',' ')}}, /* Western Apache -> Athapaskan */ - {"ar", {HB_TAG('A','R','A',' ')}}, /* Arabic [macrolanguage] */ - {"arb", {HB_TAG('A','R','A',' ')}}, /* Standard Arabic -> Arabic */ - {"arn", {HB_TAG('M','A','P',' ')}}, /* Mapudungun */ - {"arq", {HB_TAG('A','R','A',' ')}}, /* Algerian Arabic -> Arabic */ - {"ars", {HB_TAG('A','R','A',' ')}}, /* Najdi Arabic -> Arabic */ - {"ary", {HB_TAG('M','O','R',' ')}}, /* Moroccan Arabic -> Moroccan */ - {"arz", {HB_TAG('A','R','A',' ')}}, /* Egyptian Arabic -> Arabic */ - {"as", {HB_TAG('A','S','M',' ')}}, /* Assamese */ - {"ast", {HB_TAG('A','S','T',' ')}}, /* Asturian */ - {"ath", {HB_TAG('A','T','H',' ')}}, /* Athapascan [family] -> Athapaskan */ - {"atj", {HB_TAG('R','C','R',' ')}}, /* Atikamekw -> R-Cree */ - {"atv", {HB_TAG('A','L','T',' ')}}, /* Northern Altai -> Altai */ - {"auz", {HB_TAG('A','R','A',' ')}}, /* Uzbeki Arabic -> Arabic */ - {"av", {HB_TAG('A','V','R',' ')}}, /* Avaric -> Avar */ - {"avl", {HB_TAG('A','R','A',' ')}}, /* Eastern Egyptian Bedawi Arabic -> Arabic */ - {"awa", {HB_TAG('A','W','A',' ')}}, /* Awadhi */ - {"ay", {HB_TAG('A','Y','M',' ')}}, /* Aymara [macrolanguage] */ - {"ayc", {HB_TAG('A','Y','M',' ')}}, /* Southern Aymara -> Aymara */ - {"ayh", {HB_TAG('A','R','A',' ')}}, /* Hadrami Arabic -> Arabic */ - {"ayl", {HB_TAG('A','R','A',' ')}}, /* Libyan Arabic -> Arabic */ - {"ayn", {HB_TAG('A','R','A',' ')}}, /* Sanaani Arabic -> Arabic */ - {"ayp", {HB_TAG('A','R','A',' ')}}, /* North Mesopotamian Arabic -> Arabic */ - {"ayr", {HB_TAG('A','Y','M',' ')}}, /* Central Aymara -> Aymara */ - {"az", {HB_TAG('A','Z','E',' ')}}, /* Azerbaijani [macrolanguage] */ - {"azb", {HB_TAG('A','Z','B',' ')}}, /* South Azerbaijani -> Torki */ - {"azj", {HB_TAG('A','Z','E',' ')}}, /* North Azerbaijani -> Azerbaijani */ - {"ba", {HB_TAG('B','S','H',' ')}}, /* Bashkir */ - {"bad", {HB_TAG('B','A','D','0')}}, /* Banda [family] */ - {"bai", {HB_TAG('B','M','L',' ')}}, /* Bamileke [family] */ - {"bal", {HB_TAG('B','L','I',' ')}}, /* Baluchi [macrolanguage] */ - {"ban", {HB_TAG('B','A','N',' ')}}, /* Balinese */ - {"bar", {HB_TAG('B','A','R',' ')}}, /* Bavarian */ - {"bbc", {HB_TAG('B','B','C',' ')}}, /* Batak Toba */ - {"bbz", {HB_TAG('A','R','A',' ')}}, /* Babalia Creole Arabic -> Arabic */ - {"bcc", {HB_TAG('B','L','I',' ')}}, /* Southern Balochi -> Baluchi */ - {"bci", {HB_TAG('B','A','U',' ')}}, /* Baoulé -> Baulé */ - {"bcl", {HB_TAG('B','I','K',' ')}}, /* Central Bikol -> Bikol */ - {"bcq", {HB_TAG('B','C','H',' ')}}, /* Bench */ - {"bcr", {HB_TAG('A','T','H',' ')}}, /* Babine -> Athapaskan */ - {"bdy", {HB_TAG('B','D','Y',' ')}}, /* Bandjalang */ - {"be", {HB_TAG('B','E','L',' ')}}, /* Belarusian -> Belarussian */ - {"bea", {HB_TAG('A','T','H',' ')}}, /* Beaver -> Athapaskan */ - {"beb", {HB_TAG('B','T','I',' ')}}, /* Bebele -> Beti */ - {"bem", {HB_TAG('B','E','M',' ')}}, /* Bemba (Zambia) */ - {"ber", {HB_TAG('B','B','R',' ')}}, /* Berber [family] */ - {"bfq", {HB_TAG('B','A','D',' ')}}, /* Badaga */ - {"bft", {HB_TAG('B','L','T',' ')}}, /* Balti */ - {"bfu", {HB_TAG('L','A','H',' ')}}, /* Gahri -> Lahuli */ - {"bfy", {HB_TAG('B','A','G',' ')}}, /* Bagheli -> Baghelkhandi */ - {"bg", {HB_TAG('B','G','R',' ')}}, /* Bulgarian */ - {"bgc", {HB_TAG('B','G','C',' ')}}, /* Haryanvi */ - {"bgn", {HB_TAG('B','L','I',' ')}}, /* Western Balochi -> Baluchi */ - {"bgp", {HB_TAG('B','L','I',' ')}}, /* Eastern Balochi -> Baluchi */ - {"bgq", {HB_TAG('B','G','Q',' ')}}, /* Bagri */ - {"bgr", {HB_TAG('Q','I','N',' ')}}, /* Bawm Chin -> Chin */ - {"bhb", {HB_TAG('B','H','I',' ')}}, /* Bhili */ - {"bhi", {HB_TAG('B','H','I',' ')}}, /* Bhilali -> Bhili */ - {"bhk", {HB_TAG('B','I','K',' ')}}, /* Albay Bicolano (retired code) -> Bikol */ - {"bho", {HB_TAG('B','H','O',' ')}}, /* Bhojpuri */ - {"bhr", {HB_TAG('M','L','G',' ')}}, /* Bara Malagasy -> Malagasy */ - {"bi", {HB_TAG('B','I','S',' ')}}, /* Bislama */ - {"bik", {HB_TAG('B','I','K',' ')}}, /* Bikol [macrolanguage] */ - {"bin", {HB_TAG('E','D','O',' ')}}, /* Edo */ - {"bjj", {HB_TAG('B','J','J',' ')}}, /* Kanauji */ - {"bjn", {HB_TAG('M','L','Y',' ')}}, /* Banjar -> Malay */ - {"bjq", {HB_TAG('M','L','G',' ')}}, /* Southern Betsimisaraka Malagasy (retired code) -> Malagasy */ - {"bjt", {HB_TAG('B','L','N',' ')}}, /* Balanta-Ganja -> Balante */ - {"bla", {HB_TAG('B','K','F',' ')}}, /* Siksika -> Blackfoot */ - {"ble", {HB_TAG('B','L','N',' ')}}, /* Balanta-Kentohe -> Balante */ - {"blk", {HB_TAG('B','L','K',' ')}}, /* Pa’o Karen */ - {"bln", {HB_TAG('B','I','K',' ')}}, /* Southern Catanduanes Bikol -> Bikol */ - {"bm", {HB_TAG('B','M','B',' ')}}, /* Bambara (Bamanankan) */ - {"bmm", {HB_TAG('M','L','G',' ')}}, /* Northern Betsimisaraka Malagasy -> Malagasy */ - {"bn", {HB_TAG('B','E','N',' ')}}, /* Bengali */ - {"bo", {HB_TAG('T','I','B',' ')}}, /* Tibetan */ - {"bpy", {HB_TAG('B','P','Y',' ')}}, /* Bishnupriya -> Bishnupriya Manipuri */ - {"bqi", {HB_TAG('L','R','C',' ')}}, /* Bakhtiari -> Luri */ - {"br", {HB_TAG('B','R','E',' ')}}, /* Breton */ - {"bra", {HB_TAG('B','R','I',' ')}}, /* Braj -> Braj Bhasha */ - {"brh", {HB_TAG('B','R','H',' ')}}, /* Brahui */ - {"brx", {HB_TAG('B','R','X',' ')}}, /* Bodo (India) */ - {"bs", {HB_TAG('B','O','S',' ')}}, /* Bosnian */ - {"bsk", {HB_TAG('B','S','K',' ')}}, /* Burushaski */ - {"btb", {HB_TAG('B','T','I',' ')}}, /* Beti (Cameroon) (retired code) */ - {"btj", {HB_TAG('M','L','Y',' ')}}, /* Bacanese Malay -> Malay */ - {"bto", {HB_TAG('B','I','K',' ')}}, /* Rinconada Bikol -> Bikol */ - {"bts", {HB_TAG('B','T','S',' ')}}, /* Batak Simalungun */ - {"bug", {HB_TAG('B','U','G',' ')}}, /* Buginese -> Bugis */ - {"bum", {HB_TAG('B','T','I',' ')}}, /* Bulu (Cameroon) -> Beti */ - {"bve", {HB_TAG('M','L','Y',' ')}}, /* Berau Malay -> Malay */ - {"bvu", {HB_TAG('M','L','Y',' ')}}, /* Bukit Malay -> Malay */ - {"bxk", {HB_TAG('L','U','H',' ')}}, /* Bukusu -> Luyia */ - {"bxp", {HB_TAG('B','T','I',' ')}}, /* Bebil -> Beti */ - {"bxr", {HB_TAG('R','B','U',' ')}}, /* Russia Buriat -> Russian Buriat */ - {"byn", {HB_TAG('B','I','L',' ')}}, /* Bilin -> Bilen */ - {"byv", {HB_TAG('B','Y','V',' ')}}, /* Medumba */ - {"bzc", {HB_TAG('M','L','G',' ')}}, /* Southern Betsimisaraka Malagasy -> Malagasy */ - {"ca", {HB_TAG('C','A','T',' ')}}, /* Catalan */ - {"caf", {HB_TAG('C','R','R',' '), /* Southern Carrier -> Carrier */ - HB_TAG('A','T','H',' ')}}, /* Southern Carrier -> Athapaskan */ - {"cak", {HB_TAG('C','A','K',' ')}}, /* Kaqchikel */ - {"cbk", {HB_TAG('C','B','K',' ')}}, /* Chavacano -> Zamboanga Chavacano */ - {"cbl", {HB_TAG('Q','I','N',' ')}}, /* Bualkhaw Chin -> Chin */ - {"cco", {HB_TAG('C','C','H','N')}}, /* Comaltepec Chinantec -> Chinantec */ - {"ccq", {HB_TAG('A','R','K',' ')}}, /* Chaungtha (retired code) -> Rakhine */ - {"cdo", {HB_TAG('Z','H','S',' ')}}, /* Min Dong Chinese -> Chinese Simplified */ - {"ce", {HB_TAG('C','H','E',' ')}}, /* Chechen */ - {"ceb", {HB_TAG('C','E','B',' ')}}, /* Cebuano */ - {"cfm", {HB_TAG('H','A','L',' ')}}, /* Halam (Falam Chin) */ - {"cgg", {HB_TAG('C','G','G',' ')}}, /* Chiga */ - {"ch", {HB_TAG('C','H','A',' ')}}, /* Chamorro */ - {"chj", {HB_TAG('C','C','H','N')}}, /* Ojitlán Chinantec -> Chinantec */ - {"chk", {HB_TAG('C','H','K','0')}}, /* Chuukese */ - {"cho", {HB_TAG('C','H','O',' ')}}, /* Choctaw */ - {"chp", {HB_TAG('C','H','P',' '), /* Chipewyan */ - HB_TAG('S','A','Y',' '), /* Chipewyan -> Sayisi */ - HB_TAG('A','T','H',' ')}}, /* Chipewyan -> Athapaskan */ - {"chq", {HB_TAG('C','C','H','N')}}, /* Quiotepec Chinantec -> Chinantec */ - {"chr", {HB_TAG('C','H','R',' ')}}, /* Cherokee */ - {"chy", {HB_TAG('C','H','Y',' ')}}, /* Cheyenne */ - {"chz", {HB_TAG('C','C','H','N')}}, /* Ozumacín Chinantec -> Chinantec */ - {"ciw", {HB_TAG('O','J','B',' ')}}, /* Chippewa -> Ojibway */ - {"cja", {HB_TAG('C','J','A',' ')}}, /* Western Cham */ - {"cjm", {HB_TAG('C','J','M',' ')}}, /* Eastern Cham */ - {"cjy", {HB_TAG('Z','H','S',' ')}}, /* Jinyu Chinese -> Chinese Simplified */ - {"cka", {HB_TAG('Q','I','N',' ')}}, /* Khumi Awa Chin (retired code) -> Chin */ - {"ckb", {HB_TAG('K','U','R',' ')}}, /* Central Kurdish -> Kurdish */ - {"ckt", {HB_TAG('C','H','K',' ')}}, /* Chukot -> Chukchi */ - {"clc", {HB_TAG('A','T','H',' ')}}, /* Chilcotin -> Athapaskan */ - {"cld", {HB_TAG('S','Y','R',' ')}}, /* Chaldean Neo-Aramaic -> Syriac */ - {"cle", {HB_TAG('C','C','H','N')}}, /* Lealao Chinantec -> Chinantec */ - {"cmn", {HB_TAG('Z','H','S',' ')}}, /* Mandarin Chinese -> Chinese Simplified */ - {"cmr", {HB_TAG('Q','I','N',' ')}}, /* Mro-Khimi Chin -> Chin */ - {"cnb", {HB_TAG('Q','I','N',' ')}}, /* Chinbon Chin -> Chin */ - {"cnh", {HB_TAG('Q','I','N',' ')}}, /* Hakha Chin -> Chin */ - {"cnk", {HB_TAG('Q','I','N',' ')}}, /* Khumi Chin -> Chin */ - {"cnl", {HB_TAG('C','C','H','N')}}, /* Lalana Chinantec -> Chinantec */ - {"cnt", {HB_TAG('C','C','H','N')}}, /* Tepetotutla Chinantec -> Chinantec */ - {"cnw", {HB_TAG('Q','I','N',' ')}}, /* Ngawn Chin -> Chin */ - {"co", {HB_TAG('C','O','S',' ')}}, /* Corsican */ - {"coa", {HB_TAG('M','L','Y',' ')}}, /* Cocos Islands Malay -> Malay */ - {"cop", {HB_TAG('C','O','P',' ')}}, /* Coptic */ - {"coq", {HB_TAG('A','T','H',' ')}}, /* Coquille -> Athapaskan */ - {"cpa", {HB_TAG('C','C','H','N')}}, /* Palantla Chinantec -> Chinantec */ - {"cpe", {HB_TAG('C','P','P',' ')}}, /* English-based creoles and pidgins [family] -> Creoles */ - {"cpf", {HB_TAG('C','P','P',' ')}}, /* French-based creoles and pidgins [family] -> Creoles */ - {"cpp", {HB_TAG('C','P','P',' ')}}, /* Portuguese-based creoles and pidgins [family] -> Creoles */ - {"cpx", {HB_TAG('Z','H','S',' ')}}, /* Pu-Xian Chinese -> Chinese Simplified */ - {"cqd", {HB_TAG('H','M','N',' ')}}, /* Chuanqiandian Cluster Miao -> Hmong */ - {"cqu", {HB_TAG('Q','U','H',' ')}}, /* Chilean Quechua (retired code) -> Quechua (Bolivia) */ - {"cr", {HB_TAG('C','R','E',' '), /* Cree [macrolanguage] */ - HB_TAG('Y','C','R',' ')}}, /* Cree [macrolanguage] -> Y-Cree */ - {"crh", {HB_TAG('C','R','T',' ')}}, /* Crimean Tatar */ - {"crj", {HB_TAG('E','C','R',' ')}}, /* Southern East Cree -> Eastern Cree */ - {"crk", {HB_TAG('W','C','R',' ')}}, /* Plains Cree -> West-Cree */ - {"crl", {HB_TAG('E','C','R',' ')}}, /* Northern East Cree -> Eastern Cree */ - {"crm", {HB_TAG('M','C','R',' '), /* Moose Cree */ - HB_TAG('L','C','R',' ')}}, /* Moose Cree -> L-Cree */ - {"crp", {HB_TAG('C','P','P',' ')}}, /* Creoles and pidgins [family] -> Creoles */ - {"crx", {HB_TAG('C','R','R',' '), /* Carrier */ - HB_TAG('A','T','H',' ')}}, /* Carrier -> Athapaskan */ - {"cs", {HB_TAG('C','S','Y',' ')}}, /* Czech */ - {"csa", {HB_TAG('C','C','H','N')}}, /* Chiltepec Chinantec -> Chinantec */ - {"csb", {HB_TAG('C','S','B',' ')}}, /* Kashubian */ - {"csh", {HB_TAG('Q','I','N',' ')}}, /* Asho Chin -> Chin */ - {"cso", {HB_TAG('C','C','H','N')}}, /* Sochiapam Chinantec -> Chinantec */ - {"csw", {HB_TAG('N','C','R',' '), /* Swampy Cree -> N-Cree */ - HB_TAG('N','H','C',' ')}}, /* Swampy Cree -> Norway House Cree */ - {"csy", {HB_TAG('Q','I','N',' ')}}, /* Siyin Chin -> Chin */ - {"ctc", {HB_TAG('A','T','H',' ')}}, /* Chetco -> Athapaskan */ - {"ctd", {HB_TAG('Q','I','N',' ')}}, /* Tedim Chin -> Chin */ - {"cte", {HB_TAG('C','C','H','N')}}, /* Tepinapa Chinantec -> Chinantec */ - {"ctg", {HB_TAG('C','T','G',' ')}}, /* Chittagonian */ - {"ctl", {HB_TAG('C','C','H','N')}}, /* Tlacoatzintepec Chinantec -> Chinantec */ - {"cts", {HB_TAG('B','I','K',' ')}}, /* Northern Catanduanes Bikol -> Bikol */ - {"cu", {HB_TAG('C','S','L',' ')}}, /* Church Slavonic */ - {"cuc", {HB_TAG('C','C','H','N')}}, /* Usila Chinantec -> Chinantec */ - {"cuk", {HB_TAG('C','U','K',' ')}}, /* San Blas Kuna */ - {"cv", {HB_TAG('C','H','U',' ')}}, /* Chuvash */ - {"cvn", {HB_TAG('C','C','H','N')}}, /* Valle Nacional Chinantec -> Chinantec */ - {"cwd", {HB_TAG('D','C','R',' '), /* Woods Cree */ - HB_TAG('T','C','R',' ')}}, /* Woods Cree -> TH-Cree */ - {"cy", {HB_TAG('W','E','L',' ')}}, /* Welsh */ - {"czh", {HB_TAG('Z','H','S',' ')}}, /* Huizhou Chinese -> Chinese Simplified */ - {"czo", {HB_TAG('Z','H','S',' ')}}, /* Min Zhong Chinese -> Chinese Simplified */ - {"czt", {HB_TAG('Q','I','N',' ')}}, /* Zotung Chin -> Chin */ - {"da", {HB_TAG('D','A','N',' ')}}, /* Danish */ - {"dao", {HB_TAG('Q','I','N',' ')}}, /* Daai Chin -> Chin */ - {"dap", {HB_TAG('N','I','S',' ')}}, /* Nisi (India) (retired code) */ - {"dar", {HB_TAG('D','A','R',' ')}}, /* Dargwa */ - {"dax", {HB_TAG('D','A','X',' ')}}, /* Dayi */ - {"de", {HB_TAG('D','E','U',' ')}}, /* German */ - {"den", {HB_TAG('S','L','A',' '), /* Slave (Athapascan) [macrolanguage] -> Slavey */ - HB_TAG('A','T','H',' ')}}, /* Slave (Athapascan) [macrolanguage] -> Athapaskan */ - {"dgo", {HB_TAG('D','G','O',' ')}}, /* Dogri */ - {"dgr", {HB_TAG('A','T','H',' ')}}, /* Dogrib -> Athapaskan */ - {"dhd", {HB_TAG('M','A','W',' ')}}, /* Dhundari -> Marwari */ - {"dhg", {HB_TAG('D','H','G',' ')}}, /* Dhangu */ - {"dib", {HB_TAG('D','N','K',' ')}}, /* South Central Dinka -> Dinka */ - {"dik", {HB_TAG('D','N','K',' ')}}, /* Southwestern Dinka -> Dinka */ - {"din", {HB_TAG('D','N','K',' ')}}, /* Dinka [macrolanguage] */ - {"dip", {HB_TAG('D','N','K',' ')}}, /* Northeastern Dinka -> Dinka */ - {"diq", {HB_TAG('D','I','Q',' ')}}, /* Dimli */ - {"diw", {HB_TAG('D','N','K',' ')}}, /* Northwestern Dinka -> Dinka */ - {"dje", {HB_TAG('D','J','R',' ')}}, /* Zarma */ - {"djr", {HB_TAG('D','J','R','0')}}, /* Djambarrpuyngu */ - {"dks", {HB_TAG('D','N','K',' ')}}, /* Southeastern Dinka -> Dinka */ - {"dng", {HB_TAG('D','U','N',' ')}}, /* Dungan */ - {"dnj", {HB_TAG('D','N','J',' ')}}, /* Dan */ - {"doi", {HB_TAG('D','G','R',' ')}}, /* Dogri [macrolanguage] */ - {"drh", {HB_TAG('M','N','G',' ')}}, /* Darkhat (retired code) -> Mongolian */ - {"drw", {HB_TAG('D','R','I',' ')}}, /* Darwazi (retired code) -> Dari */ - {"dsb", {HB_TAG('L','S','B',' ')}}, /* Lower Sorbian */ - {"dty", {HB_TAG('N','E','P',' ')}}, /* Dotyali -> Nepali */ - {"duj", {HB_TAG('D','U','J',' ')}}, /* Dhuwal (retired code) */ - {"dup", {HB_TAG('M','L','Y',' ')}}, /* Duano -> Malay */ - {"dv", {HB_TAG('D','I','V',' '), /* Divehi (Dhivehi, Maldivian) */ - HB_TAG('D','H','V',' ')}}, /* Divehi (Dhivehi, Maldivian) (deprecated) */ - {"dwu", {HB_TAG('D','U','J',' ')}}, /* Dhuwal */ - {"dwy", {HB_TAG('D','U','J',' ')}}, /* Dhuwaya -> Dhuwal */ - {"dyu", {HB_TAG('J','U','L',' ')}}, /* Dyula -> Jula */ - {"dz", {HB_TAG('D','Z','N',' ')}}, /* Dzongkha */ - {"ee", {HB_TAG('E','W','E',' ')}}, /* Ewe */ - {"efi", {HB_TAG('E','F','I',' ')}}, /* Efik */ - {"ekk", {HB_TAG('E','T','I',' ')}}, /* Standard Estonian -> Estonian */ - {"el", {HB_TAG('E','L','L',' ')}}, /* Modern Greek (1453-) -> Greek */ - {"emk", {HB_TAG('E','M','K',' '), /* Eastern Maninkakan */ - HB_TAG('M','N','K',' ')}}, /* Eastern Maninkakan -> Maninka */ - {"en", {HB_TAG('E','N','G',' ')}}, /* English */ - {"enb", {HB_TAG('K','A','L',' ')}}, /* Markweeta -> Kalenjin */ - {"enf", {HB_TAG('F','N','E',' ')}}, /* Forest Enets -> Forest Nenets */ - {"enh", {HB_TAG('T','N','E',' ')}}, /* Tundra Enets -> Tundra Nenets */ - {"eo", {HB_TAG('N','T','O',' ')}}, /* Esperanto */ - {"es", {HB_TAG('E','S','P',' ')}}, /* Spanish */ - {"esg", {HB_TAG('G','O','N',' ')}}, /* Aheri Gondi -> Gondi */ - {"esi", {HB_TAG('I','P','K',' ')}}, /* North Alaskan Inupiatun -> Inupiat */ - {"esk", {HB_TAG('I','P','K',' ')}}, /* Northwest Alaska Inupiatun -> Inupiat */ - {"esu", {HB_TAG('E','S','U',' ')}}, /* Central Yupik */ - {"et", {HB_TAG('E','T','I',' ')}}, /* Estonian [macrolanguage] */ - {"eto", {HB_TAG('B','T','I',' ')}}, /* Eton (Cameroon) -> Beti */ - {"eu", {HB_TAG('E','U','Q',' ')}}, /* Basque */ - {"eve", {HB_TAG('E','V','N',' ')}}, /* Even */ - {"evn", {HB_TAG('E','V','K',' ')}}, /* Evenki */ - {"ewo", {HB_TAG('B','T','I',' ')}}, /* Ewondo -> Beti */ - {"eyo", {HB_TAG('K','A','L',' ')}}, /* Keiyo -> Kalenjin */ - {"fa", {HB_TAG('F','A','R',' ')}}, /* Persian [macrolanguage] */ - {"fan", {HB_TAG('F','A','N','0')}}, /* Fang (Equatorial Guinea) */ - {"fat", {HB_TAG('F','A','T',' ')}}, /* Fanti */ - {"fbl", {HB_TAG('B','I','K',' ')}}, /* West Albay Bikol -> Bikol */ - {"ff", {HB_TAG('F','U','L',' ')}}, /* Fulah [macrolanguage] */ - {"ffm", {HB_TAG('F','U','L',' ')}}, /* Maasina Fulfulde -> Fulah */ - {"fi", {HB_TAG('F','I','N',' ')}}, /* Finnish */ - {"fil", {HB_TAG('P','I','L',' ')}}, /* Filipino */ - {"fj", {HB_TAG('F','J','I',' ')}}, /* Fijian */ - {"flm", {HB_TAG('H','A','L',' '), /* Halam (Falam Chin) (retired code) */ - HB_TAG('Q','I','N',' ')}}, /* Falam Chin (retired code) -> Chin */ - {"fmp", {HB_TAG('F','M','P',' ')}}, /* Fe’fe’ */ - {"fo", {HB_TAG('F','O','S',' ')}}, /* Faroese */ - {"fon", {HB_TAG('F','O','N',' ')}}, /* Fon */ - {"fr", {HB_TAG('F','R','A',' ')}}, /* French */ - {"frc", {HB_TAG('F','R','C',' ')}}, /* Cajun French */ - {"frp", {HB_TAG('F','R','P',' ')}}, /* Arpitan */ - {"fub", {HB_TAG('F','U','L',' ')}}, /* Adamawa Fulfulde -> Fulah */ - {"fuc", {HB_TAG('F','U','L',' ')}}, /* Pulaar -> Fulah */ - {"fue", {HB_TAG('F','U','L',' ')}}, /* Borgu Fulfulde -> Fulah */ - {"fuf", {HB_TAG('F','T','A',' ')}}, /* Pular -> Futa */ - {"fuh", {HB_TAG('F','U','L',' ')}}, /* Western Niger Fulfulde -> Fulah */ - {"fui", {HB_TAG('F','U','L',' ')}}, /* Bagirmi Fulfulde -> Fulah */ - {"fuq", {HB_TAG('F','U','L',' ')}}, /* Central-Eastern Niger Fulfulde -> Fulah */ - {"fur", {HB_TAG('F','R','L',' ')}}, /* Friulian */ - {"fuv", {HB_TAG('F','U','V',' ')}}, /* Nigerian Fulfulde */ - {"fy", {HB_TAG('F','R','I',' ')}}, /* Western Frisian -> Frisian */ - {"ga", {HB_TAG('I','R','I',' ')}}, /* Irish */ - {"gaa", {HB_TAG('G','A','D',' ')}}, /* Ga */ - {"gag", {HB_TAG('G','A','G',' ')}}, /* Gagauz */ - {"gan", {HB_TAG('Z','H','S',' ')}}, /* Gan Chinese -> Chinese Simplified */ - {"gax", {HB_TAG('O','R','O',' ')}}, /* Borana-Arsi-Guji Oromo -> Oromo */ - {"gaz", {HB_TAG('O','R','O',' ')}}, /* West Central Oromo -> Oromo */ - {"gbm", {HB_TAG('G','A','W',' ')}}, /* Garhwali */ - {"gce", {HB_TAG('A','T','H',' ')}}, /* Galice -> Athapaskan */ - {"gd", {HB_TAG('G','A','E',' ')}}, /* Scottish Gaelic (Gaelic) */ - {"gda", {HB_TAG('R','A','J',' ')}}, /* Gade Lohar -> Rajasthani */ - {"gez", {HB_TAG('G','E','Z',' ')}}, /* Geez */ - {"ggo", {HB_TAG('G','O','N',' ')}}, /* Southern Gondi (retired code) -> Gondi */ - {"gih", {HB_TAG('G','I','H',' ')}}, /* Githabul */ - {"gil", {HB_TAG('G','I','L','0')}}, /* Kiribati (Gilbertese) */ - {"gju", {HB_TAG('R','A','J',' ')}}, /* Gujari -> Rajasthani */ - {"gkp", {HB_TAG('G','K','P',' ')}}, /* Guinea Kpelle -> Kpelle (Guinea) */ - {"gl", {HB_TAG('G','A','L',' ')}}, /* Galician */ - {"gld", {HB_TAG('N','A','N',' ')}}, /* Nanai */ - {"glk", {HB_TAG('G','L','K',' ')}}, /* Gilaki */ - {"gn", {HB_TAG('G','U','A',' ')}}, /* Guarani [macrolanguage] */ - {"gnn", {HB_TAG('G','N','N',' ')}}, /* Gumatj */ - {"gno", {HB_TAG('G','O','N',' ')}}, /* Northern Gondi -> Gondi */ - {"gnw", {HB_TAG('G','U','A',' ')}}, /* Western Bolivian Guaraní -> Guarani */ - {"gog", {HB_TAG('G','O','G',' ')}}, /* Gogo */ - {"gom", {HB_TAG('K','O','K',' ')}}, /* Goan Konkani -> Konkani */ - {"gon", {HB_TAG('G','O','N',' ')}}, /* Gondi [macrolanguage] */ - {"grt", {HB_TAG('G','R','O',' ')}}, /* Garo */ - {"gru", {HB_TAG('S','O','G',' ')}}, /* Kistane -> Sodo Gurage */ - {"gsw", {HB_TAG('A','L','S',' ')}}, /* Alsatian */ - {"gu", {HB_TAG('G','U','J',' ')}}, /* Gujarati */ - {"guc", {HB_TAG('G','U','C',' ')}}, /* Wayuu */ - {"guf", {HB_TAG('G','U','F',' ')}}, /* Gupapuyngu */ - {"gug", {HB_TAG('G','U','A',' ')}}, /* Paraguayan Guaraní -> Guarani */ - {"gui", {HB_TAG('G','U','A',' ')}}, /* Eastern Bolivian Guaraní -> Guarani */ - {"guk", {HB_TAG('G','M','Z',' '), /* Gumuz */ - HB_TAG('G','U','K',' ')}}, /* Gumuz (SIL fonts) */ - {"gun", {HB_TAG('G','U','A',' ')}}, /* Mbyá Guaraní -> Guarani */ - {"guz", {HB_TAG('G','U','Z',' ')}}, /* Gusii */ - {"gv", {HB_TAG('M','N','X',' ')}}, /* Manx */ - {"gwi", {HB_TAG('A','T','H',' ')}}, /* Gwichʼin -> Athapaskan */ - {"ha", {HB_TAG('H','A','U',' ')}}, /* Hausa */ - {"haa", {HB_TAG('A','T','H',' ')}}, /* Han -> Athapaskan */ - {"hae", {HB_TAG('O','R','O',' ')}}, /* Eastern Oromo -> Oromo */ - {"hak", {HB_TAG('Z','H','S',' ')}}, /* Hakka Chinese -> Chinese Simplified */ - {"har", {HB_TAG('H','R','I',' ')}}, /* Harari */ - {"haw", {HB_TAG('H','A','W',' ')}}, /* Hawaiian */ - {"hay", {HB_TAG('H','A','Y',' ')}}, /* Haya */ - {"haz", {HB_TAG('H','A','Z',' ')}}, /* Hazaragi */ - {"he", {HB_TAG('I','W','R',' ')}}, /* Hebrew */ - {"hea", {HB_TAG('H','M','N',' ')}}, /* Northern Qiandong Miao -> Hmong */ - {"hi", {HB_TAG('H','I','N',' ')}}, /* Hindi */ - {"hil", {HB_TAG('H','I','L',' ')}}, /* Hiligaynon */ - {"hji", {HB_TAG('M','L','Y',' ')}}, /* Haji -> Malay */ - {"hlt", {HB_TAG('Q','I','N',' ')}}, /* Matu Chin -> Chin */ - {"hma", {HB_TAG('H','M','N',' ')}}, /* Southern Mashan Hmong -> Hmong */ - {"hmc", {HB_TAG('H','M','N',' ')}}, /* Central Huishui Hmong -> Hmong */ - {"hmd", {HB_TAG('H','M','N',' ')}}, /* Large Flowery Miao -> Hmong */ - {"hme", {HB_TAG('H','M','N',' ')}}, /* Eastern Huishui Hmong -> Hmong */ - {"hmg", {HB_TAG('H','M','N',' ')}}, /* Southwestern Guiyang Hmong -> Hmong */ - {"hmh", {HB_TAG('H','M','N',' ')}}, /* Southwestern Huishui Hmong -> Hmong */ - {"hmi", {HB_TAG('H','M','N',' ')}}, /* Northern Huishui Hmong -> Hmong */ - {"hmj", {HB_TAG('H','M','N',' ')}}, /* Ge -> Hmong */ - {"hml", {HB_TAG('H','M','N',' ')}}, /* Luopohe Hmong -> Hmong */ - {"hmm", {HB_TAG('H','M','N',' ')}}, /* Central Mashan Hmong -> Hmong */ - {"hmn", {HB_TAG('H','M','N',' ')}}, /* Hmong [macrolanguage] */ - {"hmp", {HB_TAG('H','M','N',' ')}}, /* Northern Mashan Hmong -> Hmong */ - {"hmq", {HB_TAG('H','M','N',' ')}}, /* Eastern Qiandong Miao -> Hmong */ - {"hms", {HB_TAG('H','M','N',' ')}}, /* Southern Qiandong Miao -> Hmong */ - {"hmw", {HB_TAG('H','M','N',' ')}}, /* Western Mashan Hmong -> Hmong */ - {"hmy", {HB_TAG('H','M','N',' ')}}, /* Southern Guiyang Hmong -> Hmong */ - {"hmz", {HB_TAG('H','M','N',' ')}}, /* Hmong Shua -> Hmong */ - {"hnd", {HB_TAG('H','N','D',' ')}}, /* Southern Hindko -> Hindko */ - {"hne", {HB_TAG('C','H','H',' ')}}, /* Chhattisgarhi -> Chattisgarhi */ - {"hnj", {HB_TAG('H','M','N',' ')}}, /* Hmong Njua -> Hmong */ - {"hno", {HB_TAG('H','N','D',' ')}}, /* Northern Hindko -> Hindko */ - {"ho", {HB_TAG('H','M','O',' ')}}, /* Hiri Motu */ - {"hoc", {HB_TAG('H','O',' ',' ')}}, /* Ho */ - {"hoi", {HB_TAG('A','T','H',' ')}}, /* Holikachuk -> Athapaskan */ - {"hoj", {HB_TAG('H','A','R',' ')}}, /* Hadothi -> Harauti */ - {"hr", {HB_TAG('H','R','V',' ')}}, /* Croatian */ - {"hrm", {HB_TAG('H','M','N',' ')}}, /* Horned Miao -> Hmong */ - {"hsb", {HB_TAG('U','S','B',' ')}}, /* Upper Sorbian */ - {"hsn", {HB_TAG('Z','H','S',' ')}}, /* Xiang Chinese -> Chinese Simplified */ - {"ht", {HB_TAG('H','A','I',' ')}}, /* Haitian (Haitian Creole) */ - {"hu", {HB_TAG('H','U','N',' ')}}, /* Hungarian */ - {"huj", {HB_TAG('H','M','N',' ')}}, /* Northern Guiyang Hmong -> Hmong */ - {"hup", {HB_TAG('A','T','H',' ')}}, /* Hupa -> Athapaskan */ - {"hy", {HB_TAG('H','Y','E','0'), /* Armenian -> Armenian East */ - HB_TAG('H','Y','E',' ')}}, /* Armenian */ - {"hyw", {HB_TAG('H','Y','E',' ')}}, /* Western Armenian -> Armenian */ - {"hz", {HB_TAG('H','E','R',' ')}}, /* Herero */ - {"ia", {HB_TAG('I','N','A',' ')}}, /* Interlingua (International Auxiliary Language Association) */ - {"iba", {HB_TAG('I','B','A',' ')}}, /* Iban */ - {"ibb", {HB_TAG('I','B','B',' ')}}, /* Ibibio */ - {"id", {HB_TAG('I','N','D',' ')}}, /* Indonesian */ - {"ida", {HB_TAG('L','U','H',' ')}}, /* Idakho-Isukha-Tiriki -> Luyia */ - {"ie", {HB_TAG('I','L','E',' ')}}, /* Interlingue */ - {"ig", {HB_TAG('I','B','O',' ')}}, /* Igbo */ - {"igb", {HB_TAG('E','B','I',' ')}}, /* Ebira */ - {"ii", {HB_TAG('Y','I','M',' ')}}, /* Sichuan Yi -> Yi Modern */ - {"ijc", {HB_TAG('I','J','O',' ')}}, /* Izon -> Ijo */ - {"ijo", {HB_TAG('I','J','O',' ')}}, /* Ijo [family] */ - {"ik", {HB_TAG('I','P','K',' ')}}, /* Inupiaq [macrolanguage] -> Inupiat */ - {"ike", {HB_TAG('I','N','U',' ')}}, /* Eastern Canadian Inuktitut -> Inuktitut */ - {"ikt", {HB_TAG('I','N','U',' ')}}, /* Inuinnaqtun -> Inuktitut */ - {"ilo", {HB_TAG('I','L','O',' ')}}, /* Iloko -> Ilokano */ - {"in", {HB_TAG('I','N','D',' ')}}, /* Indonesian (retired code) */ - {"ing", {HB_TAG('A','T','H',' ')}}, /* Degexit'an -> Athapaskan */ - {"inh", {HB_TAG('I','N','G',' ')}}, /* Ingush */ - {"io", {HB_TAG('I','D','O',' ')}}, /* Ido */ - {"is", {HB_TAG('I','S','L',' ')}}, /* Icelandic */ - {"it", {HB_TAG('I','T','A',' ')}}, /* Italian */ - {"iu", {HB_TAG('I','N','U',' ')}}, /* Inuktitut [macrolanguage] */ - {"iw", {HB_TAG('I','W','R',' ')}}, /* Hebrew (retired code) */ - {"ja", {HB_TAG('J','A','N',' ')}}, /* Japanese */ - {"jak", {HB_TAG('M','L','Y',' ')}}, /* Jakun -> Malay */ - {"jam", {HB_TAG('J','A','M',' ')}}, /* Jamaican Creole English -> Jamaican Creole */ - {"jax", {HB_TAG('M','L','Y',' ')}}, /* Jambi Malay -> Malay */ - {"jbo", {HB_TAG('J','B','O',' ')}}, /* Lojban */ - {"jct", {HB_TAG('J','C','T',' ')}}, /* Krymchak */ - {"ji", {HB_TAG('J','I','I',' ')}}, /* Yiddish (retired code) */ - {"jv", {HB_TAG('J','A','V',' ')}}, /* Javanese */ - {"jw", {HB_TAG('J','A','V',' ')}}, /* Javanese (retired code) */ - {"ka", {HB_TAG('K','A','T',' ')}}, /* Georgian */ - {"kaa", {HB_TAG('K','R','K',' ')}}, /* Kara-Kalpak -> Karakalpak */ - {"kab", {HB_TAG('K','A','B','0')}}, /* Kabyle */ - {"kam", {HB_TAG('K','M','B',' ')}}, /* Kamba (Kenya) */ - {"kar", {HB_TAG('K','R','N',' ')}}, /* Karen [family] */ - {"kbd", {HB_TAG('K','A','B',' ')}}, /* Kabardian */ - {"kby", {HB_TAG('K','N','R',' ')}}, /* Manga Kanuri -> Kanuri */ - {"kca", {HB_TAG('K','H','K',' '), /* Khanty -> Khanty-Kazim */ - HB_TAG('K','H','S',' '), /* Khanty -> Khanty-Shurishkar */ - HB_TAG('K','H','V',' ')}}, /* Khanty -> Khanty-Vakhi */ - {"kde", {HB_TAG('K','D','E',' ')}}, /* Makonde */ - {"kdr", {HB_TAG('K','R','M',' ')}}, /* Karaim */ - {"kdt", {HB_TAG('K','U','Y',' ')}}, /* Kuy */ - {"kea", {HB_TAG('K','E','A',' ')}}, /* Kabuverdianu (Crioulo) */ - {"kek", {HB_TAG('K','E','K',' ')}}, /* Kekchi */ - {"kex", {HB_TAG('K','K','N',' ')}}, /* Kukna -> Kokni */ - {"kfa", {HB_TAG('K','O','D',' ')}}, /* Kodava -> Kodagu */ - {"kfr", {HB_TAG('K','A','C',' ')}}, /* Kachhi -> Kachchi */ - {"kfx", {HB_TAG('K','U','L',' ')}}, /* Kullu Pahari -> Kulvi */ - {"kfy", {HB_TAG('K','M','N',' ')}}, /* Kumaoni */ - {"kg", {HB_TAG('K','O','N','0')}}, /* Kongo [macrolanguage] */ - {"kha", {HB_TAG('K','S','I',' ')}}, /* Khasi */ - {"khb", {HB_TAG('X','B','D',' ')}}, /* Lü */ - {"khk", {HB_TAG('M','N','G',' ')}}, /* Halh Mongolian -> Mongolian */ - {"kht", {HB_TAG('K','H','N',' '), /* Khamti -> Khamti Shan (Microsoft fonts) */ - HB_TAG('K','H','T',' ')}}, /* Khamti -> Khamti Shan (OpenType spec and SIL fonts) */ - {"khw", {HB_TAG('K','H','W',' ')}}, /* Khowar */ - {"ki", {HB_TAG('K','I','K',' ')}}, /* Kikuyu (Gikuyu) */ - {"kiu", {HB_TAG('K','I','U',' ')}}, /* Kirmanjki */ - {"kj", {HB_TAG('K','U','A',' ')}}, /* Kuanyama */ - {"kjd", {HB_TAG('K','J','D',' ')}}, /* Southern Kiwai */ - {"kjh", {HB_TAG('K','H','A',' ')}}, /* Khakas -> Khakass */ - {"kjp", {HB_TAG('K','J','P',' ')}}, /* Pwo Eastern Karen -> Eastern Pwo Karen */ - {"kjz", {HB_TAG('K','J','Z',' ')}}, /* Bumthangkha */ - {"kk", {HB_TAG('K','A','Z',' ')}}, /* Kazakh */ - {"kkz", {HB_TAG('A','T','H',' ')}}, /* Kaska -> Athapaskan */ - {"kl", {HB_TAG('G','R','N',' ')}}, /* Greenlandic */ - {"kln", {HB_TAG('K','A','L',' ')}}, /* Kalenjin [macrolanguage] */ - {"km", {HB_TAG('K','H','M',' ')}}, /* Khmer */ - {"kmb", {HB_TAG('M','B','N',' ')}}, /* Kimbundu -> Mbundu */ - {"kmr", {HB_TAG('K','U','R',' ')}}, /* Northern Kurdish -> Kurdish */ - {"kmw", {HB_TAG('K','M','O',' ')}}, /* Komo (Democratic Republic of Congo) */ - {"kmz", {HB_TAG('K','M','Z',' ')}}, /* Khorasani Turkish -> Khorasani Turkic */ - {"kn", {HB_TAG('K','A','N',' ')}}, /* Kannada */ - {"knc", {HB_TAG('K','N','R',' ')}}, /* Central Kanuri -> Kanuri */ - {"kng", {HB_TAG('K','O','N','0')}}, /* Koongo -> Kongo */ - {"knn", {HB_TAG('K','O','K',' ')}}, /* Konkani */ - {"ko", {HB_TAG('K','O','R',' ')}}, /* Korean */ - {"koi", {HB_TAG('K','O','P',' ')}}, /* Komi-Permyak */ - {"kok", {HB_TAG('K','O','K',' ')}}, /* Konkani [macrolanguage] */ - {"kos", {HB_TAG('K','O','S',' ')}}, /* Kosraean */ - {"koy", {HB_TAG('A','T','H',' ')}}, /* Koyukon -> Athapaskan */ - {"kpe", {HB_TAG('K','P','L',' ')}}, /* Kpelle [macrolanguage] */ - {"kpv", {HB_TAG('K','O','Z',' ')}}, /* Komi-Zyrian */ - {"kpy", {HB_TAG('K','Y','K',' ')}}, /* Koryak */ - {"kqs", {HB_TAG('K','I','S',' ')}}, /* Northern Kissi -> Kisii */ - {"kqy", {HB_TAG('K','R','T',' ')}}, /* Koorete */ - {"kr", {HB_TAG('K','N','R',' ')}}, /* Kanuri [macrolanguage] */ - {"krc", {HB_TAG('K','A','R',' '), /* Karachay-Balkar -> Karachay */ - HB_TAG('B','A','L',' ')}}, /* Karachay-Balkar -> Balkar */ - {"kri", {HB_TAG('K','R','I',' ')}}, /* Krio */ - {"krl", {HB_TAG('K','R','L',' ')}}, /* Karelian */ - {"krt", {HB_TAG('K','N','R',' ')}}, /* Tumari Kanuri -> Kanuri */ - {"kru", {HB_TAG('K','U','U',' ')}}, /* Kurukh */ - {"ks", {HB_TAG('K','S','H',' ')}}, /* Kashmiri */ - {"ksh", {HB_TAG('K','S','H','0')}}, /* Kölsch -> Ripuarian */ - {"kss", {HB_TAG('K','I','S',' ')}}, /* Southern Kisi -> Kisii */ - {"ksw", {HB_TAG('K','S','W',' ')}}, /* S’gaw Karen */ - {"ktb", {HB_TAG('K','E','B',' ')}}, /* Kambaata -> Kebena */ - {"ktu", {HB_TAG('K','O','N',' ')}}, /* Kituba (Democratic Republic of Congo) -> Kikongo */ - {"ktw", {HB_TAG('A','T','H',' ')}}, /* Kato -> Athapaskan */ - {"ku", {HB_TAG('K','U','R',' ')}}, /* Kurdish [macrolanguage] */ - {"kum", {HB_TAG('K','U','M',' ')}}, /* Kumyk */ - {"kuu", {HB_TAG('A','T','H',' ')}}, /* Upper Kuskokwim -> Athapaskan */ - {"kv", {HB_TAG('K','O','M',' ')}}, /* Komi [macrolanguage] */ - {"kvb", {HB_TAG('M','L','Y',' ')}}, /* Kubu -> Malay */ - {"kvr", {HB_TAG('M','L','Y',' ')}}, /* Kerinci -> Malay */ - {"kw", {HB_TAG('C','O','R',' ')}}, /* Cornish */ - {"kwy", {HB_TAG('K','O','N','0')}}, /* San Salvador Kongo -> Kongo */ - {"kxc", {HB_TAG('K','M','S',' ')}}, /* Konso -> Komso */ - {"kxd", {HB_TAG('M','L','Y',' ')}}, /* Brunei -> Malay */ - {"kxu", {HB_TAG('K','U','I',' ')}}, /* Kui (India) */ - {"ky", {HB_TAG('K','I','R',' ')}}, /* Kirghiz (Kyrgyz) */ - {"kyu", {HB_TAG('K','Y','U',' ')}}, /* Western Kayah */ - {"la", {HB_TAG('L','A','T',' ')}}, /* Latin */ - {"lad", {HB_TAG('J','U','D',' ')}}, /* Ladino */ - {"lb", {HB_TAG('L','T','Z',' ')}}, /* Luxembourgish */ - {"lbe", {HB_TAG('L','A','K',' ')}}, /* Lak */ - {"lbj", {HB_TAG('L','D','K',' ')}}, /* Ladakhi */ - {"lbl", {HB_TAG('B','I','K',' ')}}, /* Libon Bikol -> Bikol */ - {"lce", {HB_TAG('M','L','Y',' ')}}, /* Loncong -> Malay */ - {"lcf", {HB_TAG('M','L','Y',' ')}}, /* Lubu -> Malay */ - {"ldi", {HB_TAG('K','O','N','0')}}, /* Laari -> Kongo */ - {"lez", {HB_TAG('L','E','Z',' ')}}, /* Lezghian -> Lezgi */ - {"lg", {HB_TAG('L','U','G',' ')}}, /* Ganda */ - {"li", {HB_TAG('L','I','M',' ')}}, /* Limburgish */ - {"lif", {HB_TAG('L','M','B',' ')}}, /* Limbu */ - {"lij", {HB_TAG('L','I','J',' ')}}, /* Ligurian */ - {"lis", {HB_TAG('L','I','S',' ')}}, /* Lisu */ - {"liw", {HB_TAG('M','L','Y',' ')}}, /* Col -> Malay */ - {"ljp", {HB_TAG('L','J','P',' ')}}, /* Lampung Api -> Lampung */ - {"lkb", {HB_TAG('L','U','H',' ')}}, /* Kabras -> Luyia */ - {"lki", {HB_TAG('L','K','I',' ')}}, /* Laki */ - {"lko", {HB_TAG('L','U','H',' ')}}, /* Khayo -> Luyia */ - {"lks", {HB_TAG('L','U','H',' ')}}, /* Kisa -> Luyia */ - {"lld", {HB_TAG('L','A','D',' ')}}, /* Ladin */ - {"lmn", {HB_TAG('L','A','M',' ')}}, /* Lambadi -> Lambani */ - {"lmo", {HB_TAG('L','M','O',' ')}}, /* Lombard */ - {"ln", {HB_TAG('L','I','N',' ')}}, /* Lingala */ - {"lo", {HB_TAG('L','A','O',' ')}}, /* Lao */ - {"lom", {HB_TAG('L','O','M',' ')}}, /* Loma (Liberia) */ - {"lrc", {HB_TAG('L','R','C',' ')}}, /* Northern Luri -> Luri */ - {"lri", {HB_TAG('L','U','H',' ')}}, /* Marachi -> Luyia */ - {"lrm", {HB_TAG('L','U','H',' ')}}, /* Marama -> Luyia */ - {"lsm", {HB_TAG('L','U','H',' ')}}, /* Saamia -> Luyia */ - {"lt", {HB_TAG('L','T','H',' ')}}, /* Lithuanian */ - {"ltg", {HB_TAG('L','V','I',' ')}}, /* Latgalian -> Latvian */ - {"lto", {HB_TAG('L','U','H',' ')}}, /* Tsotso -> Luyia */ - {"lts", {HB_TAG('L','U','H',' ')}}, /* Tachoni -> Luyia */ - {"lu", {HB_TAG('L','U','B',' ')}}, /* Luba-Katanga */ - {"lua", {HB_TAG('L','U','A',' ')}}, /* Luba-Lulua */ - {"luo", {HB_TAG('L','U','O',' ')}}, /* Luo (Kenya and Tanzania) */ - {"lus", {HB_TAG('M','I','Z',' ')}}, /* Lushai -> Mizo */ - {"luy", {HB_TAG('L','U','H',' ')}}, /* Luyia [macrolanguage] */ - {"luz", {HB_TAG('L','R','C',' ')}}, /* Southern Luri -> Luri */ - {"lv", {HB_TAG('L','V','I',' ')}}, /* Latvian [macrolanguage] */ - {"lvs", {HB_TAG('L','V','I',' ')}}, /* Standard Latvian -> Latvian */ - {"lwg", {HB_TAG('L','U','H',' ')}}, /* Wanga -> Luyia */ - {"lzh", {HB_TAG('Z','H','T',' ')}}, /* Literary Chinese -> Chinese Traditional */ - {"lzz", {HB_TAG('L','A','Z',' ')}}, /* Laz */ - {"mad", {HB_TAG('M','A','D',' ')}}, /* Madurese -> Madura */ - {"mag", {HB_TAG('M','A','G',' ')}}, /* Magahi */ - {"mai", {HB_TAG('M','T','H',' ')}}, /* Maithili */ - {"mak", {HB_TAG('M','K','R',' ')}}, /* Makasar */ - {"mam", {HB_TAG('M','A','M',' ')}}, /* Mam */ - {"man", {HB_TAG('M','N','K',' ')}}, /* Mandingo [macrolanguage] -> Maninka */ - {"max", {HB_TAG('M','L','Y',' ')}}, /* North Moluccan Malay -> Malay */ - {"mbo", {HB_TAG('M','B','O',' ')}}, /* Mbo (Cameroon) */ - {"mct", {HB_TAG('B','T','I',' ')}}, /* Mengisa -> Beti */ - {"mdf", {HB_TAG('M','O','K',' ')}}, /* Moksha */ - {"mdr", {HB_TAG('M','D','R',' ')}}, /* Mandar */ - {"mdy", {HB_TAG('M','L','E',' ')}}, /* Male (Ethiopia) */ - {"men", {HB_TAG('M','D','E',' ')}}, /* Mende (Sierra Leone) */ - {"meo", {HB_TAG('M','L','Y',' ')}}, /* Kedah Malay -> Malay */ - {"mer", {HB_TAG('M','E','R',' ')}}, /* Meru */ - {"mfa", {HB_TAG('M','F','A',' ')}}, /* Pattani Malay */ - {"mfb", {HB_TAG('M','L','Y',' ')}}, /* Bangka -> Malay */ - {"mfe", {HB_TAG('M','F','E',' ')}}, /* Morisyen */ - {"mg", {HB_TAG('M','L','G',' ')}}, /* Malagasy [macrolanguage] */ - {"mh", {HB_TAG('M','A','H',' ')}}, /* Marshallese */ - {"mhr", {HB_TAG('L','M','A',' ')}}, /* Eastern Mari -> Low Mari */ - {"mhv", {HB_TAG('A','R','K',' ')}}, /* Arakanese (retired code) -> Rakhine */ - {"mi", {HB_TAG('M','R','I',' ')}}, /* Maori */ - {"min", {HB_TAG('M','I','N',' ')}}, /* Minangkabau */ - {"mk", {HB_TAG('M','K','D',' ')}}, /* Macedonian */ - {"mku", {HB_TAG('M','N','K',' ')}}, /* Konyanka Maninka -> Maninka */ - {"mkw", {HB_TAG('M','K','W',' ')}}, /* Kituba (Congo) */ - {"ml", {HB_TAG('M','A','L',' '), /* Malayalam -> Malayalam Traditional */ - HB_TAG('M','L','R',' ')}}, /* Malayalam -> Malayalam Reformed */ - {"mlq", {HB_TAG('M','L','N',' '), /* Western Maninkakan -> Malinke */ - HB_TAG('M','N','K',' ')}}, /* Western Maninkakan -> Maninka */ - {"mmr", {HB_TAG('H','M','N',' ')}}, /* Western Xiangxi Miao -> Hmong */ - {"mn", {HB_TAG('M','N','G',' ')}}, /* Mongolian [macrolanguage] */ - {"mnc", {HB_TAG('M','C','H',' ')}}, /* Manchu */ - {"mni", {HB_TAG('M','N','I',' ')}}, /* Manipuri */ - {"mnk", {HB_TAG('M','N','D',' '), /* Mandinka */ - HB_TAG('M','N','K',' ')}}, /* Mandinka -> Maninka */ - {"mnp", {HB_TAG('Z','H','S',' ')}}, /* Min Bei Chinese -> Chinese Simplified */ - {"mns", {HB_TAG('M','A','N',' ')}}, /* Mansi */ - {"mnw", {HB_TAG('M','O','N',' ')}}, /* Mon */ - {"mo", {HB_TAG('M','O','L',' ')}}, /* Moldavian (retired code) */ - {"moh", {HB_TAG('M','O','H',' ')}}, /* Mohawk */ - {"mos", {HB_TAG('M','O','S',' ')}}, /* Mossi */ - {"mpe", {HB_TAG('M','A','J',' ')}}, /* Majang */ - {"mqg", {HB_TAG('M','L','Y',' ')}}, /* Kota Bangun Kutai Malay -> Malay */ - {"mr", {HB_TAG('M','A','R',' ')}}, /* Marathi */ - {"mrh", {HB_TAG('Q','I','N',' ')}}, /* Mara Chin -> Chin */ - {"mrj", {HB_TAG('H','M','A',' ')}}, /* Western Mari -> High Mari */ - {"ms", {HB_TAG('M','L','Y',' ')}}, /* Malay [macrolanguage] */ - {"msc", {HB_TAG('M','N','K',' ')}}, /* Sankaran Maninka -> Maninka */ - {"msh", {HB_TAG('M','L','G',' ')}}, /* Masikoro Malagasy -> Malagasy */ - {"msi", {HB_TAG('M','L','Y',' ')}}, /* Sabah Malay -> Malay */ - {"mt", {HB_TAG('M','T','S',' ')}}, /* Maltese */ - {"mtr", {HB_TAG('M','A','W',' ')}}, /* Mewari -> Marwari */ - {"mui", {HB_TAG('M','L','Y',' ')}}, /* Musi -> Malay */ - {"mup", {HB_TAG('R','A','J',' ')}}, /* Malvi -> Rajasthani */ - {"muq", {HB_TAG('H','M','N',' ')}}, /* Eastern Xiangxi Miao -> Hmong */ - {"mus", {HB_TAG('M','U','S',' ')}}, /* Creek -> Muscogee */ - {"mvb", {HB_TAG('A','T','H',' ')}}, /* Mattole -> Athapaskan */ - {"mve", {HB_TAG('M','A','W',' ')}}, /* Marwari (Pakistan) */ - {"mvf", {HB_TAG('M','N','G',' ')}}, /* Peripheral Mongolian -> Mongolian */ - {"mwk", {HB_TAG('M','N','K',' ')}}, /* Kita Maninkakan -> Maninka */ - {"mwl", {HB_TAG('M','W','L',' ')}}, /* Mirandese */ - {"mwr", {HB_TAG('M','A','W',' ')}}, /* Marwari [macrolanguage] */ - {"mww", {HB_TAG('M','W','W',' ')}}, /* Hmong Daw */ - {"my", {HB_TAG('B','R','M',' ')}}, /* Burmese */ - {"mym", {HB_TAG('M','E','N',' ')}}, /* Me’en */ - {"myn", {HB_TAG('M','Y','N',' ')}}, /* Mayan [family] */ - {"myq", {HB_TAG('M','N','K',' ')}}, /* Forest Maninka (retired code) -> Maninka */ - {"myv", {HB_TAG('E','R','Z',' ')}}, /* Erzya */ - {"mzn", {HB_TAG('M','Z','N',' ')}}, /* Mazanderani */ - {"na", {HB_TAG('N','A','U',' ')}}, /* Nauru -> Nauruan */ - {"nag", {HB_TAG('N','A','G',' ')}}, /* Naga Pidgin -> Naga-Assamese */ - {"nah", {HB_TAG('N','A','H',' ')}}, /* Nahuatl [family] */ - {"nan", {HB_TAG('Z','H','S',' ')}}, /* Min Nan Chinese -> Chinese Simplified */ - {"nap", {HB_TAG('N','A','P',' ')}}, /* Neapolitan */ - {"nb", {HB_TAG('N','O','R',' ')}}, /* Norwegian Bokmål -> Norwegian */ - {"nd", {HB_TAG('N','D','B',' ')}}, /* North Ndebele -> Ndebele */ - {"ndc", {HB_TAG('N','D','C',' ')}}, /* Ndau */ - {"nds", {HB_TAG('N','D','S',' ')}}, /* Low Saxon */ - {"ne", {HB_TAG('N','E','P',' ')}}, /* Nepali [macrolanguage] */ - {"new", {HB_TAG('N','E','W',' ')}}, /* Newari */ - {"ng", {HB_TAG('N','D','G',' ')}}, /* Ndonga */ - {"nga", {HB_TAG('N','G','A',' ')}}, /* Ngbaka */ - {"ngl", {HB_TAG('L','M','W',' ')}}, /* Lomwe */ - {"ngo", {HB_TAG('S','X','T',' ')}}, /* Ngoni -> Sutu */ - {"nhd", {HB_TAG('G','U','A',' ')}}, /* Chiripá -> Guarani */ - {"niq", {HB_TAG('K','A','L',' ')}}, /* Nandi -> Kalenjin */ - {"niu", {HB_TAG('N','I','U',' ')}}, /* Niuean */ - {"niv", {HB_TAG('G','I','L',' ')}}, /* Gilyak */ - {"njz", {HB_TAG('N','I','S',' ')}}, /* Nyishi -> Nisi */ - {"nl", {HB_TAG('N','L','D',' ')}}, /* Dutch */ - {"nle", {HB_TAG('L','U','H',' ')}}, /* East Nyala -> Luyia */ - {"nn", {HB_TAG('N','Y','N',' ')}}, /* Norwegian Nynorsk (Nynorsk, Norwegian) */ - {"no", {HB_TAG('N','O','R',' ')}}, /* Norwegian [macrolanguage] */ - {"nod", {HB_TAG('N','T','A',' ')}}, /* Northern Thai -> Northern Tai */ - {"noe", {HB_TAG('N','O','E',' ')}}, /* Nimadi */ - {"nog", {HB_TAG('N','O','G',' ')}}, /* Nogai */ - {"nov", {HB_TAG('N','O','V',' ')}}, /* Novial */ - {"npi", {HB_TAG('N','E','P',' ')}}, /* Nepali */ - {"nqo", {HB_TAG('N','K','O',' ')}}, /* N’Ko */ - {"nr", {HB_TAG('N','D','B',' ')}}, /* South Ndebele -> Ndebele */ - {"nsk", {HB_TAG('N','A','S',' ')}}, /* Naskapi */ - {"nso", {HB_TAG('N','S','O',' ')}}, /* Pedi -> Sotho, Northern */ - {"nv", {HB_TAG('N','A','V',' '), /* Navajo */ - HB_TAG('A','T','H',' ')}}, /* Navajo -> Athapaskan */ - {"ny", {HB_TAG('C','H','I',' ')}}, /* Chichewa (Chewa, Nyanja) */ - {"nyd", {HB_TAG('L','U','H',' ')}}, /* Nyore -> Luyia */ - {"nym", {HB_TAG('N','Y','M',' ')}}, /* Nyamwezi */ - {"nyn", {HB_TAG('N','K','L',' ')}}, /* Nyankole */ - {"nza", {HB_TAG('N','Z','A',' ')}}, /* Tigon Mbembe -> Mbembe Tigon */ - {"oc", {HB_TAG('O','C','I',' ')}}, /* Occitan (post 1500) */ - {"oj", {HB_TAG('O','J','B',' ')}}, /* Ojibwa [macrolanguage] -> Ojibway */ - {"ojb", {HB_TAG('O','J','B',' ')}}, /* Northwestern Ojibwa -> Ojibway */ - {"ojc", {HB_TAG('O','J','B',' ')}}, /* Central Ojibwa -> Ojibway */ - {"ojg", {HB_TAG('O','J','B',' ')}}, /* Eastern Ojibwa -> Ojibway */ - {"ojs", {HB_TAG('O','C','R',' ')}}, /* Severn Ojibwa -> Oji-Cree */ - {"ojw", {HB_TAG('O','J','B',' ')}}, /* Western Ojibwa -> Ojibway */ - {"oki", {HB_TAG('K','A','L',' ')}}, /* Okiek -> Kalenjin */ - {"okm", {HB_TAG('K','O','H',' ')}}, /* Middle Korean (10th-16th cent.) -> Korean Old Hangul */ - {"om", {HB_TAG('O','R','O',' ')}}, /* Oromo [macrolanguage] */ - {"or", {HB_TAG('O','R','I',' ')}}, /* Odia (formerly Oriya) [macrolanguage] */ - {"orc", {HB_TAG('O','R','O',' ')}}, /* Orma -> Oromo */ - {"orn", {HB_TAG('M','L','Y',' ')}}, /* Orang Kanaq -> Malay */ - {"ors", {HB_TAG('M','L','Y',' ')}}, /* Orang Seletar -> Malay */ - {"ory", {HB_TAG('O','R','I',' ')}}, /* Odia (formerly Oriya) */ - {"os", {HB_TAG('O','S','S',' ')}}, /* Ossetian */ - {"otw", {HB_TAG('O','J','B',' ')}}, /* Ottawa -> Ojibway */ - {"pa", {HB_TAG('P','A','N',' ')}}, /* Punjabi */ - {"pag", {HB_TAG('P','A','G',' ')}}, /* Pangasinan */ - {"pam", {HB_TAG('P','A','M',' ')}}, /* Pampanga -> Pampangan */ - {"pap", {HB_TAG('P','A','P','0')}}, /* Papiamento -> Papiamentu */ - {"pau", {HB_TAG('P','A','U',' ')}}, /* Palauan */ - {"pbt", {HB_TAG('P','A','S',' ')}}, /* Southern Pashto -> Pashto */ - {"pbu", {HB_TAG('P','A','S',' ')}}, /* Northern Pashto -> Pashto */ - {"pcc", {HB_TAG('P','C','C',' ')}}, /* Bouyei */ - {"pcd", {HB_TAG('P','C','D',' ')}}, /* Picard */ - {"pce", {HB_TAG('P','L','G',' ')}}, /* Ruching Palaung -> Palaung */ - {"pck", {HB_TAG('Q','I','N',' ')}}, /* Paite Chin -> Chin */ - {"pdc", {HB_TAG('P','D','C',' ')}}, /* Pennsylvania German */ - {"pel", {HB_TAG('M','L','Y',' ')}}, /* Pekal -> Malay */ - {"pes", {HB_TAG('F','A','R',' ')}}, /* Iranian Persian -> Persian */ - {"pga", {HB_TAG('A','R','A',' ')}}, /* Sudanese Creole Arabic -> Arabic */ - {"phk", {HB_TAG('P','H','K',' ')}}, /* Phake */ - {"pi", {HB_TAG('P','A','L',' ')}}, /* Pali */ - {"pih", {HB_TAG('P','I','H',' ')}}, /* Pitcairn-Norfolk -> Norfolk */ - {"pko", {HB_TAG('K','A','L',' ')}}, /* Pökoot -> Kalenjin */ - {"pl", {HB_TAG('P','L','K',' ')}}, /* Polish */ - {"pll", {HB_TAG('P','L','G',' ')}}, /* Shwe Palaung -> Palaung */ - {"plp", {HB_TAG('P','A','P',' ')}}, /* Palpa */ - {"plt", {HB_TAG('M','L','G',' ')}}, /* Plateau Malagasy -> Malagasy */ - {"pms", {HB_TAG('P','M','S',' ')}}, /* Piemontese */ - {"pnb", {HB_TAG('P','N','B',' ')}}, /* Western Panjabi */ - {"poh", {HB_TAG('P','O','H',' ')}}, /* Poqomchi' -> Pocomchi */ - {"pon", {HB_TAG('P','O','N',' ')}}, /* Pohnpeian */ - {"ppa", {HB_TAG('B','A','G',' ')}}, /* Pao (retired code) -> Baghelkhandi */ - {"pro", {HB_TAG('P','R','O',' ')}}, /* Old Provençal (to 1500) -> Provençal / Old Provençal */ - {"prs", {HB_TAG('D','R','I',' ')}}, /* Dari */ - {"ps", {HB_TAG('P','A','S',' ')}}, /* Pashto [macrolanguage] */ - {"pse", {HB_TAG('M','L','Y',' ')}}, /* Central Malay -> Malay */ - {"pst", {HB_TAG('P','A','S',' ')}}, /* Central Pashto -> Pashto */ - {"pt", {HB_TAG('P','T','G',' ')}}, /* Portuguese */ - {"pwo", {HB_TAG('P','W','O',' ')}}, /* Pwo Western Karen -> Western Pwo Karen */ - {"qu", {HB_TAG('Q','U','Z',' ')}}, /* Quechua [macrolanguage] */ - {"qub", {HB_TAG('Q','W','H',' ')}}, /* Huallaga Huánuco Quechua -> Quechua (Peru) */ - {"quc", {HB_TAG('Q','U','C',' ')}}, /* K’iche’ */ - {"qud", {HB_TAG('Q','V','I',' ')}}, /* Calderón Highland Quichua -> Quechua (Ecuador) */ - {"quf", {HB_TAG('Q','U','Z',' ')}}, /* Lambayeque Quechua -> Quechua */ - {"qug", {HB_TAG('Q','V','I',' ')}}, /* Chimborazo Highland Quichua -> Quechua (Ecuador) */ - {"quh", {HB_TAG('Q','U','H',' ')}}, /* South Bolivian Quechua -> Quechua (Bolivia) */ - {"quk", {HB_TAG('Q','U','Z',' ')}}, /* Chachapoyas Quechua -> Quechua */ - {"qul", {HB_TAG('Q','U','Z',' ')}}, /* North Bolivian Quechua -> Quechua */ - {"qup", {HB_TAG('Q','V','I',' ')}}, /* Southern Pastaza Quechua -> Quechua (Ecuador) */ - {"qur", {HB_TAG('Q','W','H',' ')}}, /* Yanahuanca Pasco Quechua -> Quechua (Peru) */ - {"qus", {HB_TAG('Q','U','H',' ')}}, /* Santiago del Estero Quichua -> Quechua (Bolivia) */ - {"quw", {HB_TAG('Q','V','I',' ')}}, /* Tena Lowland Quichua -> Quechua (Ecuador) */ - {"qux", {HB_TAG('Q','W','H',' ')}}, /* Yauyos Quechua -> Quechua (Peru) */ - {"quy", {HB_TAG('Q','U','Z',' ')}}, /* Ayacucho Quechua -> Quechua */ - {"quz", {HB_TAG('Q','U','Z',' ')}}, /* Cusco Quechua -> Quechua */ - {"qva", {HB_TAG('Q','W','H',' ')}}, /* Ambo-Pasco Quechua -> Quechua (Peru) */ - {"qvc", {HB_TAG('Q','U','Z',' ')}}, /* Cajamarca Quechua -> Quechua */ - {"qve", {HB_TAG('Q','U','Z',' ')}}, /* Eastern Apurímac Quechua -> Quechua */ - {"qvh", {HB_TAG('Q','W','H',' ')}}, /* Huamalíes-Dos de Mayo Huánuco Quechua -> Quechua (Peru) */ - {"qvi", {HB_TAG('Q','V','I',' ')}}, /* Imbabura Highland Quichua -> Quechua (Ecuador) */ - {"qvj", {HB_TAG('Q','V','I',' ')}}, /* Loja Highland Quichua -> Quechua (Ecuador) */ - {"qvl", {HB_TAG('Q','W','H',' ')}}, /* Cajatambo North Lima Quechua -> Quechua (Peru) */ - {"qvm", {HB_TAG('Q','W','H',' ')}}, /* Margos-Yarowilca-Lauricocha Quechua -> Quechua (Peru) */ - {"qvn", {HB_TAG('Q','W','H',' ')}}, /* North Junín Quechua -> Quechua (Peru) */ - {"qvo", {HB_TAG('Q','V','I',' ')}}, /* Napo Lowland Quechua -> Quechua (Ecuador) */ - {"qvp", {HB_TAG('Q','W','H',' ')}}, /* Pacaraos Quechua -> Quechua (Peru) */ - {"qvs", {HB_TAG('Q','U','Z',' ')}}, /* San Martín Quechua -> Quechua */ - {"qvw", {HB_TAG('Q','W','H',' ')}}, /* Huaylla Wanca Quechua -> Quechua (Peru) */ - {"qvz", {HB_TAG('Q','V','I',' ')}}, /* Northern Pastaza Quichua -> Quechua (Ecuador) */ - {"qwa", {HB_TAG('Q','W','H',' ')}}, /* Corongo Ancash Quechua -> Quechua (Peru) */ - {"qwc", {HB_TAG('Q','U','Z',' ')}}, /* Classical Quechua -> Quechua */ - {"qwh", {HB_TAG('Q','W','H',' ')}}, /* Huaylas Ancash Quechua -> Quechua (Peru) */ - {"qws", {HB_TAG('Q','W','H',' ')}}, /* Sihuas Ancash Quechua -> Quechua (Peru) */ - {"qxa", {HB_TAG('Q','W','H',' ')}}, /* Chiquián Ancash Quechua -> Quechua (Peru) */ - {"qxc", {HB_TAG('Q','W','H',' ')}}, /* Chincha Quechua -> Quechua (Peru) */ - {"qxh", {HB_TAG('Q','W','H',' ')}}, /* Panao Huánuco Quechua -> Quechua (Peru) */ - {"qxl", {HB_TAG('Q','V','I',' ')}}, /* Salasaca Highland Quichua -> Quechua (Ecuador) */ - {"qxn", {HB_TAG('Q','W','H',' ')}}, /* Northern Conchucos Ancash Quechua -> Quechua (Peru) */ - {"qxo", {HB_TAG('Q','W','H',' ')}}, /* Southern Conchucos Ancash Quechua -> Quechua (Peru) */ - {"qxp", {HB_TAG('Q','U','Z',' ')}}, /* Puno Quechua -> Quechua */ - {"qxr", {HB_TAG('Q','V','I',' ')}}, /* Cañar Highland Quichua -> Quechua (Ecuador) */ - {"qxt", {HB_TAG('Q','W','H',' ')}}, /* Santa Ana de Tusi Pasco Quechua -> Quechua (Peru) */ - {"qxu", {HB_TAG('Q','U','Z',' ')}}, /* Arequipa-La Unión Quechua -> Quechua */ - {"qxw", {HB_TAG('Q','W','H',' ')}}, /* Jauja Wanca Quechua -> Quechua (Peru) */ - {"rag", {HB_TAG('L','U','H',' ')}}, /* Logooli -> Luyia */ - {"raj", {HB_TAG('R','A','J',' ')}}, /* Rajasthani [macrolanguage] */ - {"rar", {HB_TAG('R','A','R',' ')}}, /* Rarotongan */ - {"rbb", {HB_TAG('P','L','G',' ')}}, /* Rumai Palaung -> Palaung */ - {"rbl", {HB_TAG('B','I','K',' ')}}, /* Miraya Bikol -> Bikol */ - {"rej", {HB_TAG('R','E','J',' ')}}, /* Rejang */ - {"ria", {HB_TAG('R','I','A',' ')}}, /* Riang (India) */ - {"rif", {HB_TAG('R','I','F',' ')}}, /* Tarifit */ - {"rit", {HB_TAG('R','I','T',' ')}}, /* Ritarungo */ - {"rki", {HB_TAG('A','R','K',' ')}}, /* Rakhine */ - {"rkw", {HB_TAG('R','K','W',' ')}}, /* Arakwal */ - {"rm", {HB_TAG('R','M','S',' ')}}, /* Romansh */ - {"rmc", {HB_TAG('R','O','Y',' ')}}, /* Carpathian Romani -> Romany */ - {"rmf", {HB_TAG('R','O','Y',' ')}}, /* Kalo Finnish Romani -> Romany */ - {"rml", {HB_TAG('R','O','Y',' ')}}, /* Baltic Romani -> Romany */ - {"rmn", {HB_TAG('R','O','Y',' ')}}, /* Balkan Romani -> Romany */ - {"rmo", {HB_TAG('R','O','Y',' ')}}, /* Sinte Romani -> Romany */ - {"rmw", {HB_TAG('R','O','Y',' ')}}, /* Welsh Romani -> Romany */ - {"rmy", {HB_TAG('R','M','Y',' ')}}, /* Vlax Romani */ - {"rmz", {HB_TAG('A','R','K',' ')}}, /* Marma -> Rakhine */ - {"rn", {HB_TAG('R','U','N',' ')}}, /* Rundi */ - {"rnl", {HB_TAG('H','A','L',' ')}}, /* Ranglong -> Halam (Falam Chin) */ - {"ro", {HB_TAG('R','O','M',' ')}}, /* Romanian */ - {"rom", {HB_TAG('R','O','Y',' ')}}, /* Romany [macrolanguage] */ - {"rtm", {HB_TAG('R','T','M',' ')}}, /* Rotuman */ - {"ru", {HB_TAG('R','U','S',' ')}}, /* Russian */ - {"rue", {HB_TAG('R','S','Y',' ')}}, /* Rusyn */ - {"rup", {HB_TAG('R','U','P',' ')}}, /* Aromanian */ - {"rw", {HB_TAG('R','U','A',' ')}}, /* Kinyarwanda */ - {"rwr", {HB_TAG('M','A','W',' ')}}, /* Marwari (India) */ - {"sa", {HB_TAG('S','A','N',' ')}}, /* Sanskrit */ - {"sah", {HB_TAG('Y','A','K',' ')}}, /* Yakut -> Sakha */ - {"sam", {HB_TAG('P','A','A',' ')}}, /* Samaritan Aramaic -> Palestinian Aramaic */ - {"sas", {HB_TAG('S','A','S',' ')}}, /* Sasak */ - {"sat", {HB_TAG('S','A','T',' ')}}, /* Santali */ - {"sc", {HB_TAG('S','R','D',' ')}}, /* Sardinian [macrolanguage] */ - {"sck", {HB_TAG('S','A','D',' ')}}, /* Sadri */ - {"scn", {HB_TAG('S','C','N',' ')}}, /* Sicilian */ - {"sco", {HB_TAG('S','C','O',' ')}}, /* Scots */ - {"scs", {HB_TAG('S','C','S',' '), /* North Slavey */ - HB_TAG('S','L','A',' '), /* North Slavey -> Slavey */ - HB_TAG('A','T','H',' ')}}, /* North Slavey -> Athapaskan */ - {"sd", {HB_TAG('S','N','D',' ')}}, /* Sindhi */ - {"sdc", {HB_TAG('S','R','D',' ')}}, /* Sassarese Sardinian -> Sardinian */ - {"sdh", {HB_TAG('K','U','R',' ')}}, /* Southern Kurdish -> Kurdish */ - {"sdn", {HB_TAG('S','R','D',' ')}}, /* Gallurese Sardinian -> Sardinian */ - {"se", {HB_TAG('N','S','M',' ')}}, /* Northern Sami */ - {"seh", {HB_TAG('S','N','A',' ')}}, /* Sena */ - {"sek", {HB_TAG('A','T','H',' ')}}, /* Sekani -> Athapaskan */ - {"sel", {HB_TAG('S','E','L',' ')}}, /* Selkup */ - {"sez", {HB_TAG('Q','I','N',' ')}}, /* Senthang Chin -> Chin */ - {"sfm", {HB_TAG('H','M','N',' ')}}, /* Small Flowery Miao -> Hmong */ - {"sg", {HB_TAG('S','G','O',' ')}}, /* Sango */ - {"sga", {HB_TAG('S','G','A',' ')}}, /* Old Irish (to 900) */ - {"sgc", {HB_TAG('K','A','L',' ')}}, /* Kipsigis -> Kalenjin */ - {"sgs", {HB_TAG('S','G','S',' ')}}, /* Samogitian */ - {"sgw", {HB_TAG('C','H','G',' '), /* Sebat Bet Gurage -> Chaha Gurage */ - HB_TAG('S','G','W',' ')}}, /* Sebat Bet Gurage -> Chaha Gurage (SIL fonts) */ - {"shi", {HB_TAG('S','H','I',' ')}}, /* Tachelhit */ - {"shn", {HB_TAG('S','H','N',' ')}}, /* Shan */ - {"shu", {HB_TAG('A','R','A',' ')}}, /* Chadian Arabic -> Arabic */ - {"si", {HB_TAG('S','N','H',' ')}}, /* Sinhala (Sinhalese) */ - {"sid", {HB_TAG('S','I','D',' ')}}, /* Sidamo */ - {"sjd", {HB_TAG('K','S','M',' ')}}, /* Kildin Sami */ - {"sjo", {HB_TAG('S','I','B',' ')}}, /* Xibe -> Sibe */ - {"sk", {HB_TAG('S','K','Y',' ')}}, /* Slovak */ - {"skg", {HB_TAG('M','L','G',' ')}}, /* Sakalava Malagasy -> Malagasy */ - {"skr", {HB_TAG('S','R','K',' ')}}, /* Saraiki */ - {"sl", {HB_TAG('S','L','V',' ')}}, /* Slovenian */ - {"sm", {HB_TAG('S','M','O',' ')}}, /* Samoan */ - {"sma", {HB_TAG('S','S','M',' ')}}, /* Southern Sami */ - {"smj", {HB_TAG('L','S','M',' ')}}, /* Lule Sami */ - {"smn", {HB_TAG('I','S','M',' ')}}, /* Inari Sami */ - {"sms", {HB_TAG('S','K','S',' ')}}, /* Skolt Sami */ - {"sn", {HB_TAG('S','N','A','0')}}, /* Shona */ - {"snk", {HB_TAG('S','N','K',' ')}}, /* Soninke */ - {"so", {HB_TAG('S','M','L',' ')}}, /* Somali */ - {"sop", {HB_TAG('S','O','P',' ')}}, /* Songe */ - {"spv", {HB_TAG('O','R','I',' ')}}, /* Sambalpuri -> Odia (formerly Oriya) */ - {"spy", {HB_TAG('K','A','L',' ')}}, /* Sabaot -> Kalenjin */ - {"sq", {HB_TAG('S','Q','I',' ')}}, /* Albanian [macrolanguage] */ - {"sr", {HB_TAG('S','R','B',' ')}}, /* Serbian */ - {"src", {HB_TAG('S','R','D',' ')}}, /* Logudorese Sardinian -> Sardinian */ - {"sro", {HB_TAG('S','R','D',' ')}}, /* Campidanese Sardinian -> Sardinian */ - {"srr", {HB_TAG('S','R','R',' ')}}, /* Serer */ - {"srs", {HB_TAG('A','T','H',' ')}}, /* Sarsi -> Athapaskan */ - {"ss", {HB_TAG('S','W','Z',' ')}}, /* Swati */ - {"ssh", {HB_TAG('A','R','A',' ')}}, /* Shihhi Arabic -> Arabic */ - {"st", {HB_TAG('S','O','T',' ')}}, /* Southern Sotho -> Sotho, Southern */ - {"stq", {HB_TAG('S','T','Q',' ')}}, /* Saterfriesisch -> Saterland Frisian */ - {"stv", {HB_TAG('S','I','G',' ')}}, /* Silt'e -> Silte Gurage */ - {"su", {HB_TAG('S','U','N',' ')}}, /* Sundanese */ - {"suk", {HB_TAG('S','U','K',' ')}}, /* Sukuma */ - {"suq", {HB_TAG('S','U','R',' ')}}, /* Suri */ - {"sv", {HB_TAG('S','V','E',' ')}}, /* Swedish */ - {"sva", {HB_TAG('S','V','A',' ')}}, /* Svan */ - {"sw", {HB_TAG('S','W','K',' ')}}, /* Swahili [macrolanguage] */ - {"swb", {HB_TAG('C','M','R',' ')}}, /* Maore Comorian -> Comorian */ - {"swc", {HB_TAG('S','W','K',' ')}}, /* Congo Swahili -> Swahili */ - {"swh", {HB_TAG('S','W','K',' ')}}, /* Swahili */ - {"swv", {HB_TAG('M','A','W',' ')}}, /* Shekhawati -> Marwari */ - {"sxu", {HB_TAG('S','X','U',' ')}}, /* Upper Saxon */ - {"syc", {HB_TAG('S','Y','R',' ')}}, /* Classical Syriac -> Syriac */ - {"syl", {HB_TAG('S','Y','L',' ')}}, /* Sylheti */ - {"syr", {HB_TAG('S','Y','R',' ')}}, /* Syriac [macrolanguage] */ - {"szl", {HB_TAG('S','Z','L',' ')}}, /* Silesian */ - {"ta", {HB_TAG('T','A','M',' ')}}, /* Tamil */ - {"taa", {HB_TAG('A','T','H',' ')}}, /* Lower Tanana -> Athapaskan */ - {"tab", {HB_TAG('T','A','B',' ')}}, /* Tabassaran -> Tabasaran */ - {"taq", {HB_TAG('T','M','H',' ')}}, /* Tamasheq -> Tamashek */ - {"tau", {HB_TAG('A','T','H',' ')}}, /* Upper Tanana -> Athapaskan */ - {"tcb", {HB_TAG('A','T','H',' ')}}, /* Tanacross -> Athapaskan */ - {"tce", {HB_TAG('A','T','H',' ')}}, /* Southern Tutchone -> Athapaskan */ - {"tcp", {HB_TAG('Q','I','N',' ')}}, /* Tawr Chin -> Chin */ - {"tcy", {HB_TAG('T','U','L',' ')}}, /* Tulu -> Tumbuka */ - {"tcz", {HB_TAG('Q','I','N',' ')}}, /* Thado Chin -> Chin */ - {"tdd", {HB_TAG('T','D','D',' ')}}, /* Tai Nüa -> Dehong Dai */ - {"tdx", {HB_TAG('M','L','G',' ')}}, /* Tandroy-Mahafaly Malagasy -> Malagasy */ - {"te", {HB_TAG('T','E','L',' ')}}, /* Telugu */ - {"tec", {HB_TAG('K','A','L',' ')}}, /* Terik -> Kalenjin */ - {"tem", {HB_TAG('T','M','N',' ')}}, /* Timne -> Temne */ - {"tet", {HB_TAG('T','E','T',' ')}}, /* Tetum */ - {"tfn", {HB_TAG('A','T','H',' ')}}, /* Tanaina -> Athapaskan */ - {"tg", {HB_TAG('T','A','J',' ')}}, /* Tajik -> Tajiki */ - {"tgj", {HB_TAG('N','I','S',' ')}}, /* Tagin -> Nisi */ - {"tgx", {HB_TAG('A','T','H',' ')}}, /* Tagish -> Athapaskan */ - {"th", {HB_TAG('T','H','A',' ')}}, /* Thai */ - {"tht", {HB_TAG('A','T','H',' ')}}, /* Tahltan -> Athapaskan */ - {"thv", {HB_TAG('T','M','H',' ')}}, /* Tahaggart Tamahaq -> Tamashek */ - {"thz", {HB_TAG('T','M','H',' ')}}, /* Tayart Tamajeq -> Tamashek */ - {"ti", {HB_TAG('T','G','Y',' ')}}, /* Tigrinya */ - {"tig", {HB_TAG('T','G','R',' ')}}, /* Tigre */ - {"tiv", {HB_TAG('T','I','V',' ')}}, /* Tiv */ - {"tk", {HB_TAG('T','K','M',' ')}}, /* Turkmen */ - {"tkg", {HB_TAG('M','L','G',' ')}}, /* Tesaka Malagasy -> Malagasy */ - {"tl", {HB_TAG('T','G','L',' ')}}, /* Tagalog */ - {"tmh", {HB_TAG('T','M','H',' ')}}, /* Tamashek [macrolanguage] */ - {"tmw", {HB_TAG('M','L','Y',' ')}}, /* Temuan -> Malay */ - {"tn", {HB_TAG('T','N','A',' ')}}, /* Tswana */ - {"tnf", {HB_TAG('D','R','I',' ')}}, /* Tangshewi (retired code) -> Dari */ - {"to", {HB_TAG('T','G','N',' ')}}, /* Tonga (Tonga Islands) -> Tongan */ - {"tod", {HB_TAG('T','O','D','0')}}, /* Toma */ - {"toi", {HB_TAG('T','N','G',' ')}}, /* Tonga (Zambia) */ - {"tol", {HB_TAG('A','T','H',' ')}}, /* Tolowa -> Athapaskan */ - {"tpi", {HB_TAG('T','P','I',' ')}}, /* Tok Pisin */ - {"tr", {HB_TAG('T','R','K',' ')}}, /* Turkish */ - {"tru", {HB_TAG('T','U','A',' '), /* Turoyo -> Turoyo Aramaic */ - HB_TAG('S','Y','R',' ')}}, /* Turoyo -> Syriac */ - {"ts", {HB_TAG('T','S','G',' ')}}, /* Tsonga */ - {"tsj", {HB_TAG('T','S','J',' ')}}, /* Tshangla */ - {"tt", {HB_TAG('T','A','T',' ')}}, /* Tatar */ - {"ttm", {HB_TAG('A','T','H',' ')}}, /* Northern Tutchone -> Athapaskan */ - {"ttq", {HB_TAG('T','M','H',' ')}}, /* Tawallammat Tamajaq -> Tamashek */ - {"tum", {HB_TAG('T','U','M',' ')}}, /* Tumbuka -> Tulu */ - {"tuu", {HB_TAG('A','T','H',' ')}}, /* Tututni -> Athapaskan */ - {"tuy", {HB_TAG('K','A','L',' ')}}, /* Tugen -> Kalenjin */ - {"tvl", {HB_TAG('T','V','L',' ')}}, /* Tuvalu */ - {"tw", {HB_TAG('T','W','I',' '), /* Twi */ - HB_TAG('A','K','A',' ')}}, /* Twi -> Akan */ - {"txc", {HB_TAG('A','T','H',' ')}}, /* Tsetsaut -> Athapaskan */ - {"txy", {HB_TAG('M','L','G',' ')}}, /* Tanosy Malagasy -> Malagasy */ - {"ty", {HB_TAG('T','H','T',' ')}}, /* Tahitian */ - {"tyv", {HB_TAG('T','U','V',' ')}}, /* Tuvinian -> Tuvin */ - {"tyz", {HB_TAG('T','Y','Z',' ')}}, /* Tày */ - {"tzm", {HB_TAG('T','Z','M',' ')}}, /* Central Atlas Tamazight -> Tamazight */ - {"tzo", {HB_TAG('T','Z','O',' ')}}, /* Tzotzil */ - {"ubl", {HB_TAG('B','I','K',' ')}}, /* Buhi'non Bikol -> Bikol */ - {"udm", {HB_TAG('U','D','M',' ')}}, /* Udmurt */ - {"ug", {HB_TAG('U','Y','G',' ')}}, /* Uyghur */ - {"uk", {HB_TAG('U','K','R',' ')}}, /* Ukrainian */ - {"umb", {HB_TAG('U','M','B',' ')}}, /* Umbundu */ - {"unr", {HB_TAG('M','U','N',' ')}}, /* Mundari */ - {"ur", {HB_TAG('U','R','D',' ')}}, /* Urdu */ - {"urk", {HB_TAG('M','L','Y',' ')}}, /* Urak Lawoi' -> Malay */ - {"uz", {HB_TAG('U','Z','B',' ')}}, /* Uzbek [macrolanguage] */ - {"uzn", {HB_TAG('U','Z','B',' ')}}, /* Northern Uzbek -> Uzbek */ - {"uzs", {HB_TAG('U','Z','B',' ')}}, /* Southern Uzbek -> Uzbek */ - {"ve", {HB_TAG('V','E','N',' ')}}, /* Venda */ - {"vec", {HB_TAG('V','E','C',' ')}}, /* Venetian */ - {"vi", {HB_TAG('V','I','T',' ')}}, /* Vietnamese */ - {"vkk", {HB_TAG('M','L','Y',' ')}}, /* Kaur -> Malay */ - {"vkt", {HB_TAG('M','L','Y',' ')}}, /* Tenggarong Kutai Malay -> Malay */ - {"vls", {HB_TAG('F','L','E',' ')}}, /* Vlaams -> Dutch (Flemish) */ - {"vmw", {HB_TAG('M','A','K',' ')}}, /* Makhuwa */ - {"vo", {HB_TAG('V','O','L',' ')}}, /* Volapük */ - {"vro", {HB_TAG('V','R','O',' ')}}, /* Võro */ - {"wa", {HB_TAG('W','L','N',' ')}}, /* Walloon */ - {"war", {HB_TAG('W','A','R',' ')}}, /* Waray (Philippines) -> Waray-Waray */ - {"wbm", {HB_TAG('W','A',' ',' ')}}, /* Wa */ - {"wbr", {HB_TAG('W','A','G',' ')}}, /* Wagdi */ - {"wlc", {HB_TAG('C','M','R',' ')}}, /* Mwali Comorian -> Comorian */ - {"wle", {HB_TAG('S','I','G',' ')}}, /* Wolane -> Silte Gurage */ - {"wlk", {HB_TAG('A','T','H',' ')}}, /* Wailaki -> Athapaskan */ - {"wni", {HB_TAG('C','M','R',' ')}}, /* Ndzwani Comorian -> Comorian */ - {"wo", {HB_TAG('W','L','F',' ')}}, /* Wolof */ - {"wry", {HB_TAG('M','A','W',' ')}}, /* Merwari -> Marwari */ - {"wsg", {HB_TAG('G','O','N',' ')}}, /* Adilabad Gondi -> Gondi */ - {"wtm", {HB_TAG('W','T','M',' ')}}, /* Mewati */ - {"wuu", {HB_TAG('Z','H','S',' ')}}, /* Wu Chinese -> Chinese Simplified */ - {"xal", {HB_TAG('K','L','M',' '), /* Kalmyk */ - HB_TAG('T','O','D',' ')}}, /* Kalmyk -> Todo */ - {"xan", {HB_TAG('S','E','K',' ')}}, /* Xamtanga -> Sekota */ - {"xh", {HB_TAG('X','H','S',' ')}}, /* Xhosa */ - {"xjb", {HB_TAG('X','J','B',' ')}}, /* Minjungbal -> Minjangbal */ - {"xkf", {HB_TAG('X','K','F',' ')}}, /* Khengkha */ - {"xmm", {HB_TAG('M','L','Y',' ')}}, /* Manado Malay -> Malay */ - {"xmv", {HB_TAG('M','L','G',' ')}}, /* Antankarana Malagasy -> Malagasy */ - {"xmw", {HB_TAG('M','L','G',' ')}}, /* Tsimihety Malagasy -> Malagasy */ - {"xnr", {HB_TAG('D','G','R',' ')}}, /* Kangri -> Dogri */ - {"xog", {HB_TAG('X','O','G',' ')}}, /* Soga */ - {"xpe", {HB_TAG('X','P','E',' ')}}, /* Liberia Kpelle -> Kpelle (Liberia) */ - {"xsl", {HB_TAG('S','S','L',' '), /* South Slavey */ - HB_TAG('S','L','A',' '), /* South Slavey -> Slavey */ - HB_TAG('A','T','H',' ')}}, /* South Slavey -> Athapaskan */ - {"xst", {HB_TAG('S','I','G',' ')}}, /* Silt'e (retired code) -> Silte Gurage */ - {"xwo", {HB_TAG('T','O','D',' ')}}, /* Written Oirat -> Todo */ - {"yao", {HB_TAG('Y','A','O',' ')}}, /* Yao */ - {"yap", {HB_TAG('Y','A','P',' ')}}, /* Yapese */ - {"ybd", {HB_TAG('A','R','K',' ')}}, /* Yangbye (retired code) -> Rakhine */ - {"ydd", {HB_TAG('J','I','I',' ')}}, /* Eastern Yiddish -> Yiddish */ - {"yi", {HB_TAG('J','I','I',' ')}}, /* Yiddish [macrolanguage] */ - {"yih", {HB_TAG('J','I','I',' ')}}, /* Western Yiddish -> Yiddish */ - {"yo", {HB_TAG('Y','B','A',' ')}}, /* Yoruba */ - {"yos", {HB_TAG('Q','I','N',' ')}}, /* Yos (retired code) -> Chin */ - {"yrk", {HB_TAG('T','N','E',' '), /* Nenets -> Tundra Nenets */ - HB_TAG('F','N','E',' ')}}, /* Nenets -> Forest Nenets */ - {"yue", {HB_TAG('Z','H','H',' ')}}, /* Yue Chinese -> Chinese, Hong Kong SAR */ - {"za", {HB_TAG('Z','H','A',' ')}}, /* Zhuang [macrolanguage] */ - {"zch", {HB_TAG('Z','H','A',' ')}}, /* Central Hongshuihe Zhuang -> Zhuang */ - {"zdj", {HB_TAG('C','M','R',' ')}}, /* Ngazidja Comorian -> Comorian */ - {"zea", {HB_TAG('Z','E','A',' ')}}, /* Zeeuws -> Zealandic */ - {"zeh", {HB_TAG('Z','H','A',' ')}}, /* Eastern Hongshuihe Zhuang -> Zhuang */ - {"zgb", {HB_TAG('Z','H','A',' ')}}, /* Guibei Zhuang -> Zhuang */ - {"zgh", {HB_TAG('Z','G','H',' ')}}, /* Standard Moroccan Tamazight */ - {"zgm", {HB_TAG('Z','H','A',' ')}}, /* Minz Zhuang -> Zhuang */ - {"zgn", {HB_TAG('Z','H','A',' ')}}, /* Guibian Zhuang -> Zhuang */ - {"zh", {HB_TAG('Z','H','S',' ')}}, /* Chinese [macrolanguage] -> Chinese Simplified */ - {"zhd", {HB_TAG('Z','H','A',' ')}}, /* Dai Zhuang -> Zhuang */ - {"zhn", {HB_TAG('Z','H','A',' ')}}, /* Nong Zhuang -> Zhuang */ - {"zlj", {HB_TAG('Z','H','A',' ')}}, /* Liujiang Zhuang -> Zhuang */ - {"zlm", {HB_TAG('M','L','Y',' ')}}, /* Malay */ - {"zln", {HB_TAG('Z','H','A',' ')}}, /* Lianshan Zhuang -> Zhuang */ - {"zlq", {HB_TAG('Z','H','A',' ')}}, /* Liuqian Zhuang -> Zhuang */ - {"zmi", {HB_TAG('M','L','Y',' ')}}, /* Negeri Sembilan Malay -> Malay */ - {"zne", {HB_TAG('Z','N','D',' ')}}, /* Zande */ - {"zom", {HB_TAG('Q','I','N',' ')}}, /* Zou -> Chin */ - {"zqe", {HB_TAG('Z','H','A',' ')}}, /* Qiubei Zhuang -> Zhuang */ - {"zsm", {HB_TAG('M','L','Y',' ')}}, /* Standard Malay -> Malay */ - {"zu", {HB_TAG('Z','U','L',' ')}}, /* Zulu */ - {"zum", {HB_TAG('L','R','C',' ')}}, /* Kumzari -> Luri */ - {"zyb", {HB_TAG('Z','H','A',' ')}}, /* Yongbei Zhuang -> Zhuang */ - {"zyg", {HB_TAG('Z','H','A',' ')}}, /* Yang Zhuang -> Zhuang */ - {"zyj", {HB_TAG('Z','H','A',' ')}}, /* Youjiang Zhuang -> Zhuang */ - {"zyn", {HB_TAG('Z','H','A',' ')}}, /* Yongnan Zhuang -> Zhuang */ - {"zza", {HB_TAG('Z','Z','A',' ')}}, /* Zazaki [macrolanguage] */ - {"zzj", {HB_TAG('Z','H','A',' ')}}, /* Zuojiang Zhuang -> Zhuang */ + {"aa", HB_TAG('A','F','R',' ')}, /* Afar */ + {"aae", HB_TAG('S','Q','I',' ')}, /* Arbëreshë Albanian -> Albanian */ + {"aao", HB_TAG('A','R','A',' ')}, /* Algerian Saharan Arabic -> Arabic */ + {"aat", HB_TAG('S','Q','I',' ')}, /* Arvanitika Albanian -> Albanian */ + {"ab", HB_TAG('A','B','K',' ')}, /* Abkhazian */ + {"abh", HB_TAG('A','R','A',' ')}, /* Tajiki Arabic -> Arabic */ + {"abq", HB_TAG('A','B','A',' ')}, /* Abaza */ + {"abv", HB_TAG('A','R','A',' ')}, /* Baharna Arabic -> Arabic */ + {"acf", HB_TAG('F','A','N',' ')}, /* Saint Lucian Creole French -> French Antillean */ +/*{"ach", HB_TAG('A','C','H',' ')},*/ /* Acoli -> Acholi */ + {"acm", HB_TAG('A','R','A',' ')}, /* Mesopotamian Arabic -> Arabic */ + {"acq", HB_TAG('A','R','A',' ')}, /* Ta'izzi-Adeni Arabic -> Arabic */ +/*{"acr", HB_TAG('A','C','R',' ')},*/ /* Achi */ + {"acw", HB_TAG('A','R','A',' ')}, /* Hijazi Arabic -> Arabic */ + {"acx", HB_TAG('A','R','A',' ')}, /* Omani Arabic -> Arabic */ + {"acy", HB_TAG('A','R','A',' ')}, /* Cypriot Arabic -> Arabic */ + {"ada", HB_TAG('D','N','G',' ')}, /* Adangme -> Dangme */ + {"adf", HB_TAG('A','R','A',' ')}, /* Dhofari Arabic -> Arabic */ + {"adp", HB_TAG('D','Z','N',' ')}, /* Adap (retired code) -> Dzongkha */ +/*{"ady", HB_TAG('A','D','Y',' ')},*/ /* Adyghe */ + {"aeb", HB_TAG('A','R','A',' ')}, /* Tunisian Arabic -> Arabic */ + {"aec", HB_TAG('A','R','A',' ')}, /* Saidi Arabic -> Arabic */ + {"af", HB_TAG('A','F','K',' ')}, /* Afrikaans */ + {"afb", HB_TAG('A','R','A',' ')}, /* Gulf Arabic -> Arabic */ + {"ahg", HB_TAG('A','G','W',' ')}, /* Qimant -> Agaw */ + {"aht", HB_TAG('A','T','H',' ')}, /* Ahtena -> Athapaskan */ + {"aii", HB_TAG('S','W','A',' ')}, /* Assyrian Neo-Aramaic -> Swadaya Aramaic */ + {"aii", HB_TAG('S','Y','R',' ')}, /* Assyrian Neo-Aramaic -> Syriac */ +/*{"aio", HB_TAG('A','I','O',' ')},*/ /* Aiton */ + {"aiw", HB_TAG('A','R','I',' ')}, /* Aari */ + {"ajp", HB_TAG('A','R','A',' ')}, /* South Levantine Arabic -> Arabic */ + {"ak", HB_TAG('A','K','A',' ')}, /* Akan [macrolanguage] */ + {"ak", HB_TAG('T','W','I',' ')}, /* Akan [macrolanguage] -> Twi */ + {"aln", HB_TAG('S','Q','I',' ')}, /* Gheg Albanian -> Albanian */ + {"als", HB_TAG('S','Q','I',' ')}, /* Tosk Albanian -> Albanian */ +/*{"alt", HB_TAG('A','L','T',' ')},*/ /* Southern Altai -> Altai */ + {"am", HB_TAG('A','M','H',' ')}, /* Amharic */ + {"amf", HB_TAG('H','B','N',' ')}, /* Hamer-Banna -> Hammer-Banna */ + {"amw", HB_TAG('S','Y','R',' ')}, /* Western Neo-Aramaic -> Syriac */ + {"an", HB_TAG('A','R','G',' ')}, /* Aragonese */ +/*{"ang", HB_TAG('A','N','G',' ')},*/ /* Old English (ca. 450-1100) -> Anglo-Saxon */ + {"apc", HB_TAG('A','R','A',' ')}, /* North Levantine Arabic -> Arabic */ + {"apd", HB_TAG('A','R','A',' ')}, /* Sudanese Arabic -> Arabic */ + {"apj", HB_TAG('A','T','H',' ')}, /* Jicarilla Apache -> Athapaskan */ + {"apk", HB_TAG('A','T','H',' ')}, /* Kiowa Apache -> Athapaskan */ + {"apl", HB_TAG('A','T','H',' ')}, /* Lipan Apache -> Athapaskan */ + {"apm", HB_TAG('A','T','H',' ')}, /* Mescalero-Chiricahua Apache -> Athapaskan */ + {"apw", HB_TAG('A','T','H',' ')}, /* Western Apache -> Athapaskan */ + {"ar", HB_TAG('A','R','A',' ')}, /* Arabic [macrolanguage] */ + {"arb", HB_TAG('A','R','A',' ')}, /* Standard Arabic -> Arabic */ + {"arn", HB_TAG('M','A','P',' ')}, /* Mapudungun */ + {"arq", HB_TAG('A','R','A',' ')}, /* Algerian Arabic -> Arabic */ + {"ars", HB_TAG('A','R','A',' ')}, /* Najdi Arabic -> Arabic */ + {"ary", HB_TAG('M','O','R',' ')}, /* Moroccan Arabic -> Moroccan */ + {"arz", HB_TAG('A','R','A',' ')}, /* Egyptian Arabic -> Arabic */ + {"as", HB_TAG('A','S','M',' ')}, /* Assamese */ +/*{"ast", HB_TAG('A','S','T',' ')},*/ /* Asturian */ +/*{"ath", HB_TAG('A','T','H',' ')},*/ /* Athapascan [family] -> Athapaskan */ + {"atj", HB_TAG('R','C','R',' ')}, /* Atikamekw -> R-Cree */ + {"atv", HB_TAG('A','L','T',' ')}, /* Northern Altai -> Altai */ + {"auz", HB_TAG('A','R','A',' ')}, /* Uzbeki Arabic -> Arabic */ + {"av", HB_TAG('A','V','R',' ')}, /* Avaric -> Avar */ + {"avl", HB_TAG('A','R','A',' ')}, /* Eastern Egyptian Bedawi Arabic -> Arabic */ +/*{"awa", HB_TAG('A','W','A',' ')},*/ /* Awadhi */ + {"ay", HB_TAG('A','Y','M',' ')}, /* Aymara [macrolanguage] */ + {"ayc", HB_TAG('A','Y','M',' ')}, /* Southern Aymara -> Aymara */ + {"ayh", HB_TAG('A','R','A',' ')}, /* Hadrami Arabic -> Arabic */ + {"ayl", HB_TAG('A','R','A',' ')}, /* Libyan Arabic -> Arabic */ + {"ayn", HB_TAG('A','R','A',' ')}, /* Sanaani Arabic -> Arabic */ + {"ayp", HB_TAG('A','R','A',' ')}, /* North Mesopotamian Arabic -> Arabic */ + {"ayr", HB_TAG('A','Y','M',' ')}, /* Central Aymara -> Aymara */ + {"az", HB_TAG('A','Z','E',' ')}, /* Azerbaijani [macrolanguage] */ +/*{"azb", HB_TAG('A','Z','B',' ')},*/ /* South Azerbaijani -> Torki */ + {"azj", HB_TAG('A','Z','E',' ')}, /* North Azerbaijani -> Azerbaijani */ + {"ba", HB_TAG('B','S','H',' ')}, /* Bashkir */ + {"bad", HB_TAG('B','A','D','0')}, /* Banda [family] */ + {"bai", HB_TAG('B','M','L',' ')}, /* Bamileke [family] */ + {"bal", HB_TAG('B','L','I',' ')}, /* Baluchi [macrolanguage] */ +/*{"ban", HB_TAG('B','A','N',' ')},*/ /* Balinese */ +/*{"bar", HB_TAG('B','A','R',' ')},*/ /* Bavarian */ +/*{"bbc", HB_TAG('B','B','C',' ')},*/ /* Batak Toba */ + {"bbz", HB_TAG('A','R','A',' ')}, /* Babalia Creole Arabic -> Arabic */ + {"bcc", HB_TAG('B','L','I',' ')}, /* Southern Balochi -> Baluchi */ + {"bci", HB_TAG('B','A','U',' ')}, /* Baoulé -> Baulé */ + {"bcl", HB_TAG('B','I','K',' ')}, /* Central Bikol -> Bikol */ + {"bcq", HB_TAG('B','C','H',' ')}, /* Bench */ + {"bcr", HB_TAG('A','T','H',' ')}, /* Babine -> Athapaskan */ +/*{"bdy", HB_TAG('B','D','Y',' ')},*/ /* Bandjalang */ + {"be", HB_TAG('B','E','L',' ')}, /* Belarusian -> Belarussian */ + {"bea", HB_TAG('A','T','H',' ')}, /* Beaver -> Athapaskan */ + {"beb", HB_TAG('B','T','I',' ')}, /* Bebele -> Beti */ +/*{"bem", HB_TAG('B','E','M',' ')},*/ /* Bemba (Zambia) */ + {"ber", HB_TAG('B','B','R',' ')}, /* Berber [family] */ + {"bfq", HB_TAG('B','A','D',' ')}, /* Badaga */ + {"bft", HB_TAG('B','L','T',' ')}, /* Balti */ + {"bfu", HB_TAG('L','A','H',' ')}, /* Gahri -> Lahuli */ + {"bfy", HB_TAG('B','A','G',' ')}, /* Bagheli -> Baghelkhandi */ + {"bg", HB_TAG('B','G','R',' ')}, /* Bulgarian */ +/*{"bgc", HB_TAG('B','G','C',' ')},*/ /* Haryanvi */ + {"bgn", HB_TAG('B','L','I',' ')}, /* Western Balochi -> Baluchi */ + {"bgp", HB_TAG('B','L','I',' ')}, /* Eastern Balochi -> Baluchi */ +/*{"bgq", HB_TAG('B','G','Q',' ')},*/ /* Bagri */ + {"bgr", HB_TAG('Q','I','N',' ')}, /* Bawm Chin -> Chin */ + {"bhb", HB_TAG('B','H','I',' ')}, /* Bhili */ +/*{"bhi", HB_TAG('B','H','I',' ')},*/ /* Bhilali -> Bhili */ + {"bhk", HB_TAG('B','I','K',' ')}, /* Albay Bicolano (retired code) -> Bikol */ +/*{"bho", HB_TAG('B','H','O',' ')},*/ /* Bhojpuri */ + {"bhr", HB_TAG('M','L','G',' ')}, /* Bara Malagasy -> Malagasy */ + {"bi", HB_TAG('B','I','S',' ')}, /* Bislama */ +/*{"bik", HB_TAG('B','I','K',' ')},*/ /* Bikol [macrolanguage] */ + {"bin", HB_TAG('E','D','O',' ')}, /* Edo */ +/*{"bjj", HB_TAG('B','J','J',' ')},*/ /* Kanauji */ + {"bjn", HB_TAG('M','L','Y',' ')}, /* Banjar -> Malay */ + {"bjq", HB_TAG('M','L','G',' ')}, /* Southern Betsimisaraka Malagasy (retired code) -> Malagasy */ + {"bjt", HB_TAG('B','L','N',' ')}, /* Balanta-Ganja -> Balante */ + {"bla", HB_TAG('B','K','F',' ')}, /* Siksika -> Blackfoot */ + {"ble", HB_TAG('B','L','N',' ')}, /* Balanta-Kentohe -> Balante */ +/*{"blk", HB_TAG('B','L','K',' ')},*/ /* Pa’o Karen */ + {"bln", HB_TAG('B','I','K',' ')}, /* Southern Catanduanes Bikol -> Bikol */ + {"bm", HB_TAG('B','M','B',' ')}, /* Bambara (Bamanankan) */ + {"bmm", HB_TAG('M','L','G',' ')}, /* Northern Betsimisaraka Malagasy -> Malagasy */ + {"bn", HB_TAG('B','E','N',' ')}, /* Bengali */ + {"bo", HB_TAG('T','I','B',' ')}, /* Tibetan */ +/*{"bpy", HB_TAG('B','P','Y',' ')},*/ /* Bishnupriya -> Bishnupriya Manipuri */ + {"bqi", HB_TAG('L','R','C',' ')}, /* Bakhtiari -> Luri */ + {"br", HB_TAG('B','R','E',' ')}, /* Breton */ + {"bra", HB_TAG('B','R','I',' ')}, /* Braj -> Braj Bhasha */ +/*{"brh", HB_TAG('B','R','H',' ')},*/ /* Brahui */ +/*{"brx", HB_TAG('B','R','X',' ')},*/ /* Bodo (India) */ + {"bs", HB_TAG('B','O','S',' ')}, /* Bosnian */ +/*{"bsk", HB_TAG('B','S','K',' ')},*/ /* Burushaski */ + {"btb", HB_TAG('B','T','I',' ')}, /* Beti (Cameroon) (retired code) */ + {"btj", HB_TAG('M','L','Y',' ')}, /* Bacanese Malay -> Malay */ + {"bto", HB_TAG('B','I','K',' ')}, /* Rinconada Bikol -> Bikol */ +/*{"bts", HB_TAG('B','T','S',' ')},*/ /* Batak Simalungun */ +/*{"bug", HB_TAG('B','U','G',' ')},*/ /* Buginese -> Bugis */ + {"bum", HB_TAG('B','T','I',' ')}, /* Bulu (Cameroon) -> Beti */ + {"bve", HB_TAG('M','L','Y',' ')}, /* Berau Malay -> Malay */ + {"bvu", HB_TAG('M','L','Y',' ')}, /* Bukit Malay -> Malay */ + {"bxk", HB_TAG('L','U','H',' ')}, /* Bukusu -> Luyia */ + {"bxp", HB_TAG('B','T','I',' ')}, /* Bebil -> Beti */ + {"bxr", HB_TAG('R','B','U',' ')}, /* Russia Buriat -> Russian Buriat */ + {"byn", HB_TAG('B','I','L',' ')}, /* Bilin -> Bilen */ +/*{"byv", HB_TAG('B','Y','V',' ')},*/ /* Medumba */ + {"bzc", HB_TAG('M','L','G',' ')}, /* Southern Betsimisaraka Malagasy -> Malagasy */ + {"ca", HB_TAG('C','A','T',' ')}, /* Catalan */ + {"caf", HB_TAG('C','R','R',' ')}, /* Southern Carrier -> Carrier */ + {"caf", HB_TAG('A','T','H',' ')}, /* Southern Carrier -> Athapaskan */ +/*{"cak", HB_TAG('C','A','K',' ')},*/ /* Kaqchikel */ +/*{"cbk", HB_TAG('C','B','K',' ')},*/ /* Chavacano -> Zamboanga Chavacano */ + {"cbl", HB_TAG('Q','I','N',' ')}, /* Bualkhaw Chin -> Chin */ + {"cco", HB_TAG('C','C','H','N')}, /* Comaltepec Chinantec -> Chinantec */ + {"ccq", HB_TAG('A','R','K',' ')}, /* Chaungtha (retired code) -> Rakhine */ + {"cdo", HB_TAG('Z','H','S',' ')}, /* Min Dong Chinese -> Chinese Simplified */ + {"ce", HB_TAG('C','H','E',' ')}, /* Chechen */ +/*{"ceb", HB_TAG('C','E','B',' ')},*/ /* Cebuano */ + {"cfm", HB_TAG('H','A','L',' ')}, /* Halam (Falam Chin) */ +/*{"cgg", HB_TAG('C','G','G',' ')},*/ /* Chiga */ + {"ch", HB_TAG('C','H','A',' ')}, /* Chamorro */ + {"chj", HB_TAG('C','C','H','N')}, /* Ojitlán Chinantec -> Chinantec */ + {"chk", HB_TAG('C','H','K','0')}, /* Chuukese */ +/*{"cho", HB_TAG('C','H','O',' ')},*/ /* Choctaw */ + {"chp", HB_TAG('C','H','P',' ')}, /* Chipewyan */ + {"chp", HB_TAG('S','A','Y',' ')}, /* Chipewyan -> Sayisi */ + {"chp", HB_TAG('A','T','H',' ')}, /* Chipewyan -> Athapaskan */ + {"chq", HB_TAG('C','C','H','N')}, /* Quiotepec Chinantec -> Chinantec */ +/*{"chr", HB_TAG('C','H','R',' ')},*/ /* Cherokee */ +/*{"chy", HB_TAG('C','H','Y',' ')},*/ /* Cheyenne */ + {"chz", HB_TAG('C','C','H','N')}, /* Ozumacín Chinantec -> Chinantec */ + {"ciw", HB_TAG('O','J','B',' ')}, /* Chippewa -> Ojibway */ +/*{"cja", HB_TAG('C','J','A',' ')},*/ /* Western Cham */ +/*{"cjm", HB_TAG('C','J','M',' ')},*/ /* Eastern Cham */ + {"cjy", HB_TAG('Z','H','S',' ')}, /* Jinyu Chinese -> Chinese Simplified */ + {"cka", HB_TAG('Q','I','N',' ')}, /* Khumi Awa Chin (retired code) -> Chin */ + {"ckb", HB_TAG('K','U','R',' ')}, /* Central Kurdish -> Kurdish */ + {"ckt", HB_TAG('C','H','K',' ')}, /* Chukot -> Chukchi */ + {"clc", HB_TAG('A','T','H',' ')}, /* Chilcotin -> Athapaskan */ + {"cld", HB_TAG('S','Y','R',' ')}, /* Chaldean Neo-Aramaic -> Syriac */ + {"cle", HB_TAG('C','C','H','N')}, /* Lealao Chinantec -> Chinantec */ + {"cmn", HB_TAG('Z','H','S',' ')}, /* Mandarin Chinese -> Chinese Simplified */ + {"cmr", HB_TAG('Q','I','N',' ')}, /* Mro-Khimi Chin -> Chin */ + {"cnb", HB_TAG('Q','I','N',' ')}, /* Chinbon Chin -> Chin */ + {"cnh", HB_TAG('Q','I','N',' ')}, /* Hakha Chin -> Chin */ + {"cnk", HB_TAG('Q','I','N',' ')}, /* Khumi Chin -> Chin */ + {"cnl", HB_TAG('C','C','H','N')}, /* Lalana Chinantec -> Chinantec */ + {"cnt", HB_TAG('C','C','H','N')}, /* Tepetotutla Chinantec -> Chinantec */ + {"cnw", HB_TAG('Q','I','N',' ')}, /* Ngawn Chin -> Chin */ + {"co", HB_TAG('C','O','S',' ')}, /* Corsican */ + {"coa", HB_TAG('M','L','Y',' ')}, /* Cocos Islands Malay -> Malay */ +/*{"cop", HB_TAG('C','O','P',' ')},*/ /* Coptic */ + {"coq", HB_TAG('A','T','H',' ')}, /* Coquille -> Athapaskan */ + {"cpa", HB_TAG('C','C','H','N')}, /* Palantla Chinantec -> Chinantec */ + {"cpe", HB_TAG('C','P','P',' ')}, /* English-based creoles and pidgins [family] -> Creoles */ + {"cpf", HB_TAG('C','P','P',' ')}, /* French-based creoles and pidgins [family] -> Creoles */ +/*{"cpp", HB_TAG('C','P','P',' ')},*/ /* Portuguese-based creoles and pidgins [family] -> Creoles */ + {"cpx", HB_TAG('Z','H','S',' ')}, /* Pu-Xian Chinese -> Chinese Simplified */ + {"cqd", HB_TAG('H','M','N',' ')}, /* Chuanqiandian Cluster Miao -> Hmong */ + {"cqu", HB_TAG('Q','U','H',' ')}, /* Chilean Quechua (retired code) -> Quechua (Bolivia) */ + {"cr", HB_TAG('C','R','E',' ')}, /* Cree [macrolanguage] */ + {"cr", HB_TAG('Y','C','R',' ')}, /* Cree [macrolanguage] -> Y-Cree */ + {"crh", HB_TAG('C','R','T',' ')}, /* Crimean Tatar */ + {"crj", HB_TAG('E','C','R',' ')}, /* Southern East Cree -> Eastern Cree */ + {"crk", HB_TAG('W','C','R',' ')}, /* Plains Cree -> West-Cree */ + {"crl", HB_TAG('E','C','R',' ')}, /* Northern East Cree -> Eastern Cree */ + {"crm", HB_TAG('M','C','R',' ')}, /* Moose Cree */ + {"crm", HB_TAG('L','C','R',' ')}, /* Moose Cree -> L-Cree */ + {"crp", HB_TAG('C','P','P',' ')}, /* Creoles and pidgins [family] -> Creoles */ + {"crx", HB_TAG('C','R','R',' ')}, /* Carrier */ + {"crx", HB_TAG('A','T','H',' ')}, /* Carrier -> Athapaskan */ + {"cs", HB_TAG('C','S','Y',' ')}, /* Czech */ + {"csa", HB_TAG('C','C','H','N')}, /* Chiltepec Chinantec -> Chinantec */ +/*{"csb", HB_TAG('C','S','B',' ')},*/ /* Kashubian */ + {"csh", HB_TAG('Q','I','N',' ')}, /* Asho Chin -> Chin */ + {"cso", HB_TAG('C','C','H','N')}, /* Sochiapam Chinantec -> Chinantec */ + {"csw", HB_TAG('N','C','R',' ')}, /* Swampy Cree -> N-Cree */ + {"csw", HB_TAG('N','H','C',' ')}, /* Swampy Cree -> Norway House Cree */ + {"csy", HB_TAG('Q','I','N',' ')}, /* Siyin Chin -> Chin */ + {"ctc", HB_TAG('A','T','H',' ')}, /* Chetco -> Athapaskan */ + {"ctd", HB_TAG('Q','I','N',' ')}, /* Tedim Chin -> Chin */ + {"cte", HB_TAG('C','C','H','N')}, /* Tepinapa Chinantec -> Chinantec */ +/*{"ctg", HB_TAG('C','T','G',' ')},*/ /* Chittagonian */ + {"ctl", HB_TAG('C','C','H','N')}, /* Tlacoatzintepec Chinantec -> Chinantec */ + {"cts", HB_TAG('B','I','K',' ')}, /* Northern Catanduanes Bikol -> Bikol */ + {"cu", HB_TAG('C','S','L',' ')}, /* Church Slavonic */ + {"cuc", HB_TAG('C','C','H','N')}, /* Usila Chinantec -> Chinantec */ +/*{"cuk", HB_TAG('C','U','K',' ')},*/ /* San Blas Kuna */ + {"cv", HB_TAG('C','H','U',' ')}, /* Chuvash */ + {"cvn", HB_TAG('C','C','H','N')}, /* Valle Nacional Chinantec -> Chinantec */ + {"cwd", HB_TAG('D','C','R',' ')}, /* Woods Cree */ + {"cwd", HB_TAG('T','C','R',' ')}, /* Woods Cree -> TH-Cree */ + {"cy", HB_TAG('W','E','L',' ')}, /* Welsh */ + {"czh", HB_TAG('Z','H','S',' ')}, /* Huizhou Chinese -> Chinese Simplified */ + {"czo", HB_TAG('Z','H','S',' ')}, /* Min Zhong Chinese -> Chinese Simplified */ + {"czt", HB_TAG('Q','I','N',' ')}, /* Zotung Chin -> Chin */ + {"da", HB_TAG('D','A','N',' ')}, /* Danish */ + {"dao", HB_TAG('Q','I','N',' ')}, /* Daai Chin -> Chin */ + {"dap", HB_TAG('N','I','S',' ')}, /* Nisi (India) (retired code) */ +/*{"dar", HB_TAG('D','A','R',' ')},*/ /* Dargwa */ +/*{"dax", HB_TAG('D','A','X',' ')},*/ /* Dayi */ + {"de", HB_TAG('D','E','U',' ')}, /* German */ + {"den", HB_TAG('S','L','A',' ')}, /* Slave (Athapascan) [macrolanguage] -> Slavey */ + {"den", HB_TAG('A','T','H',' ')}, /* Slave (Athapascan) [macrolanguage] -> Athapaskan */ +/*{"dgo", HB_TAG('D','G','O',' ')},*/ /* Dogri */ + {"dgr", HB_TAG('A','T','H',' ')}, /* Dogrib -> Athapaskan */ + {"dhd", HB_TAG('M','A','W',' ')}, /* Dhundari -> Marwari */ +/*{"dhg", HB_TAG('D','H','G',' ')},*/ /* Dhangu */ + {"dib", HB_TAG('D','N','K',' ')}, /* South Central Dinka -> Dinka */ + {"dik", HB_TAG('D','N','K',' ')}, /* Southwestern Dinka -> Dinka */ + {"din", HB_TAG('D','N','K',' ')}, /* Dinka [macrolanguage] */ + {"dip", HB_TAG('D','N','K',' ')}, /* Northeastern Dinka -> Dinka */ +/*{"diq", HB_TAG('D','I','Q',' ')},*/ /* Dimli */ + {"diw", HB_TAG('D','N','K',' ')}, /* Northwestern Dinka -> Dinka */ + {"dje", HB_TAG('D','J','R',' ')}, /* Zarma */ + {"djr", HB_TAG('D','J','R','0')}, /* Djambarrpuyngu */ + {"dks", HB_TAG('D','N','K',' ')}, /* Southeastern Dinka -> Dinka */ + {"dng", HB_TAG('D','U','N',' ')}, /* Dungan */ +/*{"dnj", HB_TAG('D','N','J',' ')},*/ /* Dan */ + {"doi", HB_TAG('D','G','R',' ')}, /* Dogri [macrolanguage] */ + {"drh", HB_TAG('M','N','G',' ')}, /* Darkhat (retired code) -> Mongolian */ + {"drw", HB_TAG('D','R','I',' ')}, /* Darwazi (retired code) -> Dari */ + {"dsb", HB_TAG('L','S','B',' ')}, /* Lower Sorbian */ + {"dty", HB_TAG('N','E','P',' ')}, /* Dotyali -> Nepali */ +/*{"duj", HB_TAG('D','U','J',' ')},*/ /* Dhuwal (retired code) */ + {"dup", HB_TAG('M','L','Y',' ')}, /* Duano -> Malay */ + {"dv", HB_TAG('D','I','V',' ')}, /* Divehi (Dhivehi, Maldivian) */ + {"dv", HB_TAG('D','H','V',' ')}, /* Divehi (Dhivehi, Maldivian) (deprecated) */ + {"dwu", HB_TAG('D','U','J',' ')}, /* Dhuwal */ + {"dwy", HB_TAG('D','U','J',' ')}, /* Dhuwaya -> Dhuwal */ + {"dyu", HB_TAG('J','U','L',' ')}, /* Dyula -> Jula */ + {"dz", HB_TAG('D','Z','N',' ')}, /* Dzongkha */ + {"ee", HB_TAG('E','W','E',' ')}, /* Ewe */ +/*{"efi", HB_TAG('E','F','I',' ')},*/ /* Efik */ + {"ekk", HB_TAG('E','T','I',' ')}, /* Standard Estonian -> Estonian */ + {"el", HB_TAG('E','L','L',' ')}, /* Modern Greek (1453-) -> Greek */ + {"emk", HB_TAG('E','M','K',' ')}, /* Eastern Maninkakan */ + {"emk", HB_TAG('M','N','K',' ')}, /* Eastern Maninkakan -> Maninka */ + {"en", HB_TAG('E','N','G',' ')}, /* English */ + {"enb", HB_TAG('K','A','L',' ')}, /* Markweeta -> Kalenjin */ + {"enf", HB_TAG('F','N','E',' ')}, /* Forest Enets -> Forest Nenets */ + {"enh", HB_TAG('T','N','E',' ')}, /* Tundra Enets -> Tundra Nenets */ + {"eo", HB_TAG('N','T','O',' ')}, /* Esperanto */ + {"es", HB_TAG('E','S','P',' ')}, /* Spanish */ + {"esg", HB_TAG('G','O','N',' ')}, /* Aheri Gondi -> Gondi */ + {"esi", HB_TAG('I','P','K',' ')}, /* North Alaskan Inupiatun -> Inupiat */ + {"esk", HB_TAG('I','P','K',' ')}, /* Northwest Alaska Inupiatun -> Inupiat */ +/*{"esu", HB_TAG('E','S','U',' ')},*/ /* Central Yupik */ + {"et", HB_TAG('E','T','I',' ')}, /* Estonian [macrolanguage] */ + {"eto", HB_TAG('B','T','I',' ')}, /* Eton (Cameroon) -> Beti */ + {"eu", HB_TAG('E','U','Q',' ')}, /* Basque */ + {"eve", HB_TAG('E','V','N',' ')}, /* Even */ + {"evn", HB_TAG('E','V','K',' ')}, /* Evenki */ + {"ewo", HB_TAG('B','T','I',' ')}, /* Ewondo -> Beti */ + {"eyo", HB_TAG('K','A','L',' ')}, /* Keiyo -> Kalenjin */ + {"fa", HB_TAG('F','A','R',' ')}, /* Persian [macrolanguage] */ + {"fan", HB_TAG('F','A','N','0')}, /* Fang (Equatorial Guinea) */ +/*{"fat", HB_TAG('F','A','T',' ')},*/ /* Fanti */ + {"fbl", HB_TAG('B','I','K',' ')}, /* West Albay Bikol -> Bikol */ + {"ff", HB_TAG('F','U','L',' ')}, /* Fulah [macrolanguage] */ + {"ffm", HB_TAG('F','U','L',' ')}, /* Maasina Fulfulde -> Fulah */ + {"fi", HB_TAG('F','I','N',' ')}, /* Finnish */ + {"fil", HB_TAG('P','I','L',' ')}, /* Filipino */ + {"fj", HB_TAG('F','J','I',' ')}, /* Fijian */ + {"flm", HB_TAG('H','A','L',' ')}, /* Halam (Falam Chin) (retired code) */ + {"flm", HB_TAG('Q','I','N',' ')}, /* Falam Chin (retired code) -> Chin */ +/*{"fmp", HB_TAG('F','M','P',' ')},*/ /* Fe’fe’ */ + {"fo", HB_TAG('F','O','S',' ')}, /* Faroese */ +/*{"fon", HB_TAG('F','O','N',' ')},*/ /* Fon */ + {"fr", HB_TAG('F','R','A',' ')}, /* French */ +/*{"frc", HB_TAG('F','R','C',' ')},*/ /* Cajun French */ +/*{"frp", HB_TAG('F','R','P',' ')},*/ /* Arpitan */ + {"fub", HB_TAG('F','U','L',' ')}, /* Adamawa Fulfulde -> Fulah */ + {"fuc", HB_TAG('F','U','L',' ')}, /* Pulaar -> Fulah */ + {"fue", HB_TAG('F','U','L',' ')}, /* Borgu Fulfulde -> Fulah */ + {"fuf", HB_TAG('F','T','A',' ')}, /* Pular -> Futa */ + {"fuh", HB_TAG('F','U','L',' ')}, /* Western Niger Fulfulde -> Fulah */ + {"fui", HB_TAG('F','U','L',' ')}, /* Bagirmi Fulfulde -> Fulah */ + {"fuq", HB_TAG('F','U','L',' ')}, /* Central-Eastern Niger Fulfulde -> Fulah */ + {"fur", HB_TAG('F','R','L',' ')}, /* Friulian */ +/*{"fuv", HB_TAG('F','U','V',' ')},*/ /* Nigerian Fulfulde */ + {"fy", HB_TAG('F','R','I',' ')}, /* Western Frisian -> Frisian */ + {"ga", HB_TAG('I','R','I',' ')}, /* Irish */ + {"gaa", HB_TAG('G','A','D',' ')}, /* Ga */ +/*{"gag", HB_TAG('G','A','G',' ')},*/ /* Gagauz */ + {"gan", HB_TAG('Z','H','S',' ')}, /* Gan Chinese -> Chinese Simplified */ + {"gax", HB_TAG('O','R','O',' ')}, /* Borana-Arsi-Guji Oromo -> Oromo */ + {"gaz", HB_TAG('O','R','O',' ')}, /* West Central Oromo -> Oromo */ + {"gbm", HB_TAG('G','A','W',' ')}, /* Garhwali */ + {"gce", HB_TAG('A','T','H',' ')}, /* Galice -> Athapaskan */ + {"gd", HB_TAG('G','A','E',' ')}, /* Scottish Gaelic (Gaelic) */ + {"gda", HB_TAG('R','A','J',' ')}, /* Gade Lohar -> Rajasthani */ +/*{"gez", HB_TAG('G','E','Z',' ')},*/ /* Geez */ + {"ggo", HB_TAG('G','O','N',' ')}, /* Southern Gondi (retired code) -> Gondi */ +/*{"gih", HB_TAG('G','I','H',' ')},*/ /* Githabul */ + {"gil", HB_TAG('G','I','L','0')}, /* Kiribati (Gilbertese) */ + {"gju", HB_TAG('R','A','J',' ')}, /* Gujari -> Rajasthani */ +/*{"gkp", HB_TAG('G','K','P',' ')},*/ /* Guinea Kpelle -> Kpelle (Guinea) */ + {"gl", HB_TAG('G','A','L',' ')}, /* Galician */ + {"gld", HB_TAG('N','A','N',' ')}, /* Nanai */ +/*{"glk", HB_TAG('G','L','K',' ')},*/ /* Gilaki */ + {"gn", HB_TAG('G','U','A',' ')}, /* Guarani [macrolanguage] */ +/*{"gnn", HB_TAG('G','N','N',' ')},*/ /* Gumatj */ + {"gno", HB_TAG('G','O','N',' ')}, /* Northern Gondi -> Gondi */ + {"gnw", HB_TAG('G','U','A',' ')}, /* Western Bolivian Guaraní -> Guarani */ +/*{"gog", HB_TAG('G','O','G',' ')},*/ /* Gogo */ + {"gom", HB_TAG('K','O','K',' ')}, /* Goan Konkani -> Konkani */ +/*{"gon", HB_TAG('G','O','N',' ')},*/ /* Gondi [macrolanguage] */ + {"grt", HB_TAG('G','R','O',' ')}, /* Garo */ + {"gru", HB_TAG('S','O','G',' ')}, /* Kistane -> Sodo Gurage */ + {"gsw", HB_TAG('A','L','S',' ')}, /* Alsatian */ + {"gu", HB_TAG('G','U','J',' ')}, /* Gujarati */ +/*{"guc", HB_TAG('G','U','C',' ')},*/ /* Wayuu */ +/*{"guf", HB_TAG('G','U','F',' ')},*/ /* Gupapuyngu */ + {"gug", HB_TAG('G','U','A',' ')}, /* Paraguayan Guaraní -> Guarani */ + {"gui", HB_TAG('G','U','A',' ')}, /* Eastern Bolivian Guaraní -> Guarani */ + {"guk", HB_TAG('G','M','Z',' ')}, /* Gumuz */ + {"guk", HB_TAG('G','U','K',' ')}, /* Gumuz (SIL fonts) */ + {"gun", HB_TAG('G','U','A',' ')}, /* Mbyá Guaraní -> Guarani */ +/*{"guz", HB_TAG('G','U','Z',' ')},*/ /* Gusii */ + {"gv", HB_TAG('M','N','X',' ')}, /* Manx */ + {"gwi", HB_TAG('A','T','H',' ')}, /* Gwichʼin -> Athapaskan */ + {"ha", HB_TAG('H','A','U',' ')}, /* Hausa */ + {"haa", HB_TAG('A','T','H',' ')}, /* Han -> Athapaskan */ + {"hae", HB_TAG('O','R','O',' ')}, /* Eastern Oromo -> Oromo */ + {"hak", HB_TAG('Z','H','S',' ')}, /* Hakka Chinese -> Chinese Simplified */ + {"har", HB_TAG('H','R','I',' ')}, /* Harari */ +/*{"haw", HB_TAG('H','A','W',' ')},*/ /* Hawaiian */ +/*{"hay", HB_TAG('H','A','Y',' ')},*/ /* Haya */ +/*{"haz", HB_TAG('H','A','Z',' ')},*/ /* Hazaragi */ + {"he", HB_TAG('I','W','R',' ')}, /* Hebrew */ + {"hea", HB_TAG('H','M','N',' ')}, /* Northern Qiandong Miao -> Hmong */ + {"hi", HB_TAG('H','I','N',' ')}, /* Hindi */ +/*{"hil", HB_TAG('H','I','L',' ')},*/ /* Hiligaynon */ + {"hji", HB_TAG('M','L','Y',' ')}, /* Haji -> Malay */ + {"hlt", HB_TAG('Q','I','N',' ')}, /* Matu Chin -> Chin */ + {"hma", HB_TAG('H','M','N',' ')}, /* Southern Mashan Hmong -> Hmong */ + {"hmc", HB_TAG('H','M','N',' ')}, /* Central Huishui Hmong -> Hmong */ + {"hmd", HB_TAG('H','M','N',' ')}, /* Large Flowery Miao -> Hmong */ + {"hme", HB_TAG('H','M','N',' ')}, /* Eastern Huishui Hmong -> Hmong */ + {"hmg", HB_TAG('H','M','N',' ')}, /* Southwestern Guiyang Hmong -> Hmong */ + {"hmh", HB_TAG('H','M','N',' ')}, /* Southwestern Huishui Hmong -> Hmong */ + {"hmi", HB_TAG('H','M','N',' ')}, /* Northern Huishui Hmong -> Hmong */ + {"hmj", HB_TAG('H','M','N',' ')}, /* Ge -> Hmong */ + {"hml", HB_TAG('H','M','N',' ')}, /* Luopohe Hmong -> Hmong */ + {"hmm", HB_TAG('H','M','N',' ')}, /* Central Mashan Hmong -> Hmong */ +/*{"hmn", HB_TAG('H','M','N',' ')},*/ /* Hmong [macrolanguage] */ + {"hmp", HB_TAG('H','M','N',' ')}, /* Northern Mashan Hmong -> Hmong */ + {"hmq", HB_TAG('H','M','N',' ')}, /* Eastern Qiandong Miao -> Hmong */ + {"hms", HB_TAG('H','M','N',' ')}, /* Southern Qiandong Miao -> Hmong */ + {"hmw", HB_TAG('H','M','N',' ')}, /* Western Mashan Hmong -> Hmong */ + {"hmy", HB_TAG('H','M','N',' ')}, /* Southern Guiyang Hmong -> Hmong */ + {"hmz", HB_TAG('H','M','N',' ')}, /* Hmong Shua -> Hmong */ +/*{"hnd", HB_TAG('H','N','D',' ')},*/ /* Southern Hindko -> Hindko */ + {"hne", HB_TAG('C','H','H',' ')}, /* Chhattisgarhi -> Chattisgarhi */ + {"hnj", HB_TAG('H','M','N',' ')}, /* Hmong Njua -> Hmong */ + {"hno", HB_TAG('H','N','D',' ')}, /* Northern Hindko -> Hindko */ + {"ho", HB_TAG('H','M','O',' ')}, /* Hiri Motu */ + {"hoc", HB_TAG('H','O',' ',' ')}, /* Ho */ + {"hoi", HB_TAG('A','T','H',' ')}, /* Holikachuk -> Athapaskan */ + {"hoj", HB_TAG('H','A','R',' ')}, /* Hadothi -> Harauti */ + {"hr", HB_TAG('H','R','V',' ')}, /* Croatian */ + {"hrm", HB_TAG('H','M','N',' ')}, /* Horned Miao -> Hmong */ + {"hsb", HB_TAG('U','S','B',' ')}, /* Upper Sorbian */ + {"hsn", HB_TAG('Z','H','S',' ')}, /* Xiang Chinese -> Chinese Simplified */ + {"ht", HB_TAG('H','A','I',' ')}, /* Haitian (Haitian Creole) */ + {"hu", HB_TAG('H','U','N',' ')}, /* Hungarian */ + {"huj", HB_TAG('H','M','N',' ')}, /* Northern Guiyang Hmong -> Hmong */ + {"hup", HB_TAG('A','T','H',' ')}, /* Hupa -> Athapaskan */ + {"hy", HB_TAG('H','Y','E','0')}, /* Armenian -> Armenian East */ + {"hy", HB_TAG('H','Y','E',' ')}, /* Armenian */ + {"hyw", HB_TAG('H','Y','E',' ')}, /* Western Armenian -> Armenian */ + {"hz", HB_TAG('H','E','R',' ')}, /* Herero */ + {"ia", HB_TAG('I','N','A',' ')}, /* Interlingua (International Auxiliary Language Association) */ +/*{"iba", HB_TAG('I','B','A',' ')},*/ /* Iban */ +/*{"ibb", HB_TAG('I','B','B',' ')},*/ /* Ibibio */ + {"id", HB_TAG('I','N','D',' ')}, /* Indonesian */ + {"ida", HB_TAG('L','U','H',' ')}, /* Idakho-Isukha-Tiriki -> Luyia */ + {"ie", HB_TAG('I','L','E',' ')}, /* Interlingue */ + {"ig", HB_TAG('I','B','O',' ')}, /* Igbo */ + {"igb", HB_TAG('E','B','I',' ')}, /* Ebira */ + {"ii", HB_TAG('Y','I','M',' ')}, /* Sichuan Yi -> Yi Modern */ + {"ijc", HB_TAG('I','J','O',' ')}, /* Izon -> Ijo */ +/*{"ijo", HB_TAG('I','J','O',' ')},*/ /* Ijo [family] */ + {"ik", HB_TAG('I','P','K',' ')}, /* Inupiaq [macrolanguage] -> Inupiat */ + {"ike", HB_TAG('I','N','U',' ')}, /* Eastern Canadian Inuktitut -> Inuktitut */ + {"ikt", HB_TAG('I','N','U',' ')}, /* Inuinnaqtun -> Inuktitut */ +/*{"ilo", HB_TAG('I','L','O',' ')},*/ /* Iloko -> Ilokano */ + {"in", HB_TAG('I','N','D',' ')}, /* Indonesian (retired code) */ + {"ing", HB_TAG('A','T','H',' ')}, /* Degexit'an -> Athapaskan */ + {"inh", HB_TAG('I','N','G',' ')}, /* Ingush */ + {"io", HB_TAG('I','D','O',' ')}, /* Ido */ + {"is", HB_TAG('I','S','L',' ')}, /* Icelandic */ + {"it", HB_TAG('I','T','A',' ')}, /* Italian */ + {"iu", HB_TAG('I','N','U',' ')}, /* Inuktitut [macrolanguage] */ + {"iw", HB_TAG('I','W','R',' ')}, /* Hebrew (retired code) */ + {"ja", HB_TAG('J','A','N',' ')}, /* Japanese */ + {"jak", HB_TAG('M','L','Y',' ')}, /* Jakun -> Malay */ +/*{"jam", HB_TAG('J','A','M',' ')},*/ /* Jamaican Creole English -> Jamaican Creole */ + {"jax", HB_TAG('M','L','Y',' ')}, /* Jambi Malay -> Malay */ +/*{"jbo", HB_TAG('J','B','O',' ')},*/ /* Lojban */ +/*{"jct", HB_TAG('J','C','T',' ')},*/ /* Krymchak */ + {"ji", HB_TAG('J','I','I',' ')}, /* Yiddish (retired code) */ + {"jv", HB_TAG('J','A','V',' ')}, /* Javanese */ + {"jw", HB_TAG('J','A','V',' ')}, /* Javanese (retired code) */ + {"ka", HB_TAG('K','A','T',' ')}, /* Georgian */ + {"kaa", HB_TAG('K','R','K',' ')}, /* Kara-Kalpak -> Karakalpak */ + {"kab", HB_TAG('K','A','B','0')}, /* Kabyle */ + {"kam", HB_TAG('K','M','B',' ')}, /* Kamba (Kenya) */ + {"kar", HB_TAG('K','R','N',' ')}, /* Karen [family] */ + {"kbd", HB_TAG('K','A','B',' ')}, /* Kabardian */ + {"kby", HB_TAG('K','N','R',' ')}, /* Manga Kanuri -> Kanuri */ + {"kca", HB_TAG('K','H','K',' ')}, /* Khanty -> Khanty-Kazim */ + {"kca", HB_TAG('K','H','S',' ')}, /* Khanty -> Khanty-Shurishkar */ + {"kca", HB_TAG('K','H','V',' ')}, /* Khanty -> Khanty-Vakhi */ +/*{"kde", HB_TAG('K','D','E',' ')},*/ /* Makonde */ + {"kdr", HB_TAG('K','R','M',' ')}, /* Karaim */ + {"kdt", HB_TAG('K','U','Y',' ')}, /* Kuy */ +/*{"kea", HB_TAG('K','E','A',' ')},*/ /* Kabuverdianu (Crioulo) */ +/*{"kek", HB_TAG('K','E','K',' ')},*/ /* Kekchi */ + {"kex", HB_TAG('K','K','N',' ')}, /* Kukna -> Kokni */ + {"kfa", HB_TAG('K','O','D',' ')}, /* Kodava -> Kodagu */ + {"kfr", HB_TAG('K','A','C',' ')}, /* Kachhi -> Kachchi */ + {"kfx", HB_TAG('K','U','L',' ')}, /* Kullu Pahari -> Kulvi */ + {"kfy", HB_TAG('K','M','N',' ')}, /* Kumaoni */ + {"kg", HB_TAG('K','O','N','0')}, /* Kongo [macrolanguage] */ + {"kha", HB_TAG('K','S','I',' ')}, /* Khasi */ + {"khb", HB_TAG('X','B','D',' ')}, /* Lü */ + {"khk", HB_TAG('M','N','G',' ')}, /* Halh Mongolian -> Mongolian */ + {"kht", HB_TAG('K','H','N',' ')}, /* Khamti -> Khamti Shan (Microsoft fonts) */ + {"kht", HB_TAG('K','H','T',' ')}, /* Khamti -> Khamti Shan (OpenType spec and SIL fonts) */ +/*{"khw", HB_TAG('K','H','W',' ')},*/ /* Khowar */ + {"ki", HB_TAG('K','I','K',' ')}, /* Kikuyu (Gikuyu) */ +/*{"kiu", HB_TAG('K','I','U',' ')},*/ /* Kirmanjki */ + {"kj", HB_TAG('K','U','A',' ')}, /* Kuanyama */ +/*{"kjd", HB_TAG('K','J','D',' ')},*/ /* Southern Kiwai */ + {"kjh", HB_TAG('K','H','A',' ')}, /* Khakas -> Khakass */ +/*{"kjp", HB_TAG('K','J','P',' ')},*/ /* Pwo Eastern Karen -> Eastern Pwo Karen */ +/*{"kjz", HB_TAG('K','J','Z',' ')},*/ /* Bumthangkha */ + {"kk", HB_TAG('K','A','Z',' ')}, /* Kazakh */ + {"kkz", HB_TAG('A','T','H',' ')}, /* Kaska -> Athapaskan */ + {"kl", HB_TAG('G','R','N',' ')}, /* Greenlandic */ + {"kln", HB_TAG('K','A','L',' ')}, /* Kalenjin [macrolanguage] */ + {"km", HB_TAG('K','H','M',' ')}, /* Khmer */ + {"kmb", HB_TAG('M','B','N',' ')}, /* Kimbundu -> Mbundu */ + {"kmr", HB_TAG('K','U','R',' ')}, /* Northern Kurdish -> Kurdish */ + {"kmw", HB_TAG('K','M','O',' ')}, /* Komo (Democratic Republic of Congo) */ +/*{"kmz", HB_TAG('K','M','Z',' ')},*/ /* Khorasani Turkish -> Khorasani Turkic */ + {"kn", HB_TAG('K','A','N',' ')}, /* Kannada */ + {"knc", HB_TAG('K','N','R',' ')}, /* Central Kanuri -> Kanuri */ + {"kng", HB_TAG('K','O','N','0')}, /* Koongo -> Kongo */ + {"knn", HB_TAG('K','O','K',' ')}, /* Konkani */ + {"ko", HB_TAG('K','O','R',' ')}, /* Korean */ + {"koi", HB_TAG('K','O','P',' ')}, /* Komi-Permyak */ +/*{"kok", HB_TAG('K','O','K',' ')},*/ /* Konkani [macrolanguage] */ +/*{"kos", HB_TAG('K','O','S',' ')},*/ /* Kosraean */ + {"koy", HB_TAG('A','T','H',' ')}, /* Koyukon -> Athapaskan */ + {"kpe", HB_TAG('K','P','L',' ')}, /* Kpelle [macrolanguage] */ + {"kpv", HB_TAG('K','O','Z',' ')}, /* Komi-Zyrian */ + {"kpy", HB_TAG('K','Y','K',' ')}, /* Koryak */ + {"kqs", HB_TAG('K','I','S',' ')}, /* Northern Kissi -> Kisii */ + {"kqy", HB_TAG('K','R','T',' ')}, /* Koorete */ + {"kr", HB_TAG('K','N','R',' ')}, /* Kanuri [macrolanguage] */ + {"krc", HB_TAG('K','A','R',' ')}, /* Karachay-Balkar -> Karachay */ + {"krc", HB_TAG('B','A','L',' ')}, /* Karachay-Balkar -> Balkar */ +/*{"kri", HB_TAG('K','R','I',' ')},*/ /* Krio */ +/*{"krl", HB_TAG('K','R','L',' ')},*/ /* Karelian */ + {"krt", HB_TAG('K','N','R',' ')}, /* Tumari Kanuri -> Kanuri */ + {"kru", HB_TAG('K','U','U',' ')}, /* Kurukh */ + {"ks", HB_TAG('K','S','H',' ')}, /* Kashmiri */ + {"ksh", HB_TAG('K','S','H','0')}, /* Kölsch -> Ripuarian */ + {"kss", HB_TAG('K','I','S',' ')}, /* Southern Kisi -> Kisii */ +/*{"ksw", HB_TAG('K','S','W',' ')},*/ /* S’gaw Karen */ + {"ktb", HB_TAG('K','E','B',' ')}, /* Kambaata -> Kebena */ + {"ktu", HB_TAG('K','O','N',' ')}, /* Kituba (Democratic Republic of Congo) -> Kikongo */ + {"ktw", HB_TAG('A','T','H',' ')}, /* Kato -> Athapaskan */ + {"ku", HB_TAG('K','U','R',' ')}, /* Kurdish [macrolanguage] */ +/*{"kum", HB_TAG('K','U','M',' ')},*/ /* Kumyk */ + {"kuu", HB_TAG('A','T','H',' ')}, /* Upper Kuskokwim -> Athapaskan */ + {"kv", HB_TAG('K','O','M',' ')}, /* Komi [macrolanguage] */ + {"kvb", HB_TAG('M','L','Y',' ')}, /* Kubu -> Malay */ + {"kvr", HB_TAG('M','L','Y',' ')}, /* Kerinci -> Malay */ + {"kw", HB_TAG('C','O','R',' ')}, /* Cornish */ + {"kwy", HB_TAG('K','O','N','0')}, /* San Salvador Kongo -> Kongo */ + {"kxc", HB_TAG('K','M','S',' ')}, /* Konso -> Komso */ + {"kxd", HB_TAG('M','L','Y',' ')}, /* Brunei -> Malay */ + {"kxu", HB_TAG('K','U','I',' ')}, /* Kui (India) */ + {"ky", HB_TAG('K','I','R',' ')}, /* Kirghiz (Kyrgyz) */ +/*{"kyu", HB_TAG('K','Y','U',' ')},*/ /* Western Kayah */ + {"la", HB_TAG('L','A','T',' ')}, /* Latin */ + {"lad", HB_TAG('J','U','D',' ')}, /* Ladino */ + {"lb", HB_TAG('L','T','Z',' ')}, /* Luxembourgish */ + {"lbe", HB_TAG('L','A','K',' ')}, /* Lak */ + {"lbj", HB_TAG('L','D','K',' ')}, /* Ladakhi */ + {"lbl", HB_TAG('B','I','K',' ')}, /* Libon Bikol -> Bikol */ + {"lce", HB_TAG('M','L','Y',' ')}, /* Loncong -> Malay */ + {"lcf", HB_TAG('M','L','Y',' ')}, /* Lubu -> Malay */ + {"ldi", HB_TAG('K','O','N','0')}, /* Laari -> Kongo */ +/*{"lez", HB_TAG('L','E','Z',' ')},*/ /* Lezghian -> Lezgi */ + {"lg", HB_TAG('L','U','G',' ')}, /* Ganda */ + {"li", HB_TAG('L','I','M',' ')}, /* Limburgish */ + {"lif", HB_TAG('L','M','B',' ')}, /* Limbu */ +/*{"lij", HB_TAG('L','I','J',' ')},*/ /* Ligurian */ +/*{"lis", HB_TAG('L','I','S',' ')},*/ /* Lisu */ + {"liw", HB_TAG('M','L','Y',' ')}, /* Col -> Malay */ +/*{"ljp", HB_TAG('L','J','P',' ')},*/ /* Lampung Api -> Lampung */ + {"lkb", HB_TAG('L','U','H',' ')}, /* Kabras -> Luyia */ +/*{"lki", HB_TAG('L','K','I',' ')},*/ /* Laki */ + {"lko", HB_TAG('L','U','H',' ')}, /* Khayo -> Luyia */ + {"lks", HB_TAG('L','U','H',' ')}, /* Kisa -> Luyia */ + {"lld", HB_TAG('L','A','D',' ')}, /* Ladin */ + {"lmn", HB_TAG('L','A','M',' ')}, /* Lambadi -> Lambani */ +/*{"lmo", HB_TAG('L','M','O',' ')},*/ /* Lombard */ + {"ln", HB_TAG('L','I','N',' ')}, /* Lingala */ + {"lo", HB_TAG('L','A','O',' ')}, /* Lao */ +/*{"lom", HB_TAG('L','O','M',' ')},*/ /* Loma (Liberia) */ +/*{"lrc", HB_TAG('L','R','C',' ')},*/ /* Northern Luri -> Luri */ + {"lri", HB_TAG('L','U','H',' ')}, /* Marachi -> Luyia */ + {"lrm", HB_TAG('L','U','H',' ')}, /* Marama -> Luyia */ + {"lsm", HB_TAG('L','U','H',' ')}, /* Saamia -> Luyia */ + {"lt", HB_TAG('L','T','H',' ')}, /* Lithuanian */ + {"ltg", HB_TAG('L','V','I',' ')}, /* Latgalian -> Latvian */ + {"lto", HB_TAG('L','U','H',' ')}, /* Tsotso -> Luyia */ + {"lts", HB_TAG('L','U','H',' ')}, /* Tachoni -> Luyia */ + {"lu", HB_TAG('L','U','B',' ')}, /* Luba-Katanga */ +/*{"lua", HB_TAG('L','U','A',' ')},*/ /* Luba-Lulua */ +/*{"luo", HB_TAG('L','U','O',' ')},*/ /* Luo (Kenya and Tanzania) */ + {"lus", HB_TAG('M','I','Z',' ')}, /* Lushai -> Mizo */ + {"luy", HB_TAG('L','U','H',' ')}, /* Luyia [macrolanguage] */ + {"luz", HB_TAG('L','R','C',' ')}, /* Southern Luri -> Luri */ + {"lv", HB_TAG('L','V','I',' ')}, /* Latvian [macrolanguage] */ + {"lvs", HB_TAG('L','V','I',' ')}, /* Standard Latvian -> Latvian */ + {"lwg", HB_TAG('L','U','H',' ')}, /* Wanga -> Luyia */ + {"lzh", HB_TAG('Z','H','T',' ')}, /* Literary Chinese -> Chinese Traditional */ + {"lzz", HB_TAG('L','A','Z',' ')}, /* Laz */ +/*{"mad", HB_TAG('M','A','D',' ')},*/ /* Madurese -> Madura */ +/*{"mag", HB_TAG('M','A','G',' ')},*/ /* Magahi */ + {"mai", HB_TAG('M','T','H',' ')}, /* Maithili */ + {"mak", HB_TAG('M','K','R',' ')}, /* Makasar */ +/*{"mam", HB_TAG('M','A','M',' ')},*/ /* Mam */ + {"man", HB_TAG('M','N','K',' ')}, /* Mandingo [macrolanguage] -> Maninka */ + {"max", HB_TAG('M','L','Y',' ')}, /* North Moluccan Malay -> Malay */ +/*{"mbo", HB_TAG('M','B','O',' ')},*/ /* Mbo (Cameroon) */ + {"mct", HB_TAG('B','T','I',' ')}, /* Mengisa -> Beti */ + {"mdf", HB_TAG('M','O','K',' ')}, /* Moksha */ +/*{"mdr", HB_TAG('M','D','R',' ')},*/ /* Mandar */ + {"mdy", HB_TAG('M','L','E',' ')}, /* Male (Ethiopia) */ + {"men", HB_TAG('M','D','E',' ')}, /* Mende (Sierra Leone) */ + {"meo", HB_TAG('M','L','Y',' ')}, /* Kedah Malay -> Malay */ +/*{"mer", HB_TAG('M','E','R',' ')},*/ /* Meru */ +/*{"mfa", HB_TAG('M','F','A',' ')},*/ /* Pattani Malay */ + {"mfb", HB_TAG('M','L','Y',' ')}, /* Bangka -> Malay */ +/*{"mfe", HB_TAG('M','F','E',' ')},*/ /* Morisyen */ + {"mg", HB_TAG('M','L','G',' ')}, /* Malagasy [macrolanguage] */ + {"mh", HB_TAG('M','A','H',' ')}, /* Marshallese */ + {"mhr", HB_TAG('L','M','A',' ')}, /* Eastern Mari -> Low Mari */ + {"mhv", HB_TAG('A','R','K',' ')}, /* Arakanese (retired code) -> Rakhine */ + {"mi", HB_TAG('M','R','I',' ')}, /* Maori */ +/*{"min", HB_TAG('M','I','N',' ')},*/ /* Minangkabau */ + {"mk", HB_TAG('M','K','D',' ')}, /* Macedonian */ + {"mku", HB_TAG('M','N','K',' ')}, /* Konyanka Maninka -> Maninka */ +/*{"mkw", HB_TAG('M','K','W',' ')},*/ /* Kituba (Congo) */ + {"ml", HB_TAG('M','A','L',' ')}, /* Malayalam -> Malayalam Traditional */ + {"ml", HB_TAG('M','L','R',' ')}, /* Malayalam -> Malayalam Reformed */ + {"mlq", HB_TAG('M','L','N',' ')}, /* Western Maninkakan -> Malinke */ + {"mlq", HB_TAG('M','N','K',' ')}, /* Western Maninkakan -> Maninka */ + {"mmr", HB_TAG('H','M','N',' ')}, /* Western Xiangxi Miao -> Hmong */ + {"mn", HB_TAG('M','N','G',' ')}, /* Mongolian [macrolanguage] */ + {"mnc", HB_TAG('M','C','H',' ')}, /* Manchu */ +/*{"mni", HB_TAG('M','N','I',' ')},*/ /* Manipuri */ + {"mnk", HB_TAG('M','N','D',' ')}, /* Mandinka */ + {"mnk", HB_TAG('M','N','K',' ')}, /* Mandinka -> Maninka */ + {"mnp", HB_TAG('Z','H','S',' ')}, /* Min Bei Chinese -> Chinese Simplified */ + {"mns", HB_TAG('M','A','N',' ')}, /* Mansi */ + {"mnw", HB_TAG('M','O','N',' ')}, /* Mon */ + {"mo", HB_TAG('M','O','L',' ')}, /* Moldavian (retired code) */ +/*{"moh", HB_TAG('M','O','H',' ')},*/ /* Mohawk */ +/*{"mos", HB_TAG('M','O','S',' ')},*/ /* Mossi */ + {"mpe", HB_TAG('M','A','J',' ')}, /* Majang */ + {"mqg", HB_TAG('M','L','Y',' ')}, /* Kota Bangun Kutai Malay -> Malay */ + {"mr", HB_TAG('M','A','R',' ')}, /* Marathi */ + {"mrh", HB_TAG('Q','I','N',' ')}, /* Mara Chin -> Chin */ + {"mrj", HB_TAG('H','M','A',' ')}, /* Western Mari -> High Mari */ + {"ms", HB_TAG('M','L','Y',' ')}, /* Malay [macrolanguage] */ + {"msc", HB_TAG('M','N','K',' ')}, /* Sankaran Maninka -> Maninka */ + {"msh", HB_TAG('M','L','G',' ')}, /* Masikoro Malagasy -> Malagasy */ + {"msi", HB_TAG('M','L','Y',' ')}, /* Sabah Malay -> Malay */ + {"mt", HB_TAG('M','T','S',' ')}, /* Maltese */ + {"mtr", HB_TAG('M','A','W',' ')}, /* Mewari -> Marwari */ + {"mui", HB_TAG('M','L','Y',' ')}, /* Musi -> Malay */ + {"mup", HB_TAG('R','A','J',' ')}, /* Malvi -> Rajasthani */ + {"muq", HB_TAG('H','M','N',' ')}, /* Eastern Xiangxi Miao -> Hmong */ +/*{"mus", HB_TAG('M','U','S',' ')},*/ /* Creek -> Muscogee */ + {"mvb", HB_TAG('A','T','H',' ')}, /* Mattole -> Athapaskan */ + {"mve", HB_TAG('M','A','W',' ')}, /* Marwari (Pakistan) */ + {"mvf", HB_TAG('M','N','G',' ')}, /* Peripheral Mongolian -> Mongolian */ + {"mwk", HB_TAG('M','N','K',' ')}, /* Kita Maninkakan -> Maninka */ +/*{"mwl", HB_TAG('M','W','L',' ')},*/ /* Mirandese */ + {"mwr", HB_TAG('M','A','W',' ')}, /* Marwari [macrolanguage] */ +/*{"mww", HB_TAG('M','W','W',' ')},*/ /* Hmong Daw */ + {"my", HB_TAG('B','R','M',' ')}, /* Burmese */ + {"mym", HB_TAG('M','E','N',' ')}, /* Me’en */ +/*{"myn", HB_TAG('M','Y','N',' ')},*/ /* Mayan [family] */ + {"myq", HB_TAG('M','N','K',' ')}, /* Forest Maninka (retired code) -> Maninka */ + {"myv", HB_TAG('E','R','Z',' ')}, /* Erzya */ +/*{"mzn", HB_TAG('M','Z','N',' ')},*/ /* Mazanderani */ + {"na", HB_TAG('N','A','U',' ')}, /* Nauru -> Nauruan */ +/*{"nag", HB_TAG('N','A','G',' ')},*/ /* Naga Pidgin -> Naga-Assamese */ +/*{"nah", HB_TAG('N','A','H',' ')},*/ /* Nahuatl [family] */ + {"nan", HB_TAG('Z','H','S',' ')}, /* Min Nan Chinese -> Chinese Simplified */ +/*{"nap", HB_TAG('N','A','P',' ')},*/ /* Neapolitan */ + {"nb", HB_TAG('N','O','R',' ')}, /* Norwegian Bokmål -> Norwegian */ + {"nd", HB_TAG('N','D','B',' ')}, /* North Ndebele -> Ndebele */ +/*{"ndc", HB_TAG('N','D','C',' ')},*/ /* Ndau */ +/*{"nds", HB_TAG('N','D','S',' ')},*/ /* Low Saxon */ + {"ne", HB_TAG('N','E','P',' ')}, /* Nepali [macrolanguage] */ +/*{"new", HB_TAG('N','E','W',' ')},*/ /* Newari */ + {"ng", HB_TAG('N','D','G',' ')}, /* Ndonga */ +/*{"nga", HB_TAG('N','G','A',' ')},*/ /* Ngbaka */ + {"ngl", HB_TAG('L','M','W',' ')}, /* Lomwe */ + {"ngo", HB_TAG('S','X','T',' ')}, /* Ngoni -> Sutu */ + {"nhd", HB_TAG('G','U','A',' ')}, /* Chiripá -> Guarani */ + {"niq", HB_TAG('K','A','L',' ')}, /* Nandi -> Kalenjin */ +/*{"niu", HB_TAG('N','I','U',' ')},*/ /* Niuean */ + {"niv", HB_TAG('G','I','L',' ')}, /* Gilyak */ + {"njz", HB_TAG('N','I','S',' ')}, /* Nyishi -> Nisi */ + {"nl", HB_TAG('N','L','D',' ')}, /* Dutch */ + {"nle", HB_TAG('L','U','H',' ')}, /* East Nyala -> Luyia */ + {"nn", HB_TAG('N','Y','N',' ')}, /* Norwegian Nynorsk (Nynorsk, Norwegian) */ + {"no", HB_TAG('N','O','R',' ')}, /* Norwegian [macrolanguage] */ + {"nod", HB_TAG('N','T','A',' ')}, /* Northern Thai -> Northern Tai */ +/*{"noe", HB_TAG('N','O','E',' ')},*/ /* Nimadi */ +/*{"nog", HB_TAG('N','O','G',' ')},*/ /* Nogai */ +/*{"nov", HB_TAG('N','O','V',' ')},*/ /* Novial */ + {"npi", HB_TAG('N','E','P',' ')}, /* Nepali */ + {"nqo", HB_TAG('N','K','O',' ')}, /* N’Ko */ + {"nr", HB_TAG('N','D','B',' ')}, /* South Ndebele -> Ndebele */ + {"nsk", HB_TAG('N','A','S',' ')}, /* Naskapi */ +/*{"nso", HB_TAG('N','S','O',' ')},*/ /* Pedi -> Sotho, Northern */ + {"nv", HB_TAG('N','A','V',' ')}, /* Navajo */ + {"nv", HB_TAG('A','T','H',' ')}, /* Navajo -> Athapaskan */ + {"ny", HB_TAG('C','H','I',' ')}, /* Chichewa (Chewa, Nyanja) */ + {"nyd", HB_TAG('L','U','H',' ')}, /* Nyore -> Luyia */ +/*{"nym", HB_TAG('N','Y','M',' ')},*/ /* Nyamwezi */ + {"nyn", HB_TAG('N','K','L',' ')}, /* Nyankole */ +/*{"nza", HB_TAG('N','Z','A',' ')},*/ /* Tigon Mbembe -> Mbembe Tigon */ + {"oc", HB_TAG('O','C','I',' ')}, /* Occitan (post 1500) */ + {"oj", HB_TAG('O','J','B',' ')}, /* Ojibwa [macrolanguage] -> Ojibway */ +/*{"ojb", HB_TAG('O','J','B',' ')},*/ /* Northwestern Ojibwa -> Ojibway */ + {"ojc", HB_TAG('O','J','B',' ')}, /* Central Ojibwa -> Ojibway */ + {"ojg", HB_TAG('O','J','B',' ')}, /* Eastern Ojibwa -> Ojibway */ + {"ojs", HB_TAG('O','C','R',' ')}, /* Severn Ojibwa -> Oji-Cree */ + {"ojw", HB_TAG('O','J','B',' ')}, /* Western Ojibwa -> Ojibway */ + {"oki", HB_TAG('K','A','L',' ')}, /* Okiek -> Kalenjin */ + {"okm", HB_TAG('K','O','H',' ')}, /* Middle Korean (10th-16th cent.) -> Korean Old Hangul */ + {"om", HB_TAG('O','R','O',' ')}, /* Oromo [macrolanguage] */ + {"or", HB_TAG('O','R','I',' ')}, /* Odia (formerly Oriya) [macrolanguage] */ + {"orc", HB_TAG('O','R','O',' ')}, /* Orma -> Oromo */ + {"orn", HB_TAG('M','L','Y',' ')}, /* Orang Kanaq -> Malay */ + {"ors", HB_TAG('M','L','Y',' ')}, /* Orang Seletar -> Malay */ + {"ory", HB_TAG('O','R','I',' ')}, /* Odia (formerly Oriya) */ + {"os", HB_TAG('O','S','S',' ')}, /* Ossetian */ + {"otw", HB_TAG('O','J','B',' ')}, /* Ottawa -> Ojibway */ + {"pa", HB_TAG('P','A','N',' ')}, /* Punjabi */ +/*{"pag", HB_TAG('P','A','G',' ')},*/ /* Pangasinan */ +/*{"pam", HB_TAG('P','A','M',' ')},*/ /* Pampanga -> Pampangan */ + {"pap", HB_TAG('P','A','P','0')}, /* Papiamento -> Papiamentu */ +/*{"pau", HB_TAG('P','A','U',' ')},*/ /* Palauan */ + {"pbt", HB_TAG('P','A','S',' ')}, /* Southern Pashto -> Pashto */ + {"pbu", HB_TAG('P','A','S',' ')}, /* Northern Pashto -> Pashto */ +/*{"pcc", HB_TAG('P','C','C',' ')},*/ /* Bouyei */ +/*{"pcd", HB_TAG('P','C','D',' ')},*/ /* Picard */ + {"pce", HB_TAG('P','L','G',' ')}, /* Ruching Palaung -> Palaung */ + {"pck", HB_TAG('Q','I','N',' ')}, /* Paite Chin -> Chin */ +/*{"pdc", HB_TAG('P','D','C',' ')},*/ /* Pennsylvania German */ + {"pel", HB_TAG('M','L','Y',' ')}, /* Pekal -> Malay */ + {"pes", HB_TAG('F','A','R',' ')}, /* Iranian Persian -> Persian */ + {"pga", HB_TAG('A','R','A',' ')}, /* Sudanese Creole Arabic -> Arabic */ +/*{"phk", HB_TAG('P','H','K',' ')},*/ /* Phake */ + {"pi", HB_TAG('P','A','L',' ')}, /* Pali */ +/*{"pih", HB_TAG('P','I','H',' ')},*/ /* Pitcairn-Norfolk -> Norfolk */ + {"pko", HB_TAG('K','A','L',' ')}, /* Pökoot -> Kalenjin */ + {"pl", HB_TAG('P','L','K',' ')}, /* Polish */ + {"pll", HB_TAG('P','L','G',' ')}, /* Shwe Palaung -> Palaung */ + {"plp", HB_TAG('P','A','P',' ')}, /* Palpa */ + {"plt", HB_TAG('M','L','G',' ')}, /* Plateau Malagasy -> Malagasy */ +/*{"pms", HB_TAG('P','M','S',' ')},*/ /* Piemontese */ +/*{"pnb", HB_TAG('P','N','B',' ')},*/ /* Western Panjabi */ +/*{"poh", HB_TAG('P','O','H',' ')},*/ /* Poqomchi' -> Pocomchi */ +/*{"pon", HB_TAG('P','O','N',' ')},*/ /* Pohnpeian */ + {"ppa", HB_TAG('B','A','G',' ')}, /* Pao (retired code) -> Baghelkhandi */ +/*{"pro", HB_TAG('P','R','O',' ')},*/ /* Old Provençal (to 1500) -> Provençal / Old Provençal */ + {"prs", HB_TAG('D','R','I',' ')}, /* Dari */ + {"ps", HB_TAG('P','A','S',' ')}, /* Pashto [macrolanguage] */ + {"pse", HB_TAG('M','L','Y',' ')}, /* Central Malay -> Malay */ + {"pst", HB_TAG('P','A','S',' ')}, /* Central Pashto -> Pashto */ + {"pt", HB_TAG('P','T','G',' ')}, /* Portuguese */ +/*{"pwo", HB_TAG('P','W','O',' ')},*/ /* Pwo Western Karen -> Western Pwo Karen */ + {"qu", HB_TAG('Q','U','Z',' ')}, /* Quechua [macrolanguage] */ + {"qub", HB_TAG('Q','W','H',' ')}, /* Huallaga Huánuco Quechua -> Quechua (Peru) */ +/*{"quc", HB_TAG('Q','U','C',' ')},*/ /* K’iche’ */ + {"qud", HB_TAG('Q','V','I',' ')}, /* Calderón Highland Quichua -> Quechua (Ecuador) */ + {"quf", HB_TAG('Q','U','Z',' ')}, /* Lambayeque Quechua -> Quechua */ + {"qug", HB_TAG('Q','V','I',' ')}, /* Chimborazo Highland Quichua -> Quechua (Ecuador) */ +/*{"quh", HB_TAG('Q','U','H',' ')},*/ /* South Bolivian Quechua -> Quechua (Bolivia) */ + {"quk", HB_TAG('Q','U','Z',' ')}, /* Chachapoyas Quechua -> Quechua */ + {"qul", HB_TAG('Q','U','Z',' ')}, /* North Bolivian Quechua -> Quechua */ + {"qup", HB_TAG('Q','V','I',' ')}, /* Southern Pastaza Quechua -> Quechua (Ecuador) */ + {"qur", HB_TAG('Q','W','H',' ')}, /* Yanahuanca Pasco Quechua -> Quechua (Peru) */ + {"qus", HB_TAG('Q','U','H',' ')}, /* Santiago del Estero Quichua -> Quechua (Bolivia) */ + {"quw", HB_TAG('Q','V','I',' ')}, /* Tena Lowland Quichua -> Quechua (Ecuador) */ + {"qux", HB_TAG('Q','W','H',' ')}, /* Yauyos Quechua -> Quechua (Peru) */ + {"quy", HB_TAG('Q','U','Z',' ')}, /* Ayacucho Quechua -> Quechua */ +/*{"quz", HB_TAG('Q','U','Z',' ')},*/ /* Cusco Quechua -> Quechua */ + {"qva", HB_TAG('Q','W','H',' ')}, /* Ambo-Pasco Quechua -> Quechua (Peru) */ + {"qvc", HB_TAG('Q','U','Z',' ')}, /* Cajamarca Quechua -> Quechua */ + {"qve", HB_TAG('Q','U','Z',' ')}, /* Eastern Apurímac Quechua -> Quechua */ + {"qvh", HB_TAG('Q','W','H',' ')}, /* Huamalíes-Dos de Mayo Huánuco Quechua -> Quechua (Peru) */ +/*{"qvi", HB_TAG('Q','V','I',' ')},*/ /* Imbabura Highland Quichua -> Quechua (Ecuador) */ + {"qvj", HB_TAG('Q','V','I',' ')}, /* Loja Highland Quichua -> Quechua (Ecuador) */ + {"qvl", HB_TAG('Q','W','H',' ')}, /* Cajatambo North Lima Quechua -> Quechua (Peru) */ + {"qvm", HB_TAG('Q','W','H',' ')}, /* Margos-Yarowilca-Lauricocha Quechua -> Quechua (Peru) */ + {"qvn", HB_TAG('Q','W','H',' ')}, /* North Junín Quechua -> Quechua (Peru) */ + {"qvo", HB_TAG('Q','V','I',' ')}, /* Napo Lowland Quechua -> Quechua (Ecuador) */ + {"qvp", HB_TAG('Q','W','H',' ')}, /* Pacaraos Quechua -> Quechua (Peru) */ + {"qvs", HB_TAG('Q','U','Z',' ')}, /* San Martín Quechua -> Quechua */ + {"qvw", HB_TAG('Q','W','H',' ')}, /* Huaylla Wanca Quechua -> Quechua (Peru) */ + {"qvz", HB_TAG('Q','V','I',' ')}, /* Northern Pastaza Quichua -> Quechua (Ecuador) */ + {"qwa", HB_TAG('Q','W','H',' ')}, /* Corongo Ancash Quechua -> Quechua (Peru) */ + {"qwc", HB_TAG('Q','U','Z',' ')}, /* Classical Quechua -> Quechua */ +/*{"qwh", HB_TAG('Q','W','H',' ')},*/ /* Huaylas Ancash Quechua -> Quechua (Peru) */ + {"qws", HB_TAG('Q','W','H',' ')}, /* Sihuas Ancash Quechua -> Quechua (Peru) */ + {"qxa", HB_TAG('Q','W','H',' ')}, /* Chiquián Ancash Quechua -> Quechua (Peru) */ + {"qxc", HB_TAG('Q','W','H',' ')}, /* Chincha Quechua -> Quechua (Peru) */ + {"qxh", HB_TAG('Q','W','H',' ')}, /* Panao Huánuco Quechua -> Quechua (Peru) */ + {"qxl", HB_TAG('Q','V','I',' ')}, /* Salasaca Highland Quichua -> Quechua (Ecuador) */ + {"qxn", HB_TAG('Q','W','H',' ')}, /* Northern Conchucos Ancash Quechua -> Quechua (Peru) */ + {"qxo", HB_TAG('Q','W','H',' ')}, /* Southern Conchucos Ancash Quechua -> Quechua (Peru) */ + {"qxp", HB_TAG('Q','U','Z',' ')}, /* Puno Quechua -> Quechua */ + {"qxr", HB_TAG('Q','V','I',' ')}, /* Cañar Highland Quichua -> Quechua (Ecuador) */ + {"qxt", HB_TAG('Q','W','H',' ')}, /* Santa Ana de Tusi Pasco Quechua -> Quechua (Peru) */ + {"qxu", HB_TAG('Q','U','Z',' ')}, /* Arequipa-La Unión Quechua -> Quechua */ + {"qxw", HB_TAG('Q','W','H',' ')}, /* Jauja Wanca Quechua -> Quechua (Peru) */ + {"rag", HB_TAG('L','U','H',' ')}, /* Logooli -> Luyia */ +/*{"raj", HB_TAG('R','A','J',' ')},*/ /* Rajasthani [macrolanguage] */ +/*{"rar", HB_TAG('R','A','R',' ')},*/ /* Rarotongan */ + {"rbb", HB_TAG('P','L','G',' ')}, /* Rumai Palaung -> Palaung */ + {"rbl", HB_TAG('B','I','K',' ')}, /* Miraya Bikol -> Bikol */ +/*{"rej", HB_TAG('R','E','J',' ')},*/ /* Rejang */ +/*{"ria", HB_TAG('R','I','A',' ')},*/ /* Riang (India) */ +/*{"rif", HB_TAG('R','I','F',' ')},*/ /* Tarifit */ +/*{"rit", HB_TAG('R','I','T',' ')},*/ /* Ritarungo */ + {"rki", HB_TAG('A','R','K',' ')}, /* Rakhine */ +/*{"rkw", HB_TAG('R','K','W',' ')},*/ /* Arakwal */ + {"rm", HB_TAG('R','M','S',' ')}, /* Romansh */ + {"rmc", HB_TAG('R','O','Y',' ')}, /* Carpathian Romani -> Romany */ + {"rmf", HB_TAG('R','O','Y',' ')}, /* Kalo Finnish Romani -> Romany */ + {"rml", HB_TAG('R','O','Y',' ')}, /* Baltic Romani -> Romany */ + {"rmn", HB_TAG('R','O','Y',' ')}, /* Balkan Romani -> Romany */ + {"rmo", HB_TAG('R','O','Y',' ')}, /* Sinte Romani -> Romany */ + {"rmw", HB_TAG('R','O','Y',' ')}, /* Welsh Romani -> Romany */ +/*{"rmy", HB_TAG('R','M','Y',' ')},*/ /* Vlax Romani */ + {"rmz", HB_TAG('A','R','K',' ')}, /* Marma -> Rakhine */ + {"rn", HB_TAG('R','U','N',' ')}, /* Rundi */ + {"rnl", HB_TAG('H','A','L',' ')}, /* Ranglong -> Halam (Falam Chin) */ + {"ro", HB_TAG('R','O','M',' ')}, /* Romanian */ + {"rom", HB_TAG('R','O','Y',' ')}, /* Romany [macrolanguage] */ +/*{"rtm", HB_TAG('R','T','M',' ')},*/ /* Rotuman */ + {"ru", HB_TAG('R','U','S',' ')}, /* Russian */ + {"rue", HB_TAG('R','S','Y',' ')}, /* Rusyn */ +/*{"rup", HB_TAG('R','U','P',' ')},*/ /* Aromanian */ + {"rw", HB_TAG('R','U','A',' ')}, /* Kinyarwanda */ + {"rwr", HB_TAG('M','A','W',' ')}, /* Marwari (India) */ + {"sa", HB_TAG('S','A','N',' ')}, /* Sanskrit */ + {"sah", HB_TAG('Y','A','K',' ')}, /* Yakut -> Sakha */ + {"sam", HB_TAG('P','A','A',' ')}, /* Samaritan Aramaic -> Palestinian Aramaic */ +/*{"sas", HB_TAG('S','A','S',' ')},*/ /* Sasak */ +/*{"sat", HB_TAG('S','A','T',' ')},*/ /* Santali */ + {"sc", HB_TAG('S','R','D',' ')}, /* Sardinian [macrolanguage] */ + {"sck", HB_TAG('S','A','D',' ')}, /* Sadri */ +/*{"scn", HB_TAG('S','C','N',' ')},*/ /* Sicilian */ +/*{"sco", HB_TAG('S','C','O',' ')},*/ /* Scots */ + {"scs", HB_TAG('S','C','S',' ')}, /* North Slavey */ + {"scs", HB_TAG('S','L','A',' ')}, /* North Slavey -> Slavey */ + {"scs", HB_TAG('A','T','H',' ')}, /* North Slavey -> Athapaskan */ + {"sd", HB_TAG('S','N','D',' ')}, /* Sindhi */ + {"sdc", HB_TAG('S','R','D',' ')}, /* Sassarese Sardinian -> Sardinian */ + {"sdh", HB_TAG('K','U','R',' ')}, /* Southern Kurdish -> Kurdish */ + {"sdn", HB_TAG('S','R','D',' ')}, /* Gallurese Sardinian -> Sardinian */ + {"se", HB_TAG('N','S','M',' ')}, /* Northern Sami */ + {"seh", HB_TAG('S','N','A',' ')}, /* Sena */ + {"sek", HB_TAG('A','T','H',' ')}, /* Sekani -> Athapaskan */ +/*{"sel", HB_TAG('S','E','L',' ')},*/ /* Selkup */ + {"sez", HB_TAG('Q','I','N',' ')}, /* Senthang Chin -> Chin */ + {"sfm", HB_TAG('H','M','N',' ')}, /* Small Flowery Miao -> Hmong */ + {"sg", HB_TAG('S','G','O',' ')}, /* Sango */ +/*{"sga", HB_TAG('S','G','A',' ')},*/ /* Old Irish (to 900) */ + {"sgc", HB_TAG('K','A','L',' ')}, /* Kipsigis -> Kalenjin */ +/*{"sgs", HB_TAG('S','G','S',' ')},*/ /* Samogitian */ + {"sgw", HB_TAG('C','H','G',' ')}, /* Sebat Bet Gurage -> Chaha Gurage */ + {"sgw", HB_TAG('S','G','W',' ')}, /* Sebat Bet Gurage -> Chaha Gurage (SIL fonts) */ +/*{"shi", HB_TAG('S','H','I',' ')},*/ /* Tachelhit */ +/*{"shn", HB_TAG('S','H','N',' ')},*/ /* Shan */ + {"shu", HB_TAG('A','R','A',' ')}, /* Chadian Arabic -> Arabic */ + {"si", HB_TAG('S','N','H',' ')}, /* Sinhala (Sinhalese) */ +/*{"sid", HB_TAG('S','I','D',' ')},*/ /* Sidamo */ + {"sjd", HB_TAG('K','S','M',' ')}, /* Kildin Sami */ + {"sjo", HB_TAG('S','I','B',' ')}, /* Xibe -> Sibe */ + {"sk", HB_TAG('S','K','Y',' ')}, /* Slovak */ + {"skg", HB_TAG('M','L','G',' ')}, /* Sakalava Malagasy -> Malagasy */ + {"skr", HB_TAG('S','R','K',' ')}, /* Saraiki */ + {"sl", HB_TAG('S','L','V',' ')}, /* Slovenian */ + {"sm", HB_TAG('S','M','O',' ')}, /* Samoan */ + {"sma", HB_TAG('S','S','M',' ')}, /* Southern Sami */ + {"smj", HB_TAG('L','S','M',' ')}, /* Lule Sami */ + {"smn", HB_TAG('I','S','M',' ')}, /* Inari Sami */ + {"sms", HB_TAG('S','K','S',' ')}, /* Skolt Sami */ + {"sn", HB_TAG('S','N','A','0')}, /* Shona */ +/*{"snk", HB_TAG('S','N','K',' ')},*/ /* Soninke */ + {"so", HB_TAG('S','M','L',' ')}, /* Somali */ +/*{"sop", HB_TAG('S','O','P',' ')},*/ /* Songe */ + {"spv", HB_TAG('O','R','I',' ')}, /* Sambalpuri -> Odia (formerly Oriya) */ + {"spy", HB_TAG('K','A','L',' ')}, /* Sabaot -> Kalenjin */ + {"sq", HB_TAG('S','Q','I',' ')}, /* Albanian [macrolanguage] */ + {"sr", HB_TAG('S','R','B',' ')}, /* Serbian */ + {"src", HB_TAG('S','R','D',' ')}, /* Logudorese Sardinian -> Sardinian */ + {"sro", HB_TAG('S','R','D',' ')}, /* Campidanese Sardinian -> Sardinian */ +/*{"srr", HB_TAG('S','R','R',' ')},*/ /* Serer */ + {"srs", HB_TAG('A','T','H',' ')}, /* Sarsi -> Athapaskan */ + {"ss", HB_TAG('S','W','Z',' ')}, /* Swati */ + {"ssh", HB_TAG('A','R','A',' ')}, /* Shihhi Arabic -> Arabic */ + {"st", HB_TAG('S','O','T',' ')}, /* Southern Sotho -> Sotho, Southern */ +/*{"stq", HB_TAG('S','T','Q',' ')},*/ /* Saterfriesisch -> Saterland Frisian */ + {"stv", HB_TAG('S','I','G',' ')}, /* Silt'e -> Silte Gurage */ + {"su", HB_TAG('S','U','N',' ')}, /* Sundanese */ +/*{"suk", HB_TAG('S','U','K',' ')},*/ /* Sukuma */ + {"suq", HB_TAG('S','U','R',' ')}, /* Suri */ + {"sv", HB_TAG('S','V','E',' ')}, /* Swedish */ +/*{"sva", HB_TAG('S','V','A',' ')},*/ /* Svan */ + {"sw", HB_TAG('S','W','K',' ')}, /* Swahili [macrolanguage] */ + {"swb", HB_TAG('C','M','R',' ')}, /* Maore Comorian -> Comorian */ + {"swc", HB_TAG('S','W','K',' ')}, /* Congo Swahili -> Swahili */ + {"swh", HB_TAG('S','W','K',' ')}, /* Swahili */ + {"swv", HB_TAG('M','A','W',' ')}, /* Shekhawati -> Marwari */ +/*{"sxu", HB_TAG('S','X','U',' ')},*/ /* Upper Saxon */ + {"syc", HB_TAG('S','Y','R',' ')}, /* Classical Syriac -> Syriac */ +/*{"syl", HB_TAG('S','Y','L',' ')},*/ /* Sylheti */ +/*{"syr", HB_TAG('S','Y','R',' ')},*/ /* Syriac [macrolanguage] */ +/*{"szl", HB_TAG('S','Z','L',' ')},*/ /* Silesian */ + {"ta", HB_TAG('T','A','M',' ')}, /* Tamil */ + {"taa", HB_TAG('A','T','H',' ')}, /* Lower Tanana -> Athapaskan */ +/*{"tab", HB_TAG('T','A','B',' ')},*/ /* Tabassaran -> Tabasaran */ + {"taq", HB_TAG('T','M','H',' ')}, /* Tamasheq -> Tamashek */ + {"tau", HB_TAG('A','T','H',' ')}, /* Upper Tanana -> Athapaskan */ + {"tcb", HB_TAG('A','T','H',' ')}, /* Tanacross -> Athapaskan */ + {"tce", HB_TAG('A','T','H',' ')}, /* Southern Tutchone -> Athapaskan */ + {"tcp", HB_TAG('Q','I','N',' ')}, /* Tawr Chin -> Chin */ + {"tcy", HB_TAG('T','U','L',' ')}, /* Tulu -> Tumbuka */ + {"tcz", HB_TAG('Q','I','N',' ')}, /* Thado Chin -> Chin */ +/*{"tdd", HB_TAG('T','D','D',' ')},*/ /* Tai Nüa -> Dehong Dai */ + {"tdx", HB_TAG('M','L','G',' ')}, /* Tandroy-Mahafaly Malagasy -> Malagasy */ + {"te", HB_TAG('T','E','L',' ')}, /* Telugu */ + {"tec", HB_TAG('K','A','L',' ')}, /* Terik -> Kalenjin */ + {"tem", HB_TAG('T','M','N',' ')}, /* Timne -> Temne */ +/*{"tet", HB_TAG('T','E','T',' ')},*/ /* Tetum */ + {"tfn", HB_TAG('A','T','H',' ')}, /* Tanaina -> Athapaskan */ + {"tg", HB_TAG('T','A','J',' ')}, /* Tajik -> Tajiki */ + {"tgj", HB_TAG('N','I','S',' ')}, /* Tagin -> Nisi */ + {"tgx", HB_TAG('A','T','H',' ')}, /* Tagish -> Athapaskan */ + {"th", HB_TAG('T','H','A',' ')}, /* Thai */ + {"tht", HB_TAG('A','T','H',' ')}, /* Tahltan -> Athapaskan */ + {"thv", HB_TAG('T','M','H',' ')}, /* Tahaggart Tamahaq -> Tamashek */ + {"thz", HB_TAG('T','M','H',' ')}, /* Tayart Tamajeq -> Tamashek */ + {"ti", HB_TAG('T','G','Y',' ')}, /* Tigrinya */ + {"tig", HB_TAG('T','G','R',' ')}, /* Tigre */ +/*{"tiv", HB_TAG('T','I','V',' ')},*/ /* Tiv */ + {"tk", HB_TAG('T','K','M',' ')}, /* Turkmen */ + {"tkg", HB_TAG('M','L','G',' ')}, /* Tesaka Malagasy -> Malagasy */ + {"tl", HB_TAG('T','G','L',' ')}, /* Tagalog */ +/*{"tmh", HB_TAG('T','M','H',' ')},*/ /* Tamashek [macrolanguage] */ + {"tmw", HB_TAG('M','L','Y',' ')}, /* Temuan -> Malay */ + {"tn", HB_TAG('T','N','A',' ')}, /* Tswana */ + {"tnf", HB_TAG('D','R','I',' ')}, /* Tangshewi (retired code) -> Dari */ + {"to", HB_TAG('T','G','N',' ')}, /* Tonga (Tonga Islands) -> Tongan */ + {"tod", HB_TAG('T','O','D','0')}, /* Toma */ + {"toi", HB_TAG('T','N','G',' ')}, /* Tonga (Zambia) */ + {"tol", HB_TAG('A','T','H',' ')}, /* Tolowa -> Athapaskan */ +/*{"tpi", HB_TAG('T','P','I',' ')},*/ /* Tok Pisin */ + {"tr", HB_TAG('T','R','K',' ')}, /* Turkish */ + {"tru", HB_TAG('T','U','A',' ')}, /* Turoyo -> Turoyo Aramaic */ + {"tru", HB_TAG('S','Y','R',' ')}, /* Turoyo -> Syriac */ + {"ts", HB_TAG('T','S','G',' ')}, /* Tsonga */ +/*{"tsj", HB_TAG('T','S','J',' ')},*/ /* Tshangla */ + {"tt", HB_TAG('T','A','T',' ')}, /* Tatar */ + {"ttm", HB_TAG('A','T','H',' ')}, /* Northern Tutchone -> Athapaskan */ + {"ttq", HB_TAG('T','M','H',' ')}, /* Tawallammat Tamajaq -> Tamashek */ +/*{"tum", HB_TAG('T','U','M',' ')},*/ /* Tumbuka -> Tulu */ + {"tuu", HB_TAG('A','T','H',' ')}, /* Tututni -> Athapaskan */ + {"tuy", HB_TAG('K','A','L',' ')}, /* Tugen -> Kalenjin */ +/*{"tvl", HB_TAG('T','V','L',' ')},*/ /* Tuvalu */ + {"tw", HB_TAG('T','W','I',' ')}, /* Twi */ + {"tw", HB_TAG('A','K','A',' ')}, /* Twi -> Akan */ + {"txc", HB_TAG('A','T','H',' ')}, /* Tsetsaut -> Athapaskan */ + {"txy", HB_TAG('M','L','G',' ')}, /* Tanosy Malagasy -> Malagasy */ + {"ty", HB_TAG('T','H','T',' ')}, /* Tahitian */ + {"tyv", HB_TAG('T','U','V',' ')}, /* Tuvinian -> Tuvin */ +/*{"tyz", HB_TAG('T','Y','Z',' ')},*/ /* Tày */ +/*{"tzm", HB_TAG('T','Z','M',' ')},*/ /* Central Atlas Tamazight -> Tamazight */ +/*{"tzo", HB_TAG('T','Z','O',' ')},*/ /* Tzotzil */ + {"ubl", HB_TAG('B','I','K',' ')}, /* Buhi'non Bikol -> Bikol */ +/*{"udm", HB_TAG('U','D','M',' ')},*/ /* Udmurt */ + {"ug", HB_TAG('U','Y','G',' ')}, /* Uyghur */ + {"uk", HB_TAG('U','K','R',' ')}, /* Ukrainian */ +/*{"umb", HB_TAG('U','M','B',' ')},*/ /* Umbundu */ + {"unr", HB_TAG('M','U','N',' ')}, /* Mundari */ + {"ur", HB_TAG('U','R','D',' ')}, /* Urdu */ + {"urk", HB_TAG('M','L','Y',' ')}, /* Urak Lawoi' -> Malay */ + {"uz", HB_TAG('U','Z','B',' ')}, /* Uzbek [macrolanguage] */ + {"uzn", HB_TAG('U','Z','B',' ')}, /* Northern Uzbek -> Uzbek */ + {"uzs", HB_TAG('U','Z','B',' ')}, /* Southern Uzbek -> Uzbek */ + {"ve", HB_TAG('V','E','N',' ')}, /* Venda */ +/*{"vec", HB_TAG('V','E','C',' ')},*/ /* Venetian */ + {"vi", HB_TAG('V','I','T',' ')}, /* Vietnamese */ + {"vkk", HB_TAG('M','L','Y',' ')}, /* Kaur -> Malay */ + {"vkt", HB_TAG('M','L','Y',' ')}, /* Tenggarong Kutai Malay -> Malay */ + {"vls", HB_TAG('F','L','E',' ')}, /* Vlaams -> Dutch (Flemish) */ + {"vmw", HB_TAG('M','A','K',' ')}, /* Makhuwa */ + {"vo", HB_TAG('V','O','L',' ')}, /* Volapük */ +/*{"vro", HB_TAG('V','R','O',' ')},*/ /* Võro */ + {"wa", HB_TAG('W','L','N',' ')}, /* Walloon */ +/*{"war", HB_TAG('W','A','R',' ')},*/ /* Waray (Philippines) -> Waray-Waray */ + {"wbm", HB_TAG('W','A',' ',' ')}, /* Wa */ + {"wbr", HB_TAG('W','A','G',' ')}, /* Wagdi */ + {"wlc", HB_TAG('C','M','R',' ')}, /* Mwali Comorian -> Comorian */ + {"wle", HB_TAG('S','I','G',' ')}, /* Wolane -> Silte Gurage */ + {"wlk", HB_TAG('A','T','H',' ')}, /* Wailaki -> Athapaskan */ + {"wni", HB_TAG('C','M','R',' ')}, /* Ndzwani Comorian -> Comorian */ + {"wo", HB_TAG('W','L','F',' ')}, /* Wolof */ + {"wry", HB_TAG('M','A','W',' ')}, /* Merwari -> Marwari */ + {"wsg", HB_TAG('G','O','N',' ')}, /* Adilabad Gondi -> Gondi */ +/*{"wtm", HB_TAG('W','T','M',' ')},*/ /* Mewati */ + {"wuu", HB_TAG('Z','H','S',' ')}, /* Wu Chinese -> Chinese Simplified */ + {"xal", HB_TAG('K','L','M',' ')}, /* Kalmyk */ + {"xal", HB_TAG('T','O','D',' ')}, /* Kalmyk -> Todo */ + {"xan", HB_TAG('S','E','K',' ')}, /* Xamtanga -> Sekota */ + {"xh", HB_TAG('X','H','S',' ')}, /* Xhosa */ +/*{"xjb", HB_TAG('X','J','B',' ')},*/ /* Minjungbal -> Minjangbal */ +/*{"xkf", HB_TAG('X','K','F',' ')},*/ /* Khengkha */ + {"xmm", HB_TAG('M','L','Y',' ')}, /* Manado Malay -> Malay */ + {"xmv", HB_TAG('M','L','G',' ')}, /* Antankarana Malagasy -> Malagasy */ + {"xmw", HB_TAG('M','L','G',' ')}, /* Tsimihety Malagasy -> Malagasy */ + {"xnr", HB_TAG('D','G','R',' ')}, /* Kangri -> Dogri */ +/*{"xog", HB_TAG('X','O','G',' ')},*/ /* Soga */ +/*{"xpe", HB_TAG('X','P','E',' ')},*/ /* Liberia Kpelle -> Kpelle (Liberia) */ + {"xsl", HB_TAG('S','S','L',' ')}, /* South Slavey */ + {"xsl", HB_TAG('S','L','A',' ')}, /* South Slavey -> Slavey */ + {"xsl", HB_TAG('A','T','H',' ')}, /* South Slavey -> Athapaskan */ + {"xst", HB_TAG('S','I','G',' ')}, /* Silt'e (retired code) -> Silte Gurage */ + {"xwo", HB_TAG('T','O','D',' ')}, /* Written Oirat -> Todo */ +/*{"yao", HB_TAG('Y','A','O',' ')},*/ /* Yao */ +/*{"yap", HB_TAG('Y','A','P',' ')},*/ /* Yapese */ + {"ybd", HB_TAG('A','R','K',' ')}, /* Yangbye (retired code) -> Rakhine */ + {"ydd", HB_TAG('J','I','I',' ')}, /* Eastern Yiddish -> Yiddish */ + {"yi", HB_TAG('J','I','I',' ')}, /* Yiddish [macrolanguage] */ + {"yih", HB_TAG('J','I','I',' ')}, /* Western Yiddish -> Yiddish */ + {"yo", HB_TAG('Y','B','A',' ')}, /* Yoruba */ + {"yos", HB_TAG('Q','I','N',' ')}, /* Yos (retired code) -> Chin */ + {"yrk", HB_TAG('T','N','E',' ')}, /* Nenets -> Tundra Nenets */ + {"yrk", HB_TAG('F','N','E',' ')}, /* Nenets -> Forest Nenets */ + {"yue", HB_TAG('Z','H','H',' ')}, /* Yue Chinese -> Chinese, Hong Kong SAR */ + {"za", HB_TAG('Z','H','A',' ')}, /* Zhuang [macrolanguage] */ + {"zch", HB_TAG('Z','H','A',' ')}, /* Central Hongshuihe Zhuang -> Zhuang */ + {"zdj", HB_TAG('C','M','R',' ')}, /* Ngazidja Comorian -> Comorian */ +/*{"zea", HB_TAG('Z','E','A',' ')},*/ /* Zeeuws -> Zealandic */ + {"zeh", HB_TAG('Z','H','A',' ')}, /* Eastern Hongshuihe Zhuang -> Zhuang */ + {"zgb", HB_TAG('Z','H','A',' ')}, /* Guibei Zhuang -> Zhuang */ +/*{"zgh", HB_TAG('Z','G','H',' ')},*/ /* Standard Moroccan Tamazight */ + {"zgm", HB_TAG('Z','H','A',' ')}, /* Minz Zhuang -> Zhuang */ + {"zgn", HB_TAG('Z','H','A',' ')}, /* Guibian Zhuang -> Zhuang */ + {"zh", HB_TAG('Z','H','S',' ')}, /* Chinese [macrolanguage] -> Chinese Simplified */ + {"zhd", HB_TAG('Z','H','A',' ')}, /* Dai Zhuang -> Zhuang */ + {"zhn", HB_TAG('Z','H','A',' ')}, /* Nong Zhuang -> Zhuang */ + {"zlj", HB_TAG('Z','H','A',' ')}, /* Liujiang Zhuang -> Zhuang */ + {"zlm", HB_TAG('M','L','Y',' ')}, /* Malay */ + {"zln", HB_TAG('Z','H','A',' ')}, /* Lianshan Zhuang -> Zhuang */ + {"zlq", HB_TAG('Z','H','A',' ')}, /* Liuqian Zhuang -> Zhuang */ + {"zmi", HB_TAG('M','L','Y',' ')}, /* Negeri Sembilan Malay -> Malay */ + {"zne", HB_TAG('Z','N','D',' ')}, /* Zande */ + {"zom", HB_TAG('Q','I','N',' ')}, /* Zou -> Chin */ + {"zqe", HB_TAG('Z','H','A',' ')}, /* Qiubei Zhuang -> Zhuang */ + {"zsm", HB_TAG('M','L','Y',' ')}, /* Standard Malay -> Malay */ + {"zu", HB_TAG('Z','U','L',' ')}, /* Zulu */ + {"zum", HB_TAG('L','R','C',' ')}, /* Kumzari -> Luri */ + {"zyb", HB_TAG('Z','H','A',' ')}, /* Yongbei Zhuang -> Zhuang */ + {"zyg", HB_TAG('Z','H','A',' ')}, /* Yang Zhuang -> Zhuang */ + {"zyj", HB_TAG('Z','H','A',' ')}, /* Youjiang Zhuang -> Zhuang */ + {"zyn", HB_TAG('Z','H','A',' ')}, /* Yongnan Zhuang -> Zhuang */ +/*{"zza", HB_TAG('Z','Z','A',' ')},*/ /* Zazaki [macrolanguage] */ + {"zzj", HB_TAG('Z','H','A',' ')}, /* Zuojiang Zhuang -> Zhuang */ }; -static_assert (HB_OT_MAX_TAGS_PER_LANGUAGE == 3u, ""); - /** * hb_ot_tags_from_complex_language: * @lang_str: a BCP 47 language tag to convert. @@ -1934,7 +1932,8 @@ hb_ot_tags_from_complex_language (const char *lang_str, * * Converts @tag to a BCP 47 language tag if it is ambiguous (it corresponds to * many language tags) and the best tag is not the alphabetically first, or if - * the best tag consists of multiple subtags. + * the best tag consists of multiple subtags, or if the best tag does not appear + * in #ot_languages. * * Return value: The #hb_language_t corresponding to the BCP 47 language tag, * or #HB_LANGUAGE_INVALID if @tag is not ambiguous. @@ -1944,6 +1943,8 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) { switch (tag) { + case HB_TAG('A','L','T',' '): /* Altai */ + return hb_language_from_string ("alt", -1); /* Southern Altai */ case HB_TAG('A','P','P','H'): /* Phonetic transcription—Americanist conventions */ return hb_language_from_string ("und-fonnapa", -1); /* Undetermined; North American Phonetic Alphabet */ case HB_TAG('A','R','A',' '): /* Arabic */ @@ -1962,8 +1963,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) return hb_language_from_string ("din", -1); /* Dinka */ case HB_TAG('D','R','I',' '): /* Dari */ return hb_language_from_string ("prs", -1); /* Dari */ - case HB_TAG('D','U','J',' '): /* Dhuwal */ - return hb_language_from_string ("dwu", -1); /* Dhuwal */ case HB_TAG('D','Z','N',' '): /* Dzongkha */ return hb_language_from_string ("dz", -1); /* Dzongkha */ case HB_TAG('E','T','I',' '): /* Estonian */ @@ -1972,6 +1971,8 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) return hb_language_from_string ("gon", -1); /* Gondi */ case HB_TAG('H','M','N',' '): /* Hmong */ return hb_language_from_string ("hmn", -1); /* Hmong */ + case HB_TAG('H','N','D',' '): /* Hindko */ + return hb_language_from_string ("hnd", -1); /* Southern Hindko */ case HB_TAG('I','J','O',' '): /* Ijo */ return hb_language_from_string ("ijo", -1); /* Ijo */ case HB_TAG('I','N','U',' '): /* Inuktitut */ diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc index 751ccab0b..ad3635bda 100644 --- a/src/hb-ot-tag.cc +++ b/src/hb-ot-tag.cc @@ -113,6 +113,7 @@ hb_ot_new_tag_to_script (hb_tag_t tag) return HB_SCRIPT_UNKNOWN; } +#ifndef HB_DISABLE_DEPRECATED void hb_ot_tags_from_script (hb_script_t script, hb_tag_t *script_tag_1, @@ -124,6 +125,7 @@ hb_ot_tags_from_script (hb_script_t script, *script_tag_1 = count > 0 ? tags[0] : HB_OT_TAG_DEFAULT_SCRIPT; *script_tag_2 = count > 1 ? tags[1] : HB_OT_TAG_DEFAULT_SCRIPT; } +#endif /* * Complete list at: @@ -198,7 +200,7 @@ lang_matches (const char *lang_str, const char *spec) struct LangTag { char language[4]; - hb_tag_t tags[HB_OT_MAX_TAGS_PER_LANGUAGE]; + hb_tag_t tag; int cmp (const char *a) const { @@ -212,7 +214,7 @@ struct LangTag p = strchr (b, '-'); db = p ? (unsigned int) (p - b) : strlen (b); - return strncmp (a, b, MAX (da, db)); + return strncmp (a, b, hb_max (da, db)); } int cmp (const LangTag *that) const { return cmp (that->language); } @@ -230,6 +232,7 @@ struct LangTag /*{"??", {HB_TAG('Y','I','C',' ')}},*/ /* Yi Classic */ /*{"zh?", {HB_TAG('Z','H','P',' ')}},*/ /* Chinese Phonetic */ +#ifndef HB_DISABLE_DEPRECATED hb_tag_t hb_ot_tag_from_language (hb_language_t language) { @@ -238,6 +241,7 @@ hb_ot_tag_from_language (hb_language_t language) hb_ot_tags_from_script_and_language (HB_SCRIPT_UNKNOWN, language, nullptr, nullptr, &count, tags); return count > 0 ? tags[0] : HB_OT_TAG_DEFAULT_LANGUAGE; } +#endif static void hb_ot_tags_from_language (const char *lang_str, @@ -246,6 +250,7 @@ hb_ot_tags_from_language (const char *lang_str, hb_tag_t *tags) { const char *s; + unsigned int tag_idx; /* Check for matches of multiple subtags. */ if (hb_ot_tags_from_complex_language (lang_str, limit, count, tags)) @@ -254,7 +259,6 @@ hb_ot_tags_from_language (const char *lang_str, /* Find a language matching in the first component. */ s = strchr (lang_str, '-'); { - const LangTag *lang_tag; if (s && limit - lang_str >= 6) { const char *extlang_end = strchr (s + 1, '-'); @@ -263,12 +267,18 @@ hb_ot_tags_from_language (const char *lang_str, ISALPHA (s[1])) lang_str = s + 1; } - lang_tag = hb_sorted_array (ot_languages).bsearch (lang_str); - if (lang_tag) + if (hb_sorted_array (ot_languages).bfind (lang_str, &tag_idx)) { unsigned int i; - for (i = 0; i < *count && lang_tag->tags[i] != HB_TAG_NONE; i++) - tags[i] = lang_tag->tags[i]; + while (tag_idx != 0 && + 0 == strcmp (ot_languages[tag_idx].language, ot_languages[tag_idx - 1].language)) + tag_idx--; + for (i = 0; + i < *count && + tag_idx + i < ARRAY_LENGTH (ot_languages) && + 0 == strcmp (ot_languages[tag_idx + i].language, ot_languages[tag_idx].language); + i++) + tags[i] = ot_languages[tag_idx + i].tag; *count = i; return; } @@ -417,20 +427,33 @@ hb_ot_tag_to_language (hb_tag_t tag) } for (i = 0; i < ARRAY_LENGTH (ot_languages); i++) - if (ot_languages[i].tags[0] == tag) + if (ot_languages[i].tag == tag) return hb_language_from_string (ot_languages[i].language, -1); - /* Else return a custom language in the form of "x-hbotABCD" */ + /* If it's three letters long, assume it's ISO 639-3 and lower-case and use it + * (if it's not a registered tag, calling hb_ot_tag_from_language on the + * result might not return the same tag as the original tag). + * Else return a custom language in the form of "x-hbotABCD". */ { - unsigned char buf[11] = "x-hbot"; + char buf[11] = "x-hbot"; + char *str = buf; buf[6] = tag >> 24; buf[7] = (tag >> 16) & 0xFF; buf[8] = (tag >> 8) & 0xFF; buf[9] = tag & 0xFF; if (buf[9] == 0x20) + { buf[9] = '\0'; + if (ISALPHA (buf[6]) && ISALPHA (buf[7]) && ISALPHA (buf[8])) + { + buf[6] = TOLOWER (buf[6]); + buf[7] = TOLOWER (buf[7]); + buf[8] = TOLOWER (buf[8]); + str += 6; + } + } buf[10] = '\0'; - return hb_language_from_string ((char *) buf, -1); + return hb_language_from_string (str, -1); } } @@ -506,7 +529,7 @@ test_langs_sorted () for (unsigned int i = 1; i < ARRAY_LENGTH (ot_languages); i++) { int c = ot_languages[i].cmp (&ot_languages[i - 1]); - if (c >= 0) + if (c > 0) { fprintf (stderr, "ot_languages not sorted at index %d: %s %d %s\n", i, ot_languages[i-1].language, c, ot_languages[i].language); diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh index c4a192dc9..57a3a6d16 100644 --- a/src/hb-ot-var-avar-table.hh +++ b/src/hb-ot-var-avar-table.hh @@ -123,7 +123,7 @@ struct avar void map_coords (int *coords, unsigned int coords_length) const { - unsigned int count = MIN (coords_length, axisCount); + unsigned int count = hb_min (coords_length, axisCount); const SegmentMaps *map = &firstAxisSegmentMaps; for (unsigned int i = 0; i < count; i++) diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh index 78cb3c867..aa89dce26 100644 --- a/src/hb-ot-var-fvar-table.hh +++ b/src/hb-ot-var-fvar-table.hh @@ -114,17 +114,19 @@ struct fvar unsigned int get_axis_count () const { return axisCount; } +#ifndef HB_DISABLE_DEPRECATED void get_axis_deprecated (unsigned int axis_index, hb_ot_var_axis_t *info) const { const AxisRecord &axis = get_axes ()[axis_index]; info->tag = axis.axisTag; info->name_id = axis.axisNameID; - info->default_value = axis.defaultValue / 65536.; + info->default_value = axis.defaultValue / 65536.f; /* Ensure order, to simplify client math. */ - info->min_value = MIN (info->default_value, axis.minValue / 65536.); - info->max_value = MAX (info->default_value, axis.maxValue / 65536.); + info->min_value = hb_min (info->default_value, axis.minValue / 65536.f); + info->max_value = hb_max (info->default_value, axis.maxValue / 65536.f); } +#endif void get_axis_info (unsigned int axis_index, hb_ot_var_axis_info_t *info) const @@ -134,13 +136,14 @@ struct fvar info->tag = axis.axisTag; info->name_id = axis.axisNameID; info->flags = (hb_ot_var_axis_flags_t) (unsigned int) axis.flags; - info->default_value = axis.defaultValue / 65536.; + info->default_value = axis.defaultValue / 65536.f; /* Ensure order, to simplify client math. */ - info->min_value = MIN (info->default_value, axis.minValue / 65536.); - info->max_value = MAX (info->default_value, axis.maxValue / 65536.); + info->min_value = hb_min (info->default_value, axis.minValue / 65536.f); + info->max_value = hb_max (info->default_value, axis.maxValue / 65536.f); info->reserved = 0; } +#ifndef HB_DISABLE_DEPRECATED unsigned int get_axes_deprecated (unsigned int start_offset, unsigned int *axes_count /* IN/OUT */, hb_ot_var_axis_t *axes_array /* OUT */) const @@ -149,12 +152,12 @@ struct fvar { /* TODO Rewrite as hb_array_t<>::sub-array() */ unsigned int count = axisCount; - start_offset = MIN (start_offset, count); + start_offset = hb_min (start_offset, count); count -= start_offset; axes_array += start_offset; - count = MIN (count, *axes_count); + count = hb_min (count, *axes_count); *axes_count = count; for (unsigned int i = 0; i < count; i++) @@ -162,6 +165,7 @@ struct fvar } return axisCount; } +#endif unsigned int get_axis_infos (unsigned int start_offset, unsigned int *axes_count /* IN/OUT */, @@ -171,12 +175,12 @@ struct fvar { /* TODO Rewrite as hb_array_t<>::sub-array() */ unsigned int count = axisCount; - start_offset = MIN (start_offset, count); + start_offset = hb_min (start_offset, count); count -= start_offset; axes_array += start_offset; - count = MIN (count, *axes_count); + count = hb_min (count, *axes_count); *axes_count = count; for (unsigned int i = 0; i < count; i++) @@ -185,6 +189,7 @@ struct fvar return axisCount; } +#ifndef HB_DISABLE_DEPRECATED bool find_axis_deprecated (hb_tag_t tag, unsigned int *axis_index, hb_ot_var_axis_t *info) const @@ -203,6 +208,7 @@ struct fvar *axis_index = HB_OT_VAR_NO_AXIS_INDEX; return false; } +#endif bool find_axis_info (hb_tag_t tag, hb_ot_var_axis_info_t *info) const @@ -223,7 +229,7 @@ struct fvar hb_ot_var_axis_info_t axis; get_axis_info (axis_index, &axis); - v = MAX (MIN (v, axis.max_value), axis.min_value); /* Clamp. */ + v = hb_max (hb_min (v, axis.max_value), axis.min_value); /* Clamp. */ if (v == axis.default_value) return 0; diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc index e327fb762..25a246a21 100644 --- a/src/hb-ot-var.cc +++ b/src/hb-ot-var.cc @@ -75,6 +75,7 @@ hb_ot_var_get_axis_count (hb_face_t *face) return face->table.fvar->get_axis_count (); } +#ifndef HB_DISABLE_DEPRECATED /** * hb_ot_var_get_axes: * @@ -104,6 +105,7 @@ hb_ot_var_find_axis (hb_face_t *face, { return face->table.fvar->find_axis_deprecated (axis_tag, axis_index, axis_info); } +#endif /** * hb_ot_var_get_axis_infos: diff --git a/src/hb-sanitize.hh b/src/hb-sanitize.hh index e58202cf7..5f5b4bdc9 100644 --- a/src/hb-sanitize.hh +++ b/src/hb-sanitize.hh @@ -130,12 +130,23 @@ struct hb_sanitize_context_t : template bool may_dispatch (const T *obj HB_UNUSED, const F *format) { return format->sanitize (this); } - template - return_t dispatch (const T &obj) { return obj.sanitize (this); } static return_t default_return_value () { return true; } static return_t no_dispatch_return_value () { return false; } bool stop_sublookup_iteration (const return_t r) const { return !r; } + private: + template auto + _dispatch (const T &obj, hb_priority<1>, Ts&&... ds) HB_AUTO_RETURN + ( obj.sanitize (this, hb_forward (ds)...) ) + template auto + _dispatch (const T &obj, hb_priority<0>, Ts&&... ds) HB_AUTO_RETURN + ( obj.dispatch (this, hb_forward (ds)...) ) + public: + template auto + dispatch (const T &obj, Ts&&... ds) HB_AUTO_RETURN + ( _dispatch (obj, hb_prioritize, hb_forward (ds)...) ) + + void init (hb_blob_t *b) { this->blob = hb_blob_reference (b); @@ -164,7 +175,7 @@ struct hb_sanitize_context_t : else { this->start = obj_start; - this->end = obj_start + MIN (this->end - obj_start, obj->get_size ()); + this->end = obj_start + hb_min (size_t (this->end - obj_start), obj->get_size ()); } } @@ -178,7 +189,7 @@ struct hb_sanitize_context_t : void start_processing () { reset_object (); - this->max_ops = MAX ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR, + this->max_ops = hb_max ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR, (unsigned) HB_SANITIZE_MAX_OPS_MIN); this->edit_count = 0; this->debug_depth = 0; @@ -200,6 +211,8 @@ struct hb_sanitize_context_t : this->start = this->end = nullptr; } + unsigned get_edit_count () { return edit_count; } + bool check_range (const void *base, unsigned int len) const { diff --git a/src/hb-serialize.hh b/src/hb-serialize.hh index 0d908bd13..76f701608 100644 --- a/src/hb-serialize.hh +++ b/src/hb-serialize.hh @@ -71,7 +71,7 @@ struct hb_serialize_context_t { bool is_wide: 1; unsigned position : 31; - int bias; + unsigned bias; objidx_t objidx; }; @@ -120,17 +120,23 @@ struct hb_serialize_context_t this->packed.push (nullptr); } - bool propagate_error (bool e) - { return this->successful = this->successful && e; } - template bool propagate_error (const T &obj) - { return this->successful = this->successful && !obj.in_error (); } - template bool propagate_error (const T *obj) - { return this->successful = this->successful && !obj->in_error (); } - template bool propagate_error (T1 &&o1, T2 &&o2) - { return propagate_error (o1) && propagate_error (o2); } - template - bool propagate_error (T1 &&o1, T2 &&o2, T3 &&o3) - { return propagate_error (o1) && propagate_error (o2, o3); } + bool check_success (bool success) + { return this->successful && (success || (err_other_error (), false)); } + + template + bool check_equal (T1 &&v1, T2 &&v2) + { return check_success (v1 == v2); } + + template + bool check_assign (T1 &v1, T2 &&v2) + { return check_equal (v1 = v2, v2); } + + template bool propagate_error (T &&obj) + { return check_success (!hb_deref (obj).in_error ()); } + + template bool propagate_error (T1 &&o1, Ts&&... os) + { return propagate_error (hb_forward (o1)) && + propagate_error (hb_forward (os)...); } /* To be called around main operation. */ template @@ -159,7 +165,7 @@ struct hb_serialize_context_t /* Only "pack" if there exist other objects... Otherwise, don't bother. * Saves a move. */ - if (packed.length == 1) + if (packed.length <= 1) return; pop_pack (); @@ -172,7 +178,7 @@ struct hb_serialize_context_t { object_t *obj = object_pool.alloc (); if (unlikely (!obj)) - propagate_error (false); + check_success (false); else { obj->head = head; @@ -272,36 +278,37 @@ struct hb_serialize_context_t auto& link = *current->links.push (); link.is_wide = sizeof (T) == 4; - link.position = (const char *) &ofs - (const char *) base; + link.position = (const char *) &ofs - current->head; link.bias = (const char *) base - current->head; link.objidx = objidx; } void resolve_links () { + if (unlikely (in_error ())) return; + assert (!current); + assert (packed.length > 1); - for (auto obj_it = ++hb_iter (packed); obj_it; ++obj_it) + for (const object_t* parent : ++hb_iter (packed)) { - const object_t &parent = **obj_it; - - for (auto link_it = parent.links.iter (); link_it; ++link_it) + for (const object_t::link_t &link : parent->links) { - const object_t::link_t &link = *link_it; - const object_t &child = *packed[link.objidx]; - unsigned offset = (child.head - parent.head) - link.bias; + const object_t* child = packed[link.objidx]; + assert (link.bias <= (size_t) (parent->tail - parent->head)); + unsigned offset = (child->head - parent->head) - link.bias; if (link.is_wide) { - auto &off = * ((BEInt *) (parent.head + link.position)); - off = offset; - propagate_error (off == offset); + auto &off = * ((BEInt *) (parent->head + link.position)); + assert (0 == off); + check_assign (off, offset); } else { - auto &off = * ((BEInt *) (parent.head + link.position)); - off = offset; - propagate_error (off == offset); + auto &off = * ((BEInt *) (parent->head + link.position)); + assert (0 == off); + check_assign (off, offset); } } } @@ -316,15 +323,16 @@ struct hb_serialize_context_t allocate_size (alignment - l); } + template + Type *start_embed (const Type *obj HB_UNUSED = nullptr) const + { return reinterpret_cast (this->head); } template - Type *start_embed (const Type *_ HB_UNUSED = nullptr) const - { - Type *ret = reinterpret_cast (this->head); - return ret; - } + Type *start_embed (const Type &obj) const + { return start_embed (hb_addressof (obj)); } - void - err_ran_out_of_room () { this->ran_out_of_room = true; } + /* Following two functions exist to allow setting breakpoint on. */ + void err_ran_out_of_room () { this->ran_out_of_room = true; } + void err_other_error () { this->successful = false; } template Type *allocate_size (unsigned int size) @@ -350,32 +358,67 @@ struct hb_serialize_context_t } template - Type *embed (const Type &obj) + Type *embed (const Type *obj) { - unsigned int size = obj.get_size (); + unsigned int size = obj->get_size (); Type *ret = this->allocate_size (size); if (unlikely (!ret)) return nullptr; - memcpy (ret, &obj, size); + memcpy (ret, obj, size); return ret; } template - hb_serialize_context_t &operator << (const Type &obj) { embed (obj); return *this; } + Type *embed (const Type &obj) + { return embed (hb_addressof (obj)); } - template - Type *extend_size (Type &obj, unsigned int size) + template auto + _copy (const Type &src, hb_priority<1>, Ts&&... ds) HB_RETURN + (Type *, src.copy (this, hb_forward (ds)...)) + + template auto + _copy (const Type &src, hb_priority<0>) -> decltype (&(src = src)) { - assert (this->start <= (char *) &obj); - assert ((char *) &obj <= this->head); - assert ((char *) &obj + size >= this->head); - if (unlikely (!this->allocate_size (((char *) &obj) + size - this->head))) return nullptr; - return reinterpret_cast (&obj); + Type *ret = this->allocate_size (sizeof (Type)); + if (unlikely (!ret)) return nullptr; + *ret = src; + return ret; } - template - Type *extend_min (Type &obj) { return extend_size (obj, obj.min_size); } + /* Like embed, but active: calls obj.operator=() or obj.copy() to transfer data + * instead of memcpy(). */ + template + Type *copy (const Type &src, Ts&&... ds) + { return _copy (src, hb_prioritize, hb_forward (ds)...); } + template + Type *copy (const Type *src, Ts&&... ds) + { return copy (*src, hb_forward (ds)...); } template - Type *extend (Type &obj) { return extend_size (obj, obj.get_size ()); } + hb_serialize_context_t& operator << (const Type &obj) & { embed (obj); return *this; } + + template + Type *extend_size (Type *obj, unsigned int size) + { + assert (this->start <= (char *) obj); + assert ((char *) obj <= this->head); + assert ((char *) obj + size >= this->head); + if (unlikely (!this->allocate_size (((char *) obj) + size - this->head))) return nullptr; + return reinterpret_cast (obj); + } + template + Type *extend_size (Type &obj, unsigned int size) + { return extend_size (hb_addressof (obj), size); } + + template + Type *extend_min (Type *obj) { return extend_size (obj, obj->min_size); } + template + Type *extend_min (Type &obj) { return extend_min (hb_addressof (obj)); } + + template + Type *extend (Type *obj, Ts&&... ds) + { return extend_size (obj, obj->get_size (hb_forward (ds)...)); } + template + Type *extend (Type &obj, Ts&&... ds) + { return extend (hb_addressof (obj), hb_forward (ds)...); } /* Output routines. */ hb_bytes_t copy_bytes () const diff --git a/src/hb-set.cc b/src/hb-set.cc index 068236264..fa9868809 100644 --- a/src/hb-set.cc +++ b/src/hb-set.cc @@ -389,6 +389,7 @@ hb_set_symmetric_difference (hb_set_t *set, set->symmetric_difference (other); } +#ifndef HB_DISABLE_DEPRECATED /** * hb_set_invert: * @set: a set. @@ -403,6 +404,7 @@ void hb_set_invert (hb_set_t *set HB_UNUSED) { } +#endif /** * hb_set_get_population: diff --git a/src/hb-set.hh b/src/hb-set.hh index 76100f6bc..332e07bd0 100644 --- a/src/hb-set.hh +++ b/src/hb-set.hh @@ -701,6 +701,9 @@ struct hb_set_t void __next__ () { s->next (&v); if (l) l--; } void __prev__ () { s->previous (&v); } unsigned __len__ () const { return l; } + iter_t end () const { return iter_t (*s); } + bool operator != (const iter_t& o) const + { return s != o.s || v != o.v; } protected: const hb_set_t *s; diff --git a/src/hb-static.cc b/src/hb-static.cc index 4c5158860..6b89183ca 100644 --- a/src/hb-static.cc +++ b/src/hb-static.cc @@ -37,6 +37,7 @@ #include "hb-ot-maxp-table.hh" #ifndef HB_NO_VISIBILITY +#include "hb-ot-name-language-static.hh" hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {}; /*thread_local*/ hb_vector_size_impl_t _hb_CrapPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {}; diff --git a/src/hb-subset-cff1.cc b/src/hb-subset-cff1.cc index 601cbe9a1..ab3ad0936 100644 --- a/src/hb-subset-cff1.cc +++ b/src/hb-subset-cff1.cc @@ -351,7 +351,7 @@ struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_tadd_op (op, env.str_ref); param.current_parsed_str->set_parsed (); - env.returnFromSubr (); + env.return_from_subr (); param.set_current_str (env, false); break; @@ -382,7 +382,7 @@ struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_tadd_call_op (op, str_ref, env.context.subr_num); hb_set_add (closure, env.context.subr_num); param.set_current_str (env, true); @@ -912,7 +912,7 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, /* top dict INDEX */ { assert (plan.offsets.topDictInfo.offset == (unsigned) (c.head - c.start)); - CFF1IndexOf *dest = c.start_embed< CFF1IndexOf > (); + CFF1IndexOf *dest = c.start_embed< CFF1IndexOf> (); if (dest == nullptr) return false; cff1_top_dict_op_serializer_t topSzr; top_dict_modifiers_t modifier (plan.offsets, plan.topDictModSIDs); @@ -1064,7 +1064,7 @@ static inline bool _write_cff1 (const cff_subset_plan &plan, return true; } -static bool +static inline bool _hb_subset_cff1 (const OT::cff1::accelerator_subset_t &acc, const char *data, hb_subset_plan_t *plan, diff --git a/src/hb-subset-cff2.cc b/src/hb-subset-cff2.cc index f033fbde1..9a03c3ed9 100644 --- a/src/hb-subset-cff2.cc +++ b/src/hb-subset-cff2.cc @@ -183,7 +183,7 @@ struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_tset_parsed (); - env.returnFromSubr (); + env.return_from_subr (); param.set_current_str (env, false); break; @@ -213,7 +213,7 @@ struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_tadd_call_op (op, str_ref, env.context.subr_num); hb_set_add (closure, env.context.subr_num); param.set_current_str (env, true); @@ -571,7 +571,7 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan, return true; } -static bool +static inline bool _hb_subset_cff2 (const OT::cff2::accelerator_subset_t &acc, const char *data, hb_subset_plan_t *plan, diff --git a/src/hb-subset-glyf.cc b/src/hb-subset-glyf.cc index 9095e9f76..0647ee4e7 100644 --- a/src/hb-subset-glyf.cc +++ b/src/hb-subset-glyf.cc @@ -60,7 +60,7 @@ struct loca_data_t } }; -/** +/* * If hints are being dropped find the range which in glyf at which * the hinting instructions are located. Add them to the instruction_ranges * vector. @@ -108,7 +108,7 @@ _calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf, hb_codepoint_t next_glyph = HB_SET_VALUE_INVALID; while (plan->glyphset ()->next (&next_glyph)) { - unsigned int start_offset, end_offset; + unsigned int start_offset = 0, end_offset = 0; if (unlikely (!(glyf.get_offsets (next_glyph, &start_offset, &end_offset) && glyf.remove_padding (start_offset, &end_offset)))) { @@ -211,7 +211,7 @@ _write_glyf_and_loca_prime (const hb_subset_plan_t *plan, } - unsigned int start_offset, end_offset; + unsigned int start_offset = 0, end_offset = 0; if (unlikely (!(glyf.get_offsets (old_gid, &start_offset, &end_offset) && glyf.remove_padding (start_offset, &end_offset)))) end_offset = start_offset = 0; diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index 4d203b545..b3b27d427 100644 --- a/src/hb-subset-input.cc +++ b/src/hb-subset-input.cc @@ -44,6 +44,7 @@ hb_subset_input_create_or_fail () input->unicodes = hb_set_create (); input->glyphs = hb_set_create (); + input->name_ids = hb_set_create (); input->drop_hints = false; input->drop_layout = true; input->desubroutinize = false; @@ -81,6 +82,7 @@ hb_subset_input_destroy (hb_subset_input_t *subset_input) hb_set_destroy (subset_input->unicodes); hb_set_destroy (subset_input->glyphs); + hb_set_destroy (subset_input->name_ids); free (subset_input); } @@ -109,6 +111,12 @@ hb_subset_input_glyph_set (hb_subset_input_t *subset_input) return subset_input->glyphs; } +HB_EXTERN hb_set_t * +hb_subset_input_nameid_set (hb_subset_input_t *subset_input) +{ + return subset_input->name_ids; +} + HB_EXTERN void hb_subset_input_set_drop_hints (hb_subset_input_t *subset_input, hb_bool_t drop_hints) diff --git a/src/hb-subset-input.hh b/src/hb-subset-input.hh index 04d6e121b..d01fecee0 100644 --- a/src/hb-subset-input.hh +++ b/src/hb-subset-input.hh @@ -40,6 +40,7 @@ struct hb_subset_input_t hb_set_t *unicodes; hb_set_t *glyphs; + hb_set_t *name_ids; bool drop_hints : 1; bool drop_layout : 1; @@ -49,7 +50,7 @@ struct hb_subset_input_t * * features * lookups - * nameIDs + * name_ids * ... */ }; diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 8b7231494..009faeb95 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -32,7 +32,7 @@ #include "hb-ot-glyf-table.hh" #include "hb-ot-cff1-table.hh" -static void +static inline void _add_gid_and_children (const OT::glyf::accelerator_t &glyf, hb_codepoint_t gid, hb_set_t *gids_to_retain) @@ -53,7 +53,7 @@ _add_gid_and_children (const OT::glyf::accelerator_t &glyf, } } -static void +static inline void _add_cff_seac_components (const OT::cff1::accelerator_t &cff, hb_codepoint_t gid, hb_set_t *gids_to_retain) @@ -66,7 +66,7 @@ _add_cff_seac_components (const OT::cff1::accelerator_t &cff, } } -static void +static inline void _gsub_closure (hb_face_t *face, hb_set_t *gids_to_retain) { hb_set_t lookup_indices; @@ -81,7 +81,7 @@ _gsub_closure (hb_face_t *face, hb_set_t *gids_to_retain) gids_to_retain); } -static void +static inline void _remove_invalid_gids (hb_set_t *glyphs, unsigned int num_glyphs) { @@ -126,9 +126,11 @@ _populate_gids_to_retain (hb_face_t *face, initial_gids_to_retain->add (gid); } +#ifndef HB_NO_SUBSET_LAYOUT if (close_over_gsub) // Add all glyphs needed for GSUB substitutions. _gsub_closure (face, initial_gids_to_retain); +#endif // Populate a full set of glyphs to retain by adding all referenced // composite glyphs. @@ -137,14 +139,15 @@ _populate_gids_to_retain (hb_face_t *face, while (initial_gids_to_retain->next (&gid)) { _add_gid_and_children (glyf, gid, all_gids_to_retain); +#ifndef HB_NO_SUBSET_CFF if (cff.is_valid ()) _add_cff_seac_components (cff, gid, all_gids_to_retain); +#endif } hb_set_destroy (initial_gids_to_retain); _remove_invalid_gids (all_gids_to_retain, face->get_num_glyphs ()); - cff.fini (); glyf.fini (); cmap.fini (); @@ -153,36 +156,36 @@ _populate_gids_to_retain (hb_face_t *face, } static void -_create_old_gid_to_new_gid_map (const hb_face_t *face, - bool retain_gids, - hb_set_t *all_gids_to_retain, - hb_map_t *glyph_map, /* OUT */ - hb_map_t *reverse_glyph_map, /* OUT */ - unsigned int *num_glyphs /* OUT */) +_create_old_gid_to_new_gid_map (const hb_face_t *face, + bool retain_gids, + const hb_set_t *all_gids_to_retain, + hb_map_t *glyph_map, /* OUT */ + hb_map_t *reverse_glyph_map, /* OUT */ + unsigned int *num_glyphs /* OUT */) { - hb_codepoint_t gid = HB_SET_VALUE_INVALID; - unsigned int length = 0; - for (unsigned int i = 0; all_gids_to_retain->next (&gid); i++) { - if (!retain_gids) - { - glyph_map->set (gid, i); - reverse_glyph_map->set (i, gid); - } - else - { - glyph_map->set (gid, gid); - reverse_glyph_map->set (gid, gid); - } - ++length; - } - if (!retain_gids || length == 0) - { - *num_glyphs = length; - } - else + if (!retain_gids) { + + hb_enumerate (hb_iter (all_gids_to_retain), (hb_codepoint_t) 0) + | hb_sink (reverse_glyph_map) + ; + *num_glyphs = reverse_glyph_map->get_population (); + } else { + + hb_iter (all_gids_to_retain) + | hb_map ([=] (hb_codepoint_t _) { + return hb_pair_t (_, _); + }) + | hb_sink (reverse_glyph_map); + ; + + // TODO(grieger): Should we discard glyphs past the max glyph to keep? + // *num_glyphs = + hb_iter (all_gids_to_retain) | hb_reduce (hb_max, 0); *num_glyphs = face->get_num_glyphs (); } + + + reverse_glyph_map->iter () + | hb_map (&hb_pair_t::reverse) + | hb_sink (glyph_map) + ; } /** @@ -204,12 +207,17 @@ hb_subset_plan_create (hb_face_t *face, plan->drop_hints = input->drop_hints; plan->drop_layout = input->drop_layout; plan->desubroutinize = input->desubroutinize; - plan->unicodes = hb_set_create(); + plan->retain_gids = input->retain_gids; + plan->unicodes = hb_set_create (); + plan->name_ids = hb_set_reference (input->name_ids); + /* TODO Clean this up... */ + if (hb_set_is_empty (plan->name_ids)) + hb_set_add_range (plan->name_ids, 0, 0x7FFF); plan->source = hb_face_reference (face); plan->dest = hb_face_builder_create (); - plan->codepoint_to_glyph = hb_map_create(); - plan->glyph_map = hb_map_create(); - plan->reverse_glyph_map = hb_map_create(); + plan->codepoint_to_glyph = hb_map_create (); + plan->glyph_map = hb_map_create (); + plan->reverse_glyph_map = hb_map_create (); plan->_glyphset = _populate_gids_to_retain (face, input->unicodes, input->glyphs, @@ -238,6 +246,7 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan) if (!hb_object_destroy (plan)) return; hb_set_destroy (plan->unicodes); + hb_set_destroy (plan->name_ids); hb_face_destroy (plan->source); hb_face_destroy (plan->dest); hb_map_destroy (plan->codepoint_to_glyph); diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index 56726d4d0..abbab5e22 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -42,10 +42,14 @@ struct hb_subset_plan_t bool drop_hints : 1; bool drop_layout : 1; bool desubroutinize : 1; + bool retain_gids : 1; // For each cp that we'd like to retain maps to the corresponding gid. hb_set_t *unicodes; + //name_ids we would like to retain + hb_set_t *name_ids; + // The glyph subset hb_map_t *codepoint_to_glyph; diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 655e495fb..a8ec14f57 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -43,11 +43,15 @@ #include "hb-ot-cff1-table.hh" #include "hb-ot-cff2-table.hh" #include "hb-ot-vorg-table.hh" +#include "hb-ot-name-table.hh" #include "hb-ot-layout-gsub-table.hh" #include "hb-ot-layout-gpos-table.hh" -static unsigned int +HB_UNUSED static inline unsigned int +_plan_estimate_subset_table_size (hb_subset_plan_t *plan, + unsigned int table_len); +static inline unsigned int _plan_estimate_subset_table_size (hb_subset_plan_t *plan, unsigned int table_len) { @@ -64,14 +68,16 @@ template static bool _subset2 (hb_subset_plan_t *plan) { + bool result = true; hb_blob_t *source_blob = hb_sanitize_context_t ().reference_table (plan->source); const TableType *table = source_blob->as (); hb_tag_t tag = TableType::tableTag; - hb_bool_t result = false; if (source_blob->data) { hb_vector_t buf; + /* TODO Not all tables are glyph-related. 'name' table size for example should not be + * affected by number of glyphs. Accommodate that. */ unsigned int buf_size = _plan_estimate_subset_table_size (plan, source_blob->length); DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG (tag), buf_size); if (unlikely (!buf.alloc (buf_size))) @@ -83,8 +89,7 @@ _subset2 (hb_subset_plan_t *plan) hb_serialize_context_t serializer ((void *) buf, buf_size); serializer.start_serialize (); hb_subset_context_t c (plan, &serializer); - result = table->subset (&c); - serializer.end_serialize (); + bool needed = table->subset (&c); if (serializer.ran_out_of_room) { buf_size += (buf_size >> 1) + 32; @@ -96,22 +101,23 @@ _subset2 (hb_subset_plan_t *plan) } goto retry; } - if (serializer.in_error ()) - { - abort (); - } + serializer.end_serialize (); + + result = !serializer.in_error (); if (result) { - hb_blob_t *dest_blob = serializer.copy_blob (); - DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c final subset table size: %u bytes.", HB_UNTAG (tag), dest_blob->length); - result = c.plan->add_table (tag, dest_blob); - hb_blob_destroy (dest_blob); - } - else - { - DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag)); - result = true; + if (needed) + { + hb_blob_t *dest_blob = serializer.copy_blob (); + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c final subset table size: %u bytes.", HB_UNTAG (tag), dest_blob->length); + result = c.plan->add_table (tag, dest_blob); + hb_blob_destroy (dest_blob); + } + else + { + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG (tag)); + } } } else @@ -153,7 +159,10 @@ _subset_table (hb_subset_plan_t *plan, result = _subset (plan); break; case HB_OT_TAG_hdmx: - result = _subset (plan); + result = _subset2 (plan); + break; + case HB_OT_TAG_name: + result = _subset2 (plan); break; case HB_OT_TAG_head: // TODO that won't work well if there is no glyf @@ -187,6 +196,8 @@ _subset_table (hb_subset_plan_t *plan, case HB_OT_TAG_post: result = _subset (plan); break; + +#ifndef HB_NO_SUBSET_CFF case HB_OT_TAG_cff1: result = _subset (plan); break; @@ -196,6 +207,9 @@ _subset_table (hb_subset_plan_t *plan, case HB_OT_TAG_VORG: result = _subset (plan); break; +#endif + +#ifndef HB_NO_SUBSET_LAYOUT case HB_OT_TAG_GDEF: result = _subset2 (plan); break; @@ -205,6 +219,7 @@ _subset_table (hb_subset_plan_t *plan, case HB_OT_TAG_GPOS: result = _subset2 (plan); break; +#endif default: hb_blob_t *source_table = hb_face_reference_table (plan->source, tag); @@ -230,11 +245,16 @@ _should_drop_table (hb_subset_plan_t *plan, hb_tag_t tag) case HB_TAG ('h', 'd', 'm', 'x'): /* hint table, fallthrough */ case HB_TAG ('V', 'D', 'M', 'X'): /* hint table, fallthrough */ return plan->drop_hints; + // Drop Layout Tables if requested. case HB_OT_TAG_GDEF: case HB_OT_TAG_GPOS: case HB_OT_TAG_GSUB: +#ifdef HB_NO_SUBSET_LAYOUT + return true; +#endif return plan->drop_layout; + // Drop these tables below by default, list pulled // from fontTools: case HB_TAG ('B', 'A', 'S', 'E'): diff --git a/src/hb-subset.h b/src/hb-subset.h index 657709ec8..50345061c 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -54,6 +54,9 @@ hb_subset_input_unicode_set (hb_subset_input_t *subset_input); HB_EXTERN hb_set_t * hb_subset_input_glyph_set (hb_subset_input_t *subset_input); +HB_EXTERN hb_set_t * +hb_subset_input_nameid_set (hb_subset_input_t *subset_input); + HB_EXTERN void hb_subset_input_set_drop_hints (hb_subset_input_t *subset_input, hb_bool_t drop_hints); diff --git a/src/hb-subset.hh b/src/hb-subset.hh index 45cb763ec..b8dd07ab2 100644 --- a/src/hb-subset.hh +++ b/src/hb-subset.hh @@ -40,9 +40,19 @@ struct hb_subset_context_t : hb_dispatch_context_t { const char *get_name () { return "SUBSET"; } - template - bool dispatch (const T &obj) { return obj.subset (this); } - static bool default_return_value () { return true; } + static return_t default_return_value () { return true; } + + private: + template auto + _dispatch (const T &obj, hb_priority<1>, Ts&&... ds) HB_AUTO_RETURN + ( obj.subset (this, hb_forward (ds)...) ) + template auto + _dispatch (const T &obj, hb_priority<0>, Ts&&... ds) HB_AUTO_RETURN + ( obj.dispatch (this, hb_forward (ds)...) ) + public: + template auto + dispatch (const T &obj, Ts&&... ds) HB_AUTO_RETURN + ( _dispatch (obj, hb_prioritize, hb_forward (ds)...) ) hb_subset_plan_t *plan; hb_serialize_context_t *serializer; diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index d32cace64..94106faee 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -60,6 +60,7 @@ hb_unicode_combining_class_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, return HB_UNICODE_COMBINING_CLASS_NOT_REORDERED; } +#ifndef HB_DISABLE_DEPRECATED static unsigned int hb_unicode_eastasian_width_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t unicode HB_UNUSED, @@ -67,6 +68,7 @@ hb_unicode_eastasian_width_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, { return 1; } +#endif static hb_unicode_general_category_t hb_unicode_general_category_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, @@ -113,6 +115,7 @@ hb_unicode_decompose_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, } +#ifndef HB_DISABLE_DEPRECATED static unsigned int hb_unicode_decompose_compatibility_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t u HB_UNUSED, @@ -121,6 +124,7 @@ hb_unicode_decompose_compatibility_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED { return 0; } +#endif extern "C" hb_unicode_funcs_t *hb_glib_get_unicode_funcs (); @@ -425,6 +429,7 @@ hb_unicode_decompose (hb_unicode_funcs_t *ufuncs, return ufuncs->decompose (ab, a, b); } +#ifndef HB_DISABLE_DEPRECATED /** * hb_unicode_decompose_compatibility: * @ufuncs: Unicode functions. @@ -445,6 +450,7 @@ hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs, { return ufuncs->decompose_compatibility (u, decomposed); } +#endif /* See hb-unicode.hh for details. */ diff --git a/src/hb-unicode.hh b/src/hb-unicode.hh index 82ebb1064..80624c0ec 100644 --- a/src/hb-unicode.hh +++ b/src/hb-unicode.hh @@ -42,19 +42,19 @@ extern HB_INTERNAL const uint8_t _hb_modified_combining_class[256]; #define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS \ HB_UNICODE_FUNC_IMPLEMENT (combining_class) \ - HB_UNICODE_FUNC_IMPLEMENT (eastasian_width) \ + HB_IF_NOT_DEPRECATED (HB_UNICODE_FUNC_IMPLEMENT (eastasian_width)) \ HB_UNICODE_FUNC_IMPLEMENT (general_category) \ HB_UNICODE_FUNC_IMPLEMENT (mirroring) \ HB_UNICODE_FUNC_IMPLEMENT (script) \ HB_UNICODE_FUNC_IMPLEMENT (compose) \ HB_UNICODE_FUNC_IMPLEMENT (decompose) \ - HB_UNICODE_FUNC_IMPLEMENT (decompose_compatibility) \ + HB_IF_NOT_DEPRECATED (HB_UNICODE_FUNC_IMPLEMENT (decompose_compatibility)) \ /* ^--- Add new callbacks here */ /* Simple callbacks are those taking a hb_codepoint_t and returning a hb_codepoint_t */ #define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE \ HB_UNICODE_FUNC_IMPLEMENT (hb_unicode_combining_class_t, combining_class) \ - HB_UNICODE_FUNC_IMPLEMENT (unsigned int, eastasian_width) \ + HB_IF_NOT_DEPRECATED (HB_UNICODE_FUNC_IMPLEMENT (unsigned int, eastasian_width)) \ HB_UNICODE_FUNC_IMPLEMENT (hb_unicode_general_category_t, general_category) \ HB_UNICODE_FUNC_IMPLEMENT (hb_codepoint_t, mirroring) \ HB_UNICODE_FUNC_IMPLEMENT (hb_script_t, script) \ @@ -89,7 +89,11 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE unsigned int decompose_compatibility (hb_codepoint_t u, hb_codepoint_t *decomposed) { +#ifdef HB_DISABLE_DEPRECATED + unsigned int ret = 0; +#else unsigned int ret = func.decompose_compatibility (this, u, decomposed, user_data.decompose_compatibility); +#endif if (ret == 1 && u == decomposed[0]) { decomposed[0] = 0; return 0; diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index f9d9f3d0f..4e004416b 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -283,7 +283,7 @@ struct active_feature_t { OPENTYPE_FEATURE_RECORD rec; unsigned int order; - static int cmp (const void *pa, const void *pb) { + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const active_feature_t *a = (const active_feature_t *) pa; const active_feature_t *b = (const active_feature_t *) pb; return a->rec.tagFeature < b->rec.tagFeature ? -1 : a->rec.tagFeature > b->rec.tagFeature ? 1 : @@ -300,7 +300,7 @@ struct feature_event_t { bool start; active_feature_t feature; - static int cmp (const void *pa, const void *pb) + HB_INTERNAL static int cmp (const void *pa, const void *pb) { const feature_event_t *a = (const feature_event_t *) pa; const feature_event_t *b = (const feature_event_t *) pb; @@ -698,7 +698,7 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan, { active_feature_t *feature = active_features.find (&event->feature); if (feature) - active_features.remove (feature - active_features.arrayZ ()); + active_features.remove (feature - active_features.arrayZ); } } @@ -889,8 +889,8 @@ retry: &items[i].a, script_tags[i], language_tag, - range_char_counts.arrayZ (), - range_properties.arrayZ (), + range_char_counts.arrayZ, + range_properties.arrayZ, range_properties.length, pchars + chars_offset, item_chars_len, @@ -930,8 +930,8 @@ retry: &items[i].a, script_tags[i], language_tag, - range_char_counts.arrayZ (), - range_properties.arrayZ (), + range_char_counts.arrayZ, + range_properties.arrayZ, range_properties.length, pchars + chars_offset, log_clusters + chars_offset, @@ -967,7 +967,7 @@ retry: vis_clusters[i] = (uint32_t) -1; for (unsigned int i = 0; i < buffer->len; i++) { uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]]; - *p = MIN (*p, buffer->info[i].cluster); + *p = hb_min (*p, buffer->info[i].cluster); } for (unsigned int i = 1; i < glyphs_len; i++) if (vis_clusters[i] == (uint32_t) -1) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index e0b7fb0cb..3c6347b3f 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -49,35 +49,34 @@ struct hb_vector_t { allocated = o.allocated; length = o.length; - arrayZ_ = o.arrayZ_; + arrayZ = o.arrayZ; o.init (); } ~hb_vector_t () { fini (); } - unsigned int length; private: int allocated; /* == -1 means allocation failed. */ - Type *arrayZ_; public: + unsigned int length; + public: + Type *arrayZ; void init () { allocated = length = 0; - arrayZ_ = nullptr; + arrayZ = nullptr; } void fini () { - if (arrayZ_) - free (arrayZ_); + free (arrayZ); init (); } void fini_deep () { - Type *array = arrayZ(); unsigned int count = length; for (unsigned int i = 0; i < count; i++) - array[i].fini (); + arrayZ[i].fini (); fini (); } @@ -95,33 +94,30 @@ struct hb_vector_t fini (); allocated = o.allocated; length = o.length; - arrayZ_ = o.arrayZ_; + arrayZ = o.arrayZ; o.init (); return *this; } hb_bytes_t as_bytes () const - { return hb_bytes_t ((const char *) arrayZ(), length * item_size); } + { return hb_bytes_t ((const char *) arrayZ, length * item_size); } bool operator == (const hb_vector_t &o) const { return as_array () == o.as_array (); } uint32_t hash () const { return as_array ().hash (); } - const Type * arrayZ () const { return arrayZ_; } - Type * arrayZ () { return arrayZ_; } - Type& operator [] (int i_) { unsigned int i = (unsigned int) i_; if (unlikely (i >= length)) return Crap (Type); - return arrayZ()[i]; + return arrayZ[i]; } const Type& operator [] (int i_) const { unsigned int i = (unsigned int) i_; if (unlikely (i >= length)) return Null(Type); - return arrayZ()[i]; + return arrayZ[i]; } Type& tail () { return (*this)[length - 1]; } @@ -134,8 +130,8 @@ struct hb_vector_t template hb_vector_t& operator << (T&& v) { push (hb_forward (v)); return *this; } - hb_array_t< Type> as_array () { return hb_array (arrayZ(), length); } - hb_array_t as_array () const { return hb_array (arrayZ(), length); } + hb_array_t< Type> as_array () { return hb_array (arrayZ, length); } + hb_array_t as_array () const { return hb_array (arrayZ, length); } /* Iterator. */ typedef hb_array_t iter_t; @@ -155,21 +151,21 @@ struct hb_vector_t { return as_array ().sub_array (start_offset, count);} hb_sorted_array_t as_sorted_array () - { return hb_sorted_array (arrayZ(), length); } + { return hb_sorted_array (arrayZ, length); } hb_sorted_array_t as_sorted_array () const - { return hb_sorted_array (arrayZ(), length); } + { return hb_sorted_array (arrayZ, length); } - template explicit operator T * () { return arrayZ(); } - template explicit operator const T * () const { return arrayZ(); } + template explicit operator T * () { return arrayZ; } + template explicit operator const T * () const { return arrayZ; } - Type * operator + (unsigned int i) { return arrayZ() + i; } - const Type * operator + (unsigned int i) const { return arrayZ() + i; } + Type * operator + (unsigned int i) { return arrayZ + i; } + const Type * operator + (unsigned int i) const { return arrayZ + i; } Type *push () { if (unlikely (!resize (length + 1))) return &Crap(Type); - return &arrayZ()[length - 1]; + return &arrayZ[length - 1]; } template Type *push (T&& v) @@ -202,7 +198,7 @@ struct hb_vector_t (new_allocated < (unsigned) allocated) || hb_unsigned_mul_overflows (new_allocated, sizeof (Type)); if (likely (!overflows)) - new_array = (Type *) realloc (arrayZ_, new_allocated * sizeof (Type)); + new_array = (Type *) realloc (arrayZ, new_allocated * sizeof (Type)); if (unlikely (!new_array)) { @@ -210,7 +206,7 @@ struct hb_vector_t return false; } - arrayZ_ = new_array; + arrayZ = new_array; allocated = new_allocated; return true; @@ -223,7 +219,7 @@ struct hb_vector_t return false; if (size > length) - memset (arrayZ() + length, 0, (size - length) * sizeof (*arrayZ())); + memset (arrayZ + length, 0, (size - length) * sizeof (*arrayZ)); length = size; return true; @@ -232,16 +228,15 @@ struct hb_vector_t Type pop () { if (!length) return Null(Type); - return hb_move (arrayZ()[--length]); /* Does this move actually work? */ + return hb_move (arrayZ[--length]); /* Does this move actually work? */ } void remove (unsigned int i) { if (unlikely (i >= length)) return; - Type *array = arrayZ(); - memmove (static_cast (&array[i]), - static_cast (&array[i + 1]), + memmove (static_cast (&arrayZ[i]), + static_cast (&arrayZ[i + 1]), (length - i - 1) * sizeof (Type)); length--; } @@ -256,19 +251,17 @@ struct hb_vector_t template Type *find (T v) { - Type *array = arrayZ(); for (unsigned int i = 0; i < length; i++) - if (array[i] == v) - return &array[i]; + if (arrayZ[i] == v) + return &arrayZ[i]; return nullptr; } template const Type *find (T v) const { - const Type *array = arrayZ(); for (unsigned int i = 0; i < length; i++) - if (array[i] == v) - return &array[i]; + if (arrayZ[i] == v) + return &arrayZ[i]; return nullptr; } @@ -288,8 +281,8 @@ struct hb_vector_t template struct hb_sorted_vector_t : hb_vector_t { - hb_sorted_array_t< Type> as_array () { return hb_sorted_array (this->arrayZ(), this->length); } - hb_sorted_array_t as_array () const { return hb_sorted_array (this->arrayZ(), this->length); } + hb_sorted_array_t< Type> as_array () { return hb_sorted_array (this->arrayZ, this->length); } + hb_sorted_array_t as_array () const { return hb_sorted_array (this->arrayZ, this->length); } /* Iterator. */ typedef hb_sorted_array_t const_iter_t; diff --git a/src/hb-warning.cc b/src/hb-warning.cc index 9fb410038..60c7445b7 100644 --- a/src/hb-warning.cc +++ b/src/hb-warning.cc @@ -26,12 +26,12 @@ #include "hb.hh" -#if defined(HB_ATOMIC_INT_NIL) +#ifdef HB_ATOMIC_INT_NIL #error "Could not find any system to define atomic_int macros, library WILL NOT be thread-safe" #error "Check hb-atomic.hh for possible resolutions." #endif -#if defined(HB_MUTEX_IMPL_NIL) +#ifdef HB_MUTEX_IMPL_NIL #error "Could not find any system to define mutex macros, library WILL NOT be thread-safe" #error "Check hb-mutex.hh for possible resolutions." #endif diff --git a/src/hb.hh b/src/hb.hh index 4ea10976e..e4c7271bd 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -29,8 +29,9 @@ #ifndef HB_HH #define HB_HH + #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC -#if defined(_MSC_VER) +#ifdef _MSC_VER #pragma warning( disable: 4068 ) /* Unknown pragma */ #endif #if defined(__GNUC__) || defined(__clang__) @@ -65,6 +66,7 @@ #pragma GCC diagnostic error "-Wcast-align" #pragma GCC diagnostic error "-Wcast-function-type" #pragma GCC diagnostic error "-Wdelete-non-virtual-dtor" +#pragma GCC diagnostic error "-Wdouble-promotion" #pragma GCC diagnostic error "-Wformat-security" #pragma GCC diagnostic error "-Wimplicit-function-declaration" #pragma GCC diagnostic error "-Winit-self" @@ -94,6 +96,7 @@ /* Warning. To be investigated if happens. */ #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING #pragma GCC diagnostic warning "-Wbuiltin-macro-redefined" +#pragma GCC diagnostic warning "-Wdeprecated" #pragma GCC diagnostic warning "-Wdisabled-optimization" #pragma GCC diagnostic warning "-Wformat=2" #pragma GCC diagnostic warning "-Wignored-pragma-optimize" @@ -121,14 +124,15 @@ #pragma GCC diagnostic ignored "-Wpacked" // Erratic impl in clang #pragma GCC diagnostic ignored "-Wstrict-aliasing" #pragma GCC diagnostic ignored "-Wtype-limits" +#pragma GCC diagnostic ignored "-Wc++11-compat" // only gcc raises it #endif #endif #endif -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif + +#include "hb-config.hh" + /* * Following added based on what AC_USE_SYSTEM_EXTENSIONS adds to @@ -167,8 +171,7 @@ #include "hb-aat.h" #define HB_AAT_H_IN -#include "hb-aat.h" - +#include #include #include #include @@ -201,7 +204,7 @@ extern "C" void hb_free_impl(void *ptr); #define realloc hb_realloc_impl #define free hb_free_impl -#if defined(hb_memalign_impl) +#ifdef hb_memalign_impl extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size); #define posix_memalign hb_memalign_impl #else @@ -260,6 +263,13 @@ extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size); # endif #endif +/* https://github.com/harfbuzz/harfbuzz/issues/1651 */ +#if defined(__clang__) && __clang_major__ < 10 +#define static_const static +#else +#define static_const static const +#endif + #if defined(__GNUC__) && (__GNUC__ >= 3) #define HB_FUNC __PRETTY_FUNCTION__ #elif defined(_MSC_VER) @@ -306,7 +316,7 @@ extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size); # define HB_FALLTHROUGH /* FALLTHROUGH */ #endif -#if defined(__clang__) +#ifdef __clang__ /* Disable certain sanitizer errors. */ /* https://github.com/harfbuzz/harfbuzz/issues/1247 */ #define HB_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW __attribute__((no_sanitize("signed-integer-overflow"))) @@ -337,19 +347,27 @@ extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size); # if defined(_WIN32_WCE) /* Some things not defined on Windows CE. */ # define vsnprintf _vsnprintf -# define getenv(Name) nullptr +# ifndef HB_NO_GETENV +# define HB_NO_GETENV +# endif # if _WIN32_WCE < 0x800 # define setlocale(Category, Locale) "C" static int errno = 0; /* Use something better? */ # endif # elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) -# define getenv(Name) nullptr +# ifndef HB_NO_GETENV +# define HB_NO_GETENV +# endif # endif # if defined(_MSC_VER) && _MSC_VER < 1900 # define snprintf _snprintf # endif #endif +#ifdef HB_NO_GETENV +#define getenv(Name) nullptr +#endif + #if defined(HAVE_ATEXIT) && !defined(HB_USE_ATEXIT) /* atexit() is only safe to be called from shared libraries on certain * platforms. Whitelist. @@ -428,12 +446,12 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); * * https://bugs.chromium.org/p/chromium/issues/detail?id=860184 */ -#if !defined(HB_VECTOR_SIZE) +#ifndef HB_VECTOR_SIZE # define HB_VECTOR_SIZE 0 #endif /* The `vector_size' attribute was introduced in gcc 3.1. */ -#if !defined(HB_VECTOR_SIZE) +#ifndef HB_VECTOR_SIZE # if defined( __GNUC__ ) && ( __GNUC__ >= 4 ) # define HB_VECTOR_SIZE 128 # else @@ -644,7 +662,7 @@ struct BEInt #include "hb-atomic.hh" // Requires: hb-meta #include "hb-null.hh" // Requires: hb-meta #include "hb-algs.hh" // Requires: hb-meta hb-null -#include "hb-iter.hh" // Requires: hb-meta +#include "hb-iter.hh" // Requires: hb-algs hb-meta #include "hb-debug.hh" // Requires: hb-algs hb-atomic #include "hb-array.hh" // Requires: hb-algs hb-iter hb-null #include "hb-vector.hh" // Requires: hb-array hb-null diff --git a/src/test-algs.cc b/src/test-algs.cc index 42a9538dc..774414ad1 100644 --- a/src/test-algs.cc +++ b/src/test-algs.cc @@ -28,6 +28,17 @@ #include "hb-algs.hh" +static char * +test_func (int a, char **b) +{ + return b ? b[a] : nullptr; +} + +struct A +{ + void a () {} +}; + int main (int argc, char **argv) { @@ -46,5 +57,24 @@ main (int argc, char **argv) q.second = 4; assert (i == 4); + hb_invoke (test_func, 0, nullptr); + + A a; + hb_invoke (&A::a, a); + + assert (1 == hb_min (3, 8, 1, 2)); + assert (8 == hb_max (3, 8, 1, 2)); + + int x = 1, y = 2; + hb_min (x, 3); + hb_min (3, x, 4); + hb_min (3, x, 4 + 3); + int &z = hb_min (x, y); + z = 3; + assert (x == 3); + + hb_pair_t xp = hb_pair_t (nullptr, 0); + xp = hb_pair_t (nullptr, 1); + return 0; } diff --git a/src/test-size-params.cc b/src/test-gpos-size-params.cc similarity index 100% rename from src/test-size-params.cc rename to src/test-gpos-size-params.cc diff --git a/src/test-would-substitute.cc b/src/test-gsub-would-substitute.cc similarity index 100% rename from src/test-would-substitute.cc rename to src/test-gsub-would-substitute.cc diff --git a/src/test-iter.cc b/src/test-iter.cc index 675bbe397..f834640ff 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -43,6 +43,7 @@ struct array_iter_t : hb_iter_with_fallback_t, T&> void __forward__ (unsigned n) { arr += n; } void __rewind__ (unsigned n) { arr -= n; } unsigned __len__ () const { return arr.length; } + bool operator != (const array_iter_t& o) { return arr != o.arr; } private: hb_array_t arr; @@ -56,7 +57,7 @@ struct some_array_t typedef array_iter_t iter_t; array_iter_t iter () { return array_iter_t (arr); } operator array_iter_t () { return iter (); } - operator hb_iter_t > () { return iter (); } + operator hb_iter_t> () { return iter (); } private: hb_array_t arr; @@ -64,14 +65,10 @@ struct some_array_t template + hb_requires (hb_is_iterator (Iter))> static void -test_iterator (Iter it) +test_iterator_non_default_constructable (Iter it) { - Iter default_constructed; - - assert (!default_constructed); - /* Iterate over a copy of it. */ for (auto c = it.iter (); c; c++) *c; @@ -80,6 +77,10 @@ test_iterator (Iter it) for (auto c = +it; c; c++) *c; + /* Range-based for over a copy. */ + for (auto _ : +it) + (void) _; + it += it.len (); it = it + 10; it = 10 + it; @@ -90,11 +91,25 @@ test_iterator (Iter it) static_assert (true || it.is_sorted_iterator, ""); } +template +static void +test_iterator (Iter it) +{ + Iter default_constructed; + assert (!default_constructed); + + test_iterator_non_default_constructable (it); +} + template + hb_requires (hb_is_iterable (Iterable))> static void test_iterable (const Iterable &lst = Null(Iterable)) { + for (auto _ : lst) + (void) _; + // Test that can take iterator from. test_iterator (lst.iter ()); } @@ -110,7 +125,7 @@ main (int argc, char **argv) array_iter_t s2 (v); /* Implicit conversion from vector. */ array_iter_t t (dst); - static_assert (hb_is_random_access_iterator (array_iter_t), ""); + static_assert (array_iter_t::is_random_access_iterator, ""); some_array_t a (src); @@ -125,31 +140,64 @@ main (int argc, char **argv) test_iterable (v); hb_set_t st; + st << 1 << 15 << 43; test_iterable (st); hb_sorted_array_t sa; + (void) static_cast, hb_sorted_array_t::item_t>&> (sa); + (void) static_cast, hb_sorted_array_t::__item_t__>&> (sa); + (void) static_cast, int&>&>(sa); + (void) static_cast>&>(sa); + (void) static_cast, int&>&> (sa); test_iterable (sa); - test_iterable > (); - test_iterable > (); - test_iterable > (); + test_iterable> (); + test_iterable> (); + test_iterable> (); test_iterable (); test_iterable (); test_iterator (hb_zip (st, v)); + test_iterator_non_default_constructable (hb_enumerate (st)); + test_iterator_non_default_constructable (hb_enumerate (st, -5)); + test_iterator_non_default_constructable (hb_enumerate (hb_iter (st))); + test_iterator_non_default_constructable (hb_enumerate (hb_iter (st) + 1)); + test_iterator_non_default_constructable (hb_iter (st) | hb_filter ()); + test_iterator_non_default_constructable (hb_iter (st) | hb_map (hb_lidentity)); - hb_any (st); + assert (true == hb_all (st)); + assert (false == hb_all (st, 42u)); + assert (true == hb_any (st)); + assert (false == hb_any (st, 14u)); + assert (true == hb_any (st, 14u, [] (unsigned _) { return _ - 1u; })); + assert (true == hb_any (st, [] (unsigned _) { return _ == 15u; })); + assert (true == hb_any (st, 15u)); + assert (false == hb_none (st)); + assert (false == hb_none (st, 15u)); + assert (true == hb_none (st, 17u)); - hb_array_t > pa; + hb_array_t> pa; pa->as_array (); + hb_map_t m; + + hb_iter (st); + hb_iter (&st); + + hb_iter (src) - | hb_map (hb_identity) + | hb_map (m) + | hb_map (&m) | hb_filter () + | hb_filter (st) + | hb_filter (&st) | hb_filter (hb_bool) | hb_filter (hb_bool, hb_identity) | hb_sink (st) ; + + hb_iter (src) + | hb_sink (hb_array (dst)) + ; + + hb_iter (src) | hb_apply (&st) ; @@ -159,6 +207,25 @@ main (int argc, char **argv) | hb_reduce ([&] (int acc, int value) -> int { return acc; }, 2) ; + using map_pair_t = hb_item_type; + + hb_iter (m) + | hb_map ([] (map_pair_t p) { return p.first * p.second; }) + ; + + m.keys (); + using map_key_t = decltype (*m.keys()); + + hb_iter (m.keys ()) + | hb_filter ([] (map_key_t k) { return k < 42; }) + | hb_drain + ; + + m.values (); + using map_value_t = decltype (*m.values()); + + hb_iter (m.values ()) + | hb_filter ([] (map_value_t k) { return k < 42; }) + | hb_drain + ; + unsigned int temp1 = 10; unsigned int temp2 = 0; hb_map_t *result = @@ -181,7 +248,7 @@ main (int argc, char **argv) ; /* The result should be something like 0->10, 1->11, ..., 9->19 */ assert (hb_map_get (result, 9) == 19); - + unsigned int temp3 = 0; + hb_iter(src) | hb_map([&] (int i) -> int { return ++temp3; }) @@ -197,5 +264,18 @@ main (int argc, char **argv) long vl; s >> vl; + hb_iota (); + hb_iota (3); + hb_iota (3, 2); + hb_range (); + assert (hb_range (9).len () == 9); + assert (hb_range (2, 9).len () == 7); + assert (hb_range (2, 9, 3).len () == 3); + assert (hb_range (2, 8, 3).len () == 2); + assert (hb_range (2, 7, 3).len () == 2); + assert (hb_range (-2, -9, -3).len () == 3); + assert (hb_range (-2, -8, -3).len () == 2); + assert (hb_range (-2, -7, -3).len () == 2); + return 0; } diff --git a/src/test-meta.cc b/src/test-meta.cc new file mode 100644 index 000000000..ffd360b0d --- /dev/null +++ b/src/test-meta.cc @@ -0,0 +1,129 @@ +/* + * Copyright © 2019 Facebook, 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. + * + * Facebook Author(s): Behdad Esfahbod + */ + +#include "hb.hh" +#include "hb-meta.hh" + +#include + +int +main (int argc, char **argv) +{ + + static_assert (hb_is_convertible (void, void), ""); + static_assert (hb_is_convertible (void, const void), ""); + static_assert (hb_is_convertible (const void, void), ""); + + static_assert (hb_is_convertible (int, int), ""); + static_assert (hb_is_convertible (char, int), ""); + static_assert (hb_is_convertible (long, int), ""); + + static_assert (hb_is_convertible (int, int), ""); + + static_assert (hb_is_convertible (const int, int), ""); + static_assert (hb_is_convertible (int, const int), ""); + static_assert (hb_is_convertible (const int, const int), ""); + + static_assert (hb_is_convertible (int&, int), ""); + static_assert (!hb_is_convertible (int, int&), ""); + + static_assert (hb_is_convertible (int, const int&), ""); + static_assert (!hb_is_convertible (const int, int&), ""); + static_assert (hb_is_convertible (const int, const int&), ""); + static_assert (hb_is_convertible (int&, const int), ""); + static_assert (hb_is_convertible (const int&, int), ""); + static_assert (hb_is_convertible (const int&, const int), ""); + static_assert (hb_is_convertible (const int&, const int), ""); + + struct X {}; + struct Y : X {}; + + static_assert (hb_is_convertible (const X &, const X), ""); + static_assert (hb_is_convertible (X &, const X), ""); + static_assert (hb_is_convertible (X &, const X &), ""); + static_assert (hb_is_convertible (X, const X &), ""); + static_assert (hb_is_convertible (const X, const X &), ""); + static_assert (!hb_is_convertible (const X, X &), ""); + static_assert (!hb_is_convertible (X, X &), ""); + static_assert (hb_is_convertible (X &, X &), ""); + + static_assert (hb_is_convertible (int&, long), ""); + static_assert (!hb_is_convertible (int&, long&), ""); + + static_assert (hb_is_convertible (int *, int *), ""); + static_assert (hb_is_convertible (int *, const int *), ""); + static_assert (!hb_is_convertible (const int *, int *), ""); + static_assert (!hb_is_convertible (int *, long *), ""); + static_assert (hb_is_convertible (int *, void *), ""); + static_assert (!hb_is_convertible (void *, int *), ""); + + static_assert (hb_is_base_of (void, void), ""); + static_assert (hb_is_base_of (void, int), ""); + static_assert (!hb_is_base_of (int, void), ""); + + static_assert (hb_is_base_of (int, int), ""); + static_assert (hb_is_base_of (const int, int), ""); + static_assert (hb_is_base_of (int, const int), ""); + + static_assert (hb_is_base_of (X, X), ""); + static_assert (hb_is_base_of (X, Y), ""); + static_assert (hb_is_base_of (const X, Y), ""); + static_assert (hb_is_base_of (X, const Y), ""); + static_assert (!hb_is_base_of (Y, X), ""); + + static_assert (hb_is_constructible (int), ""); + static_assert (hb_is_constructible (int, int), ""); + static_assert (hb_is_constructible (int, char), ""); + static_assert (hb_is_constructible (int, long), ""); + static_assert (!hb_is_constructible (int, X), ""); + static_assert (!hb_is_constructible (int, int, int), ""); + static_assert (hb_is_constructible (X), ""); + static_assert (!hb_is_constructible (X, int), ""); + static_assert (hb_is_constructible (X, X), ""); + static_assert (!hb_is_constructible (X, X, X), ""); + static_assert (hb_is_constructible (X, Y), ""); + static_assert (!hb_is_constructible (Y, X), ""); + + static_assert (hb_is_trivially_default_constructible (X), ""); + static_assert (hb_is_trivially_default_constructible (Y), ""); + static_assert (hb_is_trivially_copy_constructible (X), ""); + static_assert (hb_is_trivially_copy_constructible (Y), ""); + static_assert (hb_is_trivially_move_constructible (X), ""); + static_assert (hb_is_trivially_move_constructible (Y), ""); + static_assert (hb_is_trivially_destructible (Y), ""); + + static_assert (hb_is_trivially_copyable (int), ""); + static_assert (hb_is_trivially_copyable (X), ""); + static_assert (hb_is_trivially_copyable (Y), ""); + + static_assert (hb_is_trivial (int), ""); + static_assert (hb_is_trivial (X), ""); + static_assert (hb_is_trivial (Y), ""); + + /* TODO Add more meaningful tests. */ + + return 0; +} diff --git a/src/test-name-table.cc b/src/test-ot-name.cc similarity index 100% rename from src/test-name-table.cc rename to src/test-ot-name.cc diff --git a/test/api/Makefile.am b/test/api/Makefile.am index 67d66e16d..9d7b3198c 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -52,6 +52,7 @@ TEST_PROGS = \ test-subset-cff2 \ test-unicode \ test-version \ + test-subset-nameids \ $(NULL) test_subset_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la @@ -64,6 +65,7 @@ test_subset_post_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la test_subset_vmtx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la test_subset_cff1_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la test_subset_cff2_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_nameids_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la test_unicode_CPPFLAGS = \ $(AM_CPPFLAGS) \ diff --git a/test/api/fonts/nameID.dup.expected.ttf b/test/api/fonts/nameID.dup.expected.ttf new file mode 100644 index 000000000..e9e7ff5b4 Binary files /dev/null and b/test/api/fonts/nameID.dup.expected.ttf differ diff --git a/test/api/fonts/nameID.dup.origin.ttf b/test/api/fonts/nameID.dup.origin.ttf new file mode 100644 index 000000000..aad75d421 Binary files /dev/null and b/test/api/fonts/nameID.dup.origin.ttf differ diff --git a/test/api/fonts/nameID.expected.ttf b/test/api/fonts/nameID.expected.ttf new file mode 100644 index 000000000..00aecc0bb Binary files /dev/null and b/test/api/fonts/nameID.expected.ttf differ diff --git a/test/api/fonts/nameID.origin.ttf b/test/api/fonts/nameID.origin.ttf new file mode 100644 index 000000000..aec973a58 Binary files /dev/null and b/test/api/fonts/nameID.origin.ttf differ diff --git a/test/api/hb-subset-test.h b/test/api/hb-subset-test.h index 3e759a8a9..8f32aee67 100644 --- a/test/api/hb-subset-test.h +++ b/test/api/hb-subset-test.h @@ -65,6 +65,15 @@ hb_subset_test_create_input_from_glyphs (const hb_set_t *glyphs) return input; } +static inline hb_subset_input_t * +hb_subset_test_create_input_from_nameids (const hb_set_t *name_ids) +{ + hb_subset_input_t *input = hb_subset_input_create_or_fail (); + hb_set_t * input_name_ids = hb_subset_input_nameid_set (input); + hb_set_union (input_name_ids, name_ids); + return input; +} + static inline hb_face_t * hb_subset_test_create_subset (hb_face_t *source, hb_subset_input_t *input) diff --git a/test/api/test-ot-face.c b/test/api/test-ot-face.c index 9ebcb4e2b..12ac666a4 100644 --- a/test/api/test-ot-face.c +++ b/test/api/test-ot-face.c @@ -111,7 +111,7 @@ test_ot_face_empty (void) } static void -test_ot_var_axis_on_zero_named_instance () +test_ot_var_axis_on_zero_named_instance (void) { hb_face_t *face = hb_test_open_font_file ("fonts/Zycon.ttf"); g_assert (hb_ot_var_get_axis_count (face)); diff --git a/test/api/test-ot-tag.c b/test/api/test-ot-tag.c index 60231afe9..66c69caf7 100644 --- a/test/api/test-ot-tag.c +++ b/test/api/test-ot-tag.c @@ -281,6 +281,8 @@ test_ot_tag_language (void) g_assert_cmphex (HB_TAG_CHAR4 ("dflt"), ==, HB_OT_TAG_DEFAULT_LANGUAGE); test_language_two_way ("dflt", NULL); + test_language_two_way ("ALT", "alt"); + test_language_two_way ("ARA", "ar"); test_language_two_way ("AZE", "az"); @@ -353,7 +355,8 @@ test_ot_tag_language (void) test_tag_from_language ("ZHS", "zh"); /* Chinese */ test_tag_from_language ("ZHS", "zh-xx"); - test_language_two_way ("ABC", "x-hbotabc"); + test_language_two_way ("ABC", "abc"); + test_language_two_way ("ABCD", "x-hbotabcd"); test_tag_from_language ("ABC", "asdf-asdf-wer-x-hbotabc-zxc"); test_tag_from_language ("ABC", "asdf-asdf-wer-x-hbotabc"); test_tag_from_language ("ABCD", "asdf-asdf-wer-x-hbotabcd"); diff --git a/test/api/test-subset-hdmx.c b/test/api/test-subset-hdmx.c index 44e579ace..7178833bc 100644 --- a/test/api/test-subset-hdmx.c +++ b/test/api/test-subset-hdmx.c @@ -91,28 +91,6 @@ test_subset_hdmx_invalid (void) hb_face_destroy (face); } -static void -test_subset_hdmx_fails_sanitize (void) -{ - hb_face_t *face = hb_test_open_font_file ("../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5609911946838016"); - - hb_subset_input_t *input = hb_subset_input_create_or_fail (); - hb_set_t *codepoints = hb_subset_input_unicode_set (input); - hb_face_t *subset; - - hb_set_add (codepoints, 'a'); - hb_set_add (codepoints, 'b'); - hb_set_add (codepoints, 'c'); - - subset = hb_subset (face, input); - g_assert (subset); - g_assert (subset == hb_face_get_empty ()); - - hb_subset_input_destroy (input); - hb_face_destroy (subset); - hb_face_destroy (face); -} - static void test_subset_hdmx_noop (void) { @@ -140,7 +118,6 @@ main (int argc, char **argv) hb_test_add (test_subset_hdmx_simple_subset); hb_test_add (test_subset_hdmx_multiple_device_records); hb_test_add (test_subset_hdmx_invalid); - hb_test_add (test_subset_hdmx_fails_sanitize); hb_test_add (test_subset_hdmx_noop); return hb_test_run(); diff --git a/test/api/test-subset-nameids.c b/test/api/test-subset-nameids.c new file mode 100644 index 000000000..b58a86c91 --- /dev/null +++ b/test/api/test-subset-nameids.c @@ -0,0 +1,79 @@ +/* + * Copyright © 2018 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): Garret Rieger + */ + +#include "hb-test.h" +#include "hb-subset-test.h" + +static void +test_subset_nameids (void) +{ + hb_face_t *face_origin = hb_test_open_font_file ("fonts/nameID.origin.ttf"); + hb_face_t *face_expected = hb_test_open_font_file ("fonts/nameID.expected.ttf"); + + hb_set_t *name_ids = hb_set_create(); + hb_face_t *face_subset; + hb_set_add (name_ids, 0); + hb_set_add (name_ids, 9); + face_subset = hb_subset_test_create_subset (face_origin, hb_subset_test_create_input_from_nameids (name_ids)); + hb_set_destroy (name_ids); + + hb_subset_test_check (face_expected, face_subset, HB_TAG ('n','a','m','e')); + + hb_face_destroy (face_subset); + hb_face_destroy (face_origin); + hb_face_destroy (face_expected); +} + +static void +test_subset_nameids_with_dup_strs (void) +{ + hb_face_t *face_origin = hb_test_open_font_file ("fonts/nameID.dup.origin.ttf"); + hb_face_t *face_expected = hb_test_open_font_file ("fonts/nameID.dup.expected.ttf"); + + hb_set_t *name_ids = hb_set_create(); + hb_face_t *face_subset; + hb_set_add (name_ids, 1); + hb_set_add (name_ids, 3); + face_subset = hb_subset_test_create_subset (face_origin, hb_subset_test_create_input_from_nameids (name_ids)); + hb_set_destroy (name_ids); + + hb_subset_test_check (face_expected, face_subset, HB_TAG ('n','a','m','e')); + + hb_face_destroy (face_subset); + hb_face_destroy (face_origin); + hb_face_destroy (face_expected); +} + +int +main (int argc, char **argv) +{ + hb_test_init (&argc, &argv); + + hb_test_add (test_subset_nameids); + hb_test_add (test_subset_nameids_with_dup_strs); + + return hb_test_run(); +} diff --git a/test/fuzzing/Makefile.am b/test/fuzzing/Makefile.am index a77df7061..5bd2d7e6d 100644 --- a/test/fuzzing/Makefile.am +++ b/test/fuzzing/Makefile.am @@ -55,8 +55,8 @@ hb_subset_fuzzer_CPPFLAGS = $(AM_CPPFLAGS) hb_subset_fuzzer_DEPENDENCIES = $(top_builddir)/src/libharfbuzz-subset.la check: - EXEEXT="$(EXEEXT)" srcdir="$(srcdir)" builddir="$(builddir)" $(srcdir)/run-shape-fuzzer-tests.py - EXEEXT="$(EXEEXT)" srcdir="$(srcdir)" builddir="$(builddir)" $(srcdir)/run-subset-fuzzer-tests.py + EXEEXT="$(EXEEXT)" srcdir="$(srcdir)" builddir="$(builddir)" LIBTOOL="$(LIBTOOL)" $(srcdir)/run-shape-fuzzer-tests.py + EXEEXT="$(EXEEXT)" srcdir="$(srcdir)" builddir="$(builddir)" LIBTOOL="$(LIBTOOL)" $(srcdir)/run-subset-fuzzer-tests.py check-valgrind: $(AM_V_at)RUN_VALGRIND=1 $(MAKE) $(AM_MAKEFLGS) check diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-harfbuzz_fuzzer-5702671124791296 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-harfbuzz_fuzzer-5702671124791296 new file mode 100644 index 000000000..9ecc7f16b Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-harfbuzz_fuzzer-5702671124791296 differ diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5676773460672512 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5676773460672512 new file mode 100644 index 000000000..4fc920bf5 Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5676773460672512 differ diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5716947896893440 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5716947896893440 new file mode 100644 index 000000000..639132038 Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5716947896893440 differ diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5923632099885056 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5923632099885056 new file mode 100644 index 000000000..0a3c6df0e Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5923632099885056 differ diff --git a/test/fuzzing/run-shape-fuzzer-tests.py b/test/fuzzing/run-shape-fuzzer-tests.py index e3d180f2b..ba480dd52 100755 --- a/test/fuzzing/run-shape-fuzzer-tests.py +++ b/test/fuzzing/run-shape-fuzzer-tests.py @@ -67,33 +67,36 @@ please provide it as the first argument to the tool""") print ('hb_shape_fuzzer:', hb_shape_fuzzer) fails = 0 +libtool = os.environ.get('LIBTOOL') valgrind = None if os.environ.get('RUN_VALGRIND', ''): valgrind = which ('valgrind') + if valgrind is None: + print ("""Valgrind requested but not found.""") + sys.exit (1) + if libtool is None: + print ("""Valgrind support is currently autotools only and needs libtool but not found.""") + parent_path = os.path.join (srcdir, "fonts") for file in os.listdir (parent_path): path = os.path.join(parent_path, file) - text, returncode = cmd ([hb_shape_fuzzer, path]) - if text.strip (): + if valgrind: + text, returncode = cmd (libtool.split(' ') + ['--mode=execute', valgrind + ' --leak-check=full --error-exitcode=1', '--', hb_shape_fuzzer, path]) + else: + text, returncode = cmd ([hb_shape_fuzzer, path]) + if 'error' in text: + returncode = 1 + + if not valgrind and text.strip (): print (text) - failed = False - if returncode != 0 or 'error' in text: + if returncode != 0: print ('failure on %s' % file) - failed = True - - if valgrind: - text, returncode = cmd ([valgrind, '--error-exitcode=1', hb_shape_fuzzer, path]) - if returncode: - print (text) - print ('failure on %s' % file) - failed = True - - if failed: fails = fails + 1 + if fails: print ("%i shape fuzzer related tests failed." % fails) sys.exit (1) diff --git a/test/fuzzing/run-subset-fuzzer-tests.py b/test/fuzzing/run-subset-fuzzer-tests.py index 7392a92ec..3ac22889e 100755 --- a/test/fuzzing/run-subset-fuzzer-tests.py +++ b/test/fuzzing/run-subset-fuzzer-tests.py @@ -2,7 +2,54 @@ from __future__ import print_function, division, absolute_import -import sys, os, subprocess +import sys, os, subprocess, tempfile, threading + + +def which(program): + # https://stackoverflow.com/a/377028 + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, _ = os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + + return None + + +def cmd(command): + # https://stackoverflow.com/a/4408409 + # https://stackoverflow.com/a/10012262 + with tempfile.TemporaryFile() as tempf: + p = subprocess.Popen (command, stderr=tempf) + is_killed = {'value': False} + + def timeout(p, is_killed): + is_killed['value'] = True + p.kill() + timer = threading.Timer (2, timeout, [p, is_killed]) + + try: + timer.start() + p.wait () + tempf.seek (0) + text = tempf.read().decode ("utf-8").strip () + returncode = p.returncode + finally: + timer.cancel() + + if is_killed['value']: + text = 'error: timeout, ' + text + returncode = 1 + + return text, returncode + srcdir = os.environ.get ("srcdir", ".") EXEEXT = os.environ.get ("EXEEXT", "") @@ -20,21 +67,37 @@ please provide it as the first argument to the tool""") print ('hb_subset_fuzzer:', hb_subset_fuzzer) fails = 0 +libtool = os.environ.get('LIBTOOL') +valgrind = None +if os.environ.get('RUN_VALGRIND', ''): + valgrind = which ('valgrind') + if valgrind is None: + print ("""Valgrind requested but not found.""") + sys.exit (1) + if libtool is None: + print ("""Valgrind support is currently autotools only and needs libtool but not found.""") + + def run_dir (parent_path): global fails for file in os.listdir (parent_path): path = os.path.join(parent_path, file) print ("running subset fuzzer against %s" % path) - p = subprocess.Popen ([hb_subset_fuzzer, path]) + if valgrind: + text, returncode = cmd (libtool.split(' ') + ['--mode=execute', valgrind + ' --leak-check=full --show-leak-kinds=all --error-exitcode=1', '--', hb_subset_fuzzer, path]) + else: + text, returncode = cmd ([hb_subset_fuzzer, path]) + if 'error' in text: + returncode = 1 - if p.wait () != 0: + if not valgrind and text.strip (): + print (text) + + if returncode != 0: print ("failed for %s" % path) fails = fails + 1 - if p.wait () != 0: - print ("failed for %s" % path) - fails = fails + 1 run_dir (os.path.join (srcdir, "..", "subset", "data", "fonts")) # TODO running these tests very slow tests. Fix and re-enable diff --git a/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.61,62,63.ttf b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.61,62,63.ttf new file mode 100644 index 000000000..12d92081b Binary files /dev/null and b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.61,63.ttf b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.61,63.ttf new file mode 100644 index 000000000..1af233f48 Binary files /dev/null and b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.61,63.ttf differ diff --git a/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.61.ttf b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.61.ttf new file mode 100644 index 000000000..a699eea0b Binary files /dev/null and b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.61.ttf differ diff --git a/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.62.ttf b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.62.ttf new file mode 100644 index 000000000..52706dc90 Binary files /dev/null and b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.62.ttf differ diff --git a/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.63.ttf b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.63.ttf new file mode 100644 index 000000000..3de7c7734 Binary files /dev/null and b/test/subset/data/expected/basics/Roboto-Regular.abc.name-ids.63.ttf differ diff --git a/test/subset/data/profiles/name-ids.txt b/test/subset/data/profiles/name-ids.txt new file mode 100644 index 000000000..db42c09a4 --- /dev/null +++ b/test/subset/data/profiles/name-ids.txt @@ -0,0 +1 @@ +--name-IDs=0,1,2 diff --git a/test/subset/data/tests/basics.tests b/test/subset/data/tests/basics.tests index 4fc3f4eba..794510d87 100644 --- a/test/subset/data/tests/basics.tests +++ b/test/subset/data/tests/basics.tests @@ -6,6 +6,7 @@ default.txt drop-hints.txt drop-hints-retain-gids.txt retain-gids.txt +name-ids.txt SUBSETS: abc diff --git a/test/subset/run-tests.py b/test/subset/run-tests.py index fb4684cf1..0a1bb1076 100755 --- a/test/subset/run-tests.py +++ b/test/subset/run-tests.py @@ -32,11 +32,11 @@ def which(program): return None -ttx = which ("ttx") +fonttools = which ("fonttools") ots_sanitize = which ("ots-sanitize") -if not ttx: - print("TTX is not present, skipping test.") +if not fonttools: + print("fonttools is not present, skipping test.") sys.exit (77) def cmd(command): @@ -101,8 +101,8 @@ def run_test(test, should_check_ots): return 0 def run_ttx (file): - print ("ttx %s" % file) - return cmd([ttx, "-q", "-o-", file]) + print ("fonttools ttx %s" % file) + return cmd([fonttools, "ttx", "-q", "-o-", file]) def strip_check_sum (ttx_string): return re.sub ('checkSumAdjustment value=["]0x([0-9a-fA-F])+["]', diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 33e584b75..682ca4c34 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -93,6 +93,7 @@ struct subset_consumer_t hb_subset_input_set_drop_hints (input, subset_options.drop_hints); hb_subset_input_set_retain_gids (input, subset_options.retain_gids); hb_subset_input_set_desubroutinize (input, subset_options.desubroutinize); + hb_set_set (hb_subset_input_nameid_set (input), subset_options.name_ids); hb_face_t *face = hb_font_get_face (font); diff --git a/util/options.cc b/util/options.cc index c5a4f0f0b..a9b3fc77e 100644 --- a/util/options.cc +++ b/util/options.cc @@ -971,6 +971,49 @@ format_options_t::serialize_buffer_of_glyphs (hb_buffer_t *buffer, g_string_append_c (gs, '\n'); } +static gboolean +parse_nameids (const char *name G_GNUC_UNUSED, + const char *arg, + gpointer data, + GError **error G_GNUC_UNUSED) +{ + subset_options_t *subset_opts = (subset_options_t *) data; + + hb_set_t *name_ids = hb_set_create (); + char *s = (char *) arg; + char *p; + + while (s && *s) + { + while (*s && strchr ("<+>{},;&#\\xXuUnNiI\n\t\v\f\r ", *s)) + s++; + if (!*s) + break; + + errno = 0; + hb_codepoint_t u = strtoul (s, &p, 10); + if (errno || s == p) + { + hb_set_destroy (name_ids); + g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, + "Failed parsing nameID values at: '%s'", s); + return false; + } + + hb_set_add (name_ids, u); + + s = p; + } + + hb_set_t *prev = subset_opts->name_ids; + subset_opts->name_ids = hb_set_reference (name_ids); + hb_set_destroy (prev); + hb_set_destroy (name_ids); + + return true; +} + + void subset_options_t::add_options (option_parser_t *parser) { @@ -980,6 +1023,7 @@ subset_options_t::add_options (option_parser_t *parser) {"no-hinting", 0, 0, G_OPTION_ARG_NONE, &this->drop_hints, "Whether to drop hints", nullptr}, {"retain-gids", 0, 0, G_OPTION_ARG_NONE, &this->retain_gids, "If set don't renumber glyph ids in the subset.", nullptr}, {"desubroutinize", 0, 0, G_OPTION_ARG_NONE, &this->desubroutinize, "Remove CFF/CFF2 use of subroutines", nullptr}, + {"name-IDs", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_nameids, "Subset specified nameids", "list of int numbers"}, {nullptr} }; @@ -989,3 +1033,4 @@ subset_options_t::add_options (option_parser_t *parser) "Options subsetting", this); } + diff --git a/util/options.hh b/util/options.hh index 84139f55c..2691e2269 100644 --- a/util/options.hh +++ b/util/options.hh @@ -677,16 +677,24 @@ struct subset_options_t : option_group_t drop_hints = false; retain_gids = false; desubroutinize = false; + name_ids = hb_set_create (); add_options (parser); } + virtual ~subset_options_t () + { + hb_set_destroy (name_ids); + } + + void add_options (option_parser_t *parser); hb_bool_t keep_layout; hb_bool_t drop_hints; hb_bool_t retain_gids; hb_bool_t desubroutinize; + hb_set_t *name_ids; }; /* fallback implementation for scalbn()/scalbnf() for pre-2013 MSVC */