diff --git a/.circleci/config.yml b/.circleci/config.yml index d7efa7eae..31c686a0e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,49 +10,44 @@ executors: jobs: - macos-10_12_6-aat-fonts: - macos: - xcode: "9.0.1" - steps: - - checkout - - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config ragel freetype glib cairo python3 ninja - - run: pip3 install meson --upgrade - - run: meson build - - run: meson compile -Cbuild # or ninja -Cbuild - - run: meson test -Cbuild --print-errorlogs - macos-10_13_6-aat-fonts: macos: xcode: "10.1.0" steps: - checkout - - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config ragel freetype glib cairo python3 ninja + - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config freetype glib cairo python3 ninja - run: pip3 install meson --upgrade - run: meson build - run: meson compile -Cbuild - run: meson test -Cbuild --print-errorlogs + - store_artifacts: + path: build/meson-logs/ macos-10_14_4-aat-fonts: macos: xcode: "11.1.0" steps: - checkout - - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config ragel freetype glib cairo python3 icu4c graphite2 ninja + - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config freetype glib cairo python3 icu4c graphite2 ninja - run: pip3 install meson --upgrade - run: PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig" meson build -Dcoretext=enabled - run: meson compile -Cbuild - run: meson test -Cbuild --print-errorlogs + - store_artifacts: + path: build/meson-logs/ macos-10_15_3-aat-fonts: macos: xcode: "11.4.0" steps: - checkout - - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config ragel freetype glib cairo python3 icu4c graphite2 gobject-introspection gtk-doc ninja + - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config freetype glib cairo python3 icu4c graphite2 gobject-introspection gtk-doc ninja - run: pip3 install meson --upgrade - run: PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig" meson build -Dcoretext=enabled -Dgraphite=enabled -Dauto_features=enabled - run: meson compile -Cbuild - run: meson test -Cbuild --print-errorlogs + - store_artifacts: + path: build/meson-logs/ # will be dropped with autotools removal distcheck: @@ -86,18 +81,18 @@ jobs: - image: fedora steps: - checkout - - run: dnf install -y pkg-config ragel valgrind gcc gcc-c++ meson git glib2-devel freetype-devel cairo-devel libicu-devel gobject-introspection-devel graphite2-devel redhat-rpm-config python python-pip || true + - run: dnf install -y pkg-config valgrind gcc gcc-c++ meson git glib2-devel freetype-devel cairo-devel libicu-devel gobject-introspection-devel graphite2-devel redhat-rpm-config python python-pip || true - run: meson build --buildtype=debugoptimized - run: ninja -Cbuild -j9 # TOOD: increase timeouts and remove --no-suite=slow - - run: RUN_VALGRIND=1 HB_TEST_SHAPE_FUZZER_TIMEOUT=5 meson test -Cbuild --no-suite=slow --wrap='valgrind --leak-check=full --error-exitcode=1' --print-errorlogs + - run: RUN_VALGRIND=1 meson test -Cbuild --no-suite=slow --wrap='valgrind --leak-check=full --error-exitcode=1' --print-errorlogs alpine: docker: - image: alpine steps: - checkout - - run: apk update && apk add ragel gcc g++ glib-dev freetype-dev cairo-dev git py3-pip ninja + - run: apk update && apk add gcc g++ glib-dev freetype-dev cairo-dev git py3-pip ninja - run: pip3 install meson==0.47.0 - run: meson build --buildtype=minsize - run: ninja -Cbuild -j9 @@ -108,7 +103,7 @@ jobs: - image: archlinux/base steps: - checkout - - run: pacman --noconfirm -Syu freetype2 meson git clang cairo icu gettext gobject-introspection gcc gcc-libs glib2 graphite pkg-config ragel python python-pip base-devel gtk-doc + - run: pacman --noconfirm -Syu freetype2 meson git clang cairo icu gettext gobject-introspection gcc gcc-libs glib2 graphite pkg-config python python-pip base-devel gtk-doc - run: pip install flake8 fonttools - run: pip install git+https://github.com/mesonbuild/meson - run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics @@ -147,7 +142,7 @@ jobs: executor: win32-executor steps: - checkout - - run: sudo apt update && DEBIAN_FRONTEND=noninteractive sudo apt install -y ninja-build binutils meson gcc g++ pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python3 python3-pip git g++-mingw-w64-i686 zip + - run: sudo apt update && DEBIAN_FRONTEND=noninteractive sudo apt install -y ninja-build binutils meson gcc g++ pkg-config gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python3 python3-pip git g++-mingw-w64-i686 zip - run: .ci/build-win32.sh - store_artifacts: path: harfbuzz-win32.zip @@ -170,7 +165,6 @@ workflows: build: jobs: - - macos-10_12_6-aat-fonts - macos-10_13_6-aat-fonts - macos-10_14_4-aat-fonts - macos-10_15_3-aat-fonts diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e0bc9fcd..764a41f2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,7 +233,7 @@ endif () if (HB_HAVE_ICU) add_definitions(-DHAVE_ICU) - # https://github.com/WebKit/webkit/blob/master/Source/cmake/FindICU.cmake + # https://github.com/WebKit/webkit/blob/fdd7733f2f30eab7fe096a9791f98c60f62f49c0/Source/cmake/FindICU.cmake find_package(PkgConfig) pkg_check_modules(PC_ICU QUIET icu-uc) diff --git a/configure.ac b/configure.ac index a3c8a61a0..c8e6d47eb 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ AM_PROG_CC_C_O AC_PROG_CXX AX_CXX_COMPILE_STDCXX(11) AC_SYS_LARGEFILE -PKG_PROG_PKG_CONFIG([0.20]) +PKG_PROG_PKG_CONFIG([0.28]) AM_MISSING_PROG([RAGEL], [ragel]) AM_MISSING_PROG([GIT], [git]) diff --git a/docs/harfbuzz-docs.xml b/docs/harfbuzz-docs.xml index 96965f422..ea4c8aeed 100644 --- a/docs/harfbuzz-docs.xml +++ b/docs/harfbuzz-docs.xml @@ -11,8 +11,7 @@ HarfBuzz - HarfBuzz is an OpenType - text shaping engine. Using the HarfBuzz library allows + HarfBuzz is a text shaping library. Using the HarfBuzz library allows programs to convert a sequence of Unicode input into properly formatted and positioned glyph output—for any writing system and language. diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index fe9b89c05..ef1b88da1 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -80,6 +80,7 @@ hb_buffer_set_user_data hb_buffer_get_user_data hb_buffer_get_glyph_infos hb_buffer_get_glyph_positions +hb_buffer_has_positions hb_buffer_get_invisible_glyph hb_buffer_set_invisible_glyph hb_buffer_set_replacement_codepoint diff --git a/docs/usermanual-buffers-language-script-and-direction.xml b/docs/usermanual-buffers-language-script-and-direction.xml index d98c79b7f..0235d2d39 100644 --- a/docs/usermanual-buffers-language-script-and-direction.xml +++ b/docs/usermanual-buffers-language-script-and-direction.xml @@ -136,10 +136,12 @@ determine which glyph to return. - The safest approach is to add all of the text available, then - use item_offset and + The safest approach is to add all of the text available (even + if your text contains a mix of scripts, directions, languages + and fonts), then use item_offset and item_length to indicate which characters you - want shaped, so that HarfBuzz has access to any context. + want shaped (which must all have the same script, direction, + language and font), so that HarfBuzz has access to any context. You can also add Unicode code points directly with diff --git a/docs/usermanual-install-harfbuzz.xml b/docs/usermanual-install-harfbuzz.xml index eab399733..ada6f74ce 100644 --- a/docs/usermanual-install-harfbuzz.xml +++ b/docs/usermanual-install-harfbuzz.xml @@ -50,13 +50,9 @@ For example, on an Ubuntu or Debian system, you would run: - - sudo apt install gcc g++ libfreetype6-dev libglib2.0-dev libcairo2-dev - + sudo apt install gcc g++ libfreetype6-dev libglib2.0-dev libcairo2-dev On Fedora, RHEL, CentOS, or other Red-Hat–based systems, you would run: - - sudo yum install gcc gcc-c++ freetype-devel glib2-devel cairo-devel - + sudo yum install gcc gcc-c++ freetype-devel glib2-devel cairo-devel @@ -89,13 +85,9 @@ On Ubuntu or Debian, run: - - sudo apt-get install meson pkg-config gtk-doc-tools - + sudo apt-get install meson pkg-config gtk-doc-tools On Fedora, RHEL, CentOS, run: - - sudo yum install meson pkgconfig gtk-doc - + sudo yum install meson pkgconfig gtk-doc @@ -110,8 +102,11 @@ Building on Windows - Install meson and use it like `meson build --wrap-mode=default` - or use vcpkg. + Install meson + and run (from the console) meson build (by default + bundled dependencies are not built, --wrap-mode=default + overrides this), then meson compile -C build to + build HarfBuzz. @@ -128,15 +123,11 @@ (1) You must first install the development packages for FreeType, Cairo, and GLib. If you are using MacPorts, you should run: - - sudo port install freetype glib2 cairo - + sudo port install freetype glib2 cairo If you are using Homebrew, you should run: - - brew install freetype glib cairo - + brew install freetype glib cairo (2) The next step depends on whether you are building from the @@ -147,13 +138,9 @@ (2)(a) If you are installing HarfBuzz from a downloaded tarball release, extract the tarball and open a Terminal in the extracted source-code directory. Run: - - meson build - + meson build followed by: - - meson compile -C build - + meson compile -C build to build HarfBuzz. @@ -164,30 +151,20 @@ If you are using MacPorts, you should run: - - sudo port install meson pkgconfig gtk-doc - + sudo port install meson pkgconfig gtk-doc to install the build dependencies. If you are using Homebrew, you should run: - - brew install meson pkgconfig gtk-doc - + brew install meson pkgconfig gtk-doc Finally, you can run: - - meson build - + meson build (3) You can now build HarfBuzz (on either a MacPorts or a Homebrew system) by running: - - meson build - + meson build followed by: - - meson compile -C build - + meson compile -C build This should leave you with a shared diff --git a/src/gen-tag-table.py b/src/gen-tag-table.py index 9b5e6261e..7ea6c0eb4 100755 --- a/src/gen-tag-table.py +++ b/src/gen-tag-table.py @@ -468,11 +468,8 @@ class OpenTypeRegistryParser (HTMLParser): if ot_macrolanguages: for ot_macrolanguage in ot_macrolanguages: for language in languages: - # Remove the following condition if e.g. nn should map to NYN,NOR - # instead of just NYN. - if language not in original_ot_from_bcp_47: - self.add_language (language, ot_macrolanguage) - self.ranks[ot_macrolanguage] += 1 + self.add_language (language, ot_macrolanguage) + self.ranks[ot_macrolanguage] += 1 else: for language in languages: if language in original_ot_from_bcp_47: @@ -591,7 +588,9 @@ class BCP47Parser (object): elif not has_preferred_value and line.startswith ('Macrolanguage: '): self._add_macrolanguage (line.split (' ')[1], subtag) elif subtag_type == 'variant': - if line.startswith ('Prefix: '): + if line.startswith ('Deprecated: '): + self.scopes[subtag] = ' (retired code)' + self.scopes.get (subtag, '') + elif line.startswith ('Prefix: '): self.prefixes[subtag].add (line.split (' ')[1]) elif line.startswith ('File-Date: '): self.header = line @@ -622,6 +621,17 @@ class BCP47Parser (object): for macrolanguage in macrolanguages: self._add_macrolanguage (biggest_macrolanguage, macrolanguage) + def _get_name_piece (self, subtag): + """Return the first name of a subtag plus its scope suffix. + + Args: + subtag (str): A BCP 47 subtag. + + Returns: + The name form of ``subtag``. + """ + return self.names[subtag].split ('\n')[0] + self.scopes.get (subtag, '') + def get_name (self, lt): """Return the names of the subtags in a language tag. @@ -631,13 +641,13 @@ class BCP47Parser (object): Returns: The name form of ``lt``. """ - name = self.names[lt.language].split ('\n')[0] + name = self._get_name_piece (lt.language) if lt.script: - name += '; ' + self.names[lt.script.title ()].split ('\n')[0] + name += '; ' + self._get_name_piece (lt.script.title ()) if lt.region: - name += '; ' + self.names[lt.region.upper ()].split ('\n')[0] + name += '; ' + self._get_name_piece (lt.region.upper ()) if lt.variant: - name += '; ' + self.names[lt.variant].split ('\n')[0] + name += '; ' + self._get_name_piece (lt.variant) return name bcp_47 = BCP47Parser () @@ -673,6 +683,8 @@ ot.add_language ('und-fonnapa', 'APPH') ot.remove_language_ot ('IRT') ot.add_language ('ga-Latg', 'IRT') +ot.add_language ('hy-arevmda', 'HYE') + ot.remove_language_ot ('KGE') ot.add_language ('und-Geok', 'KGE') @@ -796,6 +808,7 @@ disambiguation = { 'ECR': 'crj', 'HAL': 'cfm', 'HND': 'hnd', + 'HYE': 'hyw', 'KIS': 'kqs', 'KUI': 'uki', 'LRC': 'bqi', @@ -982,22 +995,24 @@ for initial, items in sorted (complex_tags.items ()): print (" case '%s':" % initial) for lt, tags in items: print (' if (', end='') + script = lt.script + region = lt.region if lt.grandfathered: print ('0 == strcmp (&lang_str[1], "%s")' % lt.language[1:], end='') else: string_literal = lt.language[1:] + '-' - if lt.script: - string_literal += lt.script - lt.script = None - if lt.region: - string_literal += '-' + lt.region - lt.region = None + if script: + string_literal += script + script = None + if region: + string_literal += '-' + region + region = None if string_literal[-1] == '-': print ('0 == strncmp (&lang_str[1], "%s", %i)' % (string_literal, len (string_literal)), end='') else: print ('lang_matches (&lang_str[1], "%s")' % string_literal, end='') - print_subtag_matches (lt.script, True) - print_subtag_matches (lt.region, True) + print_subtag_matches (script, True) + print_subtag_matches (region, True) print_subtag_matches (lt.variant, True) print (')') print (' {') @@ -1087,8 +1102,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] - 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]: + different_bcp_47_tags = sorted (t for t in bcp_47_tags if not same_tag (t, ot.from_bcp_47.get (t))) + if different_bcp_47_tags and disambiguation[ot_tag] == different_bcp_47_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 0e2d57b3e..608ae2a3f 100755 --- a/src/gen-use-table.py +++ b/src/gen-use-table.py @@ -9,8 +9,8 @@ Input files: * https://unicode.org/Public/UCD/latest/ucd/UnicodeData.txt * https://unicode.org/Public/UCD/latest/ucd/ArabicShaping.txt * https://unicode.org/Public/UCD/latest/ucd/Blocks.txt -* ms-use/IndicPositionalCategory-Additional.txt * ms-use/IndicSyllabicCategory-Additional.txt +* ms-use/IndicPositionalCategory-Additional.txt """ import sys @@ -241,14 +241,13 @@ def is_BASE(U, UISC, UGC, AJT): return (UISC in [Number, Consonant, Consonant_Head_Letter, Tone_Letter, Vowel_Independent, - ] or + ] and + # TODO: https://github.com/microsoft/font-tools/issues/12 + UGC != Cn or # TODO: https://github.com/MicrosoftDocs/typography-issues/issues/484 - AJT in [jt_C, jt_D, jt_L, jt_R] and not is_ZWJ(U, UISC, UGC, AJT) or + AJT in [jt_C, jt_D, jt_L, jt_R] and UISC != Joiner or (UGC == Lo and UISC in [Avagraha, Bindu, Consonant_Final, Consonant_Medial, Consonant_Subjoined, Vowel, Vowel_Dependent])) -def is_BASE_IND(U, UISC, UGC, AJT): - return (UISC in [Consonant_Dead, Modifying_Letter] or - (UGC == Po and not U in [0x0F04, 0x0F05, 0x0F06, 0x104B, 0x104E, 0x1800, 0x1807, 0x180A, 0x1B5B, 0x1B5C, 0x1B5F, 0x2022, 0x111C8, 0x11A3F, 0x11A45, 0x11C44, 0x11C45])) def is_BASE_NUM(U, UISC, UGC, AJT): return UISC == Brahmi_Joining_Number def is_BASE_OTHER(U, UISC, UGC, AJT): @@ -290,19 +289,13 @@ def is_HIEROGLYPH_SEGMENT_END(U, UISC, UGC, AJT): return UISC == Hieroglyph_Segment_End def is_ZWNJ(U, UISC, UGC, AJT): return UISC == Non_Joiner -def is_ZWJ(U, UISC, UGC, AJT): - return UISC == Joiner -def is_Word_Joiner(U, UISC, UGC, AJT): - return U == 0x2060 def is_OTHER(U, UISC, UGC, AJT): - return (UISC == Other + return ((UGC in [Cn, Po] or UISC in [Consonant_Dead, Joiner, Modifying_Letter, Other]) and not is_BASE(U, UISC, UGC, AJT) + and not is_BASE_OTHER(U, UISC, UGC, AJT) and not is_SYM(U, UISC, UGC, AJT) and not is_SYM_MOD(U, UISC, UGC, AJT) - and not is_Word_Joiner(U, UISC, UGC, AJT) ) -def is_Reserved(U, UISC, UGC, AJT): - return UGC == 'Cn' def is_REPHA(U, UISC, UGC, AJT): return UISC in [Consonant_Preceding_Repha, Consonant_Prefixed] def is_SAKOT(U, UISC, UGC, AJT): @@ -321,10 +314,9 @@ def is_VOWEL_MOD(U, UISC, UGC, AJT): return (UISC in [Tone_Mark, Cantillation_Mark, Register_Shifter, Visarga] or (UGC != Lo and (UISC == Bindu or U in [0xAA29]))) -# CGJ and VS are handled in find_syllables +# CGJ, VS, WJ, and ZWJ are handled in find_syllables use_mapping = { 'B': is_BASE, - 'IND': is_BASE_IND, 'N': is_BASE_NUM, 'GB': is_BASE_OTHER, 'F': is_CONS_FINAL, @@ -341,10 +333,7 @@ use_mapping = { 'SB': is_HIEROGLYPH_SEGMENT_BEGIN, 'SE': is_HIEROGLYPH_SEGMENT_END, 'ZWNJ': is_ZWNJ, - 'ZWJ': is_ZWJ, - 'WJ': is_Word_Joiner, 'O': is_OTHER, - 'Rsv': is_Reserved, 'R': is_REPHA, 'S': is_SYM, 'Sk': is_SAKOT, @@ -402,11 +391,6 @@ def map_to_use(data): items = use_mapping.items() for U,(UISC,UIPC,UGC,AJT,UBlock) in data.items(): - if UGC == Cn: continue - - # TODO: These variation selectors are overridden to IND, but we want to ignore them - if U in range (0xFE00, 0xFE0F + 1): continue - # Resolve Indic_Syllabic_Category # TODO: These don't have UISC assigned in Unicode 13.0.0, but have UIPC @@ -533,6 +517,8 @@ print ("static const USE_TABLE_ELEMENT_TYPE use_table[] = {") for u in uu: if u <= last: continue + if data[u][0] == 'O': + continue block = data[u][1] start = u//8*8 diff --git a/src/hb-buffer-deserialize-json.hh b/src/hb-buffer-deserialize-json.hh index 1f9e2e91d..01db29549 100644 --- a/src/hb-buffer-deserialize-json.hh +++ b/src/hb-buffer-deserialize-json.hh @@ -1,30 +1,29 @@ - #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,612 +31,577 @@ #include "hb.hh" -#line 36 "hb-buffer-deserialize-json.hh" +#line 35 "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, 10u, 15u, + 16u, 17u, 2u, 2u, 0u, 7u, 0u, 6u, + 5u, 6u, 0u, 19u, 0u, 19u, 0u, 19u, + 2u, 2u, 0u, 7u, 0u, 6u, 5u, 6u, + 0u, 19u, 0u, 19u, 14u, 14u, 2u, 2u, + 0u, 7u, 0u, 6u, 0u, 19u, 0u, 19u, + 16u, 17u, 2u, 2u, 0u, 7u, 0u, 6u, + 5u, 6u, 0u, 19u, 0u, 19u, 2u, 2u, + 0u, 7u, 0u, 6u, 5u, 6u, 0u, 19u, + 0u, 19u, 2u, 2u, 0u, 7u, 0u, 6u, + 2u, 8u, 0u, 19u, 2u, 8u, 0u, 19u, + 0u, 19u, 2u, 2u, 0u, 7u, 0u, 6u, + 0u, 19u, 0u, 9u, 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 signed 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, 1, 1, 5, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 7, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 8, 9, 1, 1, 1, + 10, 1, 11, 12, 1, 1, 13, 1, + 1, 1, 1, 14, 1, 1, 1, 1, + 1, 1, 1, 1, 15, 1, 1, 16, + 17, 1, 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, 28, 30, 31, 39, + 46, 48, 68, 88, 108, 109, 117, 124, + 126, 146, 166, 167, 168, 176, 183, 203, + 223, 225, 226, 234, 241, 243, 263, 283, + 284, 292, 299, 301, 321, 341, 342, 350, + 357, 364, 384, 391, 411, 431, 432, 440, + 447, 467, 477, 496, 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 +static const signed char _deserialize_json_indicies[] = { + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 3, 0, 4, 5, 6, + 7, 8, 0, 9, 10, 11, 12, 12, + 0, 0, 0, 0, 0, 0, 13, 13, + 0, 0, 0, 14, 15, 16, 18, 19, + 20, 0, 0, 21, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 22, 23, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 24, + 20, 0, 0, 21, 0, 19, 19, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 22, 25, 25, 0, 0, + 0, 0, 0, 0, 26, 26, 0, 0, + 0, 27, 28, 29, 31, 32, 33, 0, + 0, 34, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 35, 33, 0, 0, 34, 0, 32, + 32, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 35, 36, 37, + 37, 0, 0, 0, 0, 0, 0, 38, + 38, 0, 0, 0, 0, 39, 40, 42, + 0, 0, 43, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 44, 42, 0, 0, 43, 0, + 45, 45, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 44, 46, + 47, 48, 48, 0, 0, 0, 0, 0, + 0, 49, 49, 0, 0, 0, 50, 51, + 52, 54, 55, 56, 0, 0, 57, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 58, 56, + 0, 0, 57, 0, 55, 55, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 58, 59, 59, 0, 0, 0, + 0, 0, 0, 60, 60, 0, 0, 0, + 61, 62, 63, 65, 66, 67, 0, 0, + 68, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 69, 67, 0, 0, 68, 0, 66, 66, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 69, 70, 70, 0, + 0, 0, 0, 0, 0, 71, 71, 0, + 72, 0, 0, 73, 74, 76, 75, 75, + 75, 75, 75, 77, 79, 0, 0, 80, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 81, + 75, 0, 0, 0, 0, 0, 75, 83, + 0, 0, 84, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 85, 83, 0, 0, 84, 0, + 87, 87, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 85, 88, + 88, 0, 0, 0, 0, 0, 0, 89, + 89, 0, 0, 0, 0, 90, 91, 83, + 0, 0, 84, 0, 93, 93, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 85, 94, 0, 0, 95, 0, + 0, 0, 0, 0, 96, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 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 signed char _deserialize_json_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, 0, 0, 0, 0, 0, 0, + 75, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 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 signed char _deserialize_json_cond_targs[] = { + 0, 1, 2, 2, 3, 4, 18, 24, + 37, 45, 5, 12, 6, 7, 8, 9, + 11, 8, 9, 11, 10, 2, 49, 10, + 49, 13, 14, 15, 16, 17, 15, 16, + 17, 10, 2, 49, 19, 20, 21, 22, + 23, 22, 10, 2, 49, 23, 25, 31, + 26, 27, 28, 29, 30, 28, 29, 30, + 10, 2, 49, 32, 33, 34, 35, 36, + 34, 35, 36, 10, 2, 49, 38, 39, + 40, 43, 44, 40, 41, 42, 41, 10, + 2, 49, 43, 10, 2, 49, 44, 44, + 46, 47, 43, 48, 48, 48, 49, 50, + 51, 0 +}; + +static const signed char _deserialize_json_cond_actions[] = { + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2, 2, + 2, 0, 0, 0, 3, 3, 4, 0, + 5, 0, 0, 2, 2, 2, 0, 0, + 0, 6, 6, 7, 0, 0, 0, 2, + 2, 0, 8, 8, 9, 0, 0, 0, + 0, 0, 2, 2, 2, 0, 0, 0, + 10, 10, 11, 0, 0, 2, 2, 2, + 0, 0, 0, 12, 12, 13, 0, 0, + 2, 14, 14, 0, 15, 0, 0, 16, + 16, 17, 0, 18, 18, 19, 0, 15, + 0, 0, 20, 20, 0, 21, 0, 0, + 0, 0 }; static const int deserialize_json_start = 1; -static const int deserialize_json_first_final = 44; +static const int deserialize_json_first_final = 49; static const int deserialize_json_error = 0; static const int deserialize_json_en_main = 1; -#line 97 "hb-buffer-deserialize-json.rl" +#line 108 "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) +_hb_buffer_deserialize_json (hb_buffer_t *buffer, +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" - { - cs = deserialize_json_start; + 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; } - -#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}; + +#line 223 "hb-buffer-deserialize-json.hh" { - 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: + cs = (int)deserialize_json_start; + } + +#line 228 "hb-buffer-deserialize-json.hh" + { + unsigned int _trans = 0; + const unsigned char * _keys; + const signed char * _inds; + int _ic; + _resume: {} + if ( p == pe ) + goto _out; + _keys = ( _deserialize_json_trans_keys + ((cs<<1))); + _inds = ( _deserialize_json_indicies + (_deserialize_json_index_offsets[cs])); + + if ( ( (*( p))) <= 125 && ( (*( p))) >= 9 ) { + _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]; + } + + cs = (int)_deserialize_json_cond_targs[_trans]; + + if ( _deserialize_json_cond_actions[_trans] != 0 ) { + + 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: + + memset (&info, 0, sizeof (info)); + memset (&pos , 0, sizeof (pos )); + } + +#line 264 "hb-buffer-deserialize-json.hh" + + + 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: + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + +#line 280 "hb-buffer-deserialize-json.hh" + + + break; + } + case 2: { + { #line 51 "hb-buffer-deserialize-json.rl" - { - tok = p; -} - break; - case 14: + + tok = p; + } + +#line 292 "hb-buffer-deserialize-json.hh" + + + break; + } + case 15: { + { #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: + if (unlikely (!buffer->ensure_glyphs ())) return false; } + +#line 302 "hb-buffer-deserialize-json.hh" + + + break; + } + case 21: { + { +#line 56 "hb-buffer-deserialize-json.rl" + if (unlikely (!buffer->ensure_unicode ())) return false; } + +#line 312 "hb-buffer-deserialize-json.hh" + + + break; + } + case 16: { + { +#line 58 "hb-buffer-deserialize-json.rl" + + /* TODO Unescape \" and \\ if found. */ + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + +#line 328 "hb-buffer-deserialize-json.hh" + + + break; + } + case 18: { + { #line 66 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.x_advance)) return false; } - break; - case 6: + if (!parse_uint (tok, p, &info.codepoint)) return false; } + +#line 338 "hb-buffer-deserialize-json.hh" + + + break; + } + case 8: { + { #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; } + if (!parse_uint (tok, p, &info.cluster )) return false; } + +#line 348 "hb-buffer-deserialize-json.hh" + + + break; + } + case 10: { + { +#line 68 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.x_offset )) return false; } + +#line 358 "hb-buffer-deserialize-json.hh" + + + break; + } + case 12: { + { +#line 69 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.y_offset )) return false; } + +#line 368 "hb-buffer-deserialize-json.hh" + + + break; + } + case 3: { + { +#line 70 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.x_advance)) return false; } + +#line 378 "hb-buffer-deserialize-json.hh" + + + break; + } + case 6: { + { +#line 71 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.y_advance)) return false; } + +#line 388 "hb-buffer-deserialize-json.hh" + + + break; + } + case 14: { + { +#line 51 "hb-buffer-deserialize-json.rl" + + tok = p; + } + +#line 400 "hb-buffer-deserialize-json.hh" + + { +#line 55 "hb-buffer-deserialize-json.rl" + if (unlikely (!buffer->ensure_glyphs ())) return false; } + +#line 406 "hb-buffer-deserialize-json.hh" + + + break; + } + case 20: { + { +#line 51 "hb-buffer-deserialize-json.rl" + + tok = p; + } + +#line 418 "hb-buffer-deserialize-json.hh" + + { +#line 56 "hb-buffer-deserialize-json.rl" + if (unlikely (!buffer->ensure_unicode ())) return false; } + +#line 424 "hb-buffer-deserialize-json.hh" + + + break; + } + case 17: { + { +#line 58 "hb-buffer-deserialize-json.rl" + + /* TODO Unescape \" and \\ if found. */ + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + +#line 440 "hb-buffer-deserialize-json.hh" + + { #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: + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + +#line 452 "hb-buffer-deserialize-json.hh" + + + break; + } + case 19: { + { #line 66 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.x_advance)) return false; } + if (!parse_uint (tok, p, &info.codepoint)) return false; } + +#line 462 "hb-buffer-deserialize-json.hh" + + { #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: + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + +#line 474 "hb-buffer-deserialize-json.hh" + + + break; + } + case 9: { + { #line 67 "hb-buffer-deserialize-json.rl" - { if (!parse_int (tok, p, &pos.y_advance)) return false; } + if (!parse_uint (tok, p, &info.cluster )) return false; } + +#line 484 "hb-buffer-deserialize-json.hh" + + { #line 43 "hb-buffer-deserialize-json.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + +#line 496 "hb-buffer-deserialize-json.hh" + + + break; + } + case 11: { + { +#line 68 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.x_offset )) return false; } + +#line 506 "hb-buffer-deserialize-json.hh" + + { +#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; + } + +#line 518 "hb-buffer-deserialize-json.hh" + + + break; + } + case 13: { + { +#line 69 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.y_offset )) return false; } + +#line 528 "hb-buffer-deserialize-json.hh" + + { +#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; + } + +#line 540 "hb-buffer-deserialize-json.hh" + + + break; + } + case 4: { + { +#line 70 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.x_advance)) return false; } + +#line 550 "hb-buffer-deserialize-json.hh" + + { +#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; + } + +#line 562 "hb-buffer-deserialize-json.hh" + + + break; + } + case 7: { + { +#line 71 "hb-buffer-deserialize-json.rl" + if (!parse_int (tok, p, &pos.y_advance)) return false; } + +#line 572 "hb-buffer-deserialize-json.hh" + + { +#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; + } + +#line 584 "hb-buffer-deserialize-json.hh" + + + break; + } + } + + } + + if ( cs != 0 ) { + p += 1; + goto _resume; + } + _out: {} + } + +#line 136 "hb-buffer-deserialize-json.rl" + + *end_ptr = p; -} - break; -#line 624 "hb-buffer-deserialize-json.hh" - } - -_again: - if ( cs == 0 ) - goto _out; - if ( ++p != pe ) - goto _resume; - _test_eof: {} - _out: {} - } - -#line 125 "hb-buffer-deserialize-json.rl" - - - *end_ptr = p; - - return p == pe && *(p-1) != ']'; + + return p == pe && *(p-1) != ']'; } #endif /* HB_BUFFER_DESERIALIZE_JSON_HH */ diff --git a/src/hb-buffer-deserialize-json.rl b/src/hb-buffer-deserialize-json.rl index f3abb027b..382423f6c 100644 --- a/src/hb-buffer-deserialize-json.rl +++ b/src/hb-buffer-deserialize-json.rl @@ -52,14 +52,18 @@ action tok { tok = p; } -action parse_glyph { +action ensure_glyphs { if (unlikely (!buffer->ensure_glyphs ())) return false; } +action ensure_unicode { if (unlikely (!buffer->ensure_unicode ())) return false; } + +action parse_glyph_name { + /* TODO Unescape \" and \\ if found. */ if (!hb_font_glyph_from_string (font, tok, p - tok, &info.codepoint)) return false; } -action parse_gid { if (!parse_uint (tok, p, &info.codepoint)) return false; } +action parse_codepoint { if (!parse_uint (tok, p, &info.codepoint)) return false; } action parse_cluster { if (!parse_uint (tok, p, &info.cluster )) return false; } action parse_x_offset { if (!parse_int (tok, p, &pos.x_offset )) return false; } action parse_y_offset { if (!parse_int (tok, p, &pos.y_offset )) return false; } @@ -72,20 +76,27 @@ num = '-'? unum; comma = space* ',' space*; colon = space* ':' space*; -glyph_id = unum; -glyph_name = alpha (alnum|'_'|'.'|'-')*; +codepoint = unum; +glyph_name = '"' ([^\\"] | '\\' [\\"])* '"'; -glyph_string = '"' (glyph_name >tok %parse_glyph) '"'; -glyph_number = (glyph_id >tok %parse_gid); +parse_glyph_name = (glyph_name >tok %parse_glyph_name); +parse_codepoint = (codepoint >tok %parse_codepoint); -glyph = "\"g\"" colon (glyph_string | glyph_number); +glyph = "\"g\"" colon (parse_glyph_name | parse_codepoint); +unicode = "\"u\"" colon parse_codepoint; cluster = "\"cl\"" colon (unum >tok %parse_cluster); xoffset = "\"dx\"" colon (num >tok %parse_x_offset); yoffset = "\"dy\"" colon (num >tok %parse_y_offset); xadvance= "\"ax\"" colon (num >tok %parse_x_advance); yadvance= "\"ay\"" colon (num >tok %parse_y_advance); -element = glyph | cluster | xoffset | yoffset | xadvance | yadvance; +element = glyph @ensure_glyphs + | unicode @ensure_unicode + | cluster + | xoffset + | yoffset + | xadvance + | yadvance; item = ( '{' space* element (comma element)* space* '}') >clear_item @@ -97,7 +108,7 @@ main := space* item (comma item)* space* (','|']')?; }%% static hb_bool_t -_hb_buffer_deserialize_glyphs_json (hb_buffer_t *buffer, +_hb_buffer_deserialize_json (hb_buffer_t *buffer, const char *buf, unsigned int buf_len, const char **end_ptr, diff --git a/src/hb-buffer-deserialize-text.hh b/src/hb-buffer-deserialize-text.hh index 67f0a1252..fb36f5601 100644 --- a/src/hb-buffer-deserialize-text.hh +++ b/src/hb-buffer-deserialize-text.hh @@ -1,30 +1,29 @@ - #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,540 +31,734 @@ #include "hb.hh" -#line 36 "hb-buffer-deserialize-text.hh" +#line 35 "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, 13u, 12u, 12u, 2u, 2u, + 5u, 11u, 0u, 12u, 5u, 6u, 4u, 6u, + 5u, 6u, 5u, 6u, 4u, 6u, 5u, 6u, + 3u, 3u, 4u, 6u, 5u, 6u, 3u, 6u, + 2u, 16u, 4u, 6u, 5u, 6u, 0u, 16u, + 0u, 16u, 1u, 0u, 0u, 12u, 0u, 16u, + 0u, 16u, 0u, 16u, 0u, 16u, 0u, 16u, + 0u, 16u, 0u, 16u, 0u, 16u, 0u, 16u, + 0u, 16u, 0u, 16u, 0u, 16u, 0u, 16u, + 0u, 16u, 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 signed 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, 1, 1, 5, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 1, 1, 7, 8, 9, 1, 10, + 11, 11, 11, 11, 11, 11, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 12, 1, 1, 1, + 1, 1, 13, 14, 15, 1, 1, 1, + 11, 11, 11, 11, 11, 11, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 16, 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, 14, 15, 16, 23, 36, 38, + 41, 43, 45, 48, 50, 51, 54, 56, + 60, 75, 78, 80, 97, 114, 114, 127, + 144, 161, 178, 195, 212, 229, 246, 263, + 280, 297, 314, 331, 348, 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 +static const signed char _deserialize_text_indicies[] = { + 1, 0, 0, 0, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 3, 4, 6, + 7, 7, 0, 0, 0, 0, 7, 8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 4, 10, 11, 13, 14, + 15, 17, 18, 20, 21, 23, 24, 25, + 27, 28, 29, 31, 32, 33, 35, 36, + 29, 0, 28, 28, 38, 38, 0, 0, + 0, 0, 38, 0, 38, 0, 0, 0, + 38, 38, 38, 40, 41, 42, 44, 45, + 47, 0, 0, 0, 0, 48, 48, 0, + 49, 50, 0, 48, 0, 0, 0, 0, + 51, 52, 0, 0, 0, 0, 0, 0, + 0, 0, 53, 0, 0, 0, 0, 0, + 0, 54, 8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4, 56, + 0, 0, 0, 0, 0, 0, 0, 0, + 57, 0, 0, 0, 0, 0, 0, 58, + 56, 0, 0, 0, 0, 60, 60, 0, + 0, 57, 0, 0, 0, 0, 0, 0, + 58, 63, 62, 64, 0, 62, 62, 62, + 62, 65, 62, 66, 62, 62, 62, 67, + 68, 69, 71, 38, 72, 0, 38, 38, + 38, 38, 73, 38, 74, 38, 38, 38, + 37, 75, 76, 78, 0, 0, 79, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 80, 81, 82, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 53, 83, 84, 62, 64, + 0, 62, 62, 62, 62, 65, 62, 66, + 62, 62, 62, 67, 68, 69, 86, 0, + 87, 0, 0, 0, 0, 0, 0, 0, + 88, 0, 0, 0, 0, 57, 89, 91, + 0, 92, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 93, 94, + 91, 0, 92, 0, 0, 36, 36, 0, + 0, 0, 0, 0, 0, 0, 0, 93, + 94, 86, 0, 87, 0, 0, 97, 97, + 0, 0, 0, 88, 0, 0, 0, 0, + 57, 89, 99, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 100, 101, 99, 0, 0, 0, 0, + 45, 45, 0, 0, 0, 0, 0, 0, + 0, 0, 100, 101, 78, 0, 0, 79, + 0, 18, 18, 0, 0, 0, 0, 0, + 0, 0, 0, 80, 81, 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 signed char _deserialize_text_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, 62, 38, 0, 0, 62, 0, 0, + 0, 0, 0, 0, 0, 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 signed char _deserialize_text_cond_targs[] = { + 0, 1, 2, 25, 3, 3, 4, 19, + 5, 6, 23, 24, 7, 8, 27, 36, + 8, 27, 36, 9, 30, 33, 10, 11, + 12, 15, 11, 12, 15, 13, 13, 14, + 31, 32, 14, 31, 32, 16, 26, 17, + 18, 34, 35, 18, 34, 35, 19, 20, + 19, 6, 21, 22, 20, 21, 22, 23, + 20, 21, 22, 24, 24, 25, 26, 26, + 7, 9, 10, 16, 21, 29, 26, 26, + 7, 9, 10, 21, 29, 27, 28, 17, + 21, 29, 28, 29, 29, 30, 28, 7, + 10, 29, 31, 28, 7, 21, 29, 32, + 33, 33, 34, 28, 21, 29, 35, 36, + 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 +static const signed char _deserialize_text_cond_actions[] = { + 0, 0, 0, 0, 1, 0, 0, 2, + 0, 0, 2, 2, 0, 3, 4, 4, + 0, 5, 5, 0, 4, 4, 0, 3, + 3, 3, 0, 0, 0, 6, 0, 3, + 4, 4, 0, 5, 5, 0, 5, 0, + 3, 4, 4, 0, 5, 5, 7, 7, + 8, 9, 7, 7, 0, 0, 0, 10, + 10, 10, 10, 10, 8, 11, 12, 13, + 14, 14, 14, 15, 11, 11, 16, 17, + 18, 18, 18, 16, 16, 19, 19, 20, + 19, 19, 0, 0, 13, 10, 10, 21, + 21, 10, 22, 22, 23, 22, 22, 22, + 10, 5, 24, 24, 24, 24, 24, 19, + 0 +}; + +static const signed char _deserialize_text_eof_trans[] = { + 1, 2, 3, 6, 7, 9, 10, 13, + 17, 20, 23, 27, 28, 31, 35, 29, + 38, 40, 44, 47, 53, 54, 55, 56, + 60, 62, 71, 78, 83, 70, 86, 91, + 96, 97, 99, 103, 104, 0 }; static const int deserialize_text_start = 1; -static const int deserialize_text_first_final = 13; +static const int deserialize_text_first_final = 19; static const int deserialize_text_error = 0; static const int deserialize_text_en_main = 1; -#line 91 "hb-buffer-deserialize-text.rl" +#line 114 "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) +_hb_buffer_deserialize_text (hb_buffer_t *buffer, +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++; + + const char *eof = pe, *tok = nullptr; + int cs; + hb_glyph_info_t info = {0}; + hb_glyph_position_t pos = {0}; + +#line 204 "hb-buffer-deserialize-text.hh" { - cs = deserialize_text_start; + cs = (int)deserialize_text_start; } - -#line 348 "hb-buffer-deserialize-text.hh" + +#line 209 "hb-buffer-deserialize-text.hh" { - 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: + unsigned int _trans = 0; + const unsigned char * _keys; + const signed char * _inds; + int _ic; + _resume: {} + if ( p == pe && p != eof ) + goto _out; + if ( p == eof ) { + if ( _deserialize_text_eof_trans[cs] > 0 ) { + _trans = (unsigned int)_deserialize_text_eof_trans[cs] - 1; + } + } + else { + _keys = ( _deserialize_text_trans_keys + ((cs<<1))); + _inds = ( _deserialize_text_indicies + (_deserialize_text_index_offsets[cs])); + + if ( ( (*( p))) <= 124 && ( (*( p))) >= 9 ) { + _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]; + } + + } + cs = (int)_deserialize_text_cond_targs[_trans]; + + if ( _deserialize_text_cond_actions[_trans] != 0 ) { + + switch ( _deserialize_text_cond_actions[_trans] ) { + case 1: { + { #line 38 "hb-buffer-deserialize-text.rl" - { - memset (&info, 0, sizeof (info)); - memset (&pos , 0, sizeof (pos )); -} + + memset (&info, 0, sizeof (info)); + memset (&pos , 0, sizeof (pos )); + } + +#line 252 "hb-buffer-deserialize-text.hh" + + + break; + } + case 3: { + { #line 51 "hb-buffer-deserialize-text.rl" - { - tok = p; -} - break; - case 4: + + tok = p; + } + +#line 264 "hb-buffer-deserialize-text.hh" + + + break; + } + case 5: { + { #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: + if (unlikely (!buffer->ensure_glyphs ())) return false; } + +#line 274 "hb-buffer-deserialize-text.hh" + + + break; + } + case 8: { + { +#line 56 "hb-buffer-deserialize-text.rl" + if (unlikely (!buffer->ensure_unicode ())) return false; } + +#line 284 "hb-buffer-deserialize-text.hh" + + + break; + } + case 18: { + { +#line 58 "hb-buffer-deserialize-text.rl" + + /* TODO Unescape delimeters. */ + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + +#line 300 "hb-buffer-deserialize-text.hh" + + + break; + } + case 9: { + { #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" - } - -_again: - if ( cs == 0 ) - goto _out; - if ( ++p != pe ) - goto _resume; - _test_eof: {} - if ( p == eof ) - { - switch ( _deserialize_text_eof_actions[cs] ) { - case 4: + if (!parse_hex (tok, p, &info.codepoint )) return false; } + +#line 310 "hb-buffer-deserialize-text.hh" + + + break; + } + case 21: { + { +#line 68 "hb-buffer-deserialize-text.rl" + if (!parse_uint (tok, p, &info.cluster )) return false; } + +#line 320 "hb-buffer-deserialize-text.hh" + + + break; + } + case 6: { + { +#line 69 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.x_offset )) return false; } + +#line 330 "hb-buffer-deserialize-text.hh" + + + break; + } + case 23: { + { +#line 70 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.y_offset )) return false; } + +#line 340 "hb-buffer-deserialize-text.hh" + + + break; + } + case 20: { + { +#line 71 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.x_advance)) return false; } + +#line 350 "hb-buffer-deserialize-text.hh" + + + break; + } + case 15: { + { +#line 38 "hb-buffer-deserialize-text.rl" + + memset (&info, 0, sizeof (info)); + memset (&pos , 0, sizeof (pos )); + } + +#line 363 "hb-buffer-deserialize-text.hh" + + { +#line 51 "hb-buffer-deserialize-text.rl" + + tok = p; + } + +#line 371 "hb-buffer-deserialize-text.hh" + + + break; + } + case 4: { + { +#line 51 "hb-buffer-deserialize-text.rl" + + tok = p; + } + +#line 383 "hb-buffer-deserialize-text.hh" + + { #line 55 "hb-buffer-deserialize-text.rl" - { - if (!hb_font_glyph_from_string (font, - tok, p - tok, - &info.codepoint)) - return false; -} + if (unlikely (!buffer->ensure_glyphs ())) return false; } + +#line 389 "hb-buffer-deserialize-text.hh" + + + break; + } + case 2: { + { +#line 51 "hb-buffer-deserialize-text.rl" + + tok = p; + } + +#line 401 "hb-buffer-deserialize-text.hh" + + { +#line 56 "hb-buffer-deserialize-text.rl" + if (unlikely (!buffer->ensure_unicode ())) return false; } + +#line 407 "hb-buffer-deserialize-text.hh" + + + break; + } + case 16: { + { +#line 58 "hb-buffer-deserialize-text.rl" + + /* TODO Unescape delimeters. */ + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + +#line 423 "hb-buffer-deserialize-text.hh" + + { #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: + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + +#line 435 "hb-buffer-deserialize-text.hh" + + + break; + } + case 7: { + { #line 66 "hb-buffer-deserialize-text.rl" - { if (!parse_int (tok, p, &pos.y_advance)) return false; } + if (!parse_hex (tok, p, &info.codepoint )) return false; } + +#line 445 "hb-buffer-deserialize-text.hh" + + { #line 43 "hb-buffer-deserialize-text.rl" - { - buffer->add_info (info); - if (unlikely (!buffer->successful)) - return false; - buffer->pos[buffer->len - 1] = pos; + + buffer->add_info (info); + if (unlikely (!buffer->successful)) + return false; + buffer->pos[buffer->len - 1] = pos; + *end_ptr = p; + } + +#line 457 "hb-buffer-deserialize-text.hh" + + + break; + } + case 10: { + { +#line 68 "hb-buffer-deserialize-text.rl" + if (!parse_uint (tok, p, &info.cluster )) return false; } + +#line 467 "hb-buffer-deserialize-text.hh" + + { +#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; + } + +#line 479 "hb-buffer-deserialize-text.hh" + + + break; + } + case 22: { + { +#line 70 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.y_offset )) return false; } + +#line 489 "hb-buffer-deserialize-text.hh" + + { +#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; + } + +#line 501 "hb-buffer-deserialize-text.hh" + + + break; + } + case 19: { + { +#line 71 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.x_advance)) return false; } + +#line 511 "hb-buffer-deserialize-text.hh" + + { +#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; + } + +#line 523 "hb-buffer-deserialize-text.hh" + + + break; + } + case 24: { + { +#line 72 "hb-buffer-deserialize-text.rl" + if (!parse_int (tok, p, &pos.y_advance)) return false; } + +#line 533 "hb-buffer-deserialize-text.hh" + + { +#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; + } + +#line 545 "hb-buffer-deserialize-text.hh" + + + break; + } + case 12: { + { +#line 38 "hb-buffer-deserialize-text.rl" + + memset (&info, 0, sizeof (info)); + memset (&pos , 0, sizeof (pos )); + } + +#line 558 "hb-buffer-deserialize-text.hh" + + { +#line 51 "hb-buffer-deserialize-text.rl" + + tok = p; + } + +#line 566 "hb-buffer-deserialize-text.hh" + + { +#line 55 "hb-buffer-deserialize-text.rl" + if (unlikely (!buffer->ensure_glyphs ())) return false; } + +#line 572 "hb-buffer-deserialize-text.hh" + + + break; + } + case 14: { + { +#line 38 "hb-buffer-deserialize-text.rl" + + memset (&info, 0, sizeof (info)); + memset (&pos , 0, sizeof (pos )); + } + +#line 585 "hb-buffer-deserialize-text.hh" + + { +#line 51 "hb-buffer-deserialize-text.rl" + + tok = p; + } + +#line 593 "hb-buffer-deserialize-text.hh" + + { +#line 58 "hb-buffer-deserialize-text.rl" + + /* TODO Unescape delimeters. */ + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + +#line 605 "hb-buffer-deserialize-text.hh" + + + break; + } + case 17: { + { +#line 58 "hb-buffer-deserialize-text.rl" + + /* TODO Unescape delimeters. */ + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + +#line 621 "hb-buffer-deserialize-text.hh" + + { +#line 55 "hb-buffer-deserialize-text.rl" + if (unlikely (!buffer->ensure_glyphs ())) return false; } + +#line 627 "hb-buffer-deserialize-text.hh" + + { +#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; + } + +#line 639 "hb-buffer-deserialize-text.hh" + + + break; + } + case 11: { + { +#line 38 "hb-buffer-deserialize-text.rl" + + memset (&info, 0, sizeof (info)); + memset (&pos , 0, sizeof (pos )); + } + +#line 652 "hb-buffer-deserialize-text.hh" + + { +#line 51 "hb-buffer-deserialize-text.rl" + + tok = p; + } + +#line 660 "hb-buffer-deserialize-text.hh" + + { +#line 58 "hb-buffer-deserialize-text.rl" + + /* TODO Unescape delimeters. */ + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + +#line 672 "hb-buffer-deserialize-text.hh" + + { +#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; + } + +#line 684 "hb-buffer-deserialize-text.hh" + + + break; + } + case 13: { + { +#line 38 "hb-buffer-deserialize-text.rl" + + memset (&info, 0, sizeof (info)); + memset (&pos , 0, sizeof (pos )); + } + +#line 697 "hb-buffer-deserialize-text.hh" + + { +#line 51 "hb-buffer-deserialize-text.rl" + + tok = p; + } + +#line 705 "hb-buffer-deserialize-text.hh" + + { +#line 58 "hb-buffer-deserialize-text.rl" + + /* TODO Unescape delimeters. */ + if (!hb_font_glyph_from_string (font, + tok, p - tok, + &info.codepoint)) + return false; + } + +#line 717 "hb-buffer-deserialize-text.hh" + + { +#line 55 "hb-buffer-deserialize-text.rl" + if (unlikely (!buffer->ensure_glyphs ())) return false; } + +#line 723 "hb-buffer-deserialize-text.hh" + + { +#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; + } + +#line 735 "hb-buffer-deserialize-text.hh" + + + break; + } + } + + } + + if ( p == eof ) { + if ( cs >= 19 ) + goto _out; + } + else { + if ( cs != 0 ) { + p += 1; + goto _resume; + } + } + _out: {} + } + +#line 138 "hb-buffer-deserialize-text.rl" + + *end_ptr = p; -} - break; -#line 557 "hb-buffer-deserialize-text.hh" - } - } - - _out: {} - } - -#line 119 "hb-buffer-deserialize-text.rl" - - - *end_ptr = p; - - return p == pe && *(p-1) != ']'; + + return p == pe && *(p-1) != ']'; } #endif /* HB_BUFFER_DESERIALIZE_TEXT_HH */ diff --git a/src/hb-buffer-deserialize-text.rl b/src/hb-buffer-deserialize-text.rl index 6268a6c50..a2170288e 100644 --- a/src/hb-buffer-deserialize-text.rl +++ b/src/hb-buffer-deserialize-text.rl @@ -52,30 +52,37 @@ action tok { tok = p; } +action ensure_glyphs { if (unlikely (!buffer->ensure_glyphs ())) return false; } +action ensure_unicode { if (unlikely (!buffer->ensure_unicode ())) return false; } + action parse_glyph { + /* TODO Unescape delimeters. */ if (!hb_font_glyph_from_string (font, tok, p - tok, &info.codepoint)) return false; } +action parse_hexdigits {if (!parse_hex (tok, p, &info.codepoint )) return false; } + action parse_cluster { if (!parse_uint (tok, p, &info.cluster )) return false; } action parse_x_offset { if (!parse_int (tok, p, &pos.x_offset )) return false; } action parse_y_offset { if (!parse_int (tok, p, &pos.y_offset )) return false; } action parse_x_advance { if (!parse_int (tok, p, &pos.x_advance)) return false; } action parse_y_advance { if (!parse_int (tok, p, &pos.y_advance)) return false; } -unum = '0' | [1-9] digit*; +unum = '0' | [1-9] digit*; num = '-'? unum; glyph_id = unum; -glyph_name = alpha (alnum|'_'|'.'|'-')*; +glyph_name = ([^\\\]=@+,|] | '\\' [\\\]=@+,|]) *; glyph = (glyph_id | glyph_name) >tok %parse_glyph; cluster = '=' (unum >tok %parse_cluster); offsets = '@' (num >tok %parse_x_offset) ',' (num >tok %parse_y_offset ); advances= '+' (num >tok %parse_x_advance) (',' (num >tok %parse_y_advance))?; -item = + +glyph_item = ( glyph cluster? @@ -83,15 +90,31 @@ item = advances? ) >clear_item + @ensure_glyphs %add_item ; -main := space* item (space* '|' space* item)* space* ('|'|']')?; +unicode = 'U' '+' xdigit+ >tok %parse_hexdigits; + +unicode_item = + ( + unicode + cluster? + ) + >clear_item + @ensure_unicode + %add_item + ; + +glyphs = glyph_item (space* '|' space* glyph_item)* space* ('|'|']')?; +unicodes = unicode_item (space* '|' space* unicode_item)* space* ('|'|'>')?; + +main := space* ( ('[' glyphs) | ('<' unicodes) ); }%% static hb_bool_t -_hb_buffer_deserialize_glyphs_text (hb_buffer_t *buffer, +_hb_buffer_deserialize_text (hb_buffer_t *buffer, const char *buf, unsigned int buf_len, const char **end_ptr, @@ -104,10 +127,6 @@ _hb_buffer_deserialize_glyphs_text (hb_buffer_t *buffer, while (p < pe && ISSPACE (*p)) p++; - if (p < pe && *p == (buffer->len ? '|' : '[')) - { - *end_ptr = ++p; - } const char *eof = pe, *tok = nullptr; int cs; diff --git a/src/hb-buffer-serialize.cc b/src/hb-buffer-serialize.cc index aeeb19745..294b65e42 100644 --- a/src/hb-buffer-serialize.cc +++ b/src/hb-buffer-serialize.cc @@ -91,26 +91,26 @@ hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format) { switch ((unsigned) format) { - case HB_BUFFER_SERIALIZE_FORMAT_TEXT: return serialize_formats[0]; - case HB_BUFFER_SERIALIZE_FORMAT_JSON: return serialize_formats[1]; + case HB_BUFFER_SERIALIZE_FORMAT_TEXT: return serialize_formats[0]; + case HB_BUFFER_SERIALIZE_FORMAT_JSON: return serialize_formats[1]; default: - case HB_BUFFER_SERIALIZE_FORMAT_INVALID: return nullptr; + case HB_BUFFER_SERIALIZE_FORMAT_INVALID: return nullptr; } } static unsigned int _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, - unsigned int start, - unsigned int end, - char *buf, - unsigned int buf_size, - unsigned int *buf_consumed, - hb_font_t *font, - hb_buffer_serialize_flags_t flags) + unsigned int start, + unsigned int end, + char *buf, + unsigned int buf_size, + unsigned int *buf_consumed, + hb_font_t *font, + hb_buffer_serialize_flags_t flags) { hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr); hb_glyph_position_t *pos = (flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS) ? - nullptr : hb_buffer_get_glyph_positions (buffer, nullptr); + nullptr : hb_buffer_get_glyph_positions (buffer, nullptr); *buf_consumed = 0; hb_position_t x = 0, y = 0; @@ -125,6 +125,8 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, if (i) *p++ = ','; + else + *p++ = '['; *p++ = '{'; @@ -134,8 +136,9 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, char g[128]; hb_font_glyph_to_string (font, info[i].codepoint, g, sizeof (g)); *p++ = '"'; - for (char *q = g; *q; q++) { - if (*q == '"') + for (char *q = g; *q; q++) + { + if (unlikely (*q == '"' || *q == '\\')) *p++ = '\\'; *p++ = *q; } @@ -151,16 +154,16 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS)) { 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)); + x+pos[i].x_offset, y+pos[i].y_offset)); if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES)) - p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"ax\":%d,\"ay\":%d", - pos[i].x_advance, pos[i].y_advance)); + 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 += hb_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) @@ -168,12 +171,14 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, hb_glyph_extents_t extents; hb_font_get_glyph_extents(font, info[i].codepoint, &extents); p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"xb\":%d,\"yb\":%d", - extents.x_bearing, extents.y_bearing)); + extents.x_bearing, extents.y_bearing)); p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"w\":%d,\"h\":%d", - extents.width, extents.height)); + extents.width, extents.height)); } *p++ = '}'; + if (i == end-1) + *p++ = ']'; unsigned int l = p - b; if (buf_size > l) @@ -196,19 +201,72 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, return end - start; } +static unsigned int +_hb_buffer_serialize_unicode_json (hb_buffer_t *buffer, + unsigned int start, + unsigned int end, + char *buf, + unsigned int buf_size, + unsigned int *buf_consumed, + hb_buffer_serialize_flags_t flags) +{ + hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr); + + *buf_consumed = 0; + for (unsigned int i = start; i < end; i++) + { + char b[1024]; + char *p = b; + + if (i) + *p++ = ','; + else + *p++ = '['; + + *p++ = '{'; + + APPEND ("\"u\":"); + + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%u", info[i].codepoint)); + + if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS)) { + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"cl\":%u", info[i].cluster)); + } + + *p++ = '}'; + + if (i == end-1) + *p++ = ']'; + + unsigned int l = p - b; + if (buf_size > l) + { + memcpy (buf, b, l); + buf += l; + buf_size -= l; + *buf_consumed += l; + *buf = '\0'; + } else + return i - start; + + } + + return end - start; +} + static unsigned int _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, - unsigned int start, - unsigned int end, - char *buf, - unsigned int buf_size, - unsigned int *buf_consumed, - hb_font_t *font, - hb_buffer_serialize_flags_t flags) + unsigned int start, + unsigned int end, + char *buf, + unsigned int buf_size, + unsigned int *buf_consumed, + hb_font_t *font, + hb_buffer_serialize_flags_t flags) { hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr); hb_glyph_position_t *pos = (flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS) ? - nullptr : hb_buffer_get_glyph_positions (buffer, nullptr); + nullptr : hb_buffer_get_glyph_positions (buffer, nullptr); *buf_consumed = 0; hb_position_t x = 0, y = 0; @@ -221,9 +279,12 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, if (i) *p++ = '|'; + else + *p++ = '['; if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES)) { + /* TODO Escape delimiters we use. */ hb_font_glyph_to_string (font, info[i].codepoint, p, 128); p += strlen (p); } @@ -237,21 +298,21 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS)) { if (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)); + 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 += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%d", pos[i].x_advance)); - if (pos[i].y_advance) - p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",%d", pos[i].y_advance)); + *p++ = '+'; + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%d", pos[i].x_advance)); + if (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 += hb_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) @@ -261,6 +322,10 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, 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)); } + if (i == end-1) { + *p++ = ']'; + } + unsigned int l = p - b; if (buf_size > l) { @@ -282,6 +347,51 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, return end - start; } + +static unsigned int +_hb_buffer_serialize_unicode_text (hb_buffer_t *buffer, + unsigned int start, + unsigned int end, + char *buf, + unsigned int buf_size, + unsigned int *buf_consumed, + hb_buffer_serialize_flags_t flags) +{ + hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr); + *buf_consumed = 0; + for (unsigned int i = start; i < end; i++) + { + char b[1024]; + char *p = b; + + if (i) + *p++ = '|'; + else + *p++ = '<'; + + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "U+%04X", info[i].codepoint)); + + if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS)) { + p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "=%u", info[i].cluster)); + } + + if (i == end-1) + *p++ = '>'; + + unsigned int l = p - b; + if (buf_size > l) + { + memcpy (buf, b, l); + buf += l; + buf_size -= l; + *buf_consumed += l; + *buf = '\0'; + } else + return i - start; + } + return end - start; +} + /** * hb_buffer_serialize_glyphs: * @buffer: an #hb_buffer_t buffer. @@ -321,7 +431,24 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, * `<x_bearing,y_bearing,width,height>` * * ## json - * TODO. + * A machine-readable, structured format. + * The serialized glyphs will look something like: + * + * ``` + * [{"g":"uni0651","cl":0,"dx":518,"dy":0,"ax":0,"ay":0}, + * {"g":"uni0628","cl":0,"dx":0,"dy":0,"ax":1897,"ay":0}] + * ``` + * Each glyph is a JSON object, with the following properties: + * - `g`: the glyph name or glyph index if + * #HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES flag is set. + * - `cl`: #hb_glyph_info_t.cluster if + * #HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS is not set. + * - `dx`,`dy`,`ax`,`ay`: #hb_glyph_position_t.x_offset, #hb_glyph_position_t.y_offset, + * #hb_glyph_position_t.x_advance and #hb_glyph_position_t.y_advance + * respectively, if #HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS is not set. + * - `xb`,`yb`,`w`,`h`: #hb_glyph_extents_t.x_bearing, #hb_glyph_extents_t.y_bearing, + * #hb_glyph_extents_t.width and #hb_glyph_extents_t.height respectively if + * #HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS is set. * * Return value: * The number of serialized items. @@ -330,16 +457,17 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, **/ unsigned int hb_buffer_serialize_glyphs (hb_buffer_t *buffer, - unsigned int start, - unsigned int end, - char *buf, - unsigned int buf_size, - unsigned int *buf_consumed, - hb_font_t *font, - hb_buffer_serialize_format_t format, - hb_buffer_serialize_flags_t flags) + unsigned int start, + unsigned int end, + char *buf, + unsigned int buf_size, + unsigned int *buf_consumed, + hb_font_t *font, + hb_buffer_serialize_format_t format, + hb_buffer_serialize_flags_t flags) { - assert (start <= end && end <= buffer->len); + end = hb_clamp (end, start, buffer->len); + start = hb_min (start, end); unsigned int sconsumed; if (!buf_consumed) @@ -348,8 +476,7 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer, if (buf_size) *buf = '\0'; - assert ((!buffer->len && (buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)) || - (buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS)); + buffer->assert_glyphs (); if (!buffer->have_positions) flags |= HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS; @@ -364,13 +491,13 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer, { case HB_BUFFER_SERIALIZE_FORMAT_TEXT: return _hb_buffer_serialize_glyphs_text (buffer, start, end, - buf, buf_size, buf_consumed, - font, flags); + buf, buf_size, buf_consumed, + font, flags); case HB_BUFFER_SERIALIZE_FORMAT_JSON: return _hb_buffer_serialize_glyphs_json (buffer, start, end, - buf, buf_size, buf_consumed, - font, flags); + buf, buf_size, buf_consumed, + font, flags); default: case HB_BUFFER_SERIALIZE_FORMAT_INVALID: @@ -379,6 +506,180 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer, } } +/** + * hb_buffer_serialize_unicode: + * @buffer: an #hb_buffer_t buffer. + * @start: the first item in @buffer to serialize. + * @end: the last item in @buffer to serialize. + * @buf: (out) (array length=buf_size) (element-type uint8_t): output string to + * write serialized buffer into. + * @buf_size: the size of @buf. + * @buf_consumed: (out) (allow-none): if not %NULL, will be set to the number of byes written into @buf. + * @format: the #hb_buffer_serialize_format_t to use for formatting the output. + * + * Serializes @buffer into a textual representation of its content, + * when the buffer contains Unicode codepoints (i.e., before shaping). This is + * useful for showing the contents of the buffer, for example during debugging. + * There are currently two supported serialization formats: + * + * ## text + * A human-readable, plain text format. + * The serialized codepoints will look something like: + * + * ``` + * + * ``` + * - Glyphs are separated with `|` + * - Unicode codepoints are expressed as zero-padded four (or more) + * digit hexadecimal numbers preceded by `U+` + * - If #HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS is not set, the cluster + * will be indicated with a `=` then #hb_glyph_info_t.cluster. + * + * ## json + * A machine-readable, structured format. + * The serialized codepoints will be a list of objects with the following + * properties: + * - `u`: the Unicode codepoint as a decimal integer + * - `cl`: #hb_glyph_info_t.cluster if + * #HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS is not set. + * + * For example: + * ``` + * [{u:1617,cl:0},{u:1576,cl:1}] + * ``` + * + * Return value: + * The number of serialized items. + * + * Since: 2.7.3 + **/ +unsigned int +hb_buffer_serialize_unicode (hb_buffer_t *buffer, + unsigned int start, + unsigned int end, + char *buf, + unsigned int buf_size, + unsigned int *buf_consumed, + hb_buffer_serialize_format_t format, + hb_buffer_serialize_flags_t flags) +{ + end = hb_clamp (end, start, buffer->len); + start = hb_min (start, end); + + unsigned int sconsumed; + if (!buf_consumed) + buf_consumed = &sconsumed; + *buf_consumed = 0; + if (buf_size) + *buf = '\0'; + + buffer->assert_unicode (); + + if (unlikely (start == end)) + return 0; + + switch (format) + { + case HB_BUFFER_SERIALIZE_FORMAT_TEXT: + return _hb_buffer_serialize_unicode_text (buffer, start, end, + buf, buf_size, buf_consumed, flags); + + case HB_BUFFER_SERIALIZE_FORMAT_JSON: + return _hb_buffer_serialize_unicode_json (buffer, start, end, + buf, buf_size, buf_consumed, flags); + + default: + case HB_BUFFER_SERIALIZE_FORMAT_INVALID: + return 0; + + } +} + +static unsigned int +_hb_buffer_serialize_invalid (hb_buffer_t *buffer, + unsigned int start, + unsigned int end, + char *buf, + unsigned int buf_size, + unsigned int *buf_consumed, + hb_buffer_serialize_format_t format, + hb_buffer_serialize_flags_t flags) +{ + assert (!buffer->len); + + unsigned int sconsumed; + if (!buf_consumed) + buf_consumed = &sconsumed; + if (buf_size < 3) + return 0; + if (format == HB_BUFFER_SERIALIZE_FORMAT_JSON) { + *buf++ = '['; + *buf++ = ']'; + *buf = '\0'; + } else if (format == HB_BUFFER_SERIALIZE_FORMAT_TEXT) { + *buf++ = '!'; + *buf++ = '!'; + *buf = '\0'; + } + *buf_consumed = 2; + return 0; +} + +/** + * hb_buffer_serialize: + * @buffer: an #hb_buffer_t buffer. + * @start: the first item in @buffer to serialize. + * @end: the last item in @buffer to serialize. + * @buf: (out) (array length=buf_size) (element-type uint8_t): output string to + * write serialized buffer into. + * @buf_size: the size of @buf. + * @buf_consumed: (out) (allow-none): if not %NULL, will be set to the number of byes written into @buf. + * @font: (allow-none): the #hb_font_t used to shape this buffer, needed to + * read glyph names and extents. If %NULL, and empty font will be used. + * @format: the #hb_buffer_serialize_format_t to use for formatting the output. + * @flags: the #hb_buffer_serialize_flags_t that control what glyph properties + * to serialize. + * + * Serializes @buffer into a textual representation of its content, whether + * Unicode codepoints or glyph identifiers and positioning information. This is + * useful for showing the contents of the buffer, for example during debugging. + * See the documentation of hb_buffer_serialize_unicode() and + * hb_buffer_serialize_glyphs() for a description of the output format. + * + * Return value: + * The number of serialized items. + * + * Since: 2.7.3 + **/ +unsigned int +hb_buffer_serialize (hb_buffer_t *buffer, + unsigned int start, + unsigned int end, + char *buf, + unsigned int buf_size, + unsigned int *buf_consumed, + hb_font_t *font, + hb_buffer_serialize_format_t format, + hb_buffer_serialize_flags_t flags) +{ + switch (buffer->content_type) + { + + case HB_BUFFER_CONTENT_TYPE_GLYPHS: + return hb_buffer_serialize_glyphs (buffer, start, end, buf, buf_size, + buf_consumed, font, format, flags); + + case HB_BUFFER_CONTENT_TYPE_UNICODE: + return hb_buffer_serialize_unicode (buffer, start, end, buf, buf_size, + buf_consumed, format, flags); + + case HB_BUFFER_CONTENT_TYPE_INVALID: + default: + return _hb_buffer_serialize_invalid (buffer, start, end, buf, buf_size, + buf_consumed, format, flags); + } +} + static bool parse_int (const char *pp, const char *end, int32_t *pv) { @@ -403,6 +704,18 @@ parse_uint (const char *pp, const char *end, uint32_t *pv) return true; } +static bool +parse_hex (const char *pp, const char *end, uint32_t *pv) +{ + unsigned int v; + const char *p = pp; + if (unlikely (!hb_parse_uint (&p, end, &v, true/* whole buffer */, 16))) + return false; + + *pv = v; + return true; +} + #include "hb-buffer-deserialize-json.hh" #include "hb-buffer-deserialize-text.hh" @@ -423,23 +736,23 @@ parse_uint (const char *pp, const char *end, uint32_t *pv) **/ hb_bool_t hb_buffer_deserialize_glyphs (hb_buffer_t *buffer, - const char *buf, - int buf_len, /* -1 means nul-terminated */ - const char **end_ptr, /* May be NULL */ - hb_font_t *font, /* May be NULL */ - hb_buffer_serialize_format_t format) + const char *buf, + int buf_len, /* -1 means nul-terminated */ + const char **end_ptr, /* May be NULL */ + hb_font_t *font, /* May be NULL */ + hb_buffer_serialize_format_t format) { const char *end; if (!end_ptr) end_ptr = &end; *end_ptr = buf; - assert ((!buffer->len && (buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)) || - (buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS)); + buffer->assert_glyphs (); if (unlikely (hb_object_is_immutable (buffer))) { - *end_ptr = buf; + if (end_ptr) + *end_ptr = buf; return false; } @@ -460,14 +773,82 @@ hb_buffer_deserialize_glyphs (hb_buffer_t *buffer, switch (format) { case HB_BUFFER_SERIALIZE_FORMAT_TEXT: - return _hb_buffer_deserialize_glyphs_text (buffer, - buf, buf_len, end_ptr, - font); + return _hb_buffer_deserialize_text (buffer, + buf, buf_len, end_ptr, + font); case HB_BUFFER_SERIALIZE_FORMAT_JSON: - return _hb_buffer_deserialize_glyphs_json (buffer, - buf, buf_len, end_ptr, - font); + return _hb_buffer_deserialize_json (buffer, + buf, buf_len, end_ptr, + font); + + default: + case HB_BUFFER_SERIALIZE_FORMAT_INVALID: + return false; + + } +} + + +/** + * hb_buffer_deserialize_unicode: + * @buffer: an #hb_buffer_t buffer. + * @buf: (array length=buf_len): + * @buf_len: + * @end_ptr: (out): + * @format: + * + * + * + * Return value: + * + * Since: 2.7.3 + **/ +hb_bool_t +hb_buffer_deserialize_unicode (hb_buffer_t *buffer, + const char *buf, + int buf_len, /* -1 means nul-terminated */ + const char **end_ptr, /* May be NULL */ + hb_buffer_serialize_format_t format) +{ + const char *end; + if (!end_ptr) + end_ptr = &end; + *end_ptr = buf; + + buffer->assert_unicode (); + + if (unlikely (hb_object_is_immutable (buffer))) + { + if (end_ptr) + *end_ptr = buf; + return false; + } + + if (buf_len == -1) + buf_len = strlen (buf); + + if (!buf_len) + { + *end_ptr = buf; + return false; + } + + hb_buffer_set_content_type (buffer, HB_BUFFER_CONTENT_TYPE_UNICODE); + + hb_font_t* font = hb_font_get_empty (); + + switch (format) + { + case HB_BUFFER_SERIALIZE_FORMAT_TEXT: + return _hb_buffer_deserialize_text (buffer, + buf, buf_len, end_ptr, + font); + + case HB_BUFFER_SERIALIZE_FORMAT_JSON: + return _hb_buffer_deserialize_json (buffer, + buf, buf_len, end_ptr, + font); default: case HB_BUFFER_SERIALIZE_FORMAT_INVALID: diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 4fadbb78d..488f49147 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -50,7 +50,7 @@ * Checks the equality of two #hb_segment_properties_t's. * * Return value: - * %true if all properties of @a equal those of @b, false otherwise. + * %true if all properties of @a equal those of @b, %false otherwise. * * Since: 0.9.7 **/ @@ -617,8 +617,7 @@ hb_buffer_t::unsafe_to_break_from_outbuffer (unsigned int start, unsigned int en void hb_buffer_t::guess_segment_properties () { - assert ((content_type == HB_BUFFER_CONTENT_TYPE_UNICODE) || - (!len && (content_type == HB_BUFFER_CONTENT_TYPE_INVALID))); + assert_unicode (); /* If script is set to INVALID, guess from buffer contents */ if (props.script == HB_SCRIPT_INVALID) { @@ -1404,6 +1403,25 @@ hb_buffer_get_glyph_positions (hb_buffer_t *buffer, return (hb_glyph_position_t *) buffer->pos; } +/** + * hb_buffer_has_positions: + * @buffer: an #hb_buffer_t. + * + * Returns whether @buffer has glyph position data. + * A buffer gains position data when hb_buffer_get_glyph_positions() is called on it, + * and cleared of position data when hb_buffer_clear_contents() is called. + * + * Return value: + * %true if the @buffer has position array, %false otherwise. + * + * Since: REPLACEME + **/ +HB_EXTERN hb_bool_t +hb_buffer_has_positions (hb_buffer_t *buffer) +{ + return buffer->have_positions; +} + /** * hb_glyph_info_get_glyph_flags: * @info: a #hb_glyph_info_t. @@ -1513,8 +1531,7 @@ hb_buffer_add_utf (hb_buffer_t *buffer, typedef typename utf_t::codepoint_t T; const hb_codepoint_t replacement = buffer->replacement; - assert ((buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE) || - (!buffer->len && (buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID))); + buffer->assert_unicode (); if (unlikely (hb_object_is_immutable (buffer))) return; @@ -1834,8 +1851,8 @@ void hb_buffer_normalize_glyphs (hb_buffer_t *buffer) { assert (buffer->have_positions); - assert ((buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS) || - (!buffer->len && (buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID))); + + buffer->assert_glyphs (); bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction); diff --git a/src/hb-buffer.h b/src/hb-buffer.h index 2f581f3c7..19a89bb61 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -447,6 +447,9 @@ HB_EXTERN hb_glyph_position_t * hb_buffer_get_glyph_positions (hb_buffer_t *buffer, unsigned int *length); +HB_EXTERN hb_bool_t +hb_buffer_has_positions (hb_buffer_t *buffer); + HB_EXTERN void hb_buffer_normalize_glyphs (hb_buffer_t *buffer); @@ -518,6 +521,27 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer, hb_buffer_serialize_format_t format, hb_buffer_serialize_flags_t flags); +HB_EXTERN unsigned int +hb_buffer_serialize_unicode (hb_buffer_t *buffer, + unsigned int start, + unsigned int end, + char *buf, + unsigned int buf_size, + unsigned int *buf_consumed, + hb_buffer_serialize_format_t format, + hb_buffer_serialize_flags_t flags); + +HB_EXTERN unsigned int +hb_buffer_serialize (hb_buffer_t *buffer, + unsigned int start, + unsigned int end, + char *buf, + unsigned int buf_size, + unsigned int *buf_consumed, + hb_font_t *font, + hb_buffer_serialize_format_t format, + hb_buffer_serialize_flags_t flags); + HB_EXTERN hb_bool_t hb_buffer_deserialize_glyphs (hb_buffer_t *buffer, const char *buf, @@ -526,6 +550,14 @@ hb_buffer_deserialize_glyphs (hb_buffer_t *buffer, hb_font_t *font, hb_buffer_serialize_format_t format); +HB_EXTERN hb_bool_t +hb_buffer_deserialize_unicode (hb_buffer_t *buffer, + const char *buf, + int buf_len, + const char **end_ptr, + hb_buffer_serialize_format_t format); + + /* * Compare buffers diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 3420ba434..9cad5206e 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -35,20 +35,20 @@ #ifndef HB_BUFFER_MAX_LEN_FACTOR -#define HB_BUFFER_MAX_LEN_FACTOR 32 +#define HB_BUFFER_MAX_LEN_FACTOR 64 #endif #ifndef HB_BUFFER_MAX_LEN_MIN -#define HB_BUFFER_MAX_LEN_MIN 8192 +#define HB_BUFFER_MAX_LEN_MIN 16384 #endif #ifndef HB_BUFFER_MAX_LEN_DEFAULT #define HB_BUFFER_MAX_LEN_DEFAULT 0x3FFFFFFF /* Shaping more than a billion chars? Let us know! */ #endif #ifndef HB_BUFFER_MAX_OPS_FACTOR -#define HB_BUFFER_MAX_OPS_FACTOR 64 +#define HB_BUFFER_MAX_OPS_FACTOR 1024 #endif #ifndef HB_BUFFER_MAX_OPS_MIN -#define HB_BUFFER_MAX_OPS_MIN 1024 +#define HB_BUFFER_MAX_OPS_MIN 16384 #endif #ifndef HB_BUFFER_MAX_OPS_DEFAULT #define HB_BUFFER_MAX_OPS_DEFAULT 0x1FFFFFFF /* Shaping more than a billion operations? Let us know! */ @@ -339,6 +339,39 @@ struct hb_buffer_t bool ensure_inplace (unsigned int size) { return likely (!size || size < allocated); } + void assert_glyphs () + { + assert ((content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS) || + (!len && (content_type == HB_BUFFER_CONTENT_TYPE_INVALID))); + } + void assert_unicode () + { + assert ((content_type == HB_BUFFER_CONTENT_TYPE_UNICODE) || + (!len && (content_type == HB_BUFFER_CONTENT_TYPE_INVALID))); + } + bool ensure_glyphs () + { + if (unlikely (content_type != HB_BUFFER_CONTENT_TYPE_GLYPHS)) + { + if (content_type != HB_BUFFER_CONTENT_TYPE_INVALID) + return false; + assert (len == 0); + content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS; + } + return true; + } + bool ensure_unicode () + { + if (unlikely (content_type != HB_BUFFER_CONTENT_TYPE_UNICODE)) + { + if (content_type != HB_BUFFER_CONTENT_TYPE_INVALID) + return false; + assert (len == 0); + content_type = HB_BUFFER_CONTENT_TYPE_UNICODE; + } + return true; + } + HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); HB_INTERNAL bool shift_forward (unsigned int count); diff --git a/src/hb-common.cc b/src/hb-common.cc index 5acfa7843..af8f4a207 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -448,7 +448,12 @@ hb_script_from_iso15924_tag (hb_tag_t tag) case HB_TAG('Q','a','a','c'): return HB_SCRIPT_COPTIC; /* Script variants from https://unicode.org/iso15924/ */ + case HB_TAG('A','r','a','n'): return HB_SCRIPT_ARABIC; case HB_TAG('C','y','r','s'): return HB_SCRIPT_CYRILLIC; + case HB_TAG('G','e','o','k'): return HB_SCRIPT_GEORGIAN; + case HB_TAG('H','a','n','s'): return HB_SCRIPT_HAN; + case HB_TAG('H','a','n','t'): return HB_SCRIPT_HAN; + case HB_TAG('J','a','m','o'): return HB_SCRIPT_HANGUL; case HB_TAG('L','a','t','f'): return HB_SCRIPT_LATIN; case HB_TAG('L','a','t','g'): return HB_SCRIPT_LATIN; case HB_TAG('S','y','r','e'): return HB_SCRIPT_SYRIAC; diff --git a/src/hb-face.cc b/src/hb-face.cc index 7bde50df5..848c4ff9c 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -41,8 +41,10 @@ * @short_description: Font face objects * @include: hb.h * - * Font face is objects represent a single face in a font family. - * More exactly, a font face represents a single face in a binary font file. + * A font face is an object that represents a single face from within a + * font family. + * + * More precisely, a font face represents a single face in a binary font file. * Font faces are typically built from a binary blob and a face index. * Font faces are used to create fonts. **/ @@ -52,7 +54,7 @@ * hb_face_count: * @blob: a blob. * - * Get number of faces in a blob. + * Fetches the number of faces in a blob. * * Return value: Number of faces in @blob * @@ -96,13 +98,19 @@ DEFINE_NULL_INSTANCE (hb_face_t) = /** * hb_face_create_for_tables: - * @reference_table_func: (closure user_data) (destroy destroy) (scope notified): - * @user_data: - * @destroy: + * @reference_table_func: (closure user_data) (destroy destroy) (scope notified): Table-referencing function + * @user_data: A pointer to the user data + * @destroy: (optional): A callback to call when @data is not needed anymore * + * Variant of hb_face_create(), built for those cases where it is more + * convenient to provide data for individual tables instead of the whole font + * data. With the caveat that hb_face_get_table_tags() does not currently work + * with faces created this way. + * + * Creates a new face object from the specified @user_data and @reference_table_func, + * with the @destroy callback. * - * - * Return value: (transfer full) + * Return value: (transfer full): The new face object * * Since: 0.9.2 **/ @@ -182,12 +190,15 @@ _hb_face_for_data_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void /** * hb_face_create: (Xconstructor) - * @blob: - * @index: + * @blob: #hb_blob_t to work upon + * @index: The index of the face within @blob * + * Constructs a new face object from the specified blob and + * a face index into that blob. This is used for blobs of + * file formats such as Dfont and TTC that can contain more + * than one face. * - * - * Return value: (transfer full): + * Return value: (transfer full): The new face object * * Since: 0.9.2 **/ @@ -222,9 +233,9 @@ hb_face_create (hb_blob_t *blob, /** * hb_face_get_empty: * + * Fetches the singleton empty face object. * - * - * Return value: (transfer full) + * Return value: (transfer full) The empty face object * * Since: 0.9.2 **/ @@ -237,11 +248,11 @@ hb_face_get_empty () /** * hb_face_reference: (skip) - * @face: a face. + * @face: A face object * + * Increases the reference count on a face object. * - * - * Return value: + * Return value: The @face object * * Since: 0.9.2 **/ @@ -253,9 +264,11 @@ hb_face_reference (hb_face_t *face) /** * hb_face_destroy: (skip) - * @face: a face. - * - * + * @face: A face object + * + * Decreases the reference count on a face object. When the + * reference count reaches zero, the face is destroyed, + * freeing all memory. * * Since: 0.9.2 **/ @@ -283,15 +296,15 @@ hb_face_destroy (hb_face_t *face) /** * hb_face_set_user_data: (skip) - * @face: a face. - * @key: - * @data: - * @destroy: - * @replace: + * @face: A face object + * @key: The user-data key to set + * @data: A pointer to the user data + * @destroy: (optional): A callback to call when @data is not needed anymore + * @replace: Whether to replace an existing data with the same key * + * Attaches a user-data key/data pair to the given face object. * - * - * Return value: + * Return value: %true if success, false otherwise * * Since: 0.9.2 **/ @@ -307,12 +320,13 @@ hb_face_set_user_data (hb_face_t *face, /** * hb_face_get_user_data: (skip) - * @face: a face. - * @key: + * @face: A face object + * @key: The user-data key to query * + * Fetches the user data associated with the specified key, + * attached to the specified face object. * - * - * Return value: (transfer none): + * Return value: (transfer none): A pointer to the user data * * Since: 0.9.2 **/ @@ -325,9 +339,9 @@ hb_face_get_user_data (const hb_face_t *face, /** * hb_face_make_immutable: - * @face: a face. - * + * @face: A face object * + * Makes the given face object immutable. * * Since: 0.9.2 **/ @@ -342,11 +356,11 @@ hb_face_make_immutable (hb_face_t *face) /** * hb_face_is_immutable: - * @face: a face. + * @face: A face object * + * Tests whether the given face object is immutable. * - * - * Return value: + * Return value: True is @face is immutable, false otherwise * * Since: 0.9.2 **/ @@ -359,12 +373,13 @@ hb_face_is_immutable (const hb_face_t *face) /** * hb_face_reference_table: - * @face: a face. - * @tag: + * @face: A face object + * @tag: The #hb_tag_t of the table to query * + * Fetches a reference to the specified table within + * the specified face. * - * - * Return value: (transfer full): + * Return value: (transfer full): A pointer to the @tag table within @face * * Since: 0.9.2 **/ @@ -380,11 +395,13 @@ hb_face_reference_table (const hb_face_t *face, /** * hb_face_reference_blob: - * @face: a face. + * @face: A face object * + * Fetches a pointer to the binary blob that contains the + * specified face. Returns an empty blob if referencing face data is not + * possible. * - * - * Return value: (transfer full): + * Return value: (transfer full): A pointer to the blob for @face * * Since: 0.9.2 **/ @@ -396,10 +413,13 @@ hb_face_reference_blob (hb_face_t *face) /** * hb_face_set_index: - * @face: a face. - * @index: + * @face: A face object + * @index: The index to assign * + * Assigns the specified face-index to @face. Fails if the + * face is immutable. * + * Note: face indices within a collection are zero-based. * * Since: 0.9.2 **/ @@ -415,11 +435,13 @@ hb_face_set_index (hb_face_t *face, /** * hb_face_get_index: - * @face: a face. + * @face: A face object * + * Fetches the face-index corresponding to the given face. * + * Note: face indices within a collection are zero-based. * - * Return value: + * Return value: The index of @face. * * Since: 0.9.2 **/ @@ -431,10 +453,10 @@ hb_face_get_index (const hb_face_t *face) /** * hb_face_set_upem: - * @face: a face. - * @upem: - * + * @face: A face object + * @upem: The units-per-em value to assign * + * Sets the units-per-em (upem) for a face object to the specified value. * * Since: 0.9.2 **/ @@ -450,11 +472,11 @@ hb_face_set_upem (hb_face_t *face, /** * hb_face_get_upem: - * @face: a face. + * @face: A face object * + * Fetches the units-per-em (upem) value of the specified face object. * - * - * Return value: + * Return value: The upem value of @face * * Since: 0.9.2 **/ @@ -466,10 +488,10 @@ hb_face_get_upem (const hb_face_t *face) /** * hb_face_set_glyph_count: - * @face: a face. - * @glyph_count: - * + * @face: A face object + * @glyph_count: The glyph-count value to assign * + * Sets the glyph count for a face object to the specified value. * * Since: 0.9.7 **/ @@ -485,11 +507,11 @@ hb_face_set_glyph_count (hb_face_t *face, /** * hb_face_get_glyph_count: - * @face: a face. + * @face: A face object * + * Fetches the glyph-count value of the specified face object. * - * - * Return value: + * Return value: The glyph-count value of @face * * Since: 0.9.7 **/ @@ -501,14 +523,16 @@ hb_face_get_glyph_count (const hb_face_t *face) /** * hb_face_get_table_tags: - * @face: a face. - * @start_offset: index of first tag to return. - * @table_count: input length of @table_tags array, output number of items written. - * @table_tags: array to write tags into. + * @face: A face object + * @start_offset: The index of first table tag to retrieve + * @table_count: (inout): Input = the maximum number of table tags to return; + * Output = the actual number of table tags returned (may be zero) + * @table_tags: (out) (array length=table_count): The array of table tags found * - * Retrieves table tags for a face, if possible. + * Fetches a list of all table tags for a face, if possible. The list returned will + * begin at the offset provided * - * Return value: total number of tables, or 0 if not possible to list. + * Return value: Total number of tables, or zero if it is not possible to list * * Since: 1.6.0 **/ @@ -542,8 +566,11 @@ hb_face_get_table_tags (const hb_face_t *face, #ifndef HB_NO_FACE_COLLECT_UNICODES /** * hb_face_collect_unicodes: - * @face: font face. - * @out: set to add Unicode characters covered by @face to. + * @face: A face object + * @out: The set to add Unicode characters to + * + * Collects all of the Unicode characters covered by @face and adds + * them to the #hb_set_t set @out. * * Since: 1.9.0 */ @@ -555,10 +582,11 @@ hb_face_collect_unicodes (hb_face_t *face, } /** * hb_face_collect_variation_selectors: - * @face: font face. - * @out: set to add Variation Selector characters covered by @face to. - * + * @face: A face object + * @out: The set to add Variation Selector characters to * + * Collects all Unicode "Variation Selector" characters covered by @face and adds + * them to the #hb_set_t set @out. * * Since: 1.9.0 */ @@ -570,10 +598,12 @@ hb_face_collect_variation_selectors (hb_face_t *face, } /** * hb_face_collect_variation_unicodes: - * @face: font face. - * @out: set to add Unicode characters for @variation_selector covered by @face to. - * + * @face: A face object + * @variation_selector: The Variation Selector to query + * @out: The set to add Unicode characters to * + * Collects all Unicode characters for @variation_selector covered by @face and adds + * them to the #hb_set_t set @out. * * Since: 1.9.0 */ @@ -708,6 +738,9 @@ hb_face_builder_create () /** * hb_face_builder_add_table: + * @face: A face object created with hb_face_builder_create() + * @tag: The #hb_tag_t of the table to add + * @blob: The blob containing the table data to add * * Add table for @tag with data provided by @blob to the face. @face must * be created using hb_face_builder_create(). diff --git a/src/hb-face.h b/src/hb-face.h index e8ff090d5..3b18f7eef 100644 --- a/src/hb-face.h +++ b/src/hb-face.h @@ -46,6 +46,12 @@ hb_face_count (hb_blob_t *blob); * hb_face_t */ +/** + * hb_face_t: + * + * Data type for holding font faces. + * + **/ typedef struct hb_face_t hb_face_t; HB_EXTERN hb_face_t * diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index a1dc88603..fae7b5b65 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -306,6 +306,9 @@ _hb_ot_get_font_funcs () /** * hb_ot_font_set_funcs: + * @font: #hb_font_t to work upon + * + * Sets the font functions to use when working with @font. * * Since: 0.9.28 **/ diff --git a/src/hb-ot-layout-base-table.hh b/src/hb-ot-layout-base-table.hh index 02fe14fa0..4df0d942c 100644 --- a/src/hb-ot-layout-base-table.hh +++ b/src/hb-ot-layout-base-table.hh @@ -379,12 +379,20 @@ struct Axis const BaseCoord **coord) const { const BaseScript &base_script = (this+baseScriptList).get_base_script (script_tag); - if (!base_script.has_data ()) return false; + if (!base_script.has_data ()) + { + *coord = nullptr; + return false; + } if (likely (coord)) { unsigned int tag_index = 0; - (this+baseTagList).bfind (baseline_tag, &tag_index); + if (!(this+baseTagList).bfind (baseline_tag, &tag_index)) + { + *coord = nullptr; + return false; + } *coord = &base_script.get_base_coord (tag_index); } @@ -398,7 +406,11 @@ struct Axis const BaseCoord **max_coord) const { const BaseScript &base_script = (this+baseScriptList).get_base_script (script_tag); - if (!base_script.has_data ()) return false; + if (!base_script.has_data ()) + { + *min_coord = *max_coord = nullptr; + return false; + } base_script.get_min_max (language_tag).get_min_max (feature_tag, min_coord, max_coord); diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 46408bb9d..7918f86dd 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -76,7 +76,7 @@ * Tests whether a face includes any kerning data in the 'kern' table. * Does NOT test for kerning lookups in the GPOS table. * - * Return value: true if data found, false otherwise + * Return value: %true if data found, false otherwise * **/ bool @@ -92,7 +92,7 @@ hb_ot_layout_has_kerning (hb_face_t *face) * Tests whether a face includes any state-machine kerning in the 'kern' table. * Does NOT examine the GPOS table. * - * Return value: true if data found, false otherwise + * Return value: %true if data found, false otherwise * **/ bool @@ -112,7 +112,7 @@ hb_ot_layout_has_machine_kerning (hb_face_t *face) * * Does NOT examine the GPOS table. * - * Return value: true is data found, false otherwise + * Return value: %true is data found, false otherwise * **/ bool @@ -268,7 +268,7 @@ _hb_ot_layout_set_glyph_props (hb_font_t *font, * * Tests whether a face has any glyph classes defined in its GDEF table. * - * Return value: true if data found, false otherwise + * Return value: %true if data found, false otherwise * **/ hb_bool_t @@ -444,7 +444,7 @@ hb_ot_layout_table_get_script_tags (hb_face_t *face, * Fetches the index if a given script tag in the specified face's GSUB table * or GPOS table. * - * Return value: true if the script is found, false otherwise + * Return value: %true if the script is found, false otherwise * **/ hb_bool_t @@ -598,7 +598,7 @@ hb_ot_layout_table_get_feature_tags (hb_face_t *face, * Fetches the index for a given feature tag in the specified face's GSUB table * or GPOS table. * - * Return value: true if the feature is found, false otherwise + * Return value: %true if the feature is found, false otherwise **/ bool hb_ot_layout_table_find_feature (hb_face_t *face, @@ -663,7 +663,7 @@ hb_ot_layout_script_get_language_tags (hb_face_t *face, * Fetches the index of a given language tag in the specified face's GSUB table * or GPOS table, underneath the specified script tag. * - * Return value: true if the language tag is found, false otherwise + * Return value: %true if the language tag is found, false otherwise * * Since: ?? * Deprecated: ?? @@ -697,7 +697,7 @@ hb_ot_layout_script_find_language (hb_face_t *face, * Fetches the index of a given language tag in the specified face's GSUB table * or GPOS table, underneath the specified script index. * - * Return value: true if the language tag is found, false otherwise + * Return value: %true if the language tag is found, false otherwise * * Since: 2.0.0 **/ @@ -739,7 +739,7 @@ hb_ot_layout_script_select_language (hb_face_t *face, * Fetches the index of a requested feature in the given face's GSUB or GPOS table, * underneath the specified script and language. * - * Return value: true if the feature is found, false otherwise + * Return value: %true if the feature is found, false otherwise * **/ hb_bool_t @@ -770,7 +770,7 @@ hb_ot_layout_language_get_required_feature_index (hb_face_t *face, * Fetches the tag of a requested feature index in the given face's GSUB or GPOS table, * underneath the specified script and language. * - * Return value: true if the feature is found, false otherwise + * Return value: %true if the feature is found, false otherwise * * Since: 0.9.30 **/ @@ -877,7 +877,7 @@ hb_ot_layout_language_get_feature_tags (hb_face_t *face, * Fetches the index of a given feature tag in the specified face's GSUB table * or GPOS table, underneath the specified script and language. * - * Return value: true if the feature is found, false otherwise + * Return value: %true if the feature is found, false otherwise * **/ hb_bool_t @@ -1196,7 +1196,7 @@ hb_ot_layout_collect_lookups (hb_face_t *face, * @glyphs_before: (out): Array of glyphs preceding the substitution range * @glyphs_input: (out): Array of input glyphs that would be substituted by the lookup * @glyphs_after: (out): Array of glyphs following the substitution range - * @glyphs_output: (out): Array of glyphs that would be the substitued output of the lookup + * @glyphs_output: (out): Array of glyphs that would be the substituted output of the lookup * * Fetches a list of all glyphs affected by the specified lookup in the * specified face's GSUB table or GPOS table. @@ -1245,7 +1245,7 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, * @face: #hb_face_t to work upon * @table_tag: HB_OT_TAG_GSUB or HB_OT_TAG_GPOS * @coords: The variation coordinates to query - * @num_coords: The number of variation coorinates + * @num_coords: The number of variation coordinates * @variations_index: (out): The array of feature variations found for the query * * Fetches a list of feature variations in the specified face's GSUB table @@ -1310,7 +1310,7 @@ hb_ot_layout_feature_with_variations_get_lookups (hb_face_t *face, * * Tests whether the specified face includes any GSUB substitutions. * - * Return value: true if data found, false otherwise + * Return value: %true if data found, false otherwise * **/ hb_bool_t @@ -1331,7 +1331,7 @@ hb_ot_layout_has_substitution (hb_face_t *face) * Tests whether a specified lookup in the specified face would * trigger a substitution on the given glyph sequence. * - * Return value: true if a substitution would be triggered, false otherwise + * Return value: %true if a substitution would be triggered, false otherwise * * Since: 0.9.7 **/ @@ -1488,7 +1488,7 @@ hb_ot_layout_lookups_substitute_closure (hb_face_t *face, * hb_ot_layout_has_positioning: * @face: #hb_face_t to work upon * - * Return value: true if the face has GPOS data, false otherwise + * Return value: %true if the face has GPOS data, false otherwise * **/ hb_bool_t @@ -1561,7 +1561,7 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer) * For more information on this distinction, see the [`size` feature documentation]( * https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#tag-size). * - * Return value: true if data found, false otherwise + * Return value: %true if data found, false otherwise * * Since: 0.9.10 **/ @@ -1625,7 +1625,7 @@ hb_ot_layout_get_size_params (hb_face_t *face, * Fetches name indices from feature parameters for "Stylistic Set" ('ssXX') or * "Character Variant" ('cvXX') features. * - * Return value: true if data found, false otherwise + * Return value: %true if data found, false otherwise * * Since: 2.0.0 **/ diff --git a/src/hb-ot-shape-complex-use-machine.hh b/src/hb-ot-shape-complex-use-machine.hh index 6e2abde7c..c8d24c516 100644 --- a/src/hb-ot-shape-complex-use-machine.hh +++ b/src/hb-ot-shape-complex-use-machine.hh @@ -37,306 +37,278 @@ #line 39 "hb-ot-shape-complex-use-machine.hh" static const unsigned char _use_syllable_machine_trans_keys[] = { - 12u, 48u, 1u, 15u, 1u, 1u, 12u, 48u, 1u, 1u, 0u, 51u, 11u, 48u, 11u, 48u, - 1u, 15u, 1u, 1u, 22u, 48u, 23u, 48u, 24u, 47u, 25u, 47u, 26u, 47u, 45u, 46u, - 46u, 46u, 24u, 48u, 24u, 48u, 24u, 48u, 1u, 1u, 24u, 48u, 23u, 48u, 23u, 48u, - 23u, 48u, 22u, 48u, 22u, 48u, 22u, 48u, 11u, 48u, 1u, 48u, 13u, 13u, 4u, 4u, - 11u, 48u, 41u, 42u, 42u, 42u, 11u, 48u, 22u, 48u, 23u, 48u, 24u, 47u, 25u, 47u, - 26u, 47u, 45u, 46u, 46u, 46u, 24u, 48u, 24u, 48u, 24u, 48u, 24u, 48u, 23u, 48u, - 23u, 48u, 23u, 48u, 22u, 48u, 22u, 48u, 22u, 48u, 11u, 48u, 1u, 48u, 1u, 15u, - 4u, 4u, 13u, 13u, 12u, 48u, 1u, 48u, 11u, 48u, 41u, 42u, 42u, 42u, 1u, 5u, - 50u, 52u, 49u, 52u, 49u, 51u, 0 + 1u, 1u, 1u, 1u, 0u, 51u, 11u, 48u, 11u, 48u, 1u, 1u, 22u, 48u, 23u, 48u, + 24u, 47u, 25u, 47u, 26u, 47u, 45u, 46u, 46u, 46u, 24u, 48u, 24u, 48u, 24u, 48u, + 1u, 1u, 24u, 48u, 23u, 48u, 23u, 48u, 23u, 48u, 22u, 48u, 22u, 48u, 22u, 48u, + 11u, 48u, 1u, 48u, 13u, 13u, 4u, 4u, 11u, 48u, 41u, 42u, 42u, 42u, 11u, 48u, + 22u, 48u, 23u, 48u, 24u, 47u, 25u, 47u, 26u, 47u, 45u, 46u, 46u, 46u, 24u, 48u, + 24u, 48u, 24u, 48u, 24u, 48u, 23u, 48u, 23u, 48u, 23u, 48u, 22u, 48u, 22u, 48u, + 22u, 48u, 11u, 48u, 1u, 48u, 1u, 1u, 4u, 4u, 13u, 13u, 1u, 48u, 11u, 48u, + 41u, 42u, 42u, 42u, 1u, 5u, 50u, 52u, 49u, 52u, 49u, 51u, 0 }; static const char _use_syllable_machine_key_spans[] = { - 37, 15, 1, 37, 1, 52, 38, 38, - 15, 1, 27, 26, 24, 23, 22, 2, - 1, 25, 25, 25, 1, 25, 26, 26, - 26, 27, 27, 27, 38, 48, 1, 1, - 38, 2, 1, 38, 27, 26, 24, 23, - 22, 2, 1, 25, 25, 25, 25, 26, - 26, 26, 27, 27, 27, 38, 48, 15, - 1, 1, 37, 48, 38, 2, 1, 5, - 3, 4, 3 + 1, 1, 52, 38, 38, 1, 27, 26, + 24, 23, 22, 2, 1, 25, 25, 25, + 1, 25, 26, 26, 26, 27, 27, 27, + 38, 48, 1, 1, 38, 2, 1, 38, + 27, 26, 24, 23, 22, 2, 1, 25, + 25, 25, 25, 26, 26, 26, 27, 27, + 27, 38, 48, 1, 1, 1, 48, 38, + 2, 1, 5, 3, 4, 3 }; static const short _use_syllable_machine_index_offsets[] = { - 0, 38, 54, 56, 94, 96, 149, 188, - 227, 243, 245, 273, 300, 325, 349, 372, - 375, 377, 403, 429, 455, 457, 483, 510, - 537, 564, 592, 620, 648, 687, 736, 738, - 740, 779, 782, 784, 823, 851, 878, 903, - 927, 950, 953, 955, 981, 1007, 1033, 1059, - 1086, 1113, 1140, 1168, 1196, 1224, 1263, 1312, - 1328, 1330, 1332, 1370, 1419, 1458, 1461, 1463, - 1469, 1473, 1478 + 0, 2, 4, 57, 96, 135, 137, 165, + 192, 217, 241, 264, 267, 269, 295, 321, + 347, 349, 375, 402, 429, 456, 484, 512, + 540, 579, 628, 630, 632, 671, 674, 676, + 715, 743, 770, 795, 819, 842, 845, 847, + 873, 899, 925, 951, 978, 1005, 1032, 1060, + 1088, 1116, 1155, 1204, 1206, 1208, 1210, 1259, + 1298, 1301, 1303, 1309, 1313, 1318 }; 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, 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, 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, 5, 5, 6, 5, 7, 5, - 8, 9, 10, 8, 11, 12, 10, 10, - 10, 10, 10, 3, 13, 14, 10, 15, - 8, 8, 16, 17, 10, 10, 18, 19, - 20, 21, 22, 23, 24, 18, 25, 26, - 27, 28, 29, 30, 10, 31, 32, 33, - 10, 34, 35, 36, 37, 38, 39, 40, - 13, 41, 10, 42, 10, 44, 1, 43, - 43, 45, 43, 43, 43, 43, 43, 43, - 46, 47, 48, 49, 50, 51, 52, 46, - 53, 9, 54, 55, 56, 57, 43, 58, - 59, 60, 43, 43, 43, 43, 61, 62, - 63, 64, 1, 43, 44, 1, 43, 43, - 45, 43, 43, 43, 43, 43, 43, 46, - 47, 48, 49, 50, 51, 52, 46, 53, - 54, 54, 55, 56, 57, 43, 58, 59, - 60, 43, 43, 43, 43, 61, 62, 63, - 64, 1, 43, 44, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 66, 65, 44, 65, 46, 47, 48, - 49, 50, 43, 43, 43, 43, 43, 43, - 55, 56, 57, 43, 58, 59, 60, 43, - 43, 43, 43, 47, 62, 63, 64, 67, - 43, 47, 48, 49, 50, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 58, - 59, 60, 43, 43, 43, 43, 43, 62, - 63, 64, 67, 43, 48, 49, 50, 43, - 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, - 43, 62, 63, 64, 43, 49, 50, 43, - 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, - 43, 62, 63, 64, 43, 50, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, - 62, 63, 64, 43, 62, 63, 43, 63, - 43, 48, 49, 50, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 58, 59, - 60, 43, 43, 43, 43, 43, 62, 63, - 64, 67, 43, 48, 49, 50, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, - 43, 59, 60, 43, 43, 43, 43, 43, - 62, 63, 64, 67, 43, 48, 49, 50, - 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 60, 43, 43, 43, - 43, 43, 62, 63, 64, 67, 43, 69, - 68, 48, 49, 50, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 62, 63, - 64, 67, 43, 47, 48, 49, 50, 43, - 43, 43, 43, 43, 43, 55, 56, 57, - 43, 58, 59, 60, 43, 43, 43, 43, - 47, 62, 63, 64, 67, 43, 47, 48, - 49, 50, 43, 43, 43, 43, 43, 43, - 43, 56, 57, 43, 58, 59, 60, 43, - 43, 43, 43, 47, 62, 63, 64, 67, - 43, 47, 48, 49, 50, 43, 43, 43, - 43, 43, 43, 43, 43, 57, 43, 58, - 59, 60, 43, 43, 43, 43, 47, 62, - 63, 64, 67, 43, 46, 47, 48, 49, - 50, 43, 52, 46, 43, 43, 43, 55, - 56, 57, 43, 58, 59, 60, 43, 43, - 43, 43, 47, 62, 63, 64, 67, 43, - 46, 47, 48, 49, 50, 43, 43, 46, - 43, 43, 43, 55, 56, 57, 43, 58, - 59, 60, 43, 43, 43, 43, 47, 62, - 63, 64, 67, 43, 46, 47, 48, 49, - 50, 51, 52, 46, 43, 43, 43, 55, - 56, 57, 43, 58, 59, 60, 43, 43, - 43, 43, 47, 62, 63, 64, 67, 43, - 44, 1, 43, 43, 45, 43, 43, 43, - 43, 43, 43, 46, 47, 48, 49, 50, - 51, 52, 46, 53, 43, 54, 55, 56, - 57, 43, 58, 59, 60, 43, 43, 43, - 43, 61, 62, 63, 64, 1, 43, 44, - 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 66, 65, 65, - 65, 65, 65, 65, 65, 47, 48, 49, - 50, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 58, 59, 60, 65, 65, - 65, 65, 65, 62, 63, 64, 67, 65, - 71, 70, 11, 72, 44, 1, 43, 43, - 45, 43, 43, 43, 43, 43, 43, 46, - 47, 48, 49, 50, 51, 52, 46, 53, - 9, 54, 55, 56, 57, 43, 58, 59, - 60, 43, 17, 73, 43, 61, 62, 63, - 64, 1, 43, 17, 73, 74, 73, 74, - 3, 6, 75, 75, 76, 75, 75, 75, - 75, 75, 75, 18, 19, 20, 21, 22, - 23, 24, 18, 25, 27, 27, 28, 29, - 30, 75, 31, 32, 33, 75, 75, 75, - 75, 37, 38, 39, 40, 6, 75, 18, - 19, 20, 21, 22, 75, 75, 75, 75, - 75, 75, 28, 29, 30, 75, 31, 32, - 33, 75, 75, 75, 75, 19, 38, 39, - 40, 77, 75, 19, 20, 21, 22, 75, - 75, 75, 75, 75, 75, 75, 75, 75, - 75, 31, 32, 33, 75, 75, 75, 75, - 75, 38, 39, 40, 77, 75, 20, 21, - 22, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 38, 39, 40, 75, 21, - 22, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 38, 39, 40, 75, 22, - 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 38, 39, 40, 75, 38, 39, - 75, 39, 75, 20, 21, 22, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, - 31, 32, 33, 75, 75, 75, 75, 75, - 38, 39, 40, 77, 75, 20, 21, 22, - 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 32, 33, 75, 75, 75, - 75, 75, 38, 39, 40, 77, 75, 20, - 21, 22, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 33, 75, - 75, 75, 75, 75, 38, 39, 40, 77, - 75, 20, 21, 22, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 38, 39, - 40, 77, 75, 19, 20, 21, 22, 75, - 75, 75, 75, 75, 75, 28, 29, 30, - 75, 31, 32, 33, 75, 75, 75, 75, - 19, 38, 39, 40, 77, 75, 19, 20, - 21, 22, 75, 75, 75, 75, 75, 75, - 75, 29, 30, 75, 31, 32, 33, 75, - 75, 75, 75, 19, 38, 39, 40, 77, - 75, 19, 20, 21, 22, 75, 75, 75, - 75, 75, 75, 75, 75, 30, 75, 31, - 32, 33, 75, 75, 75, 75, 19, 38, - 39, 40, 77, 75, 18, 19, 20, 21, - 22, 75, 24, 18, 75, 75, 75, 28, - 29, 30, 75, 31, 32, 33, 75, 75, - 75, 75, 19, 38, 39, 40, 77, 75, - 18, 19, 20, 21, 22, 75, 75, 18, - 75, 75, 75, 28, 29, 30, 75, 31, - 32, 33, 75, 75, 75, 75, 19, 38, - 39, 40, 77, 75, 18, 19, 20, 21, - 22, 23, 24, 18, 75, 75, 75, 28, - 29, 30, 75, 31, 32, 33, 75, 75, - 75, 75, 19, 38, 39, 40, 77, 75, - 3, 6, 75, 75, 76, 75, 75, 75, - 75, 75, 75, 18, 19, 20, 21, 22, - 23, 24, 18, 25, 75, 27, 28, 29, - 30, 75, 31, 32, 33, 75, 75, 75, - 75, 37, 38, 39, 40, 6, 75, 3, - 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 4, 75, 75, - 75, 75, 75, 75, 75, 19, 20, 21, - 22, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 31, 32, 33, 75, 75, - 75, 75, 75, 38, 39, 40, 77, 75, - 3, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 4, 78, - 79, 75, 14, 75, 6, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 6, 78, 78, 78, - 6, 78, 9, 75, 75, 75, 9, 75, - 75, 75, 75, 75, 3, 6, 14, 75, - 76, 75, 75, 75, 75, 75, 75, 18, - 19, 20, 21, 22, 23, 24, 18, 25, - 26, 27, 28, 29, 30, 75, 31, 32, - 33, 75, 34, 35, 75, 37, 38, 39, - 40, 6, 75, 3, 6, 75, 75, 76, - 75, 75, 75, 75, 75, 75, 18, 19, - 20, 21, 22, 23, 24, 18, 25, 26, - 27, 28, 29, 30, 75, 31, 32, 33, - 75, 75, 75, 75, 37, 38, 39, 40, - 6, 75, 34, 35, 75, 35, 75, 9, - 78, 78, 78, 9, 78, 81, 80, 41, - 80, 41, 81, 80, 81, 80, 41, 80, - 42, 80, 0 + 1, 0, 2, 0, 3, 4, 5, 5, + 6, 7, 5, 5, 5, 5, 5, 1, + 8, 9, 5, 5, 5, 5, 10, 11, + 5, 5, 12, 13, 14, 15, 16, 17, + 18, 12, 19, 20, 21, 22, 23, 24, + 5, 25, 26, 27, 5, 28, 29, 30, + 31, 32, 33, 34, 8, 35, 5, 36, + 5, 38, 39, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 40, 41, 42, 43, + 44, 45, 46, 40, 47, 4, 48, 49, + 50, 51, 37, 52, 53, 54, 37, 37, + 37, 37, 55, 56, 57, 58, 39, 37, + 38, 39, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 40, 41, 42, 43, 44, + 45, 46, 40, 47, 48, 48, 49, 50, + 51, 37, 52, 53, 54, 37, 37, 37, + 37, 55, 56, 57, 58, 39, 37, 38, + 59, 40, 41, 42, 43, 44, 37, 37, + 37, 37, 37, 37, 49, 50, 51, 37, + 52, 53, 54, 37, 37, 37, 37, 41, + 56, 57, 58, 60, 37, 41, 42, 43, + 44, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 52, 53, 54, 37, 37, + 37, 37, 37, 56, 57, 58, 60, 37, + 42, 43, 44, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 56, 57, 58, + 37, 43, 44, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 56, 57, 58, + 37, 44, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 56, 57, 58, 37, + 56, 57, 37, 57, 37, 42, 43, 44, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 52, 53, 54, 37, 37, 37, + 37, 37, 56, 57, 58, 60, 37, 42, + 43, 44, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 53, 54, 37, + 37, 37, 37, 37, 56, 57, 58, 60, + 37, 42, 43, 44, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 54, 37, 37, 37, 37, 37, 56, 57, + 58, 60, 37, 62, 61, 42, 43, 44, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 56, 57, 58, 60, 37, 41, + 42, 43, 44, 37, 37, 37, 37, 37, + 37, 49, 50, 51, 37, 52, 53, 54, + 37, 37, 37, 37, 41, 56, 57, 58, + 60, 37, 41, 42, 43, 44, 37, 37, + 37, 37, 37, 37, 37, 50, 51, 37, + 52, 53, 54, 37, 37, 37, 37, 41, + 56, 57, 58, 60, 37, 41, 42, 43, + 44, 37, 37, 37, 37, 37, 37, 37, + 37, 51, 37, 52, 53, 54, 37, 37, + 37, 37, 41, 56, 57, 58, 60, 37, + 40, 41, 42, 43, 44, 37, 46, 40, + 37, 37, 37, 49, 50, 51, 37, 52, + 53, 54, 37, 37, 37, 37, 41, 56, + 57, 58, 60, 37, 40, 41, 42, 43, + 44, 37, 37, 40, 37, 37, 37, 49, + 50, 51, 37, 52, 53, 54, 37, 37, + 37, 37, 41, 56, 57, 58, 60, 37, + 40, 41, 42, 43, 44, 45, 46, 40, + 37, 37, 37, 49, 50, 51, 37, 52, + 53, 54, 37, 37, 37, 37, 41, 56, + 57, 58, 60, 37, 38, 39, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 40, + 41, 42, 43, 44, 45, 46, 40, 47, + 37, 48, 49, 50, 51, 37, 52, 53, + 54, 37, 37, 37, 37, 55, 56, 57, + 58, 39, 37, 38, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 59, + 59, 41, 42, 43, 44, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 52, + 53, 54, 59, 59, 59, 59, 59, 56, + 57, 58, 60, 59, 64, 63, 6, 65, + 38, 39, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 40, 41, 42, 43, 44, + 45, 46, 40, 47, 4, 48, 49, 50, + 51, 37, 52, 53, 54, 37, 11, 66, + 37, 55, 56, 57, 58, 39, 37, 11, + 66, 67, 66, 67, 1, 69, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 12, + 13, 14, 15, 16, 17, 18, 12, 19, + 21, 21, 22, 23, 24, 68, 25, 26, + 27, 68, 68, 68, 68, 31, 32, 33, + 34, 69, 68, 12, 13, 14, 15, 16, + 68, 68, 68, 68, 68, 68, 22, 23, + 24, 68, 25, 26, 27, 68, 68, 68, + 68, 13, 32, 33, 34, 70, 68, 13, + 14, 15, 16, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 25, 26, 27, + 68, 68, 68, 68, 68, 32, 33, 34, + 70, 68, 14, 15, 16, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 32, + 33, 34, 68, 15, 16, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 32, + 33, 34, 68, 16, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 32, 33, + 34, 68, 32, 33, 68, 33, 68, 14, + 15, 16, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 25, 26, 27, 68, + 68, 68, 68, 68, 32, 33, 34, 70, + 68, 14, 15, 16, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 26, + 27, 68, 68, 68, 68, 68, 32, 33, + 34, 70, 68, 14, 15, 16, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 27, 68, 68, 68, 68, 68, + 32, 33, 34, 70, 68, 14, 15, 16, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 32, 33, 34, 70, 68, 13, + 14, 15, 16, 68, 68, 68, 68, 68, + 68, 22, 23, 24, 68, 25, 26, 27, + 68, 68, 68, 68, 13, 32, 33, 34, + 70, 68, 13, 14, 15, 16, 68, 68, + 68, 68, 68, 68, 68, 23, 24, 68, + 25, 26, 27, 68, 68, 68, 68, 13, + 32, 33, 34, 70, 68, 13, 14, 15, + 16, 68, 68, 68, 68, 68, 68, 68, + 68, 24, 68, 25, 26, 27, 68, 68, + 68, 68, 13, 32, 33, 34, 70, 68, + 12, 13, 14, 15, 16, 68, 18, 12, + 68, 68, 68, 22, 23, 24, 68, 25, + 26, 27, 68, 68, 68, 68, 13, 32, + 33, 34, 70, 68, 12, 13, 14, 15, + 16, 68, 68, 12, 68, 68, 68, 22, + 23, 24, 68, 25, 26, 27, 68, 68, + 68, 68, 13, 32, 33, 34, 70, 68, + 12, 13, 14, 15, 16, 17, 18, 12, + 68, 68, 68, 22, 23, 24, 68, 25, + 26, 27, 68, 68, 68, 68, 13, 32, + 33, 34, 70, 68, 1, 69, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 12, + 13, 14, 15, 16, 17, 18, 12, 19, + 68, 21, 22, 23, 24, 68, 25, 26, + 27, 68, 68, 68, 68, 31, 32, 33, + 34, 69, 68, 1, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, + 68, 13, 14, 15, 16, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 25, + 26, 27, 68, 68, 68, 68, 68, 32, + 33, 34, 70, 68, 1, 71, 72, 68, + 9, 68, 4, 68, 68, 68, 4, 68, + 68, 68, 68, 68, 1, 69, 9, 68, + 68, 68, 68, 68, 68, 68, 68, 12, + 13, 14, 15, 16, 17, 18, 12, 19, + 20, 21, 22, 23, 24, 68, 25, 26, + 27, 68, 28, 29, 68, 31, 32, 33, + 34, 69, 68, 1, 69, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 12, 13, + 14, 15, 16, 17, 18, 12, 19, 20, + 21, 22, 23, 24, 68, 25, 26, 27, + 68, 68, 68, 68, 31, 32, 33, 34, + 69, 68, 28, 29, 68, 29, 68, 4, + 71, 71, 71, 4, 71, 74, 73, 35, + 73, 35, 74, 73, 74, 73, 35, 73, + 36, 73, 0 }; static const char _use_syllable_machine_trans_targs[] = { - 5, 8, 5, 35, 2, 5, 1, 46, - 5, 6, 5, 30, 32, 55, 56, 58, - 59, 33, 36, 37, 38, 39, 40, 50, - 51, 52, 60, 53, 47, 48, 49, 43, - 44, 45, 61, 62, 63, 54, 41, 42, - 5, 64, 66, 5, 7, 0, 10, 11, - 12, 13, 14, 25, 26, 27, 28, 22, - 23, 24, 17, 18, 19, 29, 15, 16, - 5, 5, 9, 20, 5, 21, 5, 31, - 5, 34, 5, 5, 3, 4, 5, 57, - 5, 65 + 2, 31, 42, 2, 3, 2, 26, 28, + 51, 52, 54, 29, 32, 33, 34, 35, + 36, 46, 47, 48, 55, 49, 43, 44, + 45, 39, 40, 41, 56, 57, 58, 50, + 37, 38, 2, 59, 61, 2, 4, 5, + 6, 7, 8, 9, 10, 21, 22, 23, + 24, 18, 19, 20, 13, 14, 15, 25, + 11, 12, 2, 2, 16, 2, 17, 2, + 27, 2, 30, 2, 2, 0, 1, 2, + 53, 2, 60 }; static const char _use_syllable_machine_trans_actions[] = { - 1, 0, 2, 3, 0, 4, 0, 5, - 8, 5, 9, 0, 5, 10, 0, 10, - 3, 0, 5, 5, 0, 0, 0, 5, - 5, 5, 3, 3, 5, 5, 5, 5, - 5, 5, 0, 0, 0, 3, 0, 0, - 11, 0, 0, 12, 5, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 5, 0, + 1, 2, 2, 5, 0, 6, 0, 0, + 0, 0, 2, 0, 2, 2, 0, 0, + 0, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 0, 0, 0, 2, + 0, 0, 7, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 13, 14, 0, 0, 15, 0, 16, 0, - 17, 0, 18, 19, 0, 0, 20, 0, - 21, 0 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 9, 10, 0, 11, 0, 12, + 0, 13, 0, 14, 15, 0, 0, 16, + 0, 17, 0 }; static const char _use_syllable_machine_to_state_actions[] = { - 0, 0, 0, 0, 0, 6, 0, 0, + 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 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, 0, 7, 0, 0, + 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 6, 0, 44, 44, - 66, 66, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 69, 44, 44, 44, - 44, 44, 44, 44, 44, 66, 71, 73, - 44, 75, 75, 76, 76, 76, 76, 76, - 76, 76, 76, 76, 76, 76, 76, 76, - 76, 76, 76, 76, 76, 76, 76, 79, - 76, 76, 79, 76, 76, 76, 76, 79, - 81, 81, 81 + 1, 1, 0, 38, 38, 60, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, + 62, 38, 38, 38, 38, 38, 38, 38, + 38, 60, 64, 66, 38, 68, 68, 69, + 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 72, 69, 69, 69, 69, + 69, 69, 72, 74, 74, 74 }; -static const int use_syllable_machine_start = 5; -static const int use_syllable_machine_first_final = 5; +static const int use_syllable_machine_start = 2; +static const int use_syllable_machine_first_final = 2; static const int use_syllable_machine_error = -1; -static const int use_syllable_machine_en_main = 5; +static const int use_syllable_machine_en_main = 2; #line 39 "hb-ot-shape-complex-use-machine.rl" -#line 166 "hb-ot-shape-complex-use-machine.rl" +#line 154 "hb-ot-shape-complex-use-machine.rl" #define found_syllable(syllable_type) \ @@ -350,7 +322,7 @@ static const int use_syllable_machine_en_main = 5; static bool not_standard_default_ignorable (const hb_glyph_info_t &i) -{ return !((i.use_category() == USE_O || i.use_category() == USE_Rsv) && _hb_glyph_info_is_default_ignorable (&i)); } +{ return !(i.use_category() == USE_O && _hb_glyph_info_is_default_ignorable (&i)); } static void find_syllables_use (hb_buffer_t *buffer) @@ -359,7 +331,8 @@ find_syllables_use (hb_buffer_t *buffer) auto p = + hb_iter (info, buffer->len) | hb_enumerate - | hb_filter (not_standard_default_ignorable, hb_second) + | hb_filter ([] (const hb_glyph_info_t &i) { return not_standard_default_ignorable (i); }, + hb_second) | hb_filter ([&] (const hb_pair_t p) { if (p.second.use_category() == USE_ZWNJ) @@ -378,7 +351,7 @@ find_syllables_use (hb_buffer_t *buffer) unsigned int act; int cs; -#line 382 "hb-ot-shape-complex-use-machine.hh" +#line 355 "hb-ot-shape-complex-use-machine.hh" { cs = use_syllable_machine_start; ts = 0; @@ -386,12 +359,12 @@ find_syllables_use (hb_buffer_t *buffer) act = 0; } -#line 209 "hb-ot-shape-complex-use-machine.rl" +#line 198 "hb-ot-shape-complex-use-machine.rl" unsigned int syllable_serial = 1; -#line 395 "hb-ot-shape-complex-use-machine.hh" +#line 368 "hb-ot-shape-complex-use-machine.hh" { int _slen; int _trans; @@ -401,11 +374,11 @@ find_syllables_use (hb_buffer_t *buffer) goto _test_eof; _resume: switch ( _use_syllable_machine_from_state_actions[cs] ) { - case 7: + case 4: #line 1 "NONE" {ts = p;} break; -#line 409 "hb-ot-shape-complex-use-machine.hh" +#line 382 "hb-ot-shape-complex-use-machine.hh" } _keys = _use_syllable_machine_trans_keys + (cs<<1); @@ -423,104 +396,76 @@ _eof_trans: goto _again; switch ( _use_syllable_machine_trans_actions[_trans] ) { - case 5: + case 2: #line 1 "NONE" {te = p+1;} break; - case 8: -#line 153 "hb-ot-shape-complex-use-machine.rl" + case 5: +#line 141 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (independent_cluster); }} break; - case 13: -#line 156 "hb-ot-shape-complex-use-machine.rl" + case 9: +#line 144 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (standard_cluster); }} break; - case 11: -#line 161 "hb-ot-shape-complex-use-machine.rl" + case 7: +#line 149 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (broken_cluster); }} break; - case 9: -#line 162 "hb-ot-shape-complex-use-machine.rl" + case 6: +#line 150 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (non_cluster); }} break; - case 14: -#line 154 "hb-ot-shape-complex-use-machine.rl" + case 10: +#line 142 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (virama_terminated_cluster); }} break; - case 15: -#line 155 "hb-ot-shape-complex-use-machine.rl" + case 11: +#line 143 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (sakot_terminated_cluster); }} break; - case 12: -#line 156 "hb-ot-shape-complex-use-machine.rl" + case 8: +#line 144 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (standard_cluster); }} break; - case 17: -#line 157 "hb-ot-shape-complex-use-machine.rl" + case 13: +#line 145 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (number_joiner_terminated_cluster); }} break; - case 16: -#line 158 "hb-ot-shape-complex-use-machine.rl" + case 12: +#line 146 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (numeral_cluster); }} break; - case 18: -#line 159 "hb-ot-shape-complex-use-machine.rl" + case 14: +#line 147 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (symbol_cluster); }} break; - case 21: -#line 160 "hb-ot-shape-complex-use-machine.rl" + case 17: +#line 148 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (hieroglyph_cluster); }} break; - case 19: -#line 161 "hb-ot-shape-complex-use-machine.rl" + case 15: +#line 149 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (broken_cluster); }} break; - case 20: -#line 162 "hb-ot-shape-complex-use-machine.rl" + case 16: +#line 150 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (non_cluster); }} break; case 1: -#line 156 "hb-ot-shape-complex-use-machine.rl" - {{p = ((te))-1;}{ found_syllable (standard_cluster); }} - break; - case 4: -#line 161 "hb-ot-shape-complex-use-machine.rl" +#line 149 "hb-ot-shape-complex-use-machine.rl" {{p = ((te))-1;}{ found_syllable (broken_cluster); }} break; - case 2: -#line 1 "NONE" - { switch( act ) { - case 9: - {{p = ((te))-1;} found_syllable (broken_cluster); } - break; - case 10: - {{p = ((te))-1;} found_syllable (non_cluster); } - break; - } - } - break; - case 3: -#line 1 "NONE" - {te = p+1;} -#line 161 "hb-ot-shape-complex-use-machine.rl" - {act = 9;} - break; - case 10: -#line 1 "NONE" - {te = p+1;} -#line 162 "hb-ot-shape-complex-use-machine.rl" - {act = 10;} - break; -#line 515 "hb-ot-shape-complex-use-machine.hh" +#line 460 "hb-ot-shape-complex-use-machine.hh" } _again: switch ( _use_syllable_machine_to_state_actions[cs] ) { - case 6: + case 3: #line 1 "NONE" {ts = 0;} break; -#line 524 "hb-ot-shape-complex-use-machine.hh" +#line 469 "hb-ot-shape-complex-use-machine.hh" } if ( ++p != pe ) @@ -536,7 +481,7 @@ _again: } -#line 214 "hb-ot-shape-complex-use-machine.rl" +#line 203 "hb-ot-shape-complex-use-machine.rl" } diff --git a/src/hb-ot-shape-complex-use-machine.rl b/src/hb-ot-shape-complex-use-machine.rl index 62997c94c..da8e4a27b 100644 --- a/src/hb-ot-shape-complex-use-machine.rl +++ b/src/hb-ot-shape-complex-use-machine.rl @@ -45,26 +45,15 @@ O = 0; # OTHER B = 1; # BASE -IND = 3; # BASE_IND N = 4; # BASE_NUM GB = 5; # BASE_OTHER -#F = 7; # CONS_FINAL -#FM = 8; # CONS_FINAL_MOD -#M = 9; # CONS_MED -#CM = 10; # CONS_MOD SUB = 11; # CONS_SUB H = 12; # HALANT HN = 13; # HALANT_NUM ZWNJ = 14; # Zero width non-joiner -ZWJ = 15; # Zero width joiner -WJ = 16; # Word joiner -Rsv = 17; # Reserved characters R = 18; # REPHA S = 19; # SYM -#SM = 20; # SYM_MOD -#V = 36; # VOWEL -#VM = 40; # VOWEL_MOD CS = 43; # CONS_WITH_STACKER HVM = 44; # HALANT_OR_VOWEL_MODIFIER Sk = 48; # SAKOT @@ -98,8 +87,7 @@ FMPst = 47; # CONS_FINAL_MOD UIPC = Not_Applicable h = H | HVM | Sk; -# Override: Adhoc ZWJ placement. https://github.com/harfbuzz/harfbuzz/issues/542#issuecomment-353169729 -consonant_modifiers = CMAbv* CMBlw* ((ZWJ?.h.ZWJ? B | SUB) CMAbv? CMBlw*)*; +consonant_modifiers = CMAbv* CMBlw* ((h B | SUB) CMAbv? CMBlw*)*; medial_consonants = MPre? MAbv? MBlw? MPst?; dependent_vowels = VPre* VAbv* VBlw* VPst*; vowel_modifiers = HVM? VMPre* VMAbv* VMBlw* VMPst*; @@ -126,7 +114,7 @@ symbol_cluster_tail = SMAbv+ SMBlw* | SMBlw+; virama_terminated_cluster = complex_syllable_start consonant_modifiers - ZWJ?.h.ZWJ? + h ; sakot_terminated_cluster = complex_syllable_start @@ -146,7 +134,7 @@ number_joiner_terminated_cluster = N number_joiner_terminated_cluster_tail; numeral_cluster = N numeral_cluster_tail?; symbol_cluster = (S | GB) symbol_cluster_tail?; hieroglyph_cluster = SB+ | SB* G SE* (J SE* (G SE*)?)*; -independent_cluster = (IND | O | Rsv | WJ); +independent_cluster = O; other = any; main := |* @@ -176,7 +164,7 @@ main := |* static bool not_standard_default_ignorable (const hb_glyph_info_t &i) -{ return !((i.use_category() == USE_O || i.use_category() == USE_Rsv) && _hb_glyph_info_is_default_ignorable (&i)); } +{ return !(i.use_category() == USE_O && _hb_glyph_info_is_default_ignorable (&i)); } static void find_syllables_use (hb_buffer_t *buffer) @@ -185,7 +173,8 @@ find_syllables_use (hb_buffer_t *buffer) auto p = + hb_iter (info, buffer->len) | hb_enumerate - | hb_filter (not_standard_default_ignorable, hb_second) + | hb_filter ([] (const hb_glyph_info_t &i) { return not_standard_default_ignorable (i); }, + hb_second) | hb_filter ([&] (const hb_pair_t p) { if (p.second.use_category() == USE_ZWNJ) diff --git a/src/hb-ot-shape-complex-use-table.cc b/src/hb-ot-shape-complex-use-table.cc index 1e05f9a51..df3652b18 100644 --- a/src/hb-ot-shape-complex-use-table.cc +++ b/src/hb-ot-shape-complex-use-table.cc @@ -46,19 +46,15 @@ #define H USE_H /* HALANT */ #define HN USE_HN /* HALANT_NUM */ #define HVM USE_HVM /* HALANT_OR_VOWEL_MODIFIER */ -#define IND USE_IND /* BASE_IND */ #define J USE_J /* HIEROGLYPH_JOINER */ #define N USE_N /* BASE_NUM */ #define O USE_O /* OTHER */ #define R USE_R /* REPHA */ -#define Rsv USE_Rsv /* Reserved */ #define S USE_S /* SYM */ #define SB USE_SB /* HIEROGLYPH_SEGMENT_BEGIN */ #define SE USE_SE /* HIEROGLYPH_SEGMENT_END */ #define SUB USE_SUB /* CONS_SUB */ #define Sk USE_Sk /* SAKOT */ -#define WJ USE_WJ /* Word_Joiner */ -#define ZWJ USE_ZWJ /* ZWJ */ #define ZWNJ USE_ZWNJ /* ZWNJ */ #define CMAbv USE_CMAbv #define CMBlw USE_CMBlw @@ -148,7 +144,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0990 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 09A0 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, /* 09B0 */ B, O, B, O, O, O, B, B, B, B, O, O, CMBlw, B, VPst, VPre, - /* 09C0 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, O, O, VPre, VPre, H, IND, O, + /* 09C0 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, O, O, VPre, VPre, H, O, O, /* 09D0 */ O, O, O, O, O, O, O, VPst, O, O, O, O, B, B, O, B, /* 09E0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, /* 09F0 */ B, B, O, O, O, O, O, O, O, O, O, O, B, O, FMAbv, O, @@ -188,7 +184,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* Tamil */ - /* 0B80 */ O, O, VMAbv, IND, O, B, B, B, B, B, B, O, O, O, B, B, + /* 0B80 */ O, O, VMAbv, O, O, B, B, B, B, B, B, O, O, O, B, B, /* 0B90 */ B, O, B, B, B, B, O, O, O, B, B, O, B, O, B, B, /* 0BA0 */ O, O, O, B, B, O, O, O, B, B, B, O, O, O, B, B, /* 0BB0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, VPst, VPst, @@ -226,9 +222,9 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0D20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 0D30 */ B, B, B, B, B, B, B, B, B, B, B, VAbv, VAbv, B, VPst, VPst, /* 0D40 */ VPst, VPst, VPst, VBlw, VBlw, O, VPre, VPre, VPre, O, VPre, VPre, VPre, H, R, O, - /* 0D50 */ O, O, O, O, IND, IND, IND, VPst, O, O, O, O, O, O, O, B, + /* 0D50 */ O, O, O, O, O, O, O, VPst, O, O, O, O, O, O, O, B, /* 0D60 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B, - /* 0D70 */ O, O, O, O, O, O, O, O, O, O, IND, IND, IND, IND, IND, IND, + /* 0D70 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, /* Sinhala */ @@ -253,8 +249,8 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0F40 */ B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, B, /* 0F50 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 0F60 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, - /* 0F70 */ O, CMBlw, VBlw, VAbv, VAbv, VBlw, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VMAbv, IND, - /* 0F80 */ VBlw, VAbv, VMAbv, VMAbv, VBlw, IND, VMAbv, VMAbv, B, B, B, B, B, SUB, SUB, SUB, + /* 0F70 */ O, CMBlw, VBlw, VAbv, VAbv, VBlw, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VMAbv, O, + /* 0F80 */ VBlw, VAbv, VMAbv, VMAbv, VBlw, O, VMAbv, VMAbv, B, B, B, B, B, SUB, SUB, SUB, /* 0F90 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, /* 0FA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, /* 0FB0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, O, O, @@ -411,7 +407,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1CD0 */ VMAbv, VMAbv, VMAbv, O, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMAbv, VMAbv, VMBlw, VMBlw, VMBlw, VMBlw, /* 1CE0 */ VMAbv, VMPst, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, O, O, O, O, VMBlw, O, O, - /* 1CF0 */ O, O, IND, IND, VMAbv, CS, CS, VMPst, VMAbv, VMAbv, GB, O, O, O, O, O, + /* 1CF0 */ O, O, O, O, VMAbv, CS, CS, VMPst, VMAbv, VMAbv, GB, O, O, O, O, O, #define use_offset_0x1df8u 3040 @@ -423,32 +419,31 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* General Punctuation */ - O, O, O, O, ZWNJ, ZWJ, O, O, + O, O, O, O, ZWNJ, O, O, O, /* 2010 */ GB, GB, GB, GB, GB, O, O, O, -#define use_offset_0x2060u 3064 +#define use_offset_0x2070u 3064 - /* 2060 */ WJ, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, /* Superscripts and Subscripts */ /* 2070 */ O, O, O, O, FMPst, O, O, O, O, O, O, O, O, O, O, O, /* 2080 */ O, O, FMPst, FMPst, FMPst, O, O, O, -#define use_offset_0x20f0u 3104 +#define use_offset_0x20f0u 3088 /* Combining Diacritical Marks for Symbols */ /* 20F0 */ VMAbv, O, O, O, O, O, O, O, -#define use_offset_0x25c8u 3112 +#define use_offset_0x25c8u 3096 /* Geometric Shapes */ O, O, O, O, B, O, O, O, -#define use_offset_0x2d30u 3120 +#define use_offset_0x2d30u 3104 /* Tifinagh */ @@ -459,7 +454,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 2D60 */ B, B, B, B, B, B, B, B, O, O, O, O, O, O, O, B, /* 2D70 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, H, -#define use_offset_0xa800u 3200 +#define use_offset_0xa800u 3184 /* Syloti Nagri */ @@ -546,7 +541,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* AAE0 */ B, B, B, B, B, B, B, B, B, B, B, VPre, VBlw, VAbv, VPre, VPst, /* AAF0 */ O, O, O, O, O, VMPst, H, O, -#define use_offset_0xabc0u 3960 +#define use_offset_0xabc0u 3944 /* Meetei Mayek */ @@ -556,7 +551,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* ABE0 */ B, B, B, VPst, VPst, VAbv, VPst, VPst, VBlw, VPst, VPst, O, VMPst, VBlw, O, O, /* ABF0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x10a00u 4024 +#define use_offset_0x10a00u 4008 /* Kharoshthi */ @@ -567,7 +562,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 10A30 */ B, B, B, B, B, B, O, O, CMAbv, CMBlw, CMBlw, O, O, O, O, H, /* 10A40 */ B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, O, -#define use_offset_0x10ac0u 4104 +#define use_offset_0x10ac0u 4088 /* Manichaean */ @@ -576,7 +571,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 10AD0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 10AE0 */ B, B, B, B, B, CMBlw, CMBlw, O, -#define use_offset_0x10b80u 4144 +#define use_offset_0x10b80u 4128 /* Psalter Pahlavi */ @@ -585,7 +580,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 10B90 */ B, B, O, O, O, O, O, O, O, O, O, O, O, O, O, O, /* 10BA0 */ O, O, O, O, O, O, O, O, O, B, B, B, B, B, B, O, -#define use_offset_0x10d00u 4192 +#define use_offset_0x10d00u 4176 /* Hanifi Rohingya */ @@ -595,7 +590,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 10D20 */ B, B, B, B, VMAbv, VMAbv, VMAbv, CMAbv, O, O, O, O, O, O, O, O, /* 10D30 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x10e80u 4256 +#define use_offset_0x10e80u 4240 /* Yezidi */ @@ -605,7 +600,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 10EA0 */ B, B, B, B, B, B, B, B, B, B, O, VAbv, VAbv, O, O, O, /* 10EB0 */ B, B, O, O, O, O, O, O, -#define use_offset_0x10f30u 4312 +#define use_offset_0x10f30u 4296 /* Sogdian */ @@ -614,7 +609,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 10F40 */ B, B, B, B, B, B, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, /* 10F50 */ VMBlw, B, B, B, B, O, O, O, -#define use_offset_0x10fb0u 4352 +#define use_offset_0x10fb0u 4336 /* Chorasmian */ @@ -643,7 +638,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 110A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 110B0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VPst, VPst, H, CMBlw, O, O, O, O, O, -#define use_offset_0x11100u 4624 +#define use_offset_0x11100u 4608 /* Chakma */ @@ -681,7 +676,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11220 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VBlw, /* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv, O, O, O, O, O, O, VMAbv, O, -#define use_offset_0x11280u 4944 +#define use_offset_0x11280u 4928 /* Multani */ @@ -709,7 +704,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11360 */ B, B, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, /* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, -#define use_offset_0x11400u 5192 +#define use_offset_0x11400u 5176 /* Newa */ @@ -732,7 +727,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 114C0 */ VMAbv, VMAbv, H, CMBlw, B, O, O, O, O, O, O, O, O, O, O, O, /* 114D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x11580u 5416 +#define use_offset_0x11580u 5400 /* Siddham */ @@ -775,7 +770,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11720 */ VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VBlw, VAbv, VAbv, VMAbv, O, O, O, O, /* 11730 */ B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, -#define use_offset_0x11800u 5864 +#define use_offset_0x11800u 5848 /* Dogra */ @@ -785,7 +780,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11820 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPre, VPst, VBlw, /* 11830 */ VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, VMAbv, VMPst, H, CMBlw, O, O, O, O, O, -#define use_offset_0x11900u 5928 +#define use_offset_0x11900u 5912 /* Dives Akuru */ @@ -797,7 +792,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11940 */ MPst, R, MPst, CMBlw, O, O, O, O, O, O, O, O, O, O, O, O, /* 11950 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x119a0u 6024 +#define use_offset_0x119a0u 6008 /* Nandinagari */ @@ -825,7 +820,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11A80 */ B, B, B, B, R, R, R, R, R, R, FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, /* 11A90 */ FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, VMAbv, VMPst, CMAbv, H, O, O, O, B, O, O, -#define use_offset_0x11c00u 6280 +#define use_offset_0x11c00u 6264 /* Bhaiksuki */ @@ -846,7 +841,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11CA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, /* 11CB0 */ VBlw, VPre, VBlw, VAbv, VPst, VMAbv, VMAbv, O, -#define use_offset_0x11d00u 6464 +#define use_offset_0x11d00u 6448 /* Masaram Gondi */ @@ -866,7 +861,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11D90 */ VAbv, VAbv, O, VPst, VPst, VMAbv, VMPst, H, O, O, O, O, O, O, O, O, /* 11DA0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x11ee0u 6640 +#define use_offset_0x11ee0u 6624 /* Makasar */ @@ -874,7 +869,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11EE0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11EF0 */ B, B, GB, VAbv, VBlw, VPre, VPst, O, -#define use_offset_0x13000u 6664 +#define use_offset_0x13000u 6648 /* Egyptian Hieroglyphs */ @@ -951,7 +946,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 13430 */ J, J, J, J, J, J, J, SB, SE, O, O, O, O, O, O, O, -#define use_offset_0x16b00u 7752 +#define use_offset_0x16b00u 7736 /* Pahawh Hmong */ @@ -961,7 +956,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 16B20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 16B30 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, -#define use_offset_0x16f00u 7808 +#define use_offset_0x16f00u 7792 /* Miao */ @@ -971,20 +966,20 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 16F20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 16F30 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 16F40 */ B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, CMBlw, - /* 16F50 */ IND, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, + /* 16F50 */ O, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, /* 16F60 */ VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, /* 16F70 */ VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, /* 16F80 */ VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, O, O, O, O, O, O, O, VMBlw, /* 16F90 */ VMBlw, VMBlw, VMBlw, O, O, O, O, O, -#define use_offset_0x16fe0u 7960 +#define use_offset_0x16fe0u 7944 /* Ideographic Symbols and Punctuation */ /* 16FE0 */ O, O, O, O, B, O, O, O, -#define use_offset_0x18b00u 7968 +#define use_offset_0x18b00u 7952 /* Khitan Small Script */ @@ -1020,7 +1015,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 18CC0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 18CD0 */ B, B, B, B, B, B, O, O, -#define use_offset_0x1bc00u 8440 +#define use_offset_0x1bc00u 8424 /* Duployan */ @@ -1036,7 +1031,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1BC80 */ B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, O, /* 1BC90 */ B, B, B, B, B, B, B, B, B, B, O, O, O, CMBlw, CMBlw, O, -#define use_offset_0x1e100u 8600 +#define use_offset_0x1e100u 8584 /* Nyiakeng Puachue Hmong */ @@ -1047,7 +1042,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1E130 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, B, B, B, B, B, B, B, O, O, /* 1E140 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, B, B, -#define use_offset_0x1e2c0u 8680 +#define use_offset_0x1e2c0u 8664 /* Wancho */ @@ -1057,7 +1052,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1E2E0 */ B, B, B, B, B, B, B, B, B, B, B, B, VMAbv, VMAbv, VMAbv, VMAbv, /* 1E2F0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x1e900u 8744 +#define use_offset_0x1e900u 8728 /* Adlam */ @@ -1069,7 +1064,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1E940 */ B, B, B, B, CMAbv, CMAbv, CMAbv, CMAbv, CMAbv, CMAbv, CMAbv, B, O, O, O, O, /* 1E950 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -}; /* Table items: 8840; occupancy: 79% */ +}; /* Table items: 8824; occupancy: 79% */ USE_TABLE_ELEMENT_TYPE hb_use_get_category (hb_codepoint_t u) @@ -1097,7 +1092,7 @@ hb_use_get_category (hb_codepoint_t u) case 0x2u: if (hb_in_range (u, 0x2008u, 0x2017u)) return use_table[u - 0x2008u + use_offset_0x2008u]; - if (hb_in_range (u, 0x2060u, 0x2087u)) return use_table[u - 0x2060u + use_offset_0x2060u]; + if (hb_in_range (u, 0x2070u, 0x2087u)) return use_table[u - 0x2070u + use_offset_0x2070u]; if (hb_in_range (u, 0x20F0u, 0x20F7u)) return use_table[u - 0x20F0u + use_offset_0x20f0u]; if (hb_in_range (u, 0x25C8u, 0x25CFu)) return use_table[u - 0x25C8u + use_offset_0x25c8u]; if (hb_in_range (u, 0x2D30u, 0x2D7Fu)) return use_table[u - 0x2D30u + use_offset_0x2d30u]; @@ -1169,19 +1164,15 @@ hb_use_get_category (hb_codepoint_t u) #undef H #undef HN #undef HVM -#undef IND #undef J #undef N #undef O #undef R -#undef Rsv #undef S #undef SB #undef SE #undef SUB #undef Sk -#undef WJ -#undef ZWJ #undef ZWNJ #undef CMAbv #undef CMBlw diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index d789b9df0..19a272ce1 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc @@ -387,8 +387,7 @@ reorder_syllable_use (hb_buffer_t *buffer, unsigned int start, unsigned int end) hb_glyph_info_t *info = buffer->info; -#define POST_BASE_FLAGS64 (FLAG64 (USE_FM) | \ - FLAG64 (USE_FAbv) | \ +#define POST_BASE_FLAGS64 (FLAG64 (USE_FAbv) | \ FLAG64 (USE_FBlw) | \ FLAG64 (USE_FPst) | \ FLAG64 (USE_MAbv) | \ diff --git a/src/hb-ot-shape-complex-use.hh b/src/hb-ot-shape-complex-use.hh index 1ed3b5a85..788fb6b6a 100644 --- a/src/hb-ot-shape-complex-use.hh +++ b/src/hb-ot-shape-complex-use.hh @@ -46,26 +46,15 @@ enum use_category_t { USE_O = 0, /* OTHER */ USE_B = 1, /* BASE */ - USE_IND = 3, /* BASE_IND */ USE_N = 4, /* BASE_NUM */ USE_GB = 5, /* BASE_OTHER */ -// USE_F = 7, /* CONS_FINAL */ - USE_FM = 8, /* CONS_FINAL_MOD */ -// USE_M = 9, /* CONS_MED */ -// USE_CM = 10, /* CONS_MOD */ USE_SUB = 11, /* CONS_SUB */ USE_H = 12, /* HALANT */ USE_HN = 13, /* HALANT_NUM */ USE_ZWNJ = 14, /* Zero width non-joiner */ - USE_ZWJ = 15, /* Zero width joiner */ - USE_WJ = 16, /* Word joiner */ - USE_Rsv = 17, /* Reserved characters */ USE_R = 18, /* REPHA */ USE_S = 19, /* SYM */ -// USE_SM = 20, /* SYM_MOD */ -// USE_V = 36, /* VOWEL */ -// USE_VM = 40, /* VOWEL_MOD */ USE_CS = 43, /* CONS_WITH_STACKER */ /* https://github.com/harfbuzz/harfbuzz/issues/1102 */ diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index 42bf524d1..7d00a35ab 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -301,7 +301,7 @@ position_mark (const hb_ot_shape_plan_t *plan HB_UNUSED, /* Don't shift down "above" marks too much. */ if ((y_gap > 0) != (pos.y_offset > 0)) { - unsigned int correction = -pos.y_offset / 2; + int correction = -pos.y_offset / 2; base_extents.y_bearing += correction; base_extents.height -= correction; pos.y_offset += correction; diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index fe0444987..010a6f2c8 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -1155,6 +1155,12 @@ _hb_ot_shape (hb_shape_plan_t *shape_plan, /** * hb_ot_shape_plan_collect_lookups: + * @shape_plan: #hb_shape_plan_t to query + * @table_tag: GSUB or GPOS + * @lookup_indexes: (out): The #hb_set_t set of lookups returned + * + * Computes the complete set of GSUB or GPOS lookups that are applicable + * under a given @shape_plan. * * Since: 0.9.7 **/ @@ -1189,6 +1195,15 @@ add_char (hb_font_t *font, /** * hb_ot_shape_glyphs_closure: + * @font: #hb_font_t to work upon + * @buffer: The input buffer to compute from + * @features: (array length=num_features): The features enabled on the buffer + * @num_features: The number of features enabled on the buffer + * @glyphs: (out): The #hb_set_t set of glyphs comprising the transitive closure of the query + * + * Computes the transitive closure of glyphs needed for a specified + * input buffer under the given font and feature list. The closure is + * computed as a set, not as a list. * * Since: 0.9.2 **/ diff --git a/src/hb-ot-tag-table.hh b/src/hb-ot-tag-table.hh index 30d732d79..561ed4280 100644 --- a/src/hb-ot-tag-table.hh +++ b/src/hb-ot-tag-table.hh @@ -7,7 +7,7 @@ * on files with these headers: * * - * File-Date: 2020-07-17 + * File-Date: 2020-09-29 */ #ifndef HB_OT_TAG_TABLE_HH @@ -68,6 +68,7 @@ static const LangTag ot_languages[] = { {"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 */ + {"ary", HB_TAG('A','R','A',' ')}, /* Moroccan Arabic -> Arabic */ {"arz", HB_TAG('A','R','A',' ')}, /* Egyptian Arabic -> Arabic */ {"as", HB_TAG('A','S','M',' ')}, /* Assamese */ /*{"ast", HB_TAG('A','S','T',' ')},*/ /* Asturian */ @@ -86,7 +87,8 @@ static const LangTag ot_languages[] = { {"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 */ + {"azb", HB_TAG('A','Z','B',' ')}, /* South Azerbaijani -> Torki */ + {"azb", HB_TAG('A','Z','E',' ')}, /* South Azerbaijani -> Azerbaijani */ {"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] */ @@ -115,7 +117,8 @@ static const LangTag ot_languages[] = { /*{"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 */ + {"bgq", HB_TAG('B','G','Q',' ')}, /* Bagri */ + {"bgq", HB_TAG('R','A','J',' ')}, /* Bagri -> Rajasthani */ {"bgr", HB_TAG('Q','I','N',' ')}, /* Bawm Chin -> Chin */ {"bhb", HB_TAG('B','H','I',' ')}, /* Bhili */ /*{"bhi", HB_TAG('B','H','I',' ')},*/ /* Bhilali -> Bhili */ @@ -171,6 +174,7 @@ static const LangTag ot_languages[] = { {"ce", HB_TAG('C','H','E',' ')}, /* Chechen */ /*{"ceb", HB_TAG('C','E','B',' ')},*/ /* Cebuano */ {"cfm", HB_TAG('H','A','L',' ')}, /* Halam (Falam Chin) */ + {"cfm", HB_TAG('Q','I','N',' ')}, /* Falam Chin -> 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 */ @@ -213,14 +217,23 @@ static const LangTag ot_languages[] = { {"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) */ + {"cqu", HB_TAG('Q','U','Z',' ')}, /* Chilean Quechua (retired code) -> Quechua */ {"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 */ + {"crj", HB_TAG('C','R','E',' ')}, /* Southern East Cree -> Cree */ + {"crj", HB_TAG('Y','C','R',' ')}, /* Southern East Cree -> Y-Cree */ {"crk", HB_TAG('W','C','R',' ')}, /* Plains Cree -> West-Cree */ + {"crk", HB_TAG('C','R','E',' ')}, /* Plains Cree -> Cree */ + {"crk", HB_TAG('Y','C','R',' ')}, /* Plains Cree -> Y-Cree */ {"crl", HB_TAG('E','C','R',' ')}, /* Northern East Cree -> Eastern Cree */ + {"crl", HB_TAG('C','R','E',' ')}, /* Northern East Cree -> Cree */ + {"crl", HB_TAG('Y','C','R',' ')}, /* Northern East Cree -> Y-Cree */ {"crm", HB_TAG('M','C','R',' ')}, /* Moose Cree */ {"crm", HB_TAG('L','C','R',' ')}, /* Moose Cree -> L-Cree */ + {"crm", HB_TAG('C','R','E',' ')}, /* Moose Cree -> Cree */ + {"crm", HB_TAG('Y','C','R',' ')}, /* Moose Cree -> Y-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 */ @@ -232,6 +245,8 @@ static const LangTag ot_languages[] = { {"csp", HB_TAG('Z','H','S',' ')}, /* Southern Ping Chinese -> Chinese Simplified */ {"csw", HB_TAG('N','C','R',' ')}, /* Swampy Cree -> N-Cree */ {"csw", HB_TAG('N','H','C',' ')}, /* Swampy Cree -> Norway House Cree */ + {"csw", HB_TAG('C','R','E',' ')}, /* Swampy Cree -> Cree */ + {"csw", HB_TAG('Y','C','R',' ')}, /* Swampy Cree -> Y-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 */ @@ -246,6 +261,8 @@ static const LangTag ot_languages[] = { {"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 */ + {"cwd", HB_TAG('C','R','E',' ')}, /* Woods Cree -> Cree */ + {"cwd", HB_TAG('Y','C','R',' ')}, /* Woods Cree -> Y-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 */ @@ -258,7 +275,8 @@ static const LangTag ot_languages[] = { {"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 */ + {"dgo", HB_TAG('D','G','O',' ')}, /* Dogri */ + {"dgo", HB_TAG('D','G','R',' ')}, /* Dogri */ {"dgr", HB_TAG('A','T','H',' ')}, /* Dogrib -> Athapaskan */ {"dhd", HB_TAG('M','A','W',' ')}, /* Dhundari -> Marwari */ /*{"dhg", HB_TAG('D','H','G',' ')},*/ /* Dhangu */ @@ -266,7 +284,8 @@ static const LangTag ot_languages[] = { {"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 */ + {"diq", HB_TAG('D','I','Q',' ')}, /* Dimli */ + {"diq", HB_TAG('Z','Z','A',' ')}, /* Dimli -> Zazaki */ {"diw", HB_TAG('D','N','K',' ')}, /* Northwestern Dinka -> Dinka */ {"dje", HB_TAG('D','J','R',' ')}, /* Zarma */ {"djr", HB_TAG('D','J','R','0')}, /* Djambarrpuyngu */ @@ -276,6 +295,7 @@ static const LangTag ot_languages[] = { {"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 */ + {"drw", HB_TAG('F','A','R',' ')}, /* Darwazi (retired code) -> Persian */ {"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) */ @@ -312,7 +332,10 @@ static const LangTag ot_languages[] = { {"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 */ + {"fan", HB_TAG('B','T','I',' ')}, /* Fang (Equatorial Guinea) -> Beti */ + {"fat", HB_TAG('F','A','T',' ')}, /* Fanti */ + {"fat", HB_TAG('A','K','A',' ')}, /* Fanti -> Akan */ + {"fat", HB_TAG('T','W','I',' ')}, /* Fanti -> Twi */ {"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 */ @@ -331,11 +354,13 @@ static const LangTag ot_languages[] = { {"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 */ + {"fuf", HB_TAG('F','U','L',' ')}, /* Pular -> Fulah */ {"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 */ + {"fuv", HB_TAG('F','U','V',' ')}, /* Nigerian Fulfulde */ + {"fuv", HB_TAG('F','U','L',' ')}, /* Nigerian Fulfulde -> Fulah */ {"fy", HB_TAG('F','R','I',' ')}, /* Western Frisian -> Frisian */ {"ga", HB_TAG('I','R','I',' ')}, /* Irish */ {"gaa", HB_TAG('G','A','D',' ')}, /* Ga */ @@ -352,7 +377,8 @@ static const LangTag ot_languages[] = { /*{"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) */ + {"gkp", HB_TAG('G','K','P',' ')}, /* Guinea Kpelle -> Kpelle (Guinea) */ + {"gkp", HB_TAG('K','P','L',' ')}, /* Guinea Kpelle -> Kpelle */ {"gl", HB_TAG('G','A','L',' ')}, /* Galician */ {"gld", HB_TAG('N','A','N',' ')}, /* Nanai */ /*{"glk", HB_TAG('G','L','K',' ')},*/ /* Gilaki */ @@ -415,6 +441,7 @@ static const LangTag ot_languages[] = { {"hoc", HB_TAG('H','O',' ',' ')}, /* Ho */ {"hoi", HB_TAG('A','T','H',' ')}, /* Holikachuk -> Athapaskan */ {"hoj", HB_TAG('H','A','R',' ')}, /* Hadothi -> Harauti */ + {"hoj", HB_TAG('R','A','J',' ')}, /* Hadothi -> Rajasthani */ {"hr", HB_TAG('H','R','V',' ')}, /* Croatian */ {"hrm", HB_TAG('H','M','N',' ')}, /* Horned Miao -> Hmong */ {"hsb", HB_TAG('U','S','B',' ')}, /* Upper Sorbian */ @@ -431,6 +458,7 @@ static const LangTag ot_languages[] = { /*{"iba", HB_TAG('I','B','A',' ')},*/ /* Iban */ /*{"ibb", HB_TAG('I','B','B',' ')},*/ /* Ibibio */ {"id", HB_TAG('I','N','D',' ')}, /* Indonesian */ + {"id", HB_TAG('M','L','Y',' ')}, /* Indonesian -> Malay */ {"ida", HB_TAG('L','U','H',' ')}, /* Idakho-Isukha-Tiriki -> Luyia */ {"ie", HB_TAG('I','L','E',' ')}, /* Interlingue */ {"ig", HB_TAG('I','B','O',' ')}, /* Igbo */ @@ -443,6 +471,7 @@ static const LangTag ot_languages[] = { {"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) */ + {"in", HB_TAG('M','L','Y',' ')}, /* Indonesian (retired code) -> Malay */ {"ing", HB_TAG('A','T','H',' ')}, /* Degexit'an -> Athapaskan */ {"inh", HB_TAG('I','N','G',' ')}, /* Ingush */ {"io", HB_TAG('I','D','O',' ')}, /* Ido */ @@ -487,7 +516,8 @@ static const LangTag ot_languages[] = { {"kht", HB_TAG('K','H','N',' ')}, /* Khamti -> Khamti Shan (Microsoft fonts) */ /*{"khw", HB_TAG('K','H','W',' ')},*/ /* Khowar */ {"ki", HB_TAG('K','I','K',' ')}, /* Kikuyu (Gikuyu) */ -/*{"kiu", HB_TAG('K','I','U',' ')},*/ /* Kirmanjki */ + {"kiu", HB_TAG('K','I','U',' ')}, /* Kirmanjki */ + {"kiu", HB_TAG('Z','Z','A',' ')}, /* Kirmanjki -> Zazaki */ {"kj", HB_TAG('K','U','A',' ')}, /* Kuanyama */ /*{"kjd", HB_TAG('K','J','D',' ')},*/ /* Southern Kiwai */ {"kjh", HB_TAG('K','H','A',' ')}, /* Khakas -> Khakass */ @@ -508,11 +538,13 @@ static const LangTag ot_languages[] = { {"knn", HB_TAG('K','O','K',' ')}, /* Konkani */ {"ko", HB_TAG('K','O','R',' ')}, /* Korean */ {"koi", HB_TAG('K','O','P',' ')}, /* Komi-Permyak */ + {"koi", HB_TAG('K','O','M',' ')}, /* Komi-Permyak -> Komi */ /*{"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 */ + {"kpv", HB_TAG('K','O','M',' ')}, /* Komi-Zyrian -> Komi */ {"kpy", HB_TAG('K','Y','K',' ')}, /* Koryak */ {"kqs", HB_TAG('K','I','S',' ')}, /* Northern Kissi -> Kisii */ {"kqy", HB_TAG('K','R','T',' ')}, /* Koorete */ @@ -605,7 +637,8 @@ static const LangTag ot_languages[] = { {"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 */ + {"mfa", HB_TAG('M','F','A',' ')}, /* Pattani Malay */ + {"mfa", HB_TAG('M','L','Y',' ')}, /* Pattani Malay -> Malay */ {"mfb", HB_TAG('M','L','Y',' ')}, /* Bangka -> Malay */ /*{"mfe", HB_TAG('M','F','E',' ')},*/ /* Morisyen */ {"mg", HB_TAG('M','L','G',' ')}, /* Malagasy [macrolanguage] */ @@ -613,7 +646,8 @@ static const LangTag ot_languages[] = { {"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 */ + {"min", HB_TAG('M','I','N',' ')}, /* Minangkabau */ + {"min", HB_TAG('M','L','Y',' ')}, /* Minangkabau -> Malay */ {"mk", HB_TAG('M','K','D',' ')}, /* Macedonian */ {"mku", HB_TAG('M','N','K',' ')}, /* Konyanka Maninka -> Maninka */ /*{"mkw", HB_TAG('M','K','W',' ')},*/ /* Kituba (Congo) */ @@ -654,7 +688,8 @@ static const LangTag ot_languages[] = { {"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 */ + {"mww", HB_TAG('M','W','W',' ')}, /* Hmong Daw */ + {"mww", HB_TAG('H','M','N',' ')}, /* Hmong Daw -> Hmong */ {"my", HB_TAG('B','R','M',' ')}, /* Burmese */ {"mym", HB_TAG('M','E','N',' ')}, /* Me’en */ /*{"myn", HB_TAG('M','Y','N',' ')},*/ /* Mayan [family] */ @@ -684,6 +719,7 @@ static const LangTag ot_languages[] = { {"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) */ + {"nn", HB_TAG('N','O','R',' ')}, /* Norwegian 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 */ @@ -707,6 +743,7 @@ static const LangTag ot_languages[] = { {"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 */ + {"ojs", HB_TAG('O','J','B',' ')}, /* Severn Ojibwa -> Ojibway */ {"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 */ @@ -748,6 +785,7 @@ static const LangTag ot_languages[] = { {"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 */ + {"prs", HB_TAG('F','A','R',' ')}, /* Dari -> Persian */ {"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 */ @@ -755,49 +793,81 @@ static const LangTag ot_languages[] = { /*{"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) */ + {"qub", HB_TAG('Q','U','Z',' ')}, /* Huallaga Huánuco Quechua -> Quechua */ /*{"quc", HB_TAG('Q','U','C',' ')},*/ /* K’iche’ */ {"qud", HB_TAG('Q','V','I',' ')}, /* Calderón Highland Quichua -> Quechua (Ecuador) */ + {"qud", HB_TAG('Q','U','Z',' ')}, /* Calderón Highland Quichua -> Quechua */ {"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) */ + {"qug", HB_TAG('Q','U','Z',' ')}, /* Chimborazo Highland Quichua -> Quechua */ + {"quh", HB_TAG('Q','U','H',' ')}, /* South Bolivian Quechua -> Quechua (Bolivia) */ + {"quh", HB_TAG('Q','U','Z',' ')}, /* South Bolivian Quechua -> Quechua */ {"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) */ + {"qup", HB_TAG('Q','U','Z',' ')}, /* Southern Pastaza Quechua -> Quechua */ {"qur", HB_TAG('Q','W','H',' ')}, /* Yanahuanca Pasco Quechua -> Quechua (Peru) */ + {"qur", HB_TAG('Q','U','Z',' ')}, /* Yanahuanca Pasco Quechua -> Quechua */ {"qus", HB_TAG('Q','U','H',' ')}, /* Santiago del Estero Quichua -> Quechua (Bolivia) */ + {"qus", HB_TAG('Q','U','Z',' ')}, /* Santiago del Estero Quichua -> Quechua */ {"quw", HB_TAG('Q','V','I',' ')}, /* Tena Lowland Quichua -> Quechua (Ecuador) */ + {"quw", HB_TAG('Q','U','Z',' ')}, /* Tena Lowland Quichua -> Quechua */ {"qux", HB_TAG('Q','W','H',' ')}, /* Yauyos Quechua -> Quechua (Peru) */ + {"qux", HB_TAG('Q','U','Z',' ')}, /* Yauyos Quechua -> Quechua */ {"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) */ + {"qva", HB_TAG('Q','U','Z',' ')}, /* Ambo-Pasco Quechua -> Quechua */ {"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) */ + {"qvh", HB_TAG('Q','U','Z',' ')}, /* Huamalíes-Dos de Mayo Huánuco Quechua -> Quechua */ + {"qvi", HB_TAG('Q','V','I',' ')}, /* Imbabura Highland Quichua -> Quechua (Ecuador) */ + {"qvi", HB_TAG('Q','U','Z',' ')}, /* Imbabura Highland Quichua -> Quechua */ {"qvj", HB_TAG('Q','V','I',' ')}, /* Loja Highland Quichua -> Quechua (Ecuador) */ + {"qvj", HB_TAG('Q','U','Z',' ')}, /* Loja Highland Quichua -> Quechua */ {"qvl", HB_TAG('Q','W','H',' ')}, /* Cajatambo North Lima Quechua -> Quechua (Peru) */ + {"qvl", HB_TAG('Q','U','Z',' ')}, /* Cajatambo North Lima Quechua -> Quechua */ {"qvm", HB_TAG('Q','W','H',' ')}, /* Margos-Yarowilca-Lauricocha Quechua -> Quechua (Peru) */ + {"qvm", HB_TAG('Q','U','Z',' ')}, /* Margos-Yarowilca-Lauricocha Quechua -> Quechua */ {"qvn", HB_TAG('Q','W','H',' ')}, /* North Junín Quechua -> Quechua (Peru) */ + {"qvn", HB_TAG('Q','U','Z',' ')}, /* North Junín Quechua -> Quechua */ {"qvo", HB_TAG('Q','V','I',' ')}, /* Napo Lowland Quechua -> Quechua (Ecuador) */ + {"qvo", HB_TAG('Q','U','Z',' ')}, /* Napo Lowland Quechua -> Quechua */ {"qvp", HB_TAG('Q','W','H',' ')}, /* Pacaraos Quechua -> Quechua (Peru) */ + {"qvp", HB_TAG('Q','U','Z',' ')}, /* Pacaraos Quechua -> Quechua */ {"qvs", HB_TAG('Q','U','Z',' ')}, /* San Martín Quechua -> Quechua */ {"qvw", HB_TAG('Q','W','H',' ')}, /* Huaylla Wanca Quechua -> Quechua (Peru) */ + {"qvw", HB_TAG('Q','U','Z',' ')}, /* Huaylla Wanca Quechua -> Quechua */ {"qvz", HB_TAG('Q','V','I',' ')}, /* Northern Pastaza Quichua -> Quechua (Ecuador) */ + {"qvz", HB_TAG('Q','U','Z',' ')}, /* Northern Pastaza Quichua -> Quechua */ {"qwa", HB_TAG('Q','W','H',' ')}, /* Corongo Ancash Quechua -> Quechua (Peru) */ + {"qwa", HB_TAG('Q','U','Z',' ')}, /* Corongo Ancash Quechua -> Quechua */ {"qwc", HB_TAG('Q','U','Z',' ')}, /* Classical Quechua -> Quechua */ -/*{"qwh", HB_TAG('Q','W','H',' ')},*/ /* Huaylas Ancash Quechua -> Quechua (Peru) */ + {"qwh", HB_TAG('Q','W','H',' ')}, /* Huaylas Ancash Quechua -> Quechua (Peru) */ + {"qwh", HB_TAG('Q','U','Z',' ')}, /* Huaylas Ancash Quechua -> Quechua */ {"qws", HB_TAG('Q','W','H',' ')}, /* Sihuas Ancash Quechua -> Quechua (Peru) */ + {"qws", HB_TAG('Q','U','Z',' ')}, /* Sihuas Ancash Quechua -> Quechua */ {"qxa", HB_TAG('Q','W','H',' ')}, /* Chiquián Ancash Quechua -> Quechua (Peru) */ + {"qxa", HB_TAG('Q','U','Z',' ')}, /* Chiquián Ancash Quechua -> Quechua */ {"qxc", HB_TAG('Q','W','H',' ')}, /* Chincha Quechua -> Quechua (Peru) */ + {"qxc", HB_TAG('Q','U','Z',' ')}, /* Chincha Quechua -> Quechua */ {"qxh", HB_TAG('Q','W','H',' ')}, /* Panao Huánuco Quechua -> Quechua (Peru) */ + {"qxh", HB_TAG('Q','U','Z',' ')}, /* Panao Huánuco Quechua -> Quechua */ {"qxl", HB_TAG('Q','V','I',' ')}, /* Salasaca Highland Quichua -> Quechua (Ecuador) */ + {"qxl", HB_TAG('Q','U','Z',' ')}, /* Salasaca Highland Quichua -> Quechua */ {"qxn", HB_TAG('Q','W','H',' ')}, /* Northern Conchucos Ancash Quechua -> Quechua (Peru) */ + {"qxn", HB_TAG('Q','U','Z',' ')}, /* Northern Conchucos Ancash Quechua -> Quechua */ {"qxo", HB_TAG('Q','W','H',' ')}, /* Southern Conchucos Ancash Quechua -> Quechua (Peru) */ + {"qxo", HB_TAG('Q','U','Z',' ')}, /* Southern Conchucos Ancash Quechua -> Quechua */ {"qxp", HB_TAG('Q','U','Z',' ')}, /* Puno Quechua -> Quechua */ {"qxr", HB_TAG('Q','V','I',' ')}, /* Cañar Highland Quichua -> Quechua (Ecuador) */ + {"qxr", HB_TAG('Q','U','Z',' ')}, /* Cañar Highland Quichua -> Quechua */ {"qxt", HB_TAG('Q','W','H',' ')}, /* Santa Ana de Tusi Pasco Quechua -> Quechua (Peru) */ + {"qxt", HB_TAG('Q','U','Z',' ')}, /* Santa Ana de Tusi Pasco Quechua -> Quechua */ {"qxu", HB_TAG('Q','U','Z',' ')}, /* Arequipa-La Unión Quechua -> Quechua */ {"qxw", HB_TAG('Q','W','H',' ')}, /* Jauja Wanca Quechua -> Quechua (Peru) */ + {"qxw", HB_TAG('Q','U','Z',' ')}, /* Jauja Wanca Quechua -> Quechua */ {"rag", HB_TAG('L','U','H',' ')}, /* Logooli -> Luyia */ /*{"raj", HB_TAG('R','A','J',' ')},*/ /* Rajasthani [macrolanguage] */ /*{"rar", HB_TAG('R','A','R',' ')},*/ /* Rarotongan */ @@ -816,7 +886,8 @@ static const LangTag ot_languages[] = { {"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 */ + {"rmy", HB_TAG('R','M','Y',' ')}, /* Vlax Romani */ + {"rmy", HB_TAG('R','O','Y',' ')}, /* Vlax Romani -> Romany */ {"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) */ @@ -937,6 +1008,7 @@ static const LangTag ot_languages[] = { {"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 */ + {"tnf", HB_TAG('F','A','R',' ')}, /* Tangshewi (retired code) -> Persian */ {"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) */ @@ -988,6 +1060,7 @@ static const LangTag ot_languages[] = { /*{"war", HB_TAG('W','A','R',' ')},*/ /* Waray (Philippines) -> Waray-Waray */ {"wbm", HB_TAG('W','A',' ',' ')}, /* Wa */ {"wbr", HB_TAG('W','A','G',' ')}, /* Wagdi */ + {"wbr", HB_TAG('R','A','J',' ')}, /* Wagdi -> Rajasthani */ {"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 */ @@ -1008,7 +1081,8 @@ static const LangTag ot_languages[] = { {"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) */ + {"xpe", HB_TAG('X','P','E',' ')}, /* Liberia Kpelle -> Kpelle (Liberia) */ + {"xpe", HB_TAG('K','P','L',' ')}, /* Liberia Kpelle -> Kpelle */ {"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 */ @@ -1090,6 +1164,13 @@ hb_ot_tags_from_complex_language (const char *lang_str, *count = 1; return true; } + if (subtag_matches (lang_str, limit, "-arevmda")) + { + /* Armenian; Western Armenian (retired code) */ + tags[0] = HB_TAG('H','Y','E',' '); /* Armenian */ + *count = 1; + return true; + } if (subtag_matches (lang_str, limit, "-provenc")) { /* Occitan (post 1500); Provençal */ @@ -1137,7 +1218,7 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'a': if (0 == strcmp (&lang_str[1], "rt-lojban")) { - /* Lojban */ + /* Lojban (retired code) */ tags[0] = HB_TAG('J','B','O',' '); /* Lojban */ *count = 1; return true; @@ -1146,224 +1227,224 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'c': if (lang_matches (&lang_str[1], "do-hant-hk")) { - /* Min Dong Chinese */ + /* Min Dong Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "do-hant-mo")) { - /* Min Dong Chinese */ + /* Min Dong Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "jy-hant-hk")) { - /* Jinyu Chinese */ + /* Jinyu Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "jy-hant-mo")) { - /* Jinyu Chinese */ + /* Jinyu Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "mn-hant-hk")) { - /* Mandarin Chinese */ + /* Mandarin Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "mn-hant-mo")) { - /* Mandarin Chinese */ + /* Mandarin Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "np-hant-hk")) { - /* Northern Ping Chinese */ + /* Northern Ping Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "np-hant-mo")) { - /* Northern Ping Chinese */ + /* Northern Ping Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "px-hant-hk")) { - /* Pu-Xian Chinese */ + /* Pu-Xian Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "px-hant-mo")) { - /* Pu-Xian Chinese */ + /* Pu-Xian Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "sp-hant-hk")) { - /* Southern Ping Chinese */ + /* Southern Ping Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "sp-hant-mo")) { - /* Southern Ping Chinese */ + /* Southern Ping Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "zh-hant-hk")) { - /* Huizhou Chinese */ + /* Huizhou Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "zh-hant-mo")) { - /* Huizhou Chinese */ + /* Huizhou Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "zo-hant-hk")) { - /* Min Zhong Chinese */ + /* Min Zhong Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "zo-hant-mo")) { - /* Min Zhong Chinese */ + /* Min Zhong Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "do-hans")) { - /* Min Dong Chinese */ + /* Min Dong Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "do-hant")) { - /* Min Dong Chinese */ + /* Min Dong Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; } if (lang_matches (&lang_str[1], "jy-hans")) { - /* Jinyu Chinese */ + /* Jinyu Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "jy-hant")) { - /* Jinyu Chinese */ + /* Jinyu Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; } if (lang_matches (&lang_str[1], "mn-hans")) { - /* Mandarin Chinese */ + /* Mandarin Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "mn-hant")) { - /* Mandarin Chinese */ + /* Mandarin Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; } if (lang_matches (&lang_str[1], "np-hans")) { - /* Northern Ping Chinese */ + /* Northern Ping Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "np-hant")) { - /* Northern Ping Chinese */ + /* Northern Ping Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; } if (lang_matches (&lang_str[1], "px-hans")) { - /* Pu-Xian Chinese */ + /* Pu-Xian Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "px-hant")) { - /* Pu-Xian Chinese */ + /* Pu-Xian Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; } if (lang_matches (&lang_str[1], "sp-hans")) { - /* Southern Ping Chinese */ + /* Southern Ping Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "sp-hant")) { - /* Southern Ping Chinese */ + /* Southern Ping Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; } if (lang_matches (&lang_str[1], "zh-hans")) { - /* Huizhou Chinese */ + /* Huizhou Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "zh-hant")) { - /* Huizhou Chinese */ + /* Huizhou Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; } if (lang_matches (&lang_str[1], "zo-hans")) { - /* Min Zhong Chinese */ + /* Min Zhong Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "zo-hant")) { - /* Min Zhong Chinese */ + /* Min Zhong Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; @@ -1564,35 +1645,35 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'g': if (lang_matches (&lang_str[1], "an-hant-hk")) { - /* Gan Chinese */ + /* Gan Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "an-hant-mo")) { - /* Gan Chinese */ + /* Gan Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "an-hans")) { - /* Gan Chinese */ + /* Gan Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "an-hant")) { - /* Gan Chinese */ + /* Gan Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; } if (lang_matches (&lang_str[1], "a-latg")) { - /* Irish */ + /* Irish; Latin (Gaelic variant) */ tags[0] = HB_TAG('I','R','T',' '); /* Irish Traditional */ *count = 1; return true; @@ -1625,56 +1706,56 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'h': if (lang_matches (&lang_str[1], "ak-hant-hk")) { - /* Hakka Chinese */ + /* Hakka Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "ak-hant-mo")) { - /* Hakka Chinese */ + /* Hakka Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "sn-hant-hk")) { - /* Xiang Chinese */ + /* Xiang Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "sn-hant-mo")) { - /* Xiang Chinese */ + /* Xiang Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "ak-hans")) { - /* Hakka Chinese */ + /* Hakka Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "ak-hant")) { - /* Hakka Chinese */ + /* Hakka Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; } if (lang_matches (&lang_str[1], "sn-hans")) { - /* Xiang Chinese */ + /* Xiang Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "sn-hant")) { - /* Xiang Chinese */ + /* Xiang Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; @@ -1731,7 +1812,7 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'i': if (0 == strcmp (&lang_str[1], "-navajo")) { - /* Navajo */ + /* Navajo (retired code) */ unsigned int i; hb_tag_t possible_tags[] = { HB_TAG('N','A','V',' '), /* Navajo */ @@ -1744,14 +1825,14 @@ hb_ot_tags_from_complex_language (const char *lang_str, } if (0 == strcmp (&lang_str[1], "-hak")) { - /* Hakka */ + /* Hakka (retired code) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (0 == strcmp (&lang_str[1], "-lux")) { - /* Luxembourgish */ + /* Luxembourgish (retired code) */ tags[0] = HB_TAG('L','T','Z',' '); /* Luxembourgish */ *count = 1; return true; @@ -1760,7 +1841,7 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'l': if (lang_matches (&lang_str[1], "zh-hans")) { - /* Literary Chinese */ + /* Literary Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; @@ -1769,28 +1850,28 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'm': if (lang_matches (&lang_str[1], "np-hant-hk")) { - /* Min Bei Chinese */ + /* Min Bei Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "np-hant-mo")) { - /* Min Bei Chinese */ + /* Min Bei Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "np-hans")) { - /* Min Bei Chinese */ + /* Min Bei Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "np-hant")) { - /* Min Bei Chinese */ + /* Min Bei Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; @@ -1823,28 +1904,28 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'n': if (lang_matches (&lang_str[1], "an-hant-hk")) { - /* Min Nan Chinese */ + /* Min Nan Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "an-hant-mo")) { - /* Min Nan Chinese */ + /* Min Nan Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "an-hans")) { - /* Min Nan Chinese */ + /* Min Nan Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "an-hant")) { - /* Min Nan Chinese */ + /* Min Nan Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; @@ -1875,16 +1956,22 @@ hb_ot_tags_from_complex_language (const char *lang_str, } if (0 == strcmp (&lang_str[1], "o-bok")) { - /* Norwegian Bokmal */ + /* Norwegian Bokmal (retired code) */ tags[0] = HB_TAG('N','O','R',' '); /* Norwegian */ *count = 1; return true; } if (0 == strcmp (&lang_str[1], "o-nyn")) { - /* Norwegian Nynorsk */ - tags[0] = HB_TAG('N','Y','N',' '); /* Norwegian Nynorsk (Nynorsk, Norwegian) */ - *count = 1; + /* Norwegian Nynorsk (retired code) */ + unsigned int i; + hb_tag_t possible_tags[] = { + HB_TAG('N','Y','N',' '), /* Norwegian Nynorsk (Nynorsk, Norwegian) */ + HB_TAG('N','O','R',' '), /* Norwegian */ + }; + for (i = 0; i < 2 && i < *count; i++) + tags[i] = possible_tags[i]; + *count = i; return true; } break; @@ -1901,28 +1988,28 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'w': if (lang_matches (&lang_str[1], "uu-hant-hk")) { - /* Wu Chinese */ + /* Wu Chinese; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "uu-hant-mo")) { - /* Wu Chinese */ + /* Wu Chinese; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "uu-hans")) { - /* Wu Chinese */ + /* Wu Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "uu-hant")) { - /* Wu Chinese */ + /* Wu Chinese; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; @@ -1955,7 +2042,7 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'y': if (lang_matches (&lang_str[1], "ue-hans")) { - /* Yue Chinese */ + /* Yue Chinese; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; @@ -1964,42 +2051,42 @@ hb_ot_tags_from_complex_language (const char *lang_str, case 'z': if (lang_matches (&lang_str[1], "h-hant-hk")) { - /* Chinese */ + /* Chinese [macrolanguage]; Han (Traditional variant); Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (lang_matches (&lang_str[1], "h-hant-mo")) { - /* Chinese */ + /* Chinese [macrolanguage]; Han (Traditional variant); Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; } if (0 == strcmp (&lang_str[1], "h-min-nan")) { - /* Minnan, Hokkien, Amoy, Taiwanese, Southern Min, Southern Fujian, Hoklo, Southern Fukien, Ho-lo */ + /* Minnan, Hokkien, Amoy, Taiwanese, Southern Min, Southern Fujian, Hoklo, Southern Fukien, Ho-lo (retired code) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "h-hans")) { - /* Chinese */ + /* Chinese [macrolanguage]; Han (Simplified variant) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; } if (lang_matches (&lang_str[1], "h-hant")) { - /* Chinese */ + /* Chinese [macrolanguage]; Han (Traditional variant) */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; } if (0 == strcmp (&lang_str[1], "h-min")) { - /* Min, Fuzhou, Hokkien, Amoy, or Taiwanese */ + /* Min, Fuzhou, Hokkien, Amoy, or Taiwanese (retired code) */ tags[0] = HB_TAG('Z','H','S',' '); /* Chinese Simplified */ *count = 1; return true; @@ -2007,7 +2094,7 @@ hb_ot_tags_from_complex_language (const char *lang_str, if (0 == strncmp (&lang_str[1], "h-", 2) && subtag_matches (lang_str, limit, "-hk")) { - /* Chinese; Hong Kong */ + /* Chinese [macrolanguage]; Hong Kong */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; @@ -2015,7 +2102,7 @@ hb_ot_tags_from_complex_language (const char *lang_str, if (0 == strncmp (&lang_str[1], "h-", 2) && subtag_matches (lang_str, limit, "-mo")) { - /* Chinese; Macao */ + /* Chinese [macrolanguage]; Macao */ tags[0] = HB_TAG('Z','H','H',' '); /* Chinese, Hong Kong SAR */ *count = 1; return true; @@ -2023,7 +2110,7 @@ hb_ot_tags_from_complex_language (const char *lang_str, if (0 == strncmp (&lang_str[1], "h-", 2) && subtag_matches (lang_str, limit, "-tw")) { - /* Chinese; Taiwan, Province of China */ + /* Chinese [macrolanguage]; Taiwan, Province of China */ tags[0] = HB_TAG('Z','H','T',' '); /* Chinese Traditional */ *count = 1; return true; @@ -2055,101 +2142,113 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) 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 */ - return hb_language_from_string ("ar", -1); /* Arabic */ + return hb_language_from_string ("ar", -1); /* Arabic [macrolanguage] */ case HB_TAG('A','R','K',' '): /* Rakhine */ return hb_language_from_string ("rki", -1); /* Rakhine */ case HB_TAG('A','T','H',' '): /* Athapaskan */ - return hb_language_from_string ("ath", -1); /* Athapascan */ + return hb_language_from_string ("ath", -1); /* Athapascan [family] */ case HB_TAG('B','I','K',' '): /* Bikol */ - return hb_language_from_string ("bik", -1); /* Bikol */ + return hb_language_from_string ("bik", -1); /* Bikol [macrolanguage] */ case HB_TAG('C','P','P',' '): /* Creoles */ - return hb_language_from_string ("crp", -1); /* Creoles and pidgins */ + return hb_language_from_string ("crp", -1); /* Creoles and pidgins [family] */ case HB_TAG('C','R','R',' '): /* Carrier */ return hb_language_from_string ("crx", -1); /* Carrier */ + case HB_TAG('D','G','R',' '): /* Dogri */ + return hb_language_from_string ("doi", -1); /* Dogri [macrolanguage] */ case HB_TAG('D','N','K',' '): /* Dinka */ - return hb_language_from_string ("din", -1); /* Dinka */ + return hb_language_from_string ("din", -1); /* Dinka [macrolanguage] */ case HB_TAG('D','R','I',' '): /* Dari */ return hb_language_from_string ("prs", -1); /* Dari */ case HB_TAG('D','Z','N',' '): /* Dzongkha */ return hb_language_from_string ("dz", -1); /* Dzongkha */ case HB_TAG('E','T','I',' '): /* Estonian */ - return hb_language_from_string ("et", -1); /* Estonian */ + return hb_language_from_string ("et", -1); /* Estonian [macrolanguage] */ + case HB_TAG('F','A','R',' '): /* Persian */ + return hb_language_from_string ("fa", -1); /* Persian [macrolanguage] */ case HB_TAG('G','O','N',' '): /* Gondi */ - return hb_language_from_string ("gon", -1); /* Gondi */ + return hb_language_from_string ("gon", -1); /* Gondi [macrolanguage] */ case HB_TAG('H','M','N',' '): /* Hmong */ - return hb_language_from_string ("hmn", -1); /* Hmong */ + return hb_language_from_string ("hmn", -1); /* Hmong [macrolanguage] */ case HB_TAG('H','N','D',' '): /* Hindko */ return hb_language_from_string ("hnd", -1); /* Southern Hindko */ case HB_TAG('H','Y','E',' '): /* Armenian */ return hb_language_from_string ("hyw", -1); /* Western Armenian */ case HB_TAG('I','J','O',' '): /* Ijo */ - return hb_language_from_string ("ijo", -1); /* Ijo */ + return hb_language_from_string ("ijo", -1); /* Ijo [family] */ case HB_TAG('I','N','U',' '): /* Inuktitut */ - return hb_language_from_string ("iu", -1); /* Inuktitut */ + return hb_language_from_string ("iu", -1); /* Inuktitut [macrolanguage] */ case HB_TAG('I','P','K',' '): /* Inupiat */ - return hb_language_from_string ("ik", -1); /* Inupiaq */ + return hb_language_from_string ("ik", -1); /* Inupiaq [macrolanguage] */ case HB_TAG('I','P','P','H'): /* Phonetic transcription—IPA conventions */ return hb_language_from_string ("und-fonipa", -1); /* Undetermined; International Phonetic Alphabet */ case HB_TAG('I','R','T',' '): /* Irish Traditional */ return hb_language_from_string ("ga-Latg", -1); /* Irish; Latin (Gaelic variant) */ case HB_TAG('J','I','I',' '): /* Yiddish */ - return hb_language_from_string ("yi", -1); /* Yiddish */ + return hb_language_from_string ("yi", -1); /* Yiddish [macrolanguage] */ case HB_TAG('K','A','L',' '): /* Kalenjin */ - return hb_language_from_string ("kln", -1); /* Kalenjin */ + return hb_language_from_string ("kln", -1); /* Kalenjin [macrolanguage] */ case HB_TAG('K','G','E',' '): /* Khutsuri Georgian */ return hb_language_from_string ("und-Geok", -1); /* Undetermined; Khutsuri (Asomtavruli and Nuskhuri) */ case HB_TAG('K','N','R',' '): /* Kanuri */ - return hb_language_from_string ("kr", -1); /* Kanuri */ + return hb_language_from_string ("kr", -1); /* Kanuri [macrolanguage] */ case HB_TAG('K','O','K',' '): /* Konkani */ - return hb_language_from_string ("kok", -1); /* Konkani */ + return hb_language_from_string ("kok", -1); /* Konkani [macrolanguage] */ + case HB_TAG('K','O','M',' '): /* Komi */ + return hb_language_from_string ("kv", -1); /* Komi [macrolanguage] */ + case HB_TAG('K','P','L',' '): /* Kpelle */ + return hb_language_from_string ("kpe", -1); /* Kpelle [macrolanguage] */ case HB_TAG('K','U','I',' '): /* Kui */ return hb_language_from_string ("uki", -1); /* Kui (India) */ case HB_TAG('K','U','R',' '): /* Kurdish */ - return hb_language_from_string ("ku", -1); /* Kurdish */ + return hb_language_from_string ("ku", -1); /* Kurdish [macrolanguage] */ case HB_TAG('L','U','H',' '): /* Luyia */ - return hb_language_from_string ("luy", -1); /* Luyia */ + return hb_language_from_string ("luy", -1); /* Luyia [macrolanguage] */ case HB_TAG('L','V','I',' '): /* Latvian */ - return hb_language_from_string ("lv", -1); /* Latvian */ + return hb_language_from_string ("lv", -1); /* Latvian [macrolanguage] */ case HB_TAG('M','A','W',' '): /* Marwari */ - return hb_language_from_string ("mwr", -1); /* Marwari */ + return hb_language_from_string ("mwr", -1); /* Marwari [macrolanguage] */ case HB_TAG('M','L','G',' '): /* Malagasy */ - return hb_language_from_string ("mg", -1); /* Malagasy */ + return hb_language_from_string ("mg", -1); /* Malagasy [macrolanguage] */ case HB_TAG('M','L','Y',' '): /* Malay */ - return hb_language_from_string ("ms", -1); /* Malay */ + return hb_language_from_string ("ms", -1); /* Malay [macrolanguage] */ case HB_TAG('M','N','G',' '): /* Mongolian */ - return hb_language_from_string ("mn", -1); /* Mongolian */ + return hb_language_from_string ("mn", -1); /* Mongolian [macrolanguage] */ + case HB_TAG('M','N','K',' '): /* Maninka */ + return hb_language_from_string ("man", -1); /* Mandingo [macrolanguage] */ case HB_TAG('M','O','L',' '): /* Moldavian */ return hb_language_from_string ("ro-MD", -1); /* Romanian; Moldova */ case HB_TAG('N','E','P',' '): /* Nepali */ - return hb_language_from_string ("ne", -1); /* Nepali */ + return hb_language_from_string ("ne", -1); /* Nepali [macrolanguage] */ case HB_TAG('N','I','S',' '): /* Nisi */ return hb_language_from_string ("njz", -1); /* Nyishi */ case HB_TAG('N','O','R',' '): /* Norwegian */ - return hb_language_from_string ("no", -1); /* Norwegian */ + return hb_language_from_string ("no", -1); /* Norwegian [macrolanguage] */ case HB_TAG('O','J','B',' '): /* Ojibway */ - return hb_language_from_string ("oj", -1); /* Ojibwa */ + return hb_language_from_string ("oj", -1); /* Ojibwa [macrolanguage] */ case HB_TAG('O','R','O',' '): /* Oromo */ - return hb_language_from_string ("om", -1); /* Oromo */ + return hb_language_from_string ("om", -1); /* Oromo [macrolanguage] */ case HB_TAG('P','A','S',' '): /* Pashto */ - return hb_language_from_string ("ps", -1); /* Pashto */ + return hb_language_from_string ("ps", -1); /* Pashto [macrolanguage] */ case HB_TAG('P','G','R',' '): /* Polytonic Greek */ return hb_language_from_string ("el-polyton", -1); /* Modern Greek (1453-); Polytonic Greek */ case HB_TAG('P','R','O',' '): /* Provençal / Old Provençal */ return hb_language_from_string ("pro", -1); /* Old Provençal (to 1500) */ case HB_TAG('Q','U','H',' '): /* Quechua (Bolivia) */ return hb_language_from_string ("quh", -1); /* South Bolivian Quechua */ + case HB_TAG('Q','U','Z',' '): /* Quechua */ + return hb_language_from_string ("qu", -1); /* Quechua [macrolanguage] */ case HB_TAG('Q','V','I',' '): /* Quechua (Ecuador) */ return hb_language_from_string ("qvi", -1); /* Imbabura Highland Quichua */ case HB_TAG('Q','W','H',' '): /* Quechua (Peru) */ return hb_language_from_string ("qwh", -1); /* Huaylas Ancash Quechua */ case HB_TAG('R','A','J',' '): /* Rajasthani */ - return hb_language_from_string ("raj", -1); /* Rajasthani */ + return hb_language_from_string ("raj", -1); /* Rajasthani [macrolanguage] */ case HB_TAG('R','O','Y',' '): /* Romany */ - return hb_language_from_string ("rom", -1); /* Romany */ + return hb_language_from_string ("rom", -1); /* Romany [macrolanguage] */ case HB_TAG('S','Q','I',' '): /* Albanian */ - return hb_language_from_string ("sq", -1); /* Albanian */ + return hb_language_from_string ("sq", -1); /* Albanian [macrolanguage] */ case HB_TAG('S','Y','R',' '): /* Syriac */ - return hb_language_from_string ("syr", -1); /* Syriac */ + return hb_language_from_string ("syr", -1); /* Syriac [macrolanguage] */ case HB_TAG('S','Y','R','E'): /* Syriac, Estrangela script-variant (equivalent to ISO 15924 'Syre') */ return hb_language_from_string ("und-Syre", -1); /* Undetermined; Syriac (Estrangelo variant) */ case HB_TAG('S','Y','R','J'): /* Syriac, Western script-variant (equivalent to ISO 15924 'Syrj') */ @@ -2157,7 +2256,7 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) case HB_TAG('S','Y','R','N'): /* Syriac, Eastern script-variant (equivalent to ISO 15924 'Syrn') */ return hb_language_from_string ("und-Syrn", -1); /* Undetermined; Syriac (Eastern variant) */ case HB_TAG('T','M','H',' '): /* Tamashek */ - return hb_language_from_string ("tmh", -1); /* Tamashek */ + return hb_language_from_string ("tmh", -1); /* Tamashek [macrolanguage] */ case HB_TAG('T','N','E',' '): /* Tundra Nenets */ return hb_language_from_string ("yrk", -1); /* Nenets */ case HB_TAG('T','O','D',' '): /* Todo */ @@ -2165,11 +2264,13 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) case HB_TAG('T','W','I',' '): /* Twi */ return hb_language_from_string ("tw", -1); /* Twi */ case HB_TAG('Z','H','H',' '): /* Chinese, Hong Kong SAR */ - return hb_language_from_string ("zh-HK", -1); /* Chinese; Hong Kong */ + return hb_language_from_string ("zh-HK", -1); /* Chinese [macrolanguage]; Hong Kong */ case HB_TAG('Z','H','S',' '): /* Chinese Simplified */ - return hb_language_from_string ("zh-Hans", -1); /* Chinese; Han (Simplified variant) */ + return hb_language_from_string ("zh-Hans", -1); /* Chinese [macrolanguage]; Han (Simplified variant) */ case HB_TAG('Z','H','T',' '): /* Chinese Traditional */ - return hb_language_from_string ("zh-Hant", -1); /* Chinese; Han (Traditional variant) */ + return hb_language_from_string ("zh-Hant", -1); /* Chinese [macrolanguage]; Han (Traditional variant) */ + case HB_TAG('Z','Z','A',' '): /* Zazaki */ + return hb_language_from_string ("zza", -1); /* Zazaki [macrolanguage] */ default: return HB_LANGUAGE_INVALID; } diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index a5a101d0f..f893c4a3f 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -37,10 +37,17 @@ * @short_description: Object representing a shaping plan * @include: hb.h * - * Shape plans are not used for shaping directly, but can be access to query - * certain information about how shaping will perform given a set of input - * parameters (script, language, direction, features, etc.) - * Most client would not need to deal with shape plans directly. + * Shape plans are an internal mechanism. Each plan contains state + * describing how HarfBuzz will shape a particular text segment, based on + * the combination of segment properties and the capabilities in the + * font face in use. + * + * Shape plans are not used for shaping directly, but can be queried to + * access certain information about how shaping will perform, given a set + * of specific input parameters (script, language, direction, features, + * etc.). + * + * Most client programs will not need to deal with shape plans directly. **/ @@ -164,15 +171,16 @@ hb_shape_plan_key_t::equal (const hb_shape_plan_key_t *other) /** * hb_shape_plan_create: (Xconstructor) - * @face: - * @props: - * @user_features: (array length=num_user_features): - * @num_user_features: - * @shaper_list: (array zero-terminated=1): + * @face: #hb_face_t to use + * @props: The #hb_segment_properties_t of the segment + * @user_features: (array length=num_user_features): The list of user-selected features + * @num_user_features: The number of user-selected features + * @shaper_list: (array zero-terminated=1): List of shapers to try * + * Constructs a shaping plan for a combination of @face, @user_features, @props, + * and @shaper_list. * - * - * Return value: (transfer full): + * Return value: (transfer full): The shaping plan * * Since: 0.9.7 **/ @@ -189,6 +197,24 @@ hb_shape_plan_create (hb_face_t *face, shaper_list); } +/** + * hb_shape_plan_create2: (Xconstructor) + * @face: #hb_face_t to use + * @props: The #hb_segment_properties_t of the segment + * @user_features: (array length=num_user_features): The list of user-selected features + * @num_user_features: The number of user-selected features + * @coords: (array length=num_coords): The list of variation-space coordinates + * @num_coords: The number of variation-space coordinates + * @shaper_list: (array zero-terminated=1): List of shapers to try + * + * The variable-font version of #hb_shape_plan_create. + * Constructs a shaping plan for a combination of @face, @user_features, @props, + * and @shaper_list, plus the variation-space coordinates @coords. + * + * Return value: (transfer full): The shaping plan + * + * Since: 1.4.0 + **/ hb_shape_plan_t * hb_shape_plan_create2 (hb_face_t *face, const hb_segment_properties_t *props, @@ -248,9 +274,9 @@ bail: /** * hb_shape_plan_get_empty: * + * Fetches the singleton empty shaping plan. * - * - * Return value: (transfer full): + * Return value: (transfer full): The empty shaping plan * * Since: 0.9.7 **/ @@ -262,11 +288,11 @@ hb_shape_plan_get_empty () /** * hb_shape_plan_reference: (skip) - * @shape_plan: a shape plan. + * @shape_plan: A shaping plan * + * Increases the reference count on the given shaping plan. * - * - * Return value: (transfer full): + * Return value: (transfer full): @shape_plan * * Since: 0.9.7 **/ @@ -278,9 +304,11 @@ hb_shape_plan_reference (hb_shape_plan_t *shape_plan) /** * hb_shape_plan_destroy: (skip) - * @shape_plan: a shape plan. - * + * @shape_plan: A shaping plan * + * Decreases the reference count on the given shaping plan. When the + * reference count reaches zero, the shaping plan is destroyed, + * freeing all memory. * * Since: 0.9.7 **/ @@ -298,13 +326,13 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan) /** * hb_shape_plan_set_user_data: (skip) - * @shape_plan: a shape plan. - * @key: - * @data: - * @destroy: - * @replace: - * + * @shape_plan: A shaping plan + * @key: The user-data key to set + * @data: A pointer to the user data + * @destroy: A callback to call when @data is not needed anymore + * @replace: Whether to replace an existing data with the same key * + * Attaches a user-data key/data pair to the given shaping plan. * * Return value: * @@ -322,12 +350,13 @@ hb_shape_plan_set_user_data (hb_shape_plan_t *shape_plan, /** * hb_shape_plan_get_user_data: (skip) - * @shape_plan: a shape plan. - * @key: + * @shape_plan: A shaping plan + * @key: The user-data key to query * + * Fetches the user data associated with the specified key, + * attached to the specified shaping plan. * - * - * Return value: (transfer none): + * Return value: (transfer none): A pointer to the user data * * Since: 0.9.7 **/ @@ -340,11 +369,11 @@ hb_shape_plan_get_user_data (hb_shape_plan_t *shape_plan, /** * hb_shape_plan_get_shaper: - * @shape_plan: a shape plan. + * @shape_plan: A shaping plan * + * Fetches the shaper from a given shaping plan. * - * - * Return value: (transfer none): + * Return value: (transfer none): The shaper * * Since: 0.9.7 **/ @@ -372,7 +401,8 @@ _hb_shape_plan_execute_internal (hb_shape_plan_t *shape_plan, return true; assert (!hb_object_is_immutable (buffer)); - assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE); + + buffer->assert_unicode (); if (unlikely (hb_object_is_inert (shape_plan))) return false; @@ -400,15 +430,16 @@ _hb_shape_plan_execute_internal (hb_shape_plan_t *shape_plan, } /** * hb_shape_plan_execute: - * @shape_plan: a shape plan. - * @font: a font. - * @buffer: a buffer. - * @features: (array length=num_features): - * @num_features: + * @shape_plan: A shaping plan + * @font: The #hb_font_t to use + * @buffer: The #hb_buffer_t to work upon + * @features: (array length=num_features): Features to enable + * @num_features: The number of features to enable * + * Executes the given shaping plan on the specified buffer, using + * the given @font and @features. * - * - * Return value: + * Return value: * * Since: 0.9.7 **/ @@ -435,15 +466,16 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan, /** * hb_shape_plan_create_cached: - * @face: - * @props: - * @user_features: (array length=num_user_features): - * @num_user_features: - * @shaper_list: (array zero-terminated=1): + * @face: #hb_face_t to use + * @props: The #hb_segment_properties_t of the segment + * @user_features: (array length=num_user_features): The list of user-selected features + * @num_user_features: The number of user-selected features + * @shaper_list: (array zero-terminated=1): List of shapers to try * + * Creates a cached shaping plan suitable for reuse, for a combination + * of @face, @user_features, @props, and @shaper_list. * - * - * Return value: (transfer full): + * Return value: (transfer full): The shaping plan * * Since: 0.9.7 **/ @@ -460,6 +492,25 @@ hb_shape_plan_create_cached (hb_face_t *face, shaper_list); } +/** + * hb_shape_plan_create_cached2: + * @face: #hb_face_t to use + * @props: The #hb_segment_properties_t of the segment + * @user_features: (array length=num_user_features): The list of user-selected features + * @num_user_features: The number of user-selected features + * @coords: (array length=num_coords): The list of variation-space coordinates + * @num_coords: The number of variation-space coordinates + * @shaper_list: (array zero-terminated=1): List of shapers to try + * + * The variable-font version of #hb_shape_plan_create_cached. + * Creates a cached shaping plan suitable for reuse, for a combination + * of @face, @user_features, @props, and @shaper_list, plus the + * variation-space coordinates @coords. + * + * Return value: (transfer full): The shaping plan + * + * Since: 1.4.0 + **/ hb_shape_plan_t * hb_shape_plan_create_cached2 (hb_face_t *face, const hb_segment_properties_t *props, diff --git a/src/hb-shape-plan.h b/src/hb-shape-plan.h index b62ae7ca3..336524ee2 100644 --- a/src/hb-shape-plan.h +++ b/src/hb-shape-plan.h @@ -36,6 +36,20 @@ HB_BEGIN_DECLS +/** + * hb_shape_plan_t: + * + * Data type for holding a shaping plan. + * + * Shape plans contain information about how HarfBuzz will shape a + * particular text segment, based on the segment's properties and the + * capabilities in the font face in use. + * + * Shape plans can be queried about how shaping will perform, given a set + * of specific input parameters (script, language, direction, features, + * etc.). + * + **/ typedef struct hb_shape_plan_t hb_shape_plan_t; HB_EXTERN hb_shape_plan_t * diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index 36070a7f1..71de71549 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -40,11 +40,16 @@ * @include: hb.h * * Unicode functions are used to access Unicode character properties. - * Client can pass its own Unicode functions to HarfBuzz, or access - * the built-in Unicode functions that come with HarfBuzz. + * With these functions, client programs can query various properties from + * the Unicode Character Database for any code point, such as General + * Category (gc), Script (sc), Canonical Combining Class (ccc), etc. * - * With the Unicode functions, one can query variour Unicode character - * properties, such as General Category, Script, Combining Class, etc. + * Client programs can optionally pass in their own Unicode functions + * that implement the same queries. The set of functions available is + * defined by the virtual methods in #hb_unicode_funcs_t. + * + * HarfBuzz provides built-in default functions for each method in + * #hb_unicode_funcs_t. **/ @@ -133,6 +138,16 @@ hb_unicode_decompose_compatibility_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED #include "hb-icu.h" #endif +/** + * hb_unicode_funcs_get_default: + * + * Fetches a pointer to the default Unicode-functions structure that is used + * when no functions are explicitly set on #hb_buffer_t. + * + * Return value: (transfer none): a pointer to the #hb_unicode_funcs_t Unicode-functions structure + * + * Since: 0.9.2 + **/ hb_unicode_funcs_t * hb_unicode_funcs_get_default () { @@ -155,11 +170,11 @@ hb_unicode_funcs_get_default () /** * hb_unicode_funcs_create: (Xconstructor) - * @parent: (nullable): + * @parent: (nullable): Parent Unicode-functions structure * + * Creates a new #hb_unicode_funcs_t structure of Unicode functions. * - * - * Return value: (transfer full): + * Return value: (transfer full): The Unicode-functions structure * * Since: 0.9.2 **/ @@ -203,9 +218,9 @@ DEFINE_NULL_INSTANCE (hb_unicode_funcs_t) = /** * hb_unicode_funcs_get_empty: * + * Fetches the singleton empty Unicode-functions structure. * - * - * Return value: (transfer full): + * Return value: (transfer full): The empty Unicode-functions structure * * Since: 0.9.2 **/ @@ -217,11 +232,11 @@ hb_unicode_funcs_get_empty () /** * hb_unicode_funcs_reference: (skip) - * @ufuncs: Unicode functions. + * @ufuncs: The Unicode-functions structure * + * Increases the reference count on a Unicode-functions structure. * - * - * Return value: (transfer full): + * Return value: (transfer full): The Unicode-functions structure * * Since: 0.9.2 **/ @@ -233,9 +248,11 @@ hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs) /** * hb_unicode_funcs_destroy: (skip) - * @ufuncs: Unicode functions. - * + * @ufuncs: The Unicode-functions structure * + * Decreases the reference count on a Unicode-functions structure. When + * the reference count reaches zero, the Unicode-functions structure is + * destroyed, freeing all memory. * * Since: 0.9.2 **/ @@ -256,15 +273,15 @@ hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs) /** * hb_unicode_funcs_set_user_data: (skip) - * @ufuncs: Unicode functions. - * @key: - * @data: - * @destroy: - * @replace: + * @ufuncs: The Unicode-functions structure + * @key: The user-data key + * @data: A pointer to the user data + * @destroy: A callback to call when @data is not needed anymore + * @replace: Whether to replace an existing data with the same key * + * Attaches a user-data key/data pair to the specified Unicode-functions structure. * - * - * Return value: + * Return value: %true if success, false otherwise * * Since: 0.9.2 **/ @@ -280,12 +297,13 @@ hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_funcs_get_user_data: (skip) - * @ufuncs: Unicode functions. - * @key: + * @ufuncs: The Unicode-functions structure + * @key: The user-data key to query * + * Fetches the user-data associated with the specified key, + * attached to the specified Unicode-functions structure. * - * - * Return value: (transfer none): + * Return value: (transfer none): A pointer to the user data * * Since: 0.9.2 **/ @@ -299,9 +317,10 @@ hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_funcs_make_immutable: - * @ufuncs: Unicode functions. - * + * @ufuncs: The Unicode-functions structure * + * Makes the specified Unicode-functions structure + * immutable. * * Since: 0.9.2 **/ @@ -316,11 +335,12 @@ hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs) /** * hb_unicode_funcs_is_immutable: - * @ufuncs: Unicode functions. + * @ufuncs: The Unicode-functions structure * + * Tests whether the specified Unicode-functions structure + * is immutable. * - * - * Return value: + * Return value: %true if @ufuncs is immutable, false otherwise * * Since: 0.9.2 **/ @@ -332,11 +352,12 @@ hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs) /** * hb_unicode_funcs_get_parent: - * @ufuncs: Unicode functions. + * @ufuncs: The Unicode-functions structure * + * Fetches the parent of the Unicode-functions structure + * @ufuncs. * - * - * Return value: + * Return value: The parent Unicode-functions structure * * Since: 0.9.2 **/ @@ -389,14 +410,18 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE /** * hb_unicode_compose: - * @ufuncs: Unicode functions. - * @a: - * @b: - * @ab: (out): + * @ufuncs: The Unicode-functions structure + * @a: The first Unicode code point to compose + * @b: The second Unicode code point to compose + * @ab: (out): The composition of @a, @b * + * Fetches the composition of a sequence of two Unicode + * code points. * + * Calls the composition function of the specified + * Unicode-functions structure @ufuncs. * - * Return value: + * Return value: %true if @a and @b composed, false otherwise * * Since: 0.9.2 **/ @@ -411,14 +436,17 @@ hb_unicode_compose (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_decompose: - * @ufuncs: Unicode functions. - * @ab: - * @a: (out): - * @b: (out): + * @ufuncs: The Unicode-functions structure + * @ab: Unicode code point to decompose + * @a: (out): The first code point of the decomposition of @ab + * @b: (out): The second code point of the decomposition of @ab * + * Fetches the decomposition of a Unicode code point. * + * Calls the decomposition function of the specified + * Unicode-functions structure @ufuncs. * - * Return value: + * Return value: %true if @ab was decomposed, false otherwise * * Since: 0.9.2 **/ @@ -434,11 +462,12 @@ hb_unicode_decompose (hb_unicode_funcs_t *ufuncs, #ifndef HB_DISABLE_DEPRECATED /** * hb_unicode_decompose_compatibility: - * @ufuncs: Unicode functions. - * @u: - * @decomposed: (out): - * + * @ufuncs: The Unicode-functions structure + * @u: Code point to decompose + * @decomposed: (out): Compatibility decomposition of @u * + * Fetches the compatibility decomposition of a Unicode + * code point. Deprecated. * * Return value: * diff --git a/src/hb-unicode.h b/src/hb-unicode.h index 61b1b0ba1..2353f0fbf 100644 --- a/src/hb-unicode.h +++ b/src/hb-unicode.h @@ -48,7 +48,42 @@ HB_BEGIN_DECLS #define HB_UNICODE_MAX 0x10FFFFu -/* hb_unicode_general_category_t */ +/** + * hb_unicode_general_category_t: + * @HB_UNICODE_GENERAL_CATEGORY_CONTROL: (Cc) + * @HB_UNICODE_GENERAL_CATEGORY_FORMAT: (Cf) + * @HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED: (Cn) + * @HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE: (Co) + * @HB_UNICODE_GENERAL_CATEGORY_SURROGATE: (Cs) + * @HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER: (Ll) + * @HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER: (Lm) + * @HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER: (Lo) + * @HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER: (Lt) + * @HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER: (Lu) + * @HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK: (Mc) + * @HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK: (Me) + * @HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK: (Mn) + * @HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER: (Nd) + * @HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER: (Nl) + * @HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER: (No) + * @HB_UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION: (Pc) + * @HB_UNICODE_GENERAL_CATEGORY_DASH_PUNCTUATION: (Pd) + * @HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION: (Pe) + * @HB_UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION: (Pf) + * @HB_UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION: (Pi) + * @HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION: (Po) + * @HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION: (Ps) + * @HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL: (Sc) + * @HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL: (Sk) + * @HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL: (Sm) + * @HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL: (So) + * @HB_UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR: (Zl) + * @HB_UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR: (Zp) + * @HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR: (Zs) + * + * Data type for the "General_Category" (gc) property from + * the Unicode Character Database. + **/ /* Unicode Character Database property: General_Category (gc) */ typedef enum @@ -85,13 +120,72 @@ typedef enum HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR /* Zs */ } hb_unicode_general_category_t; -/* hb_unicode_combining_class_t */ - -/* Note: newer versions of Unicode may add new values. Clients should be ready to handle - * any value in the 0..254 range being returned from hb_unicode_combining_class(). - */ - -/* Unicode Character Database property: Canonical_Combining_Class (ccc) */ +/** + * hb_unicode_combining_class_t: + * @HB_UNICODE_COMBINING_CLASS_NOT_REORDERED + * @HB_UNICODE_COMBINING_CLASS_OVERLAY + * @HB_UNICODE_COMBINING_CLASS_NUKTA + * @HB_UNICODE_COMBINING_CLASS_KANA_VOICING + * @HB_UNICODE_COMBINING_CLASS_VIRAMA + * @HB_UNICODE_COMBINING_CLASS_CCC11: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC12: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC13: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC14: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC15: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC16: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC17: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC18: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC19: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC20: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC21: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC22: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC23: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC24: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC25: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC26: (Hebrew) + * @HB_UNICODE_COMBINING_CLASS_CCC28: (Arabic) + * @HB_UNICODE_COMBINING_CLASS_CCC29: (Arabic) + * @HB_UNICODE_COMBINING_CLASS_CCC30: (Arabic) + * @HB_UNICODE_COMBINING_CLASS_CCC31: (Arabic) + * @HB_UNICODE_COMBINING_CLASS_CCC32: (Arabic) + * @HB_UNICODE_COMBINING_CLASS_CCC33: (Arabic) + * @HB_UNICODE_COMBINING_CLASS_CCC34: (Arabic) + * @HB_UNICODE_COMBINING_CLASS_CCC35: (Arabic) + * @HB_UNICODE_COMBINING_CLASS_CCC36: (Syriac) + * @HB_UNICODE_COMBINING_CLASS_CCC84: (Telugu) + * @HB_UNICODE_COMBINING_CLASS_CCC91: (Telugu) + * @HB_UNICODE_COMBINING_CLASS_CCC103: (Thai) + * @HB_UNICODE_COMBINING_CLASS_CCC107: (Thai) + * @HB_UNICODE_COMBINING_CLASS_CCC118: (Lao) + * @HB_UNICODE_COMBINING_CLASS_CCC122: (Lao) + * @HB_UNICODE_COMBINING_CLASS_CCC129: (Tibetan) + * @HB_UNICODE_COMBINING_CLASS_CCC130: (Tibetan) + * @HB_UNICODE_COMBINING_CLASS_CCC133: (Tibetan) + * @HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT + * @HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW + * @HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE + * @HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT + * @HB_UNICODE_COMBINING_CLASS_BELOW_LEFT + * @HB_UNICODE_COMBINING_CLASS_BELOW + * @HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT + * @HB_UNICODE_COMBINING_CLASS_LEFT + * @HB_UNICODE_COMBINING_CLASS_RIGHT + * @HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT + * @HB_UNICODE_COMBINING_CLASS_ABOVE + * @HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT + * @HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW + * @HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE + * @HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT + * @HB_UNICODE_COMBINING_CLASS_INVALID: 255 + * + * Data type for the Canonical_Combining_Class (ccc) property + * from the Unicode Character Database. + * + * Note: newer versions of Unicode may add new values. + * Client programs should be ready to handle any value in the 0..254 range + * being returned from hb_unicode_combining_class(). + * + **/ typedef enum { HB_UNICODE_COMBINING_CLASS_NOT_REORDERED = 0, @@ -176,6 +270,18 @@ typedef enum * hb_unicode_funcs_t */ +/** + * hb_unicode_funcs_t: + * + * Data type containing a set of virtual methods used for + * accessing various Unicode character properties. + * + * HarfBuzz provides a default function for each of the + * methods in #hb_unicode_funcs_t. Client programs can implement + * their own replacements for the individual Unicode functions, as + * needed, and replace the default by calling the setter for a + * method. + **/ typedef struct hb_unicode_funcs_t hb_unicode_funcs_t; @@ -227,40 +333,107 @@ hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs); /* typedefs */ +/** + * hb_unicode_combining_class_func_t: + * + * A virtual method for the #hb_unicode_funcs_t structure. + * + * This method should retrieve the Canonical Combining Class (ccc) + * property for a specified Unicode code point. + * + **/ typedef hb_unicode_combining_class_t (*hb_unicode_combining_class_func_t) (hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode, void *user_data); + +/** + * hb_unicode_general_category_func_t: + * + * A virtual method for the #hb_unicode_funcs_t structure. + * + * This method should retrieve the General Category property for + * a specified Unicode code point. + * + **/ typedef hb_unicode_general_category_t (*hb_unicode_general_category_func_t) (hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode, void *user_data); + +/** + * hb_unicode_mirroring_func_t: + * + * A virtual method for the #hb_unicode_funcs_t structure. + * + * This method should retrieve the Bi-Directional Mirroring Glyph + * code point for a specified Unicode code point. + * + * Note: If a code point does not have a specified + * Bi-Directional Mirroring Glyph defined, the method should + * return the original code point. + * + **/ typedef hb_codepoint_t (*hb_unicode_mirroring_func_t) (hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode, void *user_data); + +/** + * hb_unicode_script_func_t: + * + * A virtual method for the #hb_unicode_funcs_t structure. + * + * This method should retrieve the Script property for a + * specified Unicode code point. + * + **/ typedef hb_script_t (*hb_unicode_script_func_t) (hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode, void *user_data); +/** + * hb_unicode_compose_func_t: + * + * A virtual method for the #hb_unicode_funcs_t structure. + * + * This method should compose a sequence of two input Unicode code + * points by canonical equivalence, returning the composed code + * point in a #hb_codepoint_t output parameter (if successful). + * The method must return an #hb_bool_t indicating the success + * of the composition. + * + **/ typedef hb_bool_t (*hb_unicode_compose_func_t) (hb_unicode_funcs_t *ufuncs, hb_codepoint_t a, hb_codepoint_t b, hb_codepoint_t *ab, void *user_data); + +/** + * hb_unicode_decompose_func_t: + * + * A virtual method for the #hb_unicode_funcs_t structure. + * + * This method should decompose an input Unicode code point, + * returning the two decomposed code points in #hb_codepoint_t + * output parameters (if successful). The method must return an + * #hb_bool_t indicating the success of the composition. + * + **/ typedef hb_bool_t (*hb_unicode_decompose_func_t) (hb_unicode_funcs_t *ufuncs, hb_codepoint_t ab, hb_codepoint_t *a, hb_codepoint_t *b, void *user_data); -/* setters */ +/* func setters */ /** * hb_unicode_funcs_set_combining_class_func: - * @ufuncs: a Unicode function structure - * @func: (closure user_data) (destroy destroy) (scope notified): - * @user_data: - * @destroy: - * + * @ufuncs: A Unicode-functions structure + * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign + * @user_data: Data to pass to @func + * @destroy: The function to call when @user_data is not needed anymore * + * Sets the implementation function for #hb_unicode_combining_class_func_t. * * Since: 0.9.2 **/ @@ -271,12 +444,12 @@ hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_funcs_set_general_category_func: - * @ufuncs: a Unicode function structure - * @func: (closure user_data) (destroy destroy) (scope notified): - * @user_data: - * @destroy: - * + * @ufuncs: A Unicode-functions structure + * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign + * @user_data: Data to pass to @func + * @destroy: The function to call when @user_data is not needed anymore * + * Sets the implementation function for #hb_unicode_general_category_func_t. * * Since: 0.9.2 **/ @@ -287,12 +460,12 @@ hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_funcs_set_mirroring_func: - * @ufuncs: a Unicode function structure - * @func: (closure user_data) (destroy destroy) (scope notified): - * @user_data: - * @destroy: - * + * @ufuncs: A Unicode-functions structure + * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign + * @user_data: Data to pass to @func + * @destroy: The function to call when @user_data is not needed anymore * + * Sets the implementation function for #hb_unicode_mirroring_func_t. * * Since: 0.9.2 **/ @@ -303,12 +476,12 @@ hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_funcs_set_script_func: - * @ufuncs: a Unicode function structure - * @func: (closure user_data) (destroy destroy) (scope notified): - * @user_data: - * @destroy: - * + * @ufuncs: A Unicode-functions structure + * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign + * @user_data: Data to pass to @func + * @destroy: The function to call when @user_data is not needed anymore * + * Sets the implementation function for #hb_unicode_script_func_t. * * Since: 0.9.2 **/ @@ -319,12 +492,12 @@ hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_funcs_set_compose_func: - * @ufuncs: a Unicode function structure - * @func: (closure user_data) (destroy destroy) (scope notified): - * @user_data: - * @destroy: - * + * @ufuncs: A Unicode-functions structure + * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign + * @user_data: Data to pass to @func + * @destroy: The function to call when @user_data is not needed anymore * + * Sets the implementation function for #hb_unicode_compose_func_t. * * Since: 0.9.2 **/ @@ -335,12 +508,12 @@ hb_unicode_funcs_set_compose_func (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_funcs_set_decompose_func: - * @ufuncs: a Unicode function structure - * @func: (closure user_data) (destroy destroy) (scope notified): - * @user_data: - * @destroy: - * + * @ufuncs: A Unicode-functions structure + * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign + * @user_data: Data to pass to @func + * @destroy: The function to call when @user_data is not needed anymore * + * Sets the implementation function for #hb_unicode_decompose_func_t. * * Since: 0.9.2 **/ @@ -353,6 +526,13 @@ hb_unicode_funcs_set_decompose_func (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_combining_class: + * @ufuncs: The Unicode-functions structure + * @unicode: The code point to query + * + * Retrieves the Canonical Combining Class (ccc) property + * of code point @unicode. + * + * Return value: The #hb_unicode_combining_class_t of @unicode * * Since: 0.9.2 **/ @@ -362,6 +542,13 @@ hb_unicode_combining_class (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_general_category: + * @ufuncs: The Unicode-functions structure + * @unicode: The code point to query + * + * Retrieves the General Category (gc) property + * of code point @unicode. + * + * Return value: The #hb_unicode_general_category_t of @unicode * * Since: 0.9.2 **/ @@ -371,6 +558,13 @@ hb_unicode_general_category (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_mirroring: + * @ufuncs: The Unicode-functions structure + * @unicode: The code point to query + * + * Retrieves the Bi-directional Mirroring Glyph code + * point defined for code point @unicode. + * + * Return value: The #hb_codepoint_t of the Mirroring Glyph for @unicode * * Since: 0.9.2 **/ @@ -380,6 +574,13 @@ hb_unicode_mirroring (hb_unicode_funcs_t *ufuncs, /** * hb_unicode_script: + * @ufuncs: The Unicode-functions structure + * @unicode: The code point to query + * + * Retrieves the #hb_script_t script to which code + * point @unicode belongs. + * + * Return value: The #hb_script_t of @unicode * * Since: 0.9.2 **/ @@ -387,12 +588,40 @@ HB_EXTERN hb_script_t hb_unicode_script (hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode); +/** + * hb_unicode_compose: + * @ufuncs: The Unicode-functions structure + * @a: The first code point to compose + * @b: The second code point to compose + * @ab: (out): The composed code point + * + * Composes the code point sequence @a,@b by canonical equivalence into + * code point @ab. + * + * Return value: True is @a,@b composed, false otherwise + * + * Since: 0.9.2 + **/ HB_EXTERN hb_bool_t hb_unicode_compose (hb_unicode_funcs_t *ufuncs, hb_codepoint_t a, hb_codepoint_t b, hb_codepoint_t *ab); +/** + * hb_unicode_decompose: + * @ufuncs: The Unicode-functions structure + * @ab: The code point to decompose + * @a: (out): The first decomposed code point + * @b: (out): The second decomposed code point + * + * Decomposes code point @ab by canonical equivalence, into code points + * @a and @b. + * + * Return value: True if @ab decomposed, false otherwise + * + * Since: 0.9.2 + **/ HB_EXTERN hb_bool_t hb_unicode_decompose (hb_unicode_funcs_t *ufuncs, hb_codepoint_t ab, diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c index 228f0f327..6c90109a8 100644 --- a/test/api/test-buffer.c +++ b/test/api/test-buffer.c @@ -71,7 +71,7 @@ fixture_init (fixture_t *fixture, gconstpointer user_data) case BUFFER_ONE_BY_ONE: for (i = 1; i < G_N_ELEMENTS (utf32) - 1; i++) - hb_buffer_add (b, utf32[i], i); + hb_buffer_add (b, utf32[i], i); break; case BUFFER_UTF32: @@ -856,6 +856,75 @@ test_buffer_empty (void) g_assert (!hb_buffer_allocation_successful (b)); } +typedef struct { + const char *contents; + hb_buffer_serialize_format_t format; + unsigned int num_items; + hb_bool_t success; +} serialization_test_t; + +static const serialization_test_t serialization_tests[] = { + { "", HB_BUFFER_SERIALIZE_FORMAT_TEXT, 2, 1 }, + { "[{\"u\":1600,\"cl\":0},{\"u\":1589,\"cl\":1}]", HB_BUFFER_SERIALIZE_FORMAT_JSON, 2, 1 }, + + /* Mixed glyphs/Unicodes -> parse fail */ + { "[{\"u\":1600,\"cl\":0},{\"g\":1589,\"cl\":1}]", HB_BUFFER_SERIALIZE_FORMAT_JSON, 0, 0 }, + { "", HB_BUFFER_SERIALIZE_FORMAT_TEXT, 0, 0 }, +}; + +static void +test_buffer_serialize_deserialize (void) +{ + hb_buffer_t *b; + unsigned int i; + + for (i = 0; i < G_N_ELEMENTS (serialization_tests); i++) + { + unsigned int consumed; + char round_trip[1024]; + hb_bool_t retval; + + b = hb_buffer_create (); + hb_buffer_set_replacement_codepoint (b, (hb_codepoint_t) -1); + + const serialization_test_t *test = &serialization_tests[i]; + g_test_message ("serialize test #%d", i); + + retval = hb_buffer_deserialize_unicode (b, test->contents, -1, NULL, test->format); + + // Expected parse failure, got one, don't round-trip + if (test->success != 0) + { + unsigned int num_glyphs = hb_buffer_get_length (b); + g_assert_cmpint (num_glyphs, ==, test->num_items); + + hb_buffer_serialize_unicode (b, 0, num_glyphs, round_trip, + sizeof(round_trip), &consumed, test->format, + HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + g_assert_cmpstr (round_trip, ==, test->contents); + } + + hb_buffer_destroy (b); + + } + + char test[1024]; + unsigned int consumed; + hb_buffer_t *indeterminate = hb_buffer_get_empty (); + hb_buffer_serialize (indeterminate, 0, (unsigned) -1, + test, sizeof(test), &consumed, NULL, + HB_BUFFER_SERIALIZE_FORMAT_JSON, + HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + g_assert_cmpstr ( test, ==, "[]"); + + hb_buffer_serialize (indeterminate, 0, (unsigned) - 1, + test, sizeof(test), &consumed, NULL, + HB_BUFFER_SERIALIZE_FORMAT_TEXT, + HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + g_assert_cmpstr ( test, ==, "!!"); + +} + int main (int argc, char **argv) { @@ -880,6 +949,7 @@ main (int argc, char **argv) hb_test_add (test_buffer_utf16_conversion); hb_test_add (test_buffer_utf32_conversion); hb_test_add (test_buffer_empty); + hb_test_add (test_buffer_serialize_deserialize); return hb_test_run(); } diff --git a/test/api/test-ot-tag.c b/test/api/test-ot-tag.c index 6669ea948..a0df6a4db 100644 --- a/test/api/test-ot-tag.c +++ b/test/api/test-ot-tag.c @@ -335,6 +335,8 @@ test_ot_tag_language (void) test_language_two_way ("FAR", "fa"); test_tag_from_language ("FAR", "fa_IR"); + test_language_two_way ("MNK", "man"); /* Mandingo [macrolanguage] */ + test_language_two_way ("SWA", "aii"); /* Swadaya Aramaic */ test_language_two_way ("SYR", "syr"); /* Syriac [macrolanguage] */ diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index 8f698854b..9eaf3fa99 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -31,7 +31,6 @@ endforeach env = environment() env.set('srcdir', meson.current_source_dir()) -env.set('HB_TEST_SUBSET_FUZZER_TIMEOUT', '50') test('shape_fuzzer', find_program('run-shape-fuzzer-tests.py'), args: [ diff --git a/test/fuzzing/run-draw-fuzzer-tests.py b/test/fuzzing/run-draw-fuzzer-tests.py index acae7a81d..8b5a2e82d 100755 --- a/test/fuzzing/run-draw-fuzzer-tests.py +++ b/test/fuzzing/run-draw-fuzzer-tests.py @@ -9,7 +9,7 @@ def cmd (command): p = subprocess.Popen (command, stderr=tempf) try: - p.wait (timeout=int (os.getenv ("HB_TEST_SHAPE_FUZZER_TIMEOUT", "2"))) + p.wait () tempf.seek (0) text = tempf.read () diff --git a/test/fuzzing/run-shape-fuzzer-tests.py b/test/fuzzing/run-shape-fuzzer-tests.py index 348d1384f..382f60929 100755 --- a/test/fuzzing/run-shape-fuzzer-tests.py +++ b/test/fuzzing/run-shape-fuzzer-tests.py @@ -9,7 +9,7 @@ def cmd (command): p = subprocess.Popen (command, stderr=tempf) try: - p.wait (timeout=int (os.getenv ("HB_TEST_SHAPE_FUZZER_TIMEOUT", "2"))) + p.wait () tempf.seek (0) text = tempf.read () diff --git a/test/fuzzing/run-subset-fuzzer-tests.py b/test/fuzzing/run-subset-fuzzer-tests.py index 800a43601..da7d1e570 100755 --- a/test/fuzzing/run-subset-fuzzer-tests.py +++ b/test/fuzzing/run-subset-fuzzer-tests.py @@ -9,7 +9,7 @@ def cmd (command): p = subprocess.Popen (command, stderr=tempf) try: - p.wait (timeout=int (os.getenv ("HB_TEST_SUBSET_FUZZER_TIMEOUT", "12"))) + p.wait () tempf.seek (0) text = tempf.read () diff --git a/test/shaping/data/in-house/tests/use-syllable.tests b/test/shaping/data/in-house/tests/use-syllable.tests index 61f288758..10f9e0659 100644 --- a/test/shaping/data/in-house/tests/use-syllable.tests +++ b/test/shaping/data/in-house/tests/use-syllable.tests @@ -18,3 +18,5 @@ ../fonts/573d3a3177c9a8646e94c8a0d7b224334340946a.ttf:--font-funcs=ft:U+11410,U+11442,U+200C,U+034F,U+11411:[Ga=0+576|Virama=0@70,70+0|Gha=4+566] ../fonts/573d3a3177c9a8646e94c8a0d7b224334340946a.ttf:--font-funcs=ft:U+11410,U+200C,U+11442,U+034F,U+11411:[Ga.icd=0+367|Gha.diag=1@100,0+386] ../fonts/e68a88939e0f06e34d2bc911f09b70890289c8fd.ttf::U+AA00,U+200C,U+AA34:[raMedial_cham_pre=0+400|a_cham=0+1121] +../fonts/2a670df15b73a5dc75a5cc491bde5ac93c5077dc.ttf::U+11124,U+200D,U+11127:[u11124=0+514|u11127=0+0] +../fonts/2a670df15b73a5dc75a5cc491bde5ac93c5077dc.ttf::U+11124,U+2060,U+11127:[u11124=0+514|u11127=1+0] diff --git a/util/hb-shape.cc b/util/hb-shape.cc index 78488f476..01b3d4551 100644 --- a/util/hb-shape.cc +++ b/util/hb-shape.cc @@ -137,7 +137,7 @@ struct output_buffer_t g_string_set_size (gs, 0); format.serialize_line_no (line_no, gs); g_string_append_printf (gs, "trace: %s buffer: ", message); - format.serialize_glyphs (buffer, font, output_format, format_flags, gs); + format.serialize (buffer, font, output_format, format_flags, gs); g_string_append_c (gs, '\n'); fprintf (options.fp, "%s", gs->str); } diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 253e48a0a..97a3a2f32 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -70,27 +70,27 @@ struct subset_consumer_t hb_bool_t write_file (const char *output_file, hb_blob_t *blob) { - unsigned int data_length; - const char* data = hb_blob_get_data (blob, &data_length); + unsigned int size; + const char* data = hb_blob_get_data (blob, &size); - FILE *fp_out = fopen(output_file, "wb"); - if (!fp_out) { - fprintf(stderr, "Unable to open output file\n"); - return false; - } - int bytes_written = fwrite(data, 1, data_length, fp_out); + if (!output_file) + fail (true, "No output file was specified"); - fclose (fp_out); + FILE *fp = fopen(output_file, "wb"); + if (!fp) + fail (false, "Cannot open output file `%s': %s", + g_filename_display_name (output_file), strerror (errno)); - if (bytes_written == -1) { - fprintf(stderr, "Unable to write output file\n"); - return false; - } - if ((unsigned int) bytes_written != data_length) { - fprintf(stderr, "Expected %u bytes written, got %d\n", data_length, - bytes_written); - return false; + while (size) { + size_t ret = fwrite (data, 1, size, fp); + size -= ret; + data += ret; + if (size && ferror (fp)) + fail (false, "Failed to write output: %s", strerror (errno)); } + + fclose (fp); + return true; } diff --git a/util/options.cc b/util/options.cc index ee09ac5d4..caf8233f7 100644 --- a/util/options.cc +++ b/util/options.cc @@ -910,31 +910,12 @@ format_options_t::add_options (option_parser_t *parser) } void -format_options_t::serialize_unicode (hb_buffer_t *buffer, - GString *gs) -{ - unsigned int num_glyphs = hb_buffer_get_length (buffer); - hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr); - - g_string_append_c (gs, '<'); - for (unsigned int i = 0; i < num_glyphs; i++) - { - if (i) - g_string_append_c (gs, ','); - g_string_append_printf (gs, "U+%04X", info->codepoint); - info++; - } - g_string_append_c (gs, '>'); -} - -void -format_options_t::serialize_glyphs (hb_buffer_t *buffer, +format_options_t::serialize (hb_buffer_t *buffer, hb_font_t *font, hb_buffer_serialize_format_t output_format, hb_buffer_serialize_flags_t flags, GString *gs) { - g_string_append_c (gs, '['); unsigned int num_glyphs = hb_buffer_get_length (buffer); unsigned int start = 0; @@ -942,15 +923,15 @@ format_options_t::serialize_glyphs (hb_buffer_t *buffer, { char buf[32768]; unsigned int consumed; - start += hb_buffer_serialize_glyphs (buffer, start, num_glyphs, + start += hb_buffer_serialize (buffer, start, num_glyphs, buf, sizeof (buf), &consumed, font, output_format, flags); if (!consumed) break; g_string_append (gs, buf); } - g_string_append_c (gs, ']'); } + void format_options_t::serialize_line_no (unsigned int line_no, GString *gs) @@ -978,7 +959,7 @@ format_options_t::serialize_buffer_of_text (hb_buffer_t *buffer, if (show_unicode) { serialize_line_no (line_no, gs); - serialize_unicode (buffer, gs); + serialize (buffer, font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, HB_BUFFER_SERIALIZE_FLAG_DEFAULT, gs); g_string_append_c (gs, '\n'); } } @@ -1003,6 +984,6 @@ format_options_t::serialize_buffer_of_glyphs (hb_buffer_t *buffer, GString *gs) { serialize_line_no (line_no, gs); - serialize_glyphs (buffer, font, output_format, format_flags, gs); + serialize (buffer, font, output_format, format_flags, gs); g_string_append_c (gs, '\n'); } diff --git a/util/options.hh b/util/options.hh index 2c10578a9..30b8f5b00 100644 --- a/util/options.hh +++ b/util/options.hh @@ -635,9 +635,7 @@ struct format_options_t : option_group_t void add_options (option_parser_t *parser) override; - void serialize_unicode (hb_buffer_t *buffer, - GString *gs); - void serialize_glyphs (hb_buffer_t *buffer, + void serialize (hb_buffer_t *buffer, hb_font_t *font, hb_buffer_serialize_format_t format, hb_buffer_serialize_flags_t flags,