diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2020-07-25 10:48:52 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2020-07-25 10:48:52 +0000 |
commit | 120fbb4ff2102335d09b937b3b63a9eed6ab66bb (patch) | |
tree | 536783132e9340733acf05aa2086936b22066771 /Build/source/libs/harfbuzz/harfbuzz-src/src | |
parent | 838bc80097f80371675cb700320a76c6a0ea6ab6 (diff) |
harfbuzz-2.7.0
git-svn-id: svn://tug.org/texlive/trunk@55937 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src')
66 files changed, 672 insertions, 723 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am index 633e993bf4e..c18adac2d10 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.am @@ -98,7 +98,12 @@ BUILT_SOURCES += \ hb-version.h $(srcdir)/hb-version.h: hb-version.h.in $(top_srcdir)/configure.ac - $(AM_V_GEN) $(srcdir)/gen-hb-version.py $(HB_VERSION) hb-version.h.in hb-version.h + $(AM_V_GEN) $(SED) \ + -e 's/[@]HB_VERSION_MAJOR@/$(HB_VERSION_MAJOR)/' \ + -e 's/[@]HB_VERSION_MINOR@/$(HB_VERSION_MINOR)/' \ + -e 's/[@]HB_VERSION_MICRO@/$(HB_VERSION_MICRO)/' \ + -e 's/[@]HB_VERSION@/$(HB_VERSION)/' \ + "$<" > "$@" || ($(RM) "$@"; false) # Put the library together @@ -277,8 +282,7 @@ $(srcdir)/%.hh: $(srcdir)/%.rl harfbuzz.cc: Makefile.sources $(AM_V_GEN) \ - $(srcdir)/gen-harfbuzzcc.py \ - $(srcdir)/harfbuzz.cc \ + for f in \ $(HB_BASE_sources) \ $(HB_GLIB_sources) \ $(HB_FT_sources) \ @@ -286,7 +290,10 @@ harfbuzz.cc: Makefile.sources $(HB_UNISCRIBE_sources) \ $(HB_GDI_sources) \ $(HB_DIRECTWRITE_sources) \ - $(HB_CORETEXT_sources) + $(HB_CORETEXT_sources) \ + ; do echo '#include "'$$f'"'; done | \ + grep '[.]cc"' > $(srcdir)/harfbuzz.cc \ + || ($(RM) $(srcdir)/harfbuzz.cc; false) BUILT_SOURCES += harfbuzz.cc noinst_PROGRAMS = \ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources index b3d580db85b..4ad11e2bc65 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources @@ -1,14 +1,12 @@ # Base and default-included sources and headers HB_BASE_sources = \ - hb-aat-fdsc-table.hh \ hb-aat-layout-ankr-table.hh \ hb-aat-layout-bsln-table.hh \ hb-aat-layout-common.hh \ hb-aat-layout-feat-table.hh \ hb-aat-layout-just-table.hh \ hb-aat-layout-kerx-table.hh \ - hb-aat-layout-lcar-table.hh \ hb-aat-layout-morx-table.hh \ hb-aat-layout-opbd-table.hh \ hb-aat-layout-trak-table.hh \ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-c-linkage-decls.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-c-linkage-decls.py index 41b9d02a5c4..b7532a7e944 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-c-linkage-decls.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-c-linkage-decls.py @@ -2,11 +2,11 @@ import sys, os -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) -HBHEADERS = os.environ.get ('HBHEADERS', '').split () or \ +HBHEADERS = [os.path.basename (x) for x in os.getenv ('HBHEADERS', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith ('.h')] -HBSOURCES = os.environ.get ('HBSOURCES', '').split () or \ +HBSOURCES = [os.path.basename (x) for x in os.getenv ('HBSOURCES', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))] stat = 0 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-externs.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-externs.py index 13aedf85ac6..a64d2e5b4a9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-externs.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-externs.py @@ -2,9 +2,9 @@ import sys, os, re -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) -HBHEADERS = os.environ.get ('HBHEADERS', '').split () or \ +HBHEADERS = [os.path.basename (x) for x in os.getenv ('HBHEADERS', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith ('.h')] stat = 0 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-header-guards.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-header-guards.py index e6c90773194..0ad42cd845e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-header-guards.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-header-guards.py @@ -2,11 +2,11 @@ import sys, os, re -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) -HBHEADERS = os.environ.get ('HBHEADERS', '').split () or \ +HBHEADERS = [os.path.basename (x) for x in os.getenv ('HBHEADERS', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith ('.h')] -HBSOURCES = os.environ.get ('HBSOURCES', '').split () or \ +HBSOURCES = [os.path.basename (x) for x in os.getenv ('HBSOURCES', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))] stat = 0 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.py index b278b3e5929..88eaa2eaa92 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.py @@ -2,11 +2,11 @@ import sys, os, re -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) -HBHEADERS = os.environ.get ('HBHEADERS', '').split () or \ +HBHEADERS = [os.path.basename (x) for x in os.getenv ('HBHEADERS', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith ('.h')] -HBSOURCES = os.environ.get ('HBSOURCES', '').split () or \ +HBSOURCES = [os.path.basename (x) for x in os.getenv ('HBSOURCES', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))] stat = 0 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-libstdc++.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-libstdc++.py index 142785c1548..200c6837490 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-libstdc++.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-libstdc++.py @@ -2,9 +2,9 @@ import sys, os, shutil, subprocess -os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__))) +os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) -libs = os.environ.get ('libs', '.libs') +libs = os.getenv ('libs', '.libs') ldd = shutil.which ('ldd') if ldd: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-static-inits.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-static-inits.py index 9e43b811bdd..1c88f22ca2b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-static-inits.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-static-inits.py @@ -2,8 +2,8 @@ import sys, os, shutil, subprocess, glob, re -builddir = os.environ.get ('builddir', os.path.dirname (__file__)) -libs = os.environ.get ('libs', '.libs') +builddir = os.getenv ('builddir', os.path.dirname (__file__)) +libs = os.getenv ('libs', '.libs') objdump = shutil.which ('objdump') if not objdump: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-symbols.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-symbols.py index 92f44cd26f8..c366dc0aafd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-symbols.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-symbols.py @@ -4,12 +4,12 @@ import sys, os, shutil, subprocess, re, difflib os.environ['LC_ALL'] = 'C' # otherwise 'nm' prints in wrong order -builddir = os.environ.get ('builddir', os.path.dirname (__file__)) -libs = os.environ.get ('libs', '.libs') +builddir = os.getenv ('builddir', os.path.dirname (__file__)) +libs = os.getenv ('libs', '.libs') IGNORED_SYMBOLS = '|'.join(['_fini', '_init', '_fdata', '_ftext', '_fbss', '__bss_start', '__bss_start__', '__bss_end__', '_edata', '_end', '_bss_end__', - '__end__', '__gcov_.*', 'llvm_.*', 'flush_fn_list', 'writeout_fn_list']) + '__end__', '__gcov_.*', 'llvm_.*', 'flush_fn_list', 'writeout_fn_list', 'mangle_path']) nm = shutil.which ('nm') if not nm: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-arabic-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-arabic-table.py index 50501ce7f85..621d5b60c89 100755 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-arabic-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-arabic-table.py @@ -181,7 +181,6 @@ def print_shaping_table(f): if items not in ligatures: ligatures[items] = {} ligatures[items][shape] = c - pass else: # Save shape if items[0] not in names: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py index 822a9448d2a..aa6dcd95fbb 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-def.py @@ -41,7 +41,7 @@ hb_font_get_var_coords_design""".splitlines () symbols = [x for x in symbols if x not in experimental_symbols] symbols = "\n".join (symbols) -result = symbols if os.environ.get('PLAIN_LIST', '') else """EXPORTS +result = symbols if os.getenv ('PLAIN_LIST', '') else """EXPORTS %s LIBRARY lib%s-0.dll""" % (symbols, output_file.replace ('src/', '').replace ('.def', '')) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-emoji-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-emoji-table.py index 5b78bd3a356..551bc9c7ced 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-emoji-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-emoji-table.py @@ -7,7 +7,6 @@ Input file: """ import sys -import os.path from collections import OrderedDict import packTab diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-harfbuzzcc.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-harfbuzzcc.py index a156c5d7272..b25bcc7abb9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-harfbuzzcc.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-harfbuzzcc.py @@ -1,18 +1,18 @@ #!/usr/bin/env python3 -"usage: gen-harfbuzzcc.py harfbuzz.cc hb-blob.cc hb-buffer.cc ..." +"This tool is intended to be used from meson" -import os, re, sys - -os.chdir (os.path.dirname (__file__)) +import os, sys, shutil if len (sys.argv) < 3: sys.exit (__doc__) -output_file = sys.argv[1] -source_paths = sys.argv[2:] +OUTPUT = sys.argv[1] +CURRENT_SOURCE_DIR = sys.argv[2] +sources = sys.argv[3:] + +with open (OUTPUT, "wb") as f: + f.write ("".join ('#include "{}"\n'.format (os.path.basename (x)) for x in sources if x.endswith (".cc")).encode ()) -with open (output_file, "wb") as f: - f.write ("".join ('#include "{}"\n'.format (x) - for x in source_paths - if x.endswith (".cc")).encode ()) +# copy it also to src/ +shutil.copyfile (OUTPUT, os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT))) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py index f21e5deb38d..15e56b93f98 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py @@ -1,31 +1,27 @@ #!/usr/bin/env python3 -"usage: gen-hb-version.py 1.0.0 hb-version.h.in hb-version.h" +"This tool is intended to be used from meson" -import os, re, sys +import os, sys, shutil -os.chdir (os.path.dirname (__file__)) - -if len (sys.argv) < 4: +if len (sys.argv) < 5: sys.exit(__doc__) version = sys.argv[1] major, minor, micro = version.split (".") -input = sys.argv[2] -output = sys.argv[3] - -with open (input, "r", encoding='utf-8') as input_file: - generated = (input_file.read () - .replace ("@HB_VERSION_MAJOR@", major) - .replace ("@HB_VERSION_MINOR@", minor) - .replace ("@HB_VERSION_MICRO@", micro) - .replace ("@HB_VERSION@", version) - .encode ()) - - with open (output, "rb") as current_file: - current = current_file.read() - # write only if is changed - if generated != current: - with open (output, "wb") as output_file: - output_file.write (generated) +OUTPUT = sys.argv[2] +CURRENT_SOURCE_DIR = sys.argv[3] +INPUT = sys.argv[4] + +with open (INPUT, "r", encoding='utf-8') as template: + with open (OUTPUT, "wb") as output: + output.write (template.read () + .replace ("@HB_VERSION_MAJOR@", major) + .replace ("@HB_VERSION_MINOR@", minor) + .replace ("@HB_VERSION_MICRO@", micro) + .replace ("@HB_VERSION@", version) + .encode ()) + +# copy it also to src/ +shutil.copyfile (OUTPUT, os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT))) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py index 1746aab6792..9d4d5480002 100755 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py @@ -41,8 +41,8 @@ files = [open (x, encoding='utf-8') for x in sys.argv[1:]] headers = [[f.readline () for i in range (2)] for f in files] -data = [{} for f in files] -values = [{} for f in files] +data = [{} for _ in files] +values = [{} for _ in files] for i, f in enumerate (files): for line in f: @@ -82,7 +82,6 @@ for i,d in enumerate (data): combined = {k:v for k,v in combined.items() if k in ALLOWED_SINGLES or v[2] in ALLOWED_BLOCKS} data = combined del combined -num = len (data) # Move the outliers NO-BREAK SPACE and DOTTED CIRCLE out singles = {} @@ -216,7 +215,6 @@ for u in uu: if start != last + 1: if start - last <= 1+16*3: print_block (None, last+1, start-1, data) - last = start-1 else: if last >= 0: ends.append (last + 1) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ragel-artifacts.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ragel-artifacts.py index 5833714e47f..b60ec3bff58 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ragel-artifacts.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ragel-artifacts.py @@ -1,40 +1,25 @@ #!/usr/bin/env python3 -import os, re, sys, subprocess, shutil, tempfile +"This tool is intended to be used from meson" -os.chdir (os.path.dirname (__file__)) - -if len (sys.argv) < 2: - ragel_sources = [x for x in os.listdir ('.') if x.endswith ('.rl')] -else: - ragel_sources = sys.argv[2:] +import os, os.path, sys, subprocess, shutil ragel = shutil.which ('ragel') - if not ragel: - print ('You have to install ragel if you are going to develop HarfBuzz itself') - exit (1) - -if not len (ragel_sources): - exit (77) - -tempdir = tempfile.mkdtemp () - -for rl in ragel_sources: - hh = rl.replace ('.rl', '.hh') - shutil.copy (rl, tempdir) - # writing to stdout has some complication on Windows - subprocess.Popen ([ragel, '-e', '-F1', '-o', hh, rl], cwd=tempdir).wait () + sys.exit ('You have to install ragel if you are going to develop HarfBuzz itself') - generated_path = os.path.join (tempdir, hh) - with open (generated_path, "rb") as temp_file: - generated = temp_file.read() +if len (sys.argv) < 4: + sys.exit (__doc__) - with open (hh, "rb") as current_file: - current = current_file.read() +OUTPUT = sys.argv[1] +CURRENT_SOURCE_DIR = sys.argv[2] +INPUT = sys.argv[3] - # overwrite only if is changed - if generated != current: - shutil.copyfile (generated_path, hh) +outdir = os.path.dirname (OUTPUT) +shutil.copy (INPUT, outdir) +rl = os.path.basename (INPUT) +hh = rl.replace ('.rl', '.hh') +subprocess.Popen ([ragel, '-e', '-F1', '-o', hh, rl], cwd=outdir).wait () -shutil.rmtree (tempdir) +# copy it also to src/ +shutil.copyfile (os.path.join (outdir, hh), os.path.join (CURRENT_SOURCE_DIR, hh)) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ucd-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ucd-table.py index 402de3377a5..35fba2d0729 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ucd-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-ucd-table.py @@ -6,7 +6,7 @@ Input file: * https://unicode.org/Public/UCD/latest/ucdxml/ucd.nounihan.grouped.zip """ -import os.path, sys, re +import sys, re import logging logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py index 19ad2637699..e4b48353f33 100755 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py @@ -22,8 +22,8 @@ files = [open (x, encoding='utf-8') for x in sys.argv[1:]] headers = [[f.readline () for i in range (2)] for j,f in enumerate(files) if j != 2] headers.append (["UnicodeData.txt does not have a header."]) -data = [{} for f in files] -values = [{} for f in files] +data = [{} for _ in files] +values = [{} for _ in files] for i, f in enumerate (files): for line in f: @@ -89,7 +89,6 @@ for i,d in enumerate (data): combined = {k:v for k,v in combined.items() if v[3] not in BLACKLISTED_BLOCKS} data = combined del combined -num = len (data) property_names = [ @@ -489,7 +488,6 @@ for u in uu: if start != last + 1: if start - last <= 1+16*3: print_block (None, last+1, start-1, data) - last = start-1 else: if last >= 0: ends.append (last + 1) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-vowel-constraints.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-vowel-constraints.py index 7f23dc8e6a9..44f4a27aba4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-vowel-constraints.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-vowel-constraints.py @@ -14,11 +14,9 @@ Input file: """ import collections -from html.parser import HTMLParser def write (s): sys.stdout.flush () sys.stdout.buffer.write (s.encode ('utf-8')) -import itertools import sys if len (sys.argv) != 3: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-fdsc-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-fdsc-table.hh deleted file mode 100644 index 4bc97b742bb..00000000000 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-fdsc-table.hh +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright © 2018 Ebrahim Byagowi - * - * This is part of HarfBuzz, a text shaping library. - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. - * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -#ifndef HB_AAT_FDSC_TABLE_HH -#define HB_AAT_FDSC_TABLE_HH - -#include "hb-aat-layout-common.hh" -#include "hb-open-type.hh" - -/* - * fdsc -- Font descriptors - * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6fdsc.html - */ -#define HB_AAT_TAG_fdsc HB_TAG('f','d','s','c') - - -namespace AAT { - - -struct FontDescriptor -{ - bool has_data () const { return tag; } - - int cmp (hb_tag_t a) const { return tag.cmp (a); } - - float get_value () const { return u.value.to_float (); } - - enum non_alphabetic_value_t { - Alphabetic = 0, - Dingbats = 1, - PiCharacters = 2, - Fleurons = 3, - DecorativeBorders = 4, - InternationalSymbols= 5, - MathSymbols = 6 - }; - - bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - return_trace (c->check_struct (this)); - } - - protected: - Tag tag; /* The 4-byte table tag name. */ - union { - HBFixed value; /* The value for the descriptor tag. */ - HBUINT32 nalfType; /* If the tag is `nalf`, see non_alphabetic_value_t */ - } u; - public: - DEFINE_SIZE_STATIC (8); -}; - -struct fdsc -{ - static constexpr hb_tag_t tableTag = HB_AAT_TAG_fdsc; - - enum { - Weight = HB_TAG ('w','g','h','t'), - /* Percent weight relative to regular weight. - * (defaul value: 1.0) */ - Width = HB_TAG ('w','d','t','h'), - /* Percent width relative to regular width. - * (default value: 1.0) */ - Slant = HB_TAG ('s','l','n','t'), - /* Angle of slant in degrees, where positive - * is clockwise from straight up. - * (default value: 0.0) */ - OpticalSize = HB_TAG ('o','p','s','z'), - /* Point size the font was designed for. - * (default value: 12.0) */ - NonAlphabetic= HB_TAG ('n','a','l','f') - /* These values are treated as integers, - * not fixed32s. 0 means alphabetic, and greater - * integers mean the font is non-alphabetic (e.g. symbols). - * (default value: 0) */ - }; - - const FontDescriptor &get_descriptor (hb_tag_t style) const - { return descriptors.lsearch (style); } - - bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - return_trace (c->check_struct (this) && - descriptors.sanitize (c)); - } - - protected: - HBFixed version; /* Version number of the font descriptors - * table (0x00010000 for the current version). */ - LArrayOf<FontDescriptor> - descriptors; /* List of tagged-coordinate pairs style descriptors - * that will be included to characterize this font. - * Each descriptor consists of a <tag, value> pair. - * These pairs are located in the gxFontDescriptor - * array that follows. */ - public: - DEFINE_SIZE_ARRAY (8, descriptors); -}; - -} /* namespace AAT */ - - -#endif /* HB_AAT_FDSC_TABLE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh index 15ef2da6575..cd36fc89532 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh @@ -101,7 +101,7 @@ struct BaselineTableFormat3Part bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (c->check_struct (this) && lookupTable.sanitize (c)); + return_trace (likely (c->check_struct (this) && lookupTable.sanitize (c))); } protected: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh index fa91874c726..1cd412164e7 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh @@ -229,9 +229,7 @@ struct KerxSubTableFormat1 bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, const Entry<EntryData> &entry) - { - return Format1EntryT::performAction (entry); - } + { return Format1EntryT::performAction (entry); } void transition (StateTableDriver<Types, EntryData> *driver, const Entry<EntryData> &entry) { @@ -484,7 +482,7 @@ struct KerxSubTableFormat4 }; driver_context_t (const KerxSubTableFormat4 *table, - hb_aat_apply_context_t *c_) : + hb_aat_apply_context_t *c_) : c (c_), action_type ((table->flags & ActionType) >> 30), ankrData ((HBUINT16 *) ((const char *) &table->machine + (table->flags & Offset))), @@ -493,9 +491,7 @@ struct KerxSubTableFormat4 bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED, const Entry<EntryData> &entry) - { - return entry.data.ankrActionIndex != 0xFFFF; - } + { return entry.data.ankrActionIndex != 0xFFFF; } void transition (StateTableDriver<Types, EntryData> *driver, const Entry<EntryData> &entry) { @@ -508,11 +504,13 @@ struct KerxSubTableFormat4 { case 0: /* Control Point Actions.*/ { - /* indexed into glyph outline. */ - const HBUINT16 *data = &ankrData[entry.data.ankrActionIndex]; + /* Indexed into glyph outline. */ + /* Each action (record in ankrData) contains two 16-bit fields, so we must + double the ankrActionIndex to get the correct offset here. */ + const HBUINT16 *data = &ankrData[entry.data.ankrActionIndex * 2]; if (!c->sanitizer.check_array (data, 2)) return; - HB_UNUSED unsigned int markControlPoint = *data++; - HB_UNUSED unsigned int currControlPoint = *data++; + unsigned int markControlPoint = *data++; + unsigned int currControlPoint = *data++; hb_position_t markX = 0; hb_position_t markY = 0; hb_position_t currX = 0; @@ -534,8 +532,10 @@ struct KerxSubTableFormat4 case 1: /* Anchor Point Actions. */ { - /* Indexed into 'ankr' table. */ - const HBUINT16 *data = &ankrData[entry.data.ankrActionIndex]; + /* Indexed into 'ankr' table. */ + /* Each action (record in ankrData) contains two 16-bit fields, so we must + double the ankrActionIndex to get the correct offset here. */ + const HBUINT16 *data = &ankrData[entry.data.ankrActionIndex * 2]; if (!c->sanitizer.check_array (data, 2)) return; unsigned int markAnchorPoint = *data++; unsigned int currAnchorPoint = *data++; @@ -553,7 +553,9 @@ struct KerxSubTableFormat4 case 2: /* Control Point Coordinate Actions. */ { - const FWORD *data = (const FWORD *) &ankrData[entry.data.ankrActionIndex]; + /* Each action contains four 16-bit fields, so we multiply the ankrActionIndex + by 4 to get the correct offset for the given action. */ + const FWORD *data = (const FWORD *) &ankrData[entry.data.ankrActionIndex * 4]; if (!c->sanitizer.check_array (data, 4)) return; int markX = *data++; int markY = *data++; @@ -624,7 +626,7 @@ struct KerxSubTableFormat6 bool is_long () const { return flags & ValuesAreLong; } int get_kerning (hb_codepoint_t left, hb_codepoint_t right, - hb_aat_apply_context_t *c) const + hb_aat_apply_context_t *c) const { unsigned int num_glyphs = c->sanitizer.get_num_glyphs (); if (is_long ()) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh deleted file mode 100644 index 25458a1a044..00000000000 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright © 2018 Ebrahim Byagowi - * - * This is part of HarfBuzz, a text shaping library. - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. - * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -#ifndef HB_AAT_LAYOUT_LCAR_TABLE_HH -#define HB_AAT_LAYOUT_LCAR_TABLE_HH - -#include "hb-open-type.hh" -#include "hb-aat-layout-common.hh" - -/* - * lcar -- Ligature caret - * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6lcar.html - */ -#define HB_AAT_TAG_lcar HB_TAG('l','c','a','r') - - -namespace AAT { - -typedef ArrayOf<HBINT16> LigCaretClassEntry; - -struct lcarFormat0 -{ - unsigned int get_lig_carets (hb_font_t *font, - hb_direction_t direction, - hb_codepoint_t glyph, - unsigned int start_offset, - unsigned int *caret_count /* IN/OUT */, - hb_position_t *caret_array /* OUT */, - const void *base) const - { - const OffsetTo<LigCaretClassEntry>* entry_offset = lookupTable.get_value (glyph, - font->face->get_num_glyphs ()); - const LigCaretClassEntry& array = entry_offset ? base+*entry_offset : Null (LigCaretClassEntry); - if (caret_count) - { - + array.sub_array (start_offset, caret_count) - | hb_map ([&] (int v) { return font->em_scale_dir (v, direction); }) - | hb_sink (hb_array (caret_array, *caret_count)) - ; - } - return array.len; - } - - bool sanitize (hb_sanitize_context_t *c, const void *base) const - { - TRACE_SANITIZE (this); - return_trace (likely (c->check_struct (this) && lookupTable.sanitize (c, base))); - } - - protected: - Lookup<OffsetTo<LigCaretClassEntry>> - lookupTable; /* data Lookup table associating glyphs */ - public: - DEFINE_SIZE_MIN (2); -}; - -struct lcarFormat1 -{ - unsigned int get_lig_carets (hb_font_t *font, - hb_direction_t direction, - hb_codepoint_t glyph, - unsigned int start_offset, - unsigned int *caret_count /* IN/OUT */, - hb_position_t *caret_array /* OUT */, - const void *base) const - { - const OffsetTo<LigCaretClassEntry>* entry_offset = lookupTable.get_value (glyph, - font->face->get_num_glyphs ()); - const LigCaretClassEntry& array = entry_offset ? base+*entry_offset : Null (LigCaretClassEntry); - if (caret_count) - { - + array.sub_array (start_offset, caret_count) - | hb_map ([&] (unsigned int point_index) - { - hb_position_t x = 0, y = 0; - font->get_glyph_contour_point_for_origin (glyph, point_index, direction, &x, &y); - return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y; - }) - | hb_sink (hb_array (caret_array, *caret_count)) - ; - } - return array.len; - } - - bool sanitize (hb_sanitize_context_t *c, const void *base) const - { - TRACE_SANITIZE (this); - return_trace (likely (c->check_struct (this) && lookupTable.sanitize (c, base))); - } - - protected: - Lookup<OffsetTo<LigCaretClassEntry>> - lookupTable; /* data Lookup table associating glyphs */ - public: - DEFINE_SIZE_MIN (2); -}; - -struct lcar -{ - static constexpr hb_tag_t tableTag = HB_AAT_TAG_lcar; - - bool has_data () const { return version.major; } - - unsigned int get_lig_carets (hb_font_t *font, - hb_direction_t direction, - hb_codepoint_t glyph, - unsigned int start_offset, - unsigned int *caret_count /* IN/OUT */, - hb_position_t *caret_array /* OUT */) const - { - if (!has_data ()) - { - if (caret_count) - *caret_count = 0; - return 0; - } - - switch (format) - { - case 0: return u.format0.get_lig_carets (font, direction, glyph, start_offset, - caret_count, caret_array, this); - case 1: return u.format1.get_lig_carets (font, direction, glyph, start_offset, - caret_count, caret_array, this); - default:if (caret_count) *caret_count = 0; return 0; - } - } - - bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - if (unlikely (!c->check_struct (this) || version.major != 1)) - return_trace (false); - - switch (format) { - case 0: return_trace (u.format0.sanitize (c, this)); - case 1: return_trace (u.format1.sanitize (c, this)); - default:return_trace (true); - } - } - - protected: - FixedVersion<>version; /* Version number of the ligature caret table */ - HBUINT16 format; /* Format of the ligature caret table. */ - union { - lcarFormat0 format0; - lcarFormat0 format1; - } u; - public: - DEFINE_SIZE_MIN (8); -}; - -} /* namespace AAT */ - -#endif /* HB_AAT_LAYOUT_LCAR_TABLE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh index 2342f61d827..04027a61bef 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh @@ -725,6 +725,7 @@ struct InsertionSubtable if (entry.data.markedInsertIndex != 0xFFFF) { unsigned int count = (flags & MarkedInsertCount); + if (unlikely ((buffer->max_ops -= count) <= 0)) return; unsigned int start = entry.data.markedInsertIndex; const HBGlyphID *glyphs = &insertionAction[start]; if (unlikely (!c->sanitizer.check_array (glyphs, count))) count = 0; @@ -753,6 +754,7 @@ struct InsertionSubtable if (entry.data.currentInsertIndex != 0xFFFF) { unsigned int count = (flags & CurrentInsertCount) >> 5; + if (unlikely ((buffer->max_ops -= count) <= 0)) return; unsigned int start = entry.data.currentInsertIndex; const HBGlyphID *glyphs = &insertionAction[start]; if (unlikely (!c->sanitizer.check_array (glyphs, count))) count = 0; @@ -969,7 +971,7 @@ struct Chain } void apply (hb_aat_apply_context_t *c, - hb_mask_t flags) const + hb_mask_t flags) const { const ChainSubtable<Types> *subtable = &StructAfter<ChainSubtable<Types>> (featureZ.as_array (featureCount)); unsigned int count = subtableCount; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc index aa753cb861a..fac510e9e60 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc @@ -28,7 +28,6 @@ #include "hb.hh" #include "hb-aat-layout.hh" -#include "hb-aat-fdsc-table.hh" // Just so we compile it; unused otherwise. #include "hb-aat-layout-ankr-table.hh" #include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise. #include "hb-aat-layout-feat-table.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-array.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-array.hh index 172d9c13cc9..568cd02c791 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-array.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-array.hh @@ -129,20 +129,27 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&> template <typename T> Type *lsearch (const T &x, Type *not_found = nullptr) { - unsigned int count = length; - for (unsigned int i = 0; i < count; i++) - if (!this->arrayZ[i].cmp (x)) - return &this->arrayZ[i]; - return not_found; + unsigned i; + return lfind (x, &i) ? &this->arrayZ[i] : not_found; } template <typename T> const Type *lsearch (const T &x, const Type *not_found = nullptr) const { - unsigned int count = length; - for (unsigned int i = 0; i < count; i++) + unsigned i; + return lfind (x, &i) ? &this->arrayZ[i] : not_found; + } + template <typename T> + bool lfind (const T &x, unsigned *pos = nullptr) const + { + for (unsigned i = 0; i < length; ++i) if (!this->arrayZ[i].cmp (x)) - return &this->arrayZ[i]; - return not_found; + { + if (pos) + *pos = i; + return true; + } + + return false; } hb_sorted_array_t<Type> qsort (int (*cmp_)(const void*, const void*)) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc index 3ca31c5fe65..94ed50fd3cc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc @@ -618,7 +618,7 @@ fail_without_close: wchar_t * wchar_file_name = (wchar_t *) malloc (sizeof (wchar_t) * size); if (unlikely (!wchar_file_name)) goto fail_without_close; mbstowcs (wchar_file_name, file_name, size); -#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) { CREATEFILE2_EXTENDED_PARAMETERS ceparams = { 0 }; ceparams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS); @@ -639,7 +639,7 @@ fail_without_close: if (unlikely (fd == INVALID_HANDLE_VALUE)) goto fail_without_close; -#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) { LARGE_INTEGER length; GetFileSizeEx (fd, &length); @@ -652,7 +652,7 @@ fail_without_close: #endif if (unlikely (!file->mapping)) goto fail; -#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) file->contents = (char *) MapViewOfFileFromApp (file->mapping, FILE_MAP_READ, 0, 0); #else file->contents = (char *) MapViewOfFile (file->mapping, FILE_MAP_READ, 0, 0, 0); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc index d443edf2584..c368c93d9e4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc @@ -1096,8 +1096,8 @@ hb_buffer_get_flags (hb_buffer_t *buffer) * Since: 0.9.42 **/ void -hb_buffer_set_cluster_level (hb_buffer_t *buffer, - hb_buffer_cluster_level_t cluster_level) +hb_buffer_set_cluster_level (hb_buffer_t *buffer, + hb_buffer_cluster_level_t cluster_level) { if (unlikely (hb_object_is_immutable (buffer))) return; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh index dce89fabeb8..3420ba434ae 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh @@ -318,7 +318,7 @@ struct hb_buffer_t HB_INTERNAL void delete_glyph (); void unsafe_to_break (unsigned int start, - unsigned int end) + unsigned int end) { if (end - start < 2) return; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh index 8d9bb2689bb..afbc4a7cb39 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-cff2-interp-cs.hh @@ -52,7 +52,7 @@ struct blend_arg_t : number_t void set_real (double v) { reset_blends (); number_t::set_real (v); } void set_blends (unsigned int numValues_, unsigned int valueIndex_, - unsigned int numBlends, hb_array_t<const blend_arg_t> blends_) + unsigned int numBlends, hb_array_t<const blend_arg_t> blends_) { numValues = numValues_; valueIndex = valueIndex_; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc index e4d8a3f36ad..95d3fc27fb2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc @@ -200,10 +200,15 @@ hb_face_create (hb_blob_t *blob, if (unlikely (!blob)) blob = hb_blob_get_empty (); - hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (hb_sanitize_context_t ().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob)), index); + blob = hb_sanitize_context_t ().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob)); + + hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (blob, index); if (unlikely (!closure)) + { + hb_blob_destroy (blob); return hb_face_get_empty (); + } face = hb_face_create_for_tables (_hb_face_for_data_reference_table, closure, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh index 12982fc6b49..8fc7f44d44b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh @@ -339,7 +339,7 @@ struct hb_font_t } hb_bool_t get_glyph_contour_point (hb_codepoint_t glyph, unsigned int point_index, - hb_position_t *x, hb_position_t *y) + hb_position_t *x, hb_position_t *y) { *x = *y = 0; return klass->get.f.glyph_contour_point (this, user_data, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc index b18b990b975..2680873c279 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc @@ -92,9 +92,7 @@ static hb_ft_font_t * _hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref) { hb_ft_font_t *ft_font = (hb_ft_font_t *) calloc (1, sizeof (hb_ft_font_t)); - - if (unlikely (!ft_font)) - return nullptr; + if (unlikely (!ft_font)) return nullptr; ft_font->lock.init (); ft_font->ft_face = ft_face; @@ -620,9 +618,12 @@ _hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref) { bool symbol = ft_face->charmap && ft_face->charmap->encoding == FT_ENCODING_MS_SYMBOL; + hb_ft_font_t *ft_font = _hb_ft_font_create (ft_face, symbol, unref); + if (unlikely (!ft_font)) return; + hb_font_set_funcs (font, _hb_ft_get_font_funcs (), - _hb_ft_font_create (ft_face, symbol, unref), + ft_font, _hb_ft_font_destroy); } @@ -829,6 +830,7 @@ hb_ft_font_changed (hb_font_t *font) return; hb_ft_font_t *ft_font = (hb_ft_font_t *) font->user_data; + FT_Face ft_face = ft_font->ft_face; hb_font_set_scale (font, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.hh index 1635b4a6257..92c1bd67e58 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.hh @@ -54,7 +54,7 @@ struct hb_hashmap_t void clear () { key = kINVALID; value = vINVALID; hash = 0; } - bool operator == (K o) { return hb_deref (key) == hb_deref (o); } + bool operator == (const K &o) { return hb_deref (key) == hb_deref (o); } bool operator == (const item_t &o) { return *this == o.key; } bool is_unused () const { return key == kINVALID; } bool is_tombstone () const { return key != kINVALID && value == vINVALID; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-meta.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-meta.hh index c08b191f1fd..4c0898b1b75 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-meta.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-meta.hh @@ -343,7 +343,6 @@ using hb_is_move_assignable = hb_is_assignable<hb_add_lvalue_reference<T>, template <typename T> union hb_trivial { T value; }; -/* Don't know how to do the following. */ template <typename T> using hb_is_trivially_destructible= hb_is_destructible<hb_trivial<T>>; #define hb_is_trivially_destructible(T) hb_is_trivially_destructible<T>::value diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-mutex.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-mutex.hh index e7f8b1c434b..56392d049b1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-mutex.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-mutex.hh @@ -61,10 +61,9 @@ typedef pthread_mutex_t hb_mutex_impl_t; #elif !defined(HB_NO_MT) && defined(_WIN32) -#include <windows.h> typedef CRITICAL_SECTION hb_mutex_impl_t; #define HB_MUTEX_IMPL_INIT {0} -#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) #define hb_mutex_impl_init(M) InitializeCriticalSectionEx (M, 0, 0) #else #define hb_mutex_impl_init(M) InitializeCriticalSection (M) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh index c470532aaca..39845a70e79 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh @@ -168,8 +168,8 @@ struct hb_user_data_array_t void *data; hb_destroy_func_t destroy; - bool operator == (hb_user_data_key_t *other_key) const { return key == other_key; } - bool operator == (hb_user_data_item_t &other) const { return key == other.key; } + bool operator == (const hb_user_data_key_t *other_key) const { return key == other_key; } + bool operator == (const hb_user_data_item_t &other) const { return key == other.key; } void fini () { if (destroy) destroy (data); } }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh index fee71df8465..50558cf8d3d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh @@ -442,6 +442,9 @@ struct UnsizedArrayOf template <typename T> const Type &lsearch (unsigned int len, const T &x, const Type ¬_found = Null (Type)) const { return *as_array (len).lsearch (x, ¬_found); } + template <typename T> + bool lfind (unsigned int len, const T &x, unsigned *pos = nullptr) const + { return as_array (len).lfind (x, pos); } void qsort (unsigned int len, unsigned int start = 0, unsigned int end = (unsigned int) -1) { as_array (len).qsort (start, end); } @@ -549,8 +552,8 @@ struct SortedUnsizedArrayOf : UnsizedArrayOf<Type> { return *as_array (len).bsearch (x, ¬_found); } template <typename T> bool bfind (unsigned int len, const T &x, unsigned int *i = nullptr, - hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE, - unsigned int to_store = (unsigned int) -1) const + hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE, + unsigned int to_store = (unsigned int) -1) const { return as_array (len).bfind (x, i, not_found, to_store); } }; @@ -667,6 +670,9 @@ struct ArrayOf template <typename T> const Type &lsearch (const T &x, const Type ¬_found = Null (Type)) const { return *as_array ().lsearch (x, ¬_found); } + template <typename T> + bool lfind (const T &x, unsigned *pos = nullptr) const + { return as_array ().lfind (x, pos); } void qsort (unsigned int start = 0, unsigned int end = (unsigned int) -1) { as_array ().qsort (start, end); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh index c42f3fd6390..bae6a628306 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh @@ -157,10 +157,10 @@ struct CmapSubtableFormat4 template<typename Iterator, hb_requires (hb_is_iterator (Iterator))> HBINT16* serialize_idDelta_array (hb_serialize_context_t *c, - Iterator it, - HBUINT16 *endCode, - HBUINT16 *startCode, - unsigned segcount) + Iterator it, + HBUINT16 *endCode, + HBUINT16 *startCode, + unsigned segcount) { unsigned i = 0; hb_codepoint_t last_gid = 0, start_gid = 0, last_cp = 0xFFFF; @@ -317,12 +317,12 @@ struct CmapSubtableFormat4 HBUINT16 last; }; - const HBUINT16 *found =hb_bsearch (codepoint, - this->endCount, - this->segCount, - 2, - _hb_cmp_method<hb_codepoint_t, CustomRange, unsigned>, - this->segCount + 1); + const HBUINT16 *found = hb_bsearch (codepoint, + this->endCount, + this->segCount, + 2, + _hb_cmp_method<hb_codepoint_t, CustomRange, unsigned>, + this->segCount + 1); if (!found) return false; unsigned int i = found - endCount; @@ -466,8 +466,8 @@ struct CmapSubtableFormat4 * If that is the case, just change the value to truncate * the subtable at the end of the blob. */ uint16_t new_length = (uint16_t) hb_min ((uintptr_t) 65535, - (uintptr_t) (c->end - - (char *) this)); + (uintptr_t) (c->end - + (char *) this)); if (!c->try_set (&length, new_length)) return_trace (false); } @@ -793,7 +793,7 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32> { hb_codepoint_t first = arrayZ[i].startUnicodeValue; hb_codepoint_t last = hb_min ((hb_codepoint_t) (first + arrayZ[i].additionalCount), - (hb_codepoint_t) HB_UNICODE_MAX); + (hb_codepoint_t) HB_UNICODE_MAX); out->add_range (first, last); } } @@ -1360,13 +1360,13 @@ struct cmap for (const EncodingRecord& _ : encodingrec_iter) { - hb_set_t unicodes_set; - hb_map_t cp_glyphid_map; - (base+_.subtable).collect_mapping (&unicodes_set, &cp_glyphid_map); - unsigned format = (base+_.subtable).u.format; if (!plan->glyphs_requested->is_empty ()) { + hb_set_t unicodes_set; + hb_map_t cp_glyphid_map; + (base+_.subtable).collect_mapping (&unicodes_set, &cp_glyphid_map); + auto table_iter = + hb_zip (unicodes_set.iter(), unicodes_set.iter() | hb_map(cp_glyphid_map)) | hb_filter (plan->_glyphset, hb_second) @@ -1380,7 +1380,7 @@ struct cmap return hb_pair_t<hb_codepoint_t, hb_codepoint_t> (p_org.first, plan->glyph_map->get(p_org.second)); }) ; - + if (format == 4) c->copy (_, table_iter, 4u, base, plan, &format4objidx); else if (format == 12) c->copy (_, table_iter, 12u, base, plan, &format12objidx); else if (format == 14) c->copy (_, table_iter, 14u, base, plan, &format14objidx); @@ -1389,6 +1389,9 @@ struct cmap * all codepoints in each subtable, which is more efficient */ else { + hb_set_t unicodes_set; + (base+_.subtable).collect_unicodes (&unicodes_set); + if (format == 4) c->copy (_, + it | hb_filter (unicodes_set, hb_first), 4u, base, plan, &format4objidx); else if (format == 12) c->copy (_, + it | hb_filter (unicodes_set, hb_first), 12u, base, plan, &format12objidx); else if (format == 14) c->copy (_, it, 14u, base, plan, &format14objidx); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh index 82eab963371..92a49bb4f45 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh @@ -174,7 +174,7 @@ struct COLR baseGlyphsZ = COLR::min_size; layersZ = COLR::min_size + numBaseGlyphs * BaseGlyphRecord::min_size; - for (const hb_item_type<BaseIterator>& _ : + base_it.iter ()) + for (const hb_item_type<BaseIterator> _ : + base_it.iter ()) { auto* record = c->embed (_); if (unlikely (!record)) return_trace (false); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh index 5519d4fdf87..367e143fdfb 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face-table-list.hh @@ -60,7 +60,6 @@ HB_OT_ACCELERATOR (OT, post) HB_OT_ACCELERATOR (OT, name) #endif #ifndef HB_NO_STYLE -HB_OT_TABLE (AAT, fdsc) HB_OT_TABLE (OT, STAT) #endif #ifndef HB_NO_META @@ -114,7 +113,6 @@ HB_OT_TABLE (AAT, mort) HB_OT_TABLE (AAT, kerx) HB_OT_TABLE (AAT, ankr) HB_OT_TABLE (AAT, trak) -HB_OT_TABLE (AAT, lcar) HB_OT_TABLE (AAT, ltag) HB_OT_TABLE (AAT, feat) // HB_OT_TABLE (AAT, opbd) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh index 30571fb8084..7361a088b32 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh @@ -1297,9 +1297,9 @@ struct CoverageFormat2 unsigned int get_coverage (hb_codepoint_t glyph_id) const { const RangeRecord &range = rangeRecord.bsearch (glyph_id); - return likely (range.first <= range.last) ? - (unsigned int) range.value + (glyph_id - range.first) : - NOT_COVERED; + return likely (range.first <= range.last) + ? (unsigned int) range.value + (glyph_id - range.first) + : NOT_COVERED; } template <typename Iterator, @@ -1717,7 +1717,7 @@ struct ClassDefFormat1 startGlyph = glyph_min; if (unlikely (!classValue.serialize (c, glyph_count))) return_trace (false); - for (const hb_pair_t<hb_codepoint_t, unsigned>& gid_klass_pair : + it) + for (const hb_pair_t<hb_codepoint_t, unsigned> gid_klass_pair : + it) { unsigned idx = gid_klass_pair.first - glyph_min; classValue[idx] = gid_klass_pair.second; @@ -2191,7 +2191,7 @@ struct VarRegionAxis struct VarRegionList { float evaluate (unsigned int region_index, - const int *coords, unsigned int coord_len) const + const int *coords, unsigned int coord_len) const { if (unlikely (region_index >= regionCount)) return 0.; @@ -2261,8 +2261,8 @@ struct VarData { return itemCount * get_row_size (); } float get_delta (unsigned int inner, - const int *coords, unsigned int coord_count, - const VarRegionList ®ions) const + const int *coords, unsigned int coord_count, + const VarRegionList ®ions) const { if (unlikely (inner >= itemCount)) return 0.; @@ -2836,7 +2836,7 @@ struct FeatureVariations static constexpr unsigned NOT_FOUND_INDEX = 0xFFFFFFFFu; bool find_index (const int *coords, unsigned int coord_len, - unsigned int *index) const + unsigned int *index) const { unsigned int count = varRecords.len; for (unsigned int i = 0; i < count; i++) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh index e76ecf9a829..c2bad052802 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh @@ -49,7 +49,7 @@ struct AttachPoint : ArrayOf<HBUINT16> TRACE_SUBSET (this); auto *out = c->serializer->start_embed (*this); if (unlikely (!out)) return_trace (false); - + return_trace (out->serialize (c->serializer, + iter ())); } }; @@ -231,9 +231,9 @@ struct CaretValueFormat3 struct CaretValue { hb_position_t get_caret_value (hb_font_t *font, - hb_direction_t direction, - hb_codepoint_t glyph_id, - const VariationStore &var_store) const + hb_direction_t direction, + hb_codepoint_t glyph_id, + const VariationStore &var_store) const { switch (u.format) { case 1: return u.format1.get_caret_value (font, direction); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh index 3dd09995652..2a3ebc9c174 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh @@ -79,14 +79,14 @@ struct ValueFormat : HBUINT16 /* All fields are options. Only those available advance the value pointer. */ #if 0 - HBINT16 xPlacement; /* Horizontal adjustment for + HBINT16 xPlacement; /* Horizontal adjustment for * placement--in design units */ - HBINT16 yPlacement; /* Vertical adjustment for + HBINT16 yPlacement; /* Vertical adjustment for * placement--in design units */ - HBINT16 xAdvance; /* Horizontal adjustment for + HBINT16 xAdvance; /* Horizontal adjustment for * advance--in design units (only used * for horizontal writing) */ - HBINT16 yAdvance; /* Vertical adjustment for advance--in + HBINT16 yAdvance; /* Vertical adjustment for advance--in * design units (only used for vertical * writing) */ OffsetTo<Device> xPlaDevice; /* Offset to Device table for @@ -698,7 +698,7 @@ struct SinglePosFormat1 void collect_variation_indices (hb_collect_variation_indices_context_t *c) const { if (!valueFormat.has_device ()) return; - + auto it = + hb_iter (this+coverage) | hb_filter (c->glyph_set) @@ -801,7 +801,7 @@ struct SinglePosFormat2 void collect_variation_indices (hb_collect_variation_indices_context_t *c) const { if (!valueFormat.has_device ()) return; - + auto it = + hb_zip (this+coverage, hb_range ((unsigned) valueCount)) | hb_filter (c->glyph_set, hb_first) @@ -1063,7 +1063,7 @@ struct PairSet } void collect_glyphs (hb_collect_glyphs_context_t *c, - const ValueFormat *valueFormats) const + const ValueFormat *valueFormats) const { unsigned int len1 = valueFormats[0].get_len (); unsigned int len2 = valueFormats[1].get_len (); @@ -1347,7 +1347,7 @@ struct PairPosFormat2 } if (class1_set.is_empty () || class2_set.is_empty ()) return; - + unsigned len1 = valueFormat1.get_len (); unsigned len2 = valueFormat2.get_len (); const hb_array_t<const Value> values_array = values.as_array ((unsigned)class1Count * (unsigned) class2Count * (len1 + len2)); @@ -1358,7 +1358,7 @@ struct PairPosFormat2 unsigned start_offset = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2); if (valueFormat1.has_device ()) valueFormat1.collect_variation_indices (c, this, values_array.sub_array (start_offset, len1)); - + if (valueFormat2.has_device ()) valueFormat2.collect_variation_indices (c, this, values_array.sub_array (start_offset+len1, len2)); } @@ -1816,8 +1816,10 @@ static void Markclass_closure_and_remap_indexes (const Coverage &mark_coverage, struct MarkBasePosFormat1 { bool intersects (const hb_set_t *glyphs) const - { return (this+markCoverage).intersects (glyphs) && - (this+baseCoverage).intersects (glyphs); } + { + return (this+markCoverage).intersects (glyphs) && + (this+baseCoverage).intersects (glyphs); + } void closure_lookups (hb_closure_lookups_context_t *c) const {} @@ -2031,8 +2033,10 @@ typedef OffsetListOf<LigatureAttach> LigatureArray; struct MarkLigPosFormat1 { bool intersects (const hb_set_t *glyphs) const - { return (this+markCoverage).intersects (glyphs) && - (this+ligatureCoverage).intersects (glyphs); } + { + return (this+markCoverage).intersects (glyphs) && + (this+ligatureCoverage).intersects (glyphs); + } void closure_lookups (hb_closure_lookups_context_t *c) const {} @@ -2189,8 +2193,10 @@ typedef AnchorMatrix Mark2Array; /* mark2-major-- struct MarkMarkPosFormat1 { bool intersects (const hb_set_t *glyphs) const - { return (this+mark1Coverage).intersects (glyphs) && - (this+mark2Coverage).intersects (glyphs); } + { + return (this+mark1Coverage).intersects (glyphs) && + (this+mark2Coverage).intersects (glyphs); + } void closure_lookups (hb_closure_lookups_context_t *c) const {} @@ -2254,12 +2260,15 @@ struct MarkMarkPosFormat1 unsigned int comp1 = _hb_glyph_info_get_lig_comp (&buffer->cur()); unsigned int comp2 = _hb_glyph_info_get_lig_comp (&buffer->info[j]); - if (likely (id1 == id2)) { + if (likely (id1 == id2)) + { if (id1 == 0) /* Marks belonging to the same base. */ goto good; else if (comp1 == comp2) /* Marks belonging to the same ligature component. */ goto good; - } else { + } + else + { /* If ligature ids don't match, it may be the case that one of the marks * itself is a ligature. In which case match. */ if ((id1 > 0 && !comp1) || (id2 > 0 && !comp2)) @@ -2311,7 +2320,7 @@ struct MarkMarkPosFormat1 out->mark1Array.serialize (c->serializer, out) .serialize (c->serializer, &klass_mapping, c->plan->layout_variation_idx_map, &(this+mark1Array), + mark1_iter | hb_map (hb_second)); - + unsigned mark2count = (this+mark2Array).rows; auto mark2_iter = + hb_zip (this+mark2Coverage, hb_range (mark2count)) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh index 4a9d38a5b28..ea82b08d6f5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh @@ -852,8 +852,8 @@ struct Ligature auto *out = c->serializer->start_embed (*this); return_trace (out->serialize (c->serializer, - glyph_map[ligGlyph], - it)); + glyph_map[ligGlyph], + it)); } public: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh index 8b0e4323cec..5877933729b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh @@ -335,7 +335,7 @@ struct hb_ot_apply_context_t : void set_mask (hb_mask_t mask_) { mask = mask_; } void set_syllable (uint8_t syllable_) { syllable = syllable_; } void set_match_func (match_func_t match_func_, - const void *match_data_) + const void *match_data_) { match_func = match_func_; match_data = match_data_; } enum may_match_t { @@ -540,8 +540,8 @@ struct hb_ot_apply_context_t : hb_ot_apply_context_t (unsigned int table_index_, - hb_font_t *font_, - hb_buffer_t *buffer_) : + hb_font_t *font_, + hb_buffer_t *buffer_) : iter_input (), iter_context (), font (font_), face (font->face), buffer (buffer_), recurse_func (nullptr), @@ -1753,10 +1753,12 @@ struct ContextFormat2 }; return - + hb_enumerate (ruleSet) - | hb_map ([&] (const hb_pair_t<unsigned, const OffsetTo<RuleSet> &> p) + + hb_iter (ruleSet) + | hb_map (hb_add (this)) + | hb_enumerate + | hb_map ([&] (const hb_pair_t<unsigned, const RuleSet &> p) { return class_def.intersects_class (glyphs, p.first) && - (this+p.second).intersects (glyphs, lookup_context); }) + p.second.intersects (glyphs, lookup_context); }) | hb_any ; } @@ -2001,7 +2003,7 @@ struct ContextFormat3 out->glyphCount = glyphCount; out->lookupCount = lookupCount; - const hb_array_t<const OffsetTo<Coverage>> coverages = coverageZ.as_array (glyphCount); + auto coverages = coverageZ.as_array (glyphCount); for (const OffsetTo<Coverage>& offset : coverages) { @@ -2658,10 +2660,12 @@ struct ChainContextFormat2 }; return - + hb_enumerate (ruleSet) - | hb_map ([&] (const hb_pair_t<unsigned, const OffsetTo<ChainRuleSet> &> p) + + hb_iter (ruleSet) + | hb_map (hb_add (this)) + | hb_enumerate + | hb_map ([&] (const hb_pair_t<unsigned, const ChainRuleSet &> p) { return input_class_def.intersects_class (glyphs, p.first) && - (this+p.second).intersects (glyphs, lookup_context); }) + p.second.intersects (glyphs, lookup_context); }) | hb_any ; } @@ -3009,7 +3013,7 @@ struct ChainContextFormat3 const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups; for (unsigned i = 0; i < (unsigned) lookupCount; i++) if (!c->serializer->copy (lookupRecord[i], lookup_map)) return_trace (false); - + return_trace (true); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc index 905261976cf..46408bb9d3c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc @@ -51,9 +51,7 @@ #include "hb-ot-name-table.hh" #include "hb-ot-os2-table.hh" -#include "hb-aat-layout-lcar-table.hh" #include "hb-aat-layout-morx-table.hh" - #include "hb-aat-layout-opbd-table.hh" // Just so we compile it; unused otherwise. /** @@ -368,21 +366,7 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font, unsigned int *caret_count /* IN/OUT */, hb_position_t *caret_array /* OUT */) { - unsigned int result_caret_count = caret_count ? *caret_count : 0; - unsigned int result = font->face->table.GDEF->table->get_lig_carets (font, direction, glyph, start_offset, &result_caret_count, caret_array); - if (result) - { - if (caret_count) *caret_count = result_caret_count; - } - else - { -#ifndef HB_NO_AAT - result = font->face->table.lcar->get_lig_carets (font, direction, glyph, start_offset, caret_count, caret_array); -#else - if (caret_count) *caret_count = 0; -#endif - } - return result; + return font->face->table.GDEF->table->get_lig_carets (font, direction, glyph, start_offset, caret_count, caret_array); } #endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh index b4f2fb904bf..7629a869bd7 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh @@ -213,8 +213,8 @@ struct hb_ot_map_builder_t { add_feature (feat.tag, feat.flags); } void enable_feature (hb_tag_t tag, - hb_ot_map_feature_flags_t flags=F_NONE, - unsigned int value=1) + hb_ot_map_feature_flags_t flags=F_NONE, + unsigned int value=1) { add_feature (tag, F_GLOBAL | flags, value); } void disable_feature (hb_tag_t tag) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh index ea4824394fe..26aa0806031 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh @@ -78,7 +78,7 @@ struct MathConstants } hb_position_t get_value (hb_ot_math_constant_t constant, - hb_font_t *font) const + hb_font_t *font) const { switch (constant) { @@ -616,12 +616,12 @@ struct MathVariants .get_variants (direction, font, start_offset, variants_count, variants); } unsigned int get_glyph_parts (hb_codepoint_t glyph, - hb_direction_t direction, - hb_font_t *font, - unsigned int start_offset, - unsigned int *parts_count, /* IN/OUT */ - hb_ot_math_glyph_part_t *parts /* OUT */, - hb_position_t *italics_correction /* OUT */) const + hb_direction_t direction, + hb_font_t *font, + unsigned int start_offset, + unsigned int *parts_count, /* IN/OUT */ + hb_ot_math_glyph_part_t *parts /* OUT */, + hb_position_t *italics_correction /* OUT */) const { return get_glyph_construction (glyph, direction, font) .get_assembly () .get_parts (direction, font, @@ -701,7 +701,7 @@ struct MATH } hb_position_t get_constant (hb_ot_math_constant_t constant, - hb_font_t *font) const + hb_font_t *font) const { return (this+mathConstants).get_value (constant, font); } const MathGlyphInfo &get_glyph_info () const { return this+mathGlyphInfo; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh index f538fd4c034..7d31b712c4f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh @@ -174,27 +174,32 @@ struct OS2 if (unlikely (!os2_prime)) return_trace (false); hb_set_t unicodes; - hb_map_t unicode_glyphid_map; - - OT::cmap::accelerator_t cmap; - cmap.init (c->plan->source); - cmap.collect_mapping (&unicodes, &unicode_glyphid_map); - cmap.fini (); - - if (c->plan->unicodes->is_empty ()) unicodes.clear (); - else hb_set_set (&unicodes, c->plan->unicodes); - - + unicode_glyphid_map.iter () - | hb_filter (c->plan->glyphs_requested, hb_second) - | hb_map (hb_first) - | hb_sink (unicodes) - ; + if (!c->plan->glyphs_requested->is_empty ()) + { + hb_map_t unicode_glyphid_map; + + OT::cmap::accelerator_t cmap; + cmap.init (c->plan->source); + cmap.collect_mapping (&unicodes, &unicode_glyphid_map); + cmap.fini (); + + if (c->plan->unicodes->is_empty ()) unicodes.clear (); + else hb_set_set (&unicodes, c->plan->unicodes); + + + unicode_glyphid_map.iter () + | hb_filter (c->plan->glyphs_requested, hb_second) + | hb_map (hb_first) + | hb_sink (unicodes) + ; + } + /* when --gids option is not used, no need to do collect_mapping that is + * iterating all codepoints in each subtable, which is not efficient */ uint16_t min_cp, max_cp; - find_min_and_max_codepoint (&unicodes, &min_cp, &max_cp); + find_min_and_max_codepoint (unicodes.is_empty () ? c->plan->unicodes : &unicodes, &min_cp, &max_cp); os2_prime->usFirstCharIndex = min_cp; os2_prime->usLastCharIndex = max_cp; - _update_unicode_ranges (&unicodes, os2_prime->ulUnicodeRange); + _update_unicode_ranges (unicodes.is_empty () ? c->plan->unicodes : &unicodes, os2_prime->ulUnicodeRange); return_trace (true); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc index 0c1863bc51b..1e93f0efd5e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc @@ -228,8 +228,6 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) map->enable_feature (HB_TAG('c','a','l','t'), F_MANUAL_ZWJ); map->add_gsub_pause (nullptr); - /* And undo here. */ - /* The spec includes 'cswh'. Earlier versions of Windows * used to enable this by default, but testing suggests * that Windows 8 and later do not enable it by default, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc index fd8a9be978f..3da8374899b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc @@ -161,8 +161,6 @@ struct khmer_shape_plan_t mutable hb_codepoint_t virama_glyph; - hb_indic_would_substitute_feature_t pref; - hb_mask_t mask_array[KHMER_NUM_FEATURES]; }; @@ -175,8 +173,6 @@ data_create_khmer (const hb_ot_shape_plan_t *plan) khmer_plan->virama_glyph = (hb_codepoint_t) -1; - khmer_plan->pref.init (&plan->map, HB_TAG('p','r','e','f'), true); - for (unsigned int i = 0; i < ARRAY_LENGTH (khmer_plan->mask_array); i++) khmer_plan->mask_array[i] = (khmer_features[i].flags & F_GLOBAL) ? 0 : plan->map.get_1_mask (khmer_features[i].tag); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc index 00ecdfab373..fe0444987a0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc @@ -220,7 +220,13 @@ hb_ot_shape_plan_t::init0 (hb_face_t *face, { data = shaper->data_create (this); if (unlikely (!data)) + { + map.fini (); +#ifndef HB_NO_AAT_SHAPE + aat_map.fini (); +#endif return false; + } } return true; @@ -1091,12 +1097,12 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c) if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR))) { c->buffer->max_len = hb_max (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR, - (unsigned) HB_BUFFER_MAX_LEN_MIN); + (unsigned) HB_BUFFER_MAX_LEN_MIN); } if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR))) { c->buffer->max_ops = hb_max (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR, - (unsigned) HB_BUFFER_MAX_OPS_MIN); + (unsigned) HB_BUFFER_MAX_OPS_MIN); } /* Save the original direction, we use it later. */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh index 655064bdf70..6aa4fa44928 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-stat-table.hh @@ -292,28 +292,15 @@ struct STAT bool has_data () const { return version.to_int (); } - bool find_axis_index (hb_tag_t tag, unsigned int *axis_index) const - { - hb_array_t<const StatAxisRecord> axes = get_design_axes (); - /* TODO: add lfind in hb_array_t and use it in here and fvar's find_axis_info */ - for (unsigned int i = 0; i < axes.length; i++) - if (!axes[i].cmp (tag)) - { - *axis_index = i; - return true; - } - return false; - } - bool get_value (hb_tag_t tag, float *value) const { unsigned int axis_index; - if (!find_axis_index (tag, &axis_index)) return false; + if (!get_design_axes ().lfind (tag, &axis_index)) return false; hb_array_t<const OffsetTo<AxisValue>> axis_values = get_axis_value_offsets (); for (unsigned int i = 0; i < axis_values.length; i++) { - const AxisValue& axis_value = (this + axis_values[i]); + const AxisValue& axis_value = this+axis_values[i]; if (axis_value.get_axis_index () == axis_index) { if (value) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh index 9185f755c53..f9e933fb2be 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh @@ -70,6 +70,8 @@ struct InstanceRecord struct AxisRecord { + int cmp (hb_tag_t key) const { return axisTag.cmp (key); } + enum { AXIS_FLAG_HIDDEN = 0x0001, @@ -80,10 +82,7 @@ struct AxisRecord { info->tag = axisTag; info->name_id = axisNameID; - info->default_value = defaultValue / 65536.f; - /* Ensure order, to simplify client math. */ - info->min_value = hb_min (info->default_value, minValue / 65536.f); - info->max_value = hb_max (info->default_value, maxValue / 65536.f); + get_coordinates (info->min_value, info->default_value, info->max_value); } #endif @@ -93,20 +92,57 @@ struct AxisRecord info->tag = axisTag; info->name_id = axisNameID; info->flags = (hb_ot_var_axis_flags_t) (unsigned int) flags; - info->default_value = defaultValue / 65536.f; - /* Ensure order, to simplify client math. */ - info->min_value = hb_min (info->default_value, minValue / 65536.f); - info->max_value = hb_max (info->default_value, maxValue / 65536.f); + get_coordinates (info->min_value, info->default_value, info->max_value); info->reserved = 0; } + int normalize_axis_value (float v) const + { + float min_value, default_value, max_value; + get_coordinates (min_value, default_value, max_value); + + v = hb_clamp (v, min_value, max_value); + + if (v == default_value) + return 0; + else if (v < default_value) + v = (v - default_value) / (default_value - min_value); + else + v = (v - default_value) / (max_value - default_value); + return roundf (v * 16384.f); + } + + float unnormalize_axis_value (int v) const + { + float min_value, default_value, max_value; + get_coordinates (min_value, default_value, max_value); + + if (v == 0) + return default_value; + else if (v < 0) + return v * (default_value - min_value) / 16384.f + default_value; + else + return v * (max_value - default_value) / 16384.f + default_value; + } + + hb_ot_name_id_t get_name_id () const { return axisNameID; } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); return_trace (c->check_struct (this)); } - public: + protected: + void get_coordinates (float &min, float &default_, float &max) const + { + default_ = defaultValue / 65536.f; + /* Ensure order, to simplify client math. */ + min = hb_min (default_, minValue / 65536.f); + max = hb_max (default_, maxValue / 65536.f); + } + + protected: Tag axisTag; /* Tag identifying the design variation for the axis. */ HBFixed minValue; /* The minimum coordinate value for the axis. */ HBFixed defaultValue; /* The default coordinate value for the axis. */ @@ -171,63 +207,27 @@ struct fvar bool find_axis_deprecated (hb_tag_t tag, unsigned *axis_index, hb_ot_var_axis_t *info) const { - hb_array_t<const AxisRecord> axes = get_axes (); - for (unsigned i = 0; i < axes.length; i++) - if (axes[i].axisTag == tag) - { - if (axis_index) - *axis_index = i; - axes[i].get_axis_deprecated (info); - return true; - } - if (axis_index) - *axis_index = HB_OT_VAR_NO_AXIS_INDEX; - return false; + unsigned i; + if (!axis_index) axis_index = &i; + *axis_index = HB_OT_VAR_NO_AXIS_INDEX; + auto axes = get_axes (); + return axes.lfind (tag, axis_index) && (axes[*axis_index].get_axis_deprecated (info), true); } #endif bool find_axis_info (hb_tag_t tag, hb_ot_var_axis_info_t *info) const { - hb_array_t<const AxisRecord> axes = get_axes (); - for (unsigned i = 0; i < axes.length; i++) - if (axes[i].axisTag == tag) - { - axes[i].get_axis_info (i, info); - return true; - } - return false; + unsigned i; + auto axes = get_axes (); + return axes.lfind (tag, &i) && (axes[i].get_axis_info (i, info), true); } int normalize_axis_value (unsigned int axis_index, float v) const - { - hb_ot_var_axis_info_t axis; - get_axes ()[axis_index].get_axis_info (axis_index, &axis); - - v = hb_clamp (v, axis.min_value, axis.max_value); - - if (v == axis.default_value) - return 0; - else if (v < axis.default_value) - v = (v - axis.default_value) / (axis.default_value - axis.min_value); - else - v = (v - axis.default_value) / (axis.max_value - axis.default_value); - return roundf (v * 16384.f); - } - - float unnormalize_axis_value (unsigned int axis_index, float v) const - { - hb_ot_var_axis_info_t axis; - get_axes ()[axis_index].get_axis_info (axis_index, &axis); + { return get_axes ()[axis_index].normalize_axis_value (v); } - if (v == 0) - return axis.default_value; - else if (v < 0) - v = v * (axis.default_value - axis.min_value) / 16384.f + axis.default_value; - else - v = v * (axis.max_value - axis.default_value) / 16384.f + axis.default_value; - return v; - } + float unnormalize_axis_value (unsigned int axis_index, int v) const + { return get_axes ()[axis_index].unnormalize_axis_value (v); } unsigned int get_instance_count () const { return instanceCount; } @@ -274,7 +274,7 @@ struct fvar if (!has_data ()) return; + get_axes () - | hb_map (&AxisRecord::axisNameID) + | hb_map (&AxisRecord::get_name_id) | hb_sink (nameids) ; @@ -289,7 +289,6 @@ struct fvar ; } - protected: hb_array_t<const AxisRecord> get_axes () const { return hb_array (&(this+firstAxis), axisCount); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh index db944f6dc51..6dce45ea249 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-gvar-table.hh @@ -545,7 +545,7 @@ struct gvar hb_vector_t<unsigned int> shared_indices; GlyphVariationData::tuple_iterator_t iterator; if (!GlyphVariationData::get_tuple_iterator (var_data_bytes, table->axisCount, - shared_indices, &iterator)) + shared_indices, &iterator)) return true; /* so isn't applied at all */ /* Save original points for inferred delta calculation */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-style.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-style.cc index 69f5beeb20c..86b9f7da5f2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-style.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-style.cc @@ -27,7 +27,6 @@ #ifndef HB_NO_STYLE #ifdef HB_EXPERIMENTAL_API -#include "hb-aat-fdsc-table.hh" #include "hb-ot-var-avar-table.hh" #include "hb-ot-var-fvar-table.hh" #include "hb-ot-stat-table.hh" @@ -106,19 +105,6 @@ hb_style_get_value (hb_font_t *font, hb_tag_t tag) if (face->table.STAT->get_value (style_tag, &value)) return value; - /* Check Apple's fdsc as OS2 table is optional in AAT */ - const AAT::FontDescriptor &descriptor = face->table.fdsc->get_descriptor (style_tag); - if (descriptor.has_data ()) - { - float value = descriptor.get_value (); - /* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6fdsc.html */ - /* Percent weight relative to regular weight. */ - if (style_tag == HB_STYLE_TAG_WEIGHT) value *= 400.f; - /* Percent width relative to regular width. */ - if (style_tag == HB_STYLE_TAG_WIDTH) value *= 100.f; - return value; - } - switch ((unsigned) style_tag) { case HB_STYLE_TAG_ITALIC: diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc index f3ed518f7e1..f16b2533a6c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff1.cc @@ -114,7 +114,7 @@ struct cff1_top_dict_values_mod_t : cff1_top_dict_values_t struct top_dict_modifiers_t { top_dict_modifiers_t (const cff1_sub_table_info_t &info_, - const unsigned int (&nameSIDs_)[name_dict_values_t::ValCount]) + const unsigned int (&nameSIDs_)[name_dict_values_t::ValCount]) : info (info_), nameSIDs (nameSIDs_) {} diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff2.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff2.cc index 637f38fbf82..17ee040deb6 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff2.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-cff2.cc @@ -303,13 +303,13 @@ struct cff2_subset_plan { if (acc.fdSelect != &Null (CFF2FDSelect)) { if (unlikely (!hb_plan_subset_cff_fdselect (plan, - orig_fdcount, - *(const FDSelect *)acc.fdSelect, - subset_fdcount, - subset_fdselect_size, - subset_fdselect_format, - subset_fdselect_ranges, - fdmap))) + orig_fdcount, + *(const FDSelect *)acc.fdSelect, + subset_fdcount, + subset_fdselect_size, + subset_fdselect_format, + subset_fdselect_ranges, + fdmap))) return false; } else diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh index d979169de30..079b94a6b4a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh @@ -277,6 +277,9 @@ struct hb_vector_t template <typename T> const Type *lsearch (const T &x, const Type *not_found = nullptr) const { return as_array ().lsearch (x, not_found); } + template <typename T> + bool lfind (const T &x, unsigned *pos = nullptr) const + { return as_array ().lfind (x, pos); } }; template <typename Type> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh index 3adca88ff4d..203267e8300 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh @@ -189,22 +189,31 @@ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif -#include <windows.h> #else #include <intrin.h> #endif #endif +#ifdef _WIN32 +#include <windows.h> +#include <winapifamily.h> +#endif + #define HB_PASTE1(a,b) a##b #define HB_PASTE(a,b) HB_PASTE1(a,b) /* Compile-time custom allocator support. */ -#if defined(hb_malloc_impl) \ - && defined(hb_calloc_impl) \ - && defined(hb_realloc_impl) \ - && defined(hb_free_impl) +#if !defined(HB_CUSTOM_MALLOC) \ + && defined(hb_malloc_impl) \ + && defined(hb_calloc_impl) \ + && defined(hb_realloc_impl) \ + && defined(hb_free_impl) +#define HB_CUSTOM_MALLOC +#endif + +#ifdef HB_CUSTOM_MALLOC extern "C" void* hb_malloc_impl(size_t size); extern "C" void* hb_calloc_impl(size_t nmemb, size_t size); extern "C" void* hb_realloc_impl(void *ptr, size_t size); @@ -348,7 +357,7 @@ extern "C" void hb_free_impl(void *ptr); # undef _WIN32_WINNT # endif # ifndef _WIN32_WINNT -# if !defined(WINAPI_FAMILY) || !(WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) +# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) # define _WIN32_WINNT 0x0600 # endif # endif @@ -369,7 +378,7 @@ extern "C" void hb_free_impl(void *ptr); # define HB_NO_SETLOCALE # define HB_NO_ERRNO # endif -# elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) +# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) # ifndef HB_NO_GETENV # define HB_NO_GETENV # endif @@ -499,14 +508,9 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); #define HB_VAR_ARRAY 1 #endif -static inline double -_hb_roundf (float x) -{ - return x >= 0 ? floor ((double) x + .5) : ceil ((double) x - .5); -} -#ifndef HAVE_ROUNDF +static inline float +_hb_roundf (float x) { return floorf (x + .5f); } #define roundf(x) _hb_roundf(x) -#endif /* Endian swap, used in Windows related backends */ static inline uint16_t hb_uint16_swap (const uint16_t v) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build b/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build index a9757a4bcf8..6da8e839b50 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/meson.build @@ -1,13 +1,11 @@ # Base and default-included sources and headers -hb_base_sources = [ - 'hb-aat-fdsc-table.hh', +hb_base_sources = files( 'hb-aat-layout-ankr-table.hh', 'hb-aat-layout-bsln-table.hh', 'hb-aat-layout-common.hh', 'hb-aat-layout-feat-table.hh', 'hb-aat-layout-just-table.hh', 'hb-aat-layout-kerx-table.hh', - 'hb-aat-layout-lcar-table.hh', 'hb-aat-layout-morx-table.hh', 'hb-aat-layout-opbd-table.hh', 'hb-aat-layout-trak-table.hh', @@ -167,9 +165,9 @@ hb_base_sources = [ 'hb-utf.hh', 'hb-vector.hh', 'hb.hh', -] +) -hb_base_ragel_generated_sources = [ +hb_base_ragel_generated_sources = files( 'hb-buffer-deserialize-json.hh', 'hb-buffer-deserialize-text.hh', 'hb-number-parser.hh', @@ -177,7 +175,7 @@ hb_base_ragel_generated_sources = [ 'hb-ot-shape-complex-khmer-machine.hh', 'hb-ot-shape-complex-myanmar-machine.hh', 'hb-ot-shape-complex-use-machine.hh', -] +) hb_base_ragel_sources = [ 'hb-buffer-deserialize-json.rl', 'hb-buffer-deserialize-text.rl', @@ -188,7 +186,7 @@ hb_base_ragel_sources = [ 'hb-ot-shape-complex-use-machine.rl', ] -hb_base_headers = [ +hb_base_headers = files( 'hb-aat-layout.h', 'hb-aat.h', 'hb-blob.h', @@ -217,39 +215,39 @@ hb_base_headers = [ 'hb-unicode.h', 'hb-version.h', 'hb.h', -] +) # Optional Sources and Headers with external deps -hb_ft_sources = ['hb-ft.cc'] -hb_ft_headers = ['hb-ft.h'] +hb_ft_sources = files('hb-ft.cc') +hb_ft_headers = files('hb-ft.h') -hb_glib_sources = ['hb-glib.cc'] -hb_glib_headers = ['hb-glib.h'] +hb_glib_sources = files('hb-glib.cc') +hb_glib_headers = files('hb-glib.h') -hb_graphite2_sources = ['hb-graphite2.cc'] -hb_graphite2_headers = ['hb-graphite2.h'] +hb_graphite2_sources = files('hb-graphite2.cc') +hb_graphite2_headers = files('hb-graphite2.h') # System-dependent sources and headers -hb_coretext_sources = ['hb-coretext.cc'] -hb_coretext_headers = ['hb-coretext.h'] +hb_coretext_sources = files('hb-coretext.cc') +hb_coretext_headers = files('hb-coretext.h') -hb_directwrite_sources = ['hb-directwrite.cc'] -hb_directwrite_headers = ['hb-directwrite.h'] +hb_directwrite_sources = files('hb-directwrite.cc') +hb_directwrite_headers = files('hb-directwrite.h') -hb_gdi_sources = ['hb-gdi.cc'] -hb_gdi_headers = ['hb-gdi.h'] +hb_gdi_sources = files('hb-gdi.cc') +hb_gdi_headers = files('hb-gdi.h') -hb_uniscribe_sources = ['hb-uniscribe.cc'] -hb_uniscribe_headers = ['hb-uniscribe.h'] +hb_uniscribe_sources = files('hb-uniscribe.cc') +hb_uniscribe_headers = files('hb-uniscribe.h') # Sources for libharfbuzz-gobject and libharfbuzz-icu -hb_icu_sources = ['hb-icu.cc'] -hb_icu_headers = ['hb-icu.h'] +hb_icu_sources = files('hb-icu.cc') +hb_icu_headers = files('hb-icu.h') # Sources for libharfbuzz-subset -hb_subset_sources = [ +hb_subset_sources = files( 'hb-number.cc', 'hb-number.hh', 'hb-ot-cff1-table.cc', @@ -269,44 +267,52 @@ hb_subset_sources = [ 'hb-subset.cc', 'hb-subset.hh', 'hb-subset.hh', -] +) -hb_subset_headers = ['hb-subset.h'] +hb_subset_headers = files('hb-subset.h') -hb_gobject_sources = [ +hb_gobject_sources = files( 'hb-gobject-structs.cc' -] +) -hb_gobject_headers = [ +hb_gobject_headers = files( 'hb-gobject.h', 'hb-gobject-structs.h', -] +) custom_target('hb-version.h', build_by_default: true, input: 'hb-version.h.in', output: 'hb-version.h', command: [find_program('gen-hb-version.py'), meson.project_version(), - 'hb-version.h.in', 'hb-version.h']) + '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], +) ragel = find_program('ragel', required: false) if not ragel.found() warning('You have to install ragel if you are going to develop HarfBuzz itself') else - custom_target('ragel header files', - build_by_default: true, - input: hb_base_ragel_sources, - output: '.ragel-artifacts', - command: [find_program('gen-ragel-artifacts.py')] + hb_base_ragel_sources) + ragel_helper = find_program('gen-ragel-artifacts.py') + foreach rl : hb_base_ragel_sources + hh = rl.split('.')[0] + '.hh' + custom_target('@0@'.format(hh), + build_by_default: true, + input: rl, + output: hh, + command: [ragel_helper, '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], + ) + endforeach endif custom_target('harfbuzz.cc', build_by_default: true, output: 'harfbuzz.cc', - command: [find_program('gen-harfbuzzcc.py'), 'harfbuzz.cc'] + - hb_base_sources + hb_glib_sources + hb_ft_sources + - hb_graphite2_sources + hb_uniscribe_sources + hb_gdi_sources + - hb_directwrite_sources + hb_coretext_sources) + input: hb_base_sources + hb_glib_sources + hb_ft_sources + + hb_graphite2_sources + hb_uniscribe_sources + hb_gdi_sources + + hb_directwrite_sources + hb_coretext_sources, + command: [find_program('gen-harfbuzzcc.py'), + '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], +) incsrc = include_directories('.') @@ -379,7 +385,7 @@ harfbuzz_def = custom_target('harfbuzz.def', output: 'harfbuzz.def') defs_list = [harfbuzz_def] -version = '0.' + '0'.join(meson.project_version().split('.')) + '.0' +version = '0.@0@.0'.format(hb_version_int) extra_hb_cpp_args = [] if cpp.get_id() == 'msvc' @@ -501,10 +507,12 @@ pkgmod.generate(libharfbuzz, pkgmod.generate(libharfbuzz_subset, description: 'HarfBuzz font subsetter', + requires: ['harfbuzz = @0@'.format(meson.project_version())], subdirs: [meson.project_name()], version: meson.project_version(), ) +libharfbuzz_icu_dep = null_dep if have_icu and not have_icu_builtin harfbuzz_icu_def = custom_target('harfbuzz-icu.def', command: [gen_def, '@OUTPUT@', '@INPUT@'], @@ -531,13 +539,12 @@ if have_icu and not have_icu_builtin pkgmod.generate(libharfbuzz_icu, description: 'HarfBuzz text shaping library ICU integration', + requires: ['harfbuzz = @0@'.format(meson.project_version())], subdirs: [meson.project_name()], version: meson.project_version(), ) install_headers(hb_icu_headers, subdir: meson.project_name()) -else - libharfbuzz_icu_dep = dependency('', required: false) endif have_gobject = conf.get('HAVE_GOBJECT', 0) == 1 @@ -552,6 +559,7 @@ configure_file(input: 'harfbuzz-config.cmake.in', configuration: cmake_config, install_dir: get_option('libdir') / 'cmake' / 'harfbuzz') +libharfbuzz_gobject_dep = null_dep if have_gobject gnome = import('gnome') @@ -609,7 +617,17 @@ if have_gobject ) gir = find_program('g-ir-scanner', required: get_option('introspection')) - build_gir = gir.found() and not meson.is_cross_build() + build_gir = gir.found() + + build_gir = build_gir and not meson.is_cross_build() + if not build_gir and get_option('introspection').enabled() + error('Introspection support is requested but it isn\'t available in cross builds') + endif + + build_gir = build_gir and get_option('default_library') != 'static' + if not build_gir and get_option('introspection').enabled() + error('Introspection support is requested but the default library option should be shared or both') + endif if build_gir conf.set('HAVE_INTROSPECTION', 1) @@ -644,6 +662,7 @@ if have_gobject pkgmod.generate(libharfbuzz_gobject, description: 'HarfBuzz text shaping library GObject integration', + requires: ['harfbuzz = @0@'.format(meson.project_version()), 'glib-2.0', 'gobject-2.0'], subdirs: [meson.project_name()], version: meson.project_version(), ) @@ -653,8 +672,6 @@ else if get_option('introspection').enabled() error('introspection requires gobject to be enabled') endif - - libharfbuzz_gobject_dep = dependency('', required: false) endif if get_option('tests').enabled() @@ -669,8 +686,16 @@ if get_option('tests').enabled() env.set('srcdir', meson.current_source_dir()) env.set('builddir', meson.current_build_dir()) env.set('libs', meson.current_build_dir()) # TODO: Merge this with builddir after autotools removal - env.set('HBSOURCES', ' '.join(hb_sources)) - env.set('HBHEADERS', ' '.join(hb_headers)) + HBSOURCES = [] + foreach f : hb_sources + HBSOURCES += '@0@'.format(f) + endforeach + env.set('HBSOURCES', ' '.join(HBSOURCES)) + HBHEADERS = [] + foreach f : hb_headers + HBHEADERS += '@0@'.format(f) + endforeach + env.set('HBHEADERS', ' '.join(HBHEADERS)) if cpp.get_id() != 'msvc' and not meson.is_cross_build() # ensure the local tools are usable dist_check_script += ['check-libstdc++', 'check-static-inits', 'check-symbols'] diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/COPYING b/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/COPYING new file mode 100644 index 00000000000..9e841e7a26e --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/COPYING @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/IndicShapingInvalidCluster.txt b/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/IndicShapingInvalidCluster.txt new file mode 100644 index 00000000000..8a177fde8ec --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/ms-use/IndicShapingInvalidCluster.txt @@ -0,0 +1,105 @@ +# IndicShapingInvalidCluster.txt +# Date: 2015-03-12, 21:17:00 GMT [AG] +# Date: 2019-11-08, 23:22:00 GMT [AG] +# +# This file defines the following property: +# +# Indic_Shaping_Invalid_Cluster +# +# Scope: This file enumerates sequences of characters that should be treated as invalid clusters + + 0905 0946 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN SHORT E + 0905 093E ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AA + 0930 094D 0907 ; # DEVANAGARI LETTER RA, DEVANAGARI SIGN VIRAMA, DEVANAGARI LETTER I + 0909 0941 ; # DEVANAGARI LETTER U, DEVANAGARI VOWEL SIGN U + 090F 0945 ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN CANDRA E + 090F 0946 ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN SHORT E + 090F 0947 ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN E + 0905 0949 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN CANDRA O + 0906 0945 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN CANDRA E + 0905 094A ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN SHORT O + 0906 0946 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN SHORT E + 0905 094B ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN O + 0906 0947 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN E + 0905 094C ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AU + 0906 0948 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN AI + 0905 0945 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN CANDRA E + 0905 093A ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN OE + 0905 093B ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN OOE + 0906 093A ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN OE + 0905 094F ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AW + 0905 0956 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN UE + 0905 0957 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN UUE + 0985 09BE ; # BENGALI LETTER A, BENGALI VOWEL SIGN AA + 098B 09C3 ; # BENGALI LETTER VOCALIC R, BENGALI VOWEL SIGN VOCALIC R + 098C 09E2 ; # BENGALI LETTER VOCALIC L, BENGALI VOWEL SIGN VOCALIC L + 0A05 0A3E ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AA + 0A72 0A3F ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN I + 0A72 0A40 ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN II + 0A73 0A41 ; # GURMUKHI URA, GURMUKHI VOWEL SIGN U + 0A73 0A42 ; # GURMUKHI URA, GURMUKHI VOWEL SIGN UU + 0A72 0A47 ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN EE + 0A05 0A48 ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AI + 0A73 0A4B ; # GURMUKHI URA, GURMUKHI VOWEL SIGN OO + 0A05 0A4C ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AU + 0A85 0ABE ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA + 0A85 0AC5 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN CANDRA E + 0A85 0AC7 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN E + 0A85 0AC8 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AI + 0A85 0AC9 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN CANDRA O + 0A85 0ACB ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN O + 0A85 0ABE 0AC5 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA, GUJARATI VOWEL SIGN CANDRA E + 0A85 0ACC ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AU + 0A85 0ABE 0AC8 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA, GUJARATI VOWEL SIGN AI + 0AC5 0ABE ; # GUJARATI VOWEL SIGN CANDRA E, GUJARATI VOWEL SIGN AA + 0B05 0B3E ; # ORIYA LETTER A, ORIYA VOWEL SIGN AA + 0B0F 0B57 ; # ORIYA LETTER E, ORIYA AU LENGTH MARK + 0B13 0B57 ; # ORIYA LETTER O, ORIYA AU LENGTH MARK + 0B85 0BC2 ; # TAMIL LETTER A, TAMIL VOWEL SIGN UU + 0C12 0C55 ; # TELUGU LETTER O, TELUGU LENGTH MARK + 0C12 0C4C ; # TELUGU LETTER O, TELUGU VOWEL SIGN AU + 0C3F 0C55 ; # TELUGU VOWEL SIGN I, TELUGU LENGTH MARK + 0C46 0C55 ; # TELUGU VOWEL SIGN E, TELUGU LENGTH MARK + 0C4A 0C55 ; # TELUGU VOWEL SIGN O, TELUGU LENGTH MARK + 0C89 0CBE ; # KANNADA LETTER U, KANNADA VOWEL SIGN AA + 0C92 0CCC ; # KANNADA LETTER O, KANNADA VOWEL SIGN AU + 0C8B 0CBE ; # KANNADA LETTER VOCALIC R, KANNADA VOWEL SIGN AA + 0D07 0D57 ; # MALAYALAM LETTER I, MALAYALAM AU LENGTH MARK + 0D09 0D57 ; # MALAYALAM LETTER U, MALAYALAM AU LENGTH MARK + 0D0E 0D46 ; # MALAYALAM LETTER E, MALAYALAM VOWEL SIGN E + 0D12 0D3E ; # MALAYALAM LETTER O, MALAYALAM VOWEL SIGN AA + 0D12 0D57 ; # MALAYALAM LETTER O, MALAYALAM AU LENGTH MARK + 0D85 0DCF ; # SINHALA LETTER AYANNA, SINHALA VOWEL SIGN AELA-PILLA + 0D85 0DD0 ; # SINHALA LETTER AYANNA, SINHALA VOWEL SIGN KETTI AEDA-PILLA + 0D85 0DD1 ; # SINHALA LETTER AYANNA, SINHALA VOWEL SIGN DIGA AEDA-PILLA + 0D8B 0DDF ; # SINHALA LETTER UYANNA, SINHALA VOWEL SIGN GAYANUKITTA + 0D8D 0DD8 ; # SINHALA LETTER IRUYANNA, SINHALA VOWEL SIGN GAETTA-PILLA + 0D8F 0DDF ; # SINHALA LETTER ILUYANNA, SINHALA VOWEL SIGN GAYANUKITTA + 0D91 0DCA ; # SINHALA LETTER EYANNA, SINHALA SIGN AL-LAKUNA + 0D91 0DD9 ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA + 0D91 0DDA ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN DIGA KOMBUVA + 0D91 0DDC ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA HAA AELA-PILLA + 0D91 0DDD ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA + 0D91 0DDD ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA + 0D94 0DDF ; # SINHALA LETTER OYANNA, SINHALA VOWEL SIGN GAYANUKITTA + 11005 11038 ; # BRAHMI LETTER A, BRAHMI VOWEL SIGN AA + 1100B 1103E ; # BRAHMI LETTER VOCALIC R, BRAHMI VOWEL SIGN VOCALIC R + 1100F 11042 ; # BRAHMI LETTER E, BRAHMI VOWEL SIGN E + 11680 116AD ; # TAKRI LETTER A, TAKRI VOWEL SIGN AA + 11686 116B2 ; # TAKRI LETTER E, TAKRI VOWEL SIGN E + 11680 116B4 ; # TAKRI LETTER A, TAKRI VOWEL SIGN O + 11680 116B5 ; # TAKRI LETTER A, TAKRI VOWEL SIGN AU + 112B0 112E0 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN AA + 112B0 112E5 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN E + 112B0 112E6 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN AI + 112B0 112E7 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN O + 112B0 112E8 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN AU + 11481 114B0 ; # TIRHUTA LETTER A, TIRHUTA VOWEL SIGN AA + 114AA 114B5 ; # TIRHUTA LETTER LA, TIRHUTA VOWEL SIGN VOCALIC R + 114AA 114B6 ; # TIRHUTA LETTER LA, TIRHUTA VOWEL SIGN VOCALIC RR + 1148B 114BA ; # TIRHUTA LETTER E, TIRHUTA VOWEL SIGN SHORT E + 1148D 114BA ; # TIRHUTA LETTER O, TIRHUTA VOWEL SIGN SHORT E + 11600 11639 ; # MODI LETTER A, MODI VOWEL SIGN E + 11600 1163A ; # MODI LETTER A, MODI VOWEL SIGN AI + 11601 11639 ; # MODI LETTER AA, MODI VOWEL SIGN E + 11601 1163A ; # MODI LETTER AA, MODI VOWEL SIGN AI diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/sample.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/sample.py new file mode 100644 index 00000000000..fd8504800f2 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/sample.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 + +import sys +import array +from gi.repository import HarfBuzz as hb +from gi.repository import GLib + +fontdata = open (sys.argv[1], 'rb').read () +text = sys.argv[2] +# Need to create GLib.Bytes explicitly until this bug is fixed: +# https://bugzilla.gnome.org/show_bug.cgi?id=729541 +blob = hb.glib_blob_create (GLib.Bytes.new (fontdata)) +face = hb.face_create (blob, 0) +del blob +font = hb.font_create (face) +upem = hb.face_get_upem (face) +del face +hb.font_set_scale (font, upem, upem) +#hb.ft_font_set_funcs (font) +hb.ot_font_set_funcs (font) + +buf = hb.buffer_create () +class Debugger (object): + def message (self, buf, font, msg, data, _x_what_is_this): + print (msg) + return True +debugger = Debugger () +hb.buffer_set_message_func (buf, debugger.message, 1, 0) + +## +## Add text to buffer +## +# +# See https://github.com/harfbuzz/harfbuzz/pull/271 +# +# If you do not care about cluster values reflecting Python +# string indices, then this is quickest way to add text to +# buffer: +# hb.buffer_add_utf8 (buf, text.encode('utf-8'), 0, -1) +# Otherwise, then following handles both narrow and wide +# Python builds (the first item in the array is BOM, so we skip it): +if sys.maxunicode == 0x10FFFF: + hb.buffer_add_utf32 (buf, array.array ('I', text.encode ('utf-32'))[1:], 0, -1) +else: + hb.buffer_add_utf16 (buf, array.array ('H', text.encode ('utf-16'))[1:], 0, -1) + + +hb.buffer_guess_segment_properties (buf) + +hb.shape (font, buf, []) +del font + +infos = hb.buffer_get_glyph_infos (buf) +positions = hb.buffer_get_glyph_positions (buf) + +for info, pos in zip (infos, positions): + gid = info.codepoint + cluster = info.cluster + x_advance = pos.x_advance + x_offset = pos.x_offset + y_offset = pos.y_offset + + print ("gid%d=%d@%d,%d+%d" % (gid, cluster, x_advance, x_offset, y_offset)) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/update-unicode-tables.make b/Build/source/libs/harfbuzz/harfbuzz-src/src/update-unicode-tables.make new file mode 100644 index 00000000000..c2d879a3947 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/update-unicode-tables.make @@ -0,0 +1,54 @@ +#!/usr/bin/env -S make -f + +all: packtab \ + hb-ot-shape-complex-arabic-table.hh hb-unicode-emoji-table.hh \ + hb-ot-shape-complex-indic-table.cc hb-ot-tag-table.hh \ + hb-ucd-table.hh hb-ot-shape-complex-use-table.cc \ + hb-ot-shape-complex-vowel-constraints.cc + +.PHONY: all clean packtab + +hb-ot-shape-complex-arabic-table.hh: gen-arabic-table.py ArabicShaping.txt UnicodeData.txt Blocks.txt + ./$^ > $@ || ($(RM) $@; false) +hb-unicode-emoji-table.hh: gen-emoji-table.py emoji-data.txt + ./$^ > $@ || ($(RM) $@; false) +hb-ot-shape-complex-indic-table.cc: gen-indic-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt Blocks.txt + ./$^ > $@ || ($(RM) $@; false) +hb-ot-tag-table.hh: gen-tag-table.py languagetags language-subtag-registry + ./$^ > $@ || ($(RM) $@; false) +hb-ucd-table.hh: gen-ucd-table.py ucd.nounihan.grouped.zip hb-common.h + ./$^ > $@ || ($(RM) $@; false) +hb-ot-shape-complex-use-table.cc: gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt + ./$^ > $@ || ($(RM) $@; false) +hb-ot-shape-complex-vowel-constraints.cc: gen-vowel-constraints.py ms-use/IndicShapingInvalidCluster.txt Scripts.txt + ./$^ > $@ || ($(RM) $@; false) + +packtab: + /usr/bin/env python3 -c "import packTab" 2>/dev/null || /usr/bin/env python3 -m pip install git+https://github.com/harfbuzz/packtab + +ArabicShaping.txt: + curl -O https://unicode.org/Public/UCD/latest/ucd/ArabicShaping.txt +UnicodeData.txt: + curl -O https://unicode.org/Public/UCD/latest/ucd/UnicodeData.txt +Blocks.txt: + curl -O https://unicode.org/Public/UCD/latest/ucd/Blocks.txt +emoji-data.txt: + curl -O https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt +IndicSyllabicCategory.txt: + curl -O https://unicode.org/Public/UCD/latest/ucd/IndicSyllabicCategory.txt +IndicPositionalCategory.txt: + curl -O https://unicode.org/Public/UCD/latest/ucd/IndicPositionalCategory.txt +languagetags: + curl -O https://docs.microsoft.com/en-us/typography/opentype/spec/languagetags +language-subtag-registry: + curl -O https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry +ucd.nounihan.grouped.zip: + curl -O https://unicode.org/Public/UCD/latest/ucdxml/ucd.nounihan.grouped.zip +Scripts.txt: + curl -O https://unicode.org/Public/UCD/latest/ucd/Scripts.txt + +clean: + $(RM) \ + ArabicShaping.txt UnicodeData.txt Blocks.txt emoji-data.txt \ + IndicSyllabicCategory.txt IndicPositionalCategory.txt \ + languagetags language-subtag-registry ucd.nounihan.grouped.zip Scripts.txt |