diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-02-24 05:22:02 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-02-24 05:22:02 +0000 |
commit | 5a5800df04f8ac0c19b3c2f4c96eb9e46d6f992e (patch) | |
tree | c8083a9091a5027f377d70b83e1200b2bdecf1c5 /Build/source/libs/harfbuzz/harfbuzz-src | |
parent | 9b7c914c2cde25353d10009ca9665e71af9b9838 (diff) |
harfbuzz 1.2.1
git-svn-id: svn://tug.org/texlive/trunk@39845 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src')
15 files changed, 463 insertions, 110 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog index 50611730e1b..ea9485b04c0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog +++ b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog @@ -1,3 +1,313 @@ +commit 525cc7d28cbe4e8149ddba677224f134dc0a3274 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Feb 23 15:19:27 2016 +0900 + + Add note re only adding tests with Free Software fonts + + test/shaping/README.md | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +commit 6a09d7e34b949f9929f616ee53278b2edfd9b7ea +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Feb 23 13:47:16 2016 +0900 + + [test] Add README about how to add shaping tests + + test/shaping/Makefile.am | 1 + + test/shaping/README.md | 37 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 38 insertions(+) + +commit f8ee7906d0454d950081c621f2b04a6d08e1b92f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Tue Feb 23 13:45:38 2016 +0900 + + Remove MANIFEST files + + They are unused currently. We can add later if we hook them up + to anything useful. + + test/shaping/fonts/sha1sum/MANIFEST | 52 + ---------------------- + test/shaping/tests/MANIFEST | 19 -------- + test/shaping/texts/MANIFEST | 1 - + test/shaping/texts/in-tree/MANIFEST | 9 ---- + test/shaping/texts/in-tree/shaper-arabic/MANIFEST | 6 --- + .../in-tree/shaper-arabic/script-arabic/MANIFEST | 3 -- + .../script-arabic/language-persian/MANIFEST | 1 - + .../script-arabic/language-urdu/MANIFEST | 1 - + .../script-arabic/language-urdu/crulp/MANIFEST | 1 - + .../language-urdu/crulp/ligatures/MANIFEST | 7 --- + .../shaper-arabic/script-arabic/misc/MANIFEST | 1 - + .../script-arabic/misc/diacritics/MANIFEST | 7 --- + .../in-tree/shaper-arabic/script-mandaic/MANIFEST | 1 - + .../shaper-arabic/script-mandaic/misc/MANIFEST | 0 + .../shaper-arabic/script-mongolian/MANIFEST | 1 - + .../shaper-arabic/script-mongolian/misc/MANIFEST | 4 -- + .../in-tree/shaper-arabic/script-nko/MANIFEST | 1 - + .../in-tree/shaper-arabic/script-nko/misc/MANIFEST | 1 - + .../in-tree/shaper-arabic/script-phags-pa/MANIFEST | 1 - + .../shaper-arabic/script-phags-pa/misc/MANIFEST | 1 - + .../in-tree/shaper-arabic/script-syriac/MANIFEST | 1 - + .../shaper-arabic/script-syriac/misc/MANIFEST | 2 - + test/shaping/texts/in-tree/shaper-default/MANIFEST | 5 --- + .../shaper-default/script-ethiopic/MANIFEST | 1 - + .../shaper-default/script-ethiopic/misc/MANIFEST | 1 - + .../in-tree/shaper-default/script-han/MANIFEST | 1 - + .../shaper-default/script-han/misc/MANIFEST | 1 - + .../shaper-default/script-hiragana/MANIFEST | 1 - + .../shaper-default/script-hiragana/misc/MANIFEST | 2 - + .../shaper-default/script-linear-b/MANIFEST | 1 - + .../shaper-default/script-linear-b/misc/MANIFEST | 1 - + .../shaper-default/script-tifinagh/MANIFEST | 1 - + .../shaper-default/script-tifinagh/misc/MANIFEST | 1 - + test/shaping/texts/in-tree/shaper-hangul/MANIFEST | 1 - + .../in-tree/shaper-hangul/script-hangul/MANIFEST | 1 - + .../shaper-hangul/script-hangul/misc/MANIFEST | 1 - + test/shaping/texts/in-tree/shaper-hebrew/MANIFEST | 1 - + .../in-tree/shaper-hebrew/script-hebrew/MANIFEST | 1 - + .../shaper-hebrew/script-hebrew/misc/MANIFEST | 1 - + test/shaping/texts/in-tree/shaper-indic/MANIFEST | 2 - + .../texts/in-tree/shaper-indic/indic/MANIFEST | 11 ----- + .../shaper-indic/indic/script-assamese/MANIFEST | 2 - + .../indic/script-assamese/misc/MANIFEST | 0 + .../indic/script-assamese/utrrs/MANIFEST | 3 -- + .../indic/script-assamese/utrrs/codepoint/MANIFEST | 7 --- + .../indic/script-assamese/utrrs/gpos/MANIFEST | 2 - + .../indic/script-assamese/utrrs/gsub/MANIFEST | 1 - + .../shaper-indic/indic/script-bengali/MANIFEST | 2 - + .../indic/script-bengali/misc/MANIFEST | 2 - + .../indic/script-bengali/utrrs/MANIFEST | 3 -- + .../indic/script-bengali/utrrs/codepoint/MANIFEST | 7 --- + .../indic/script-bengali/utrrs/gpos/MANIFEST | 2 - + .../indic/script-bengali/utrrs/gsub/MANIFEST | 1 - + .../shaper-indic/indic/script-devanagari/MANIFEST | 2 - + .../indic/script-devanagari/misc/MANIFEST | 6 --- + .../indic/script-devanagari/utrrs/MANIFEST | 3 -- + .../script-devanagari/utrrs/codepoint/MANIFEST | 9 ---- + .../indic/script-devanagari/utrrs/gpos/MANIFEST | 2 - + .../indic/script-devanagari/utrrs/gsub/MANIFEST | 1 - + .../shaper-indic/indic/script-gujarati/MANIFEST | 2 - + .../indic/script-gujarati/misc/MANIFEST | 0 + .../indic/script-gujarati/utrrs/MANIFEST | 3 -- + .../indic/script-gujarati/utrrs/codepoint/MANIFEST | 7 --- + .../indic/script-gujarati/utrrs/gpos/MANIFEST | 2 - + .../indic/script-gujarati/utrrs/gsub/MANIFEST | 1 - + .../shaper-indic/indic/script-gurmukhi/MANIFEST | 2 - + .../indic/script-gurmukhi/misc/MANIFEST | 1 - + .../indic/script-gurmukhi/utrrs/MANIFEST | 3 -- + .../indic/script-gurmukhi/utrrs/codepoint/MANIFEST | 7 --- + .../indic/script-gurmukhi/utrrs/gpos/MANIFEST | 2 - + .../indic/script-gurmukhi/utrrs/gsub/MANIFEST | 1 - + .../shaper-indic/indic/script-kannada/MANIFEST | 2 - + .../indic/script-kannada/misc/MANIFEST | 2 - + .../indic/script-kannada/utrrs/MANIFEST | 3 -- + .../indic/script-kannada/utrrs/codepoint/MANIFEST | 8 ---- + .../indic/script-kannada/utrrs/gpos/MANIFEST | 1 - + .../indic/script-kannada/utrrs/gsub/MANIFEST | 1 - + .../shaper-indic/indic/script-malayalam/MANIFEST | 2 - + .../indic/script-malayalam/misc/MANIFEST | 3 -- + .../indic/script-malayalam/utrrs/MANIFEST | 2 - + .../script-malayalam/utrrs/codepoint/MANIFEST | 7 --- + .../indic/script-malayalam/utrrs/gsub/MANIFEST | 1 - + .../shaper-indic/indic/script-oriya/MANIFEST | 2 - + .../shaper-indic/indic/script-oriya/misc/MANIFEST | 2 - + .../shaper-indic/indic/script-oriya/utrrs/MANIFEST | 2 - + .../indic/script-oriya/utrrs/codepoint/MANIFEST | 9 ---- + .../indic/script-oriya/utrrs/gsub/MANIFEST | 1 - + .../shaper-indic/indic/script-sinhala/MANIFEST | 2 - + .../indic/script-sinhala/misc/MANIFEST | 4 -- + .../indic/script-sinhala/utrrs/MANIFEST | 3 -- + .../indic/script-sinhala/utrrs/codepoint/MANIFEST | 5 --- + .../indic/script-sinhala/utrrs/gpos/MANIFEST | 1 - + .../indic/script-sinhala/utrrs/gsub/MANIFEST | 7 --- + .../shaper-indic/indic/script-tamil/MANIFEST | 2 - + .../shaper-indic/indic/script-tamil/misc/MANIFEST | 1 - + .../shaper-indic/indic/script-tamil/utrrs/MANIFEST | 3 -- + .../indic/script-tamil/utrrs/codepoint/MANIFEST | 10 ----- + .../indic/script-tamil/utrrs/gpos/MANIFEST | 2 - + .../indic/script-tamil/utrrs/gsub/MANIFEST | 1 - + .../shaper-indic/indic/script-telugu/MANIFEST | 2 - + .../shaper-indic/indic/script-telugu/misc/MANIFEST | 1 - + .../indic/script-telugu/utrrs/MANIFEST | 3 -- + .../indic/script-telugu/utrrs/codepoint/MANIFEST | 7 --- + .../indic/script-telugu/utrrs/gpos/MANIFEST | 1 - + .../indic/script-telugu/utrrs/gsub/MANIFEST | 1 - + .../in-tree/shaper-indic/south-east-asian/MANIFEST | 1 - + .../south-east-asian/script-khmer/MANIFEST | 1 - + .../south-east-asian/script-khmer/misc/MANIFEST | 3 -- + test/shaping/texts/in-tree/shaper-myanmar/MANIFEST | 1 - + .../in-tree/shaper-myanmar/script-myanmar/MANIFEST | 1 - + .../shaper-myanmar/script-myanmar/misc/MANIFEST | 3 -- + test/shaping/texts/in-tree/shaper-thai/MANIFEST | 2 - + .../texts/in-tree/shaper-thai/script-lao/MANIFEST | 1 - + .../in-tree/shaper-thai/script-lao/misc/MANIFEST | 1 - + .../texts/in-tree/shaper-thai/script-thai/MANIFEST | 1 - + .../in-tree/shaper-thai/script-thai/misc/MANIFEST | 4 -- + test/shaping/texts/in-tree/shaper-tibetan/MANIFEST | 1 - + .../in-tree/shaper-tibetan/script-tibetan/MANIFEST | 1 - + .../shaper-tibetan/script-tibetan/misc/MANIFEST | 1 - + test/shaping/texts/in-tree/shaper-use/MANIFEST | 6 --- + .../texts/in-tree/shaper-use/script-batak/MANIFEST | 1 - + .../in-tree/shaper-use/script-buginese/MANIFEST | 1 - + .../texts/in-tree/shaper-use/script-cham/MANIFEST | 1 - + .../in-tree/shaper-use/script-kaithi/MANIFEST | 1 - + .../in-tree/shaper-use/script-kharoshti/MANIFEST | 1 - + .../in-tree/shaper-use/script-tai-tham/MANIFEST | 2 - + 126 files changed, 381 deletions(-) + +commit 815bdd7700155efcffa9a4c3ca5bfc31833d0586 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 18:22:44 2016 +0900 + + In cluster-level=0, group ZWJ/ZWNJ with previous cluster + + This better emulates Unicode grapheme clusters. + + Note that Uniscribe does NOT do this, but should be harmless with + most clients, + and improve fallback with clients that use HarfBuzz cluster as unit + of fallback. + + Fixes https://github.com/behdad/harfbuzz/issues/217 + + src/hb-ot-layout-private.hh | 6 ++++++ + src/hb-ot-shape.cc | 3 ++- + test/shaping/tests/indic-joiner-candrabindu.tests | 2 +- + test/shaping/tests/mongolian-variation-selector.tests | 2 +- + 4 files changed, 10 insertions(+), 3 deletions(-) + +commit 89137e325a19d62fb00979e1e8ab2ca59a2c1147 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 16:00:59 2016 +0900 + + Minor + + src/hb-coretext.cc | 2 +- + src/hb-ot-shape.cc | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 15063b12f7619d4f44981248e28f38c172d12e1f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 15:56:29 2016 +0900 + + [coretext] Move CTFont construction to face_data + + src/hb-coretext.cc | 66 + +++++++++++++++++++++++++----------------------------- + 1 file changed, 30 insertions(+), 36 deletions(-) + +commit ba3d49d9a56932d341bf1916a30f322be665e3a6 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 15:50:12 2016 +0900 + + [coretext] Move code around + + src/hb-coretext.cc | 70 + +++++++++++++++++++++++++++++++----------------------- + 1 file changed, 40 insertions(+), 30 deletions(-) + +commit 90194efb8480d58c55b7a19962624c7aadbdca63 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 15:42:53 2016 +0900 + + [coretext] Move code around + + src/hb-coretext.cc | 46 ++++++++++++++++++++++++++-------------------- + 1 file changed, 26 insertions(+), 20 deletions(-) + +commit ca539e37a4b71e585a267a288db1a3975cbb99fc +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 15:37:18 2016 +0900 + + [build] git.mk fix for m4/gtk-doc.m4 + + Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +commit 54788cb1ecc5a5ffd63d07cd1f0b07b2afa9a8ca +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 15:32:52 2016 +0900 + + [win32] Install git.mk + + win32/Makefile.am | 2 ++ + 1 file changed, 2 insertions(+) + +commit 9a13ed453ef96822a47d6e6f58332b87f38d5c59 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 11:44:45 2016 +0900 + + Make FixedVersion a template + + src/hb-open-file-private.hh | 4 ++-- + src/hb-open-type-private.hh | 9 +++++---- + src/hb-ot-head-table.hh | 4 ++-- + src/hb-ot-hhea-table.hh | 2 +- + src/hb-ot-layout-gdef-table.hh | 2 +- + src/hb-ot-layout-gsubgpos-private.hh | 2 +- + src/hb-ot-layout-jstf-table.hh | 2 +- + src/hb-ot-maxp-table.hh | 2 +- + 8 files changed, 14 insertions(+), 13 deletions(-) + +commit 238b943e850ea1ab0093e12c74d2cd7c686f318e +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 15:31:22 2016 +0900 + + [coretext] Fix leak! + + src/hb-coretext.cc | 1 + + 1 file changed, 1 insertion(+) + +commit e561122856a50ed405d71cb1629317e7ae63f316 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 15:28:37 2016 +0900 + + [coretext] Move code around + + src/hb-coretext.cc | 109 + ++++++++++++++++++++++++++++++----------------------- + 1 file changed, 62 insertions(+), 47 deletions(-) + +commit 04c64431530a4a6d9ebd33674c4665a8e6d25bdd +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 15:12:27 2016 +0900 + + [coretext] Ignore PPEM in font size selection + + src/hb-coretext.cc | 14 ++++---------- + 1 file changed, 4 insertions(+), 10 deletions(-) + +commit 62c2711121fe78f373c15c0f53090b62b52d11c1 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 15:07:20 2016 +0900 + + [coretext] Limit grapheme-cluster forming to cluster-level=0 + + src/hb-coretext.cc | 1 + + src/hb-ot-shape.cc | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +commit 061105ec443eb7350ffe217305f9d8902c179e2f +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Mon Feb 22 14:59:39 2016 +0900 + + [coretext] Fix shaping with varying font size + + Fixes https://github.com/libass/libass/issues/212 + + src/hb-coretext.cc | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit 27847cab1264b4ce8342603f4626b4e0645979e4 +Author: Behdad Esfahbod <behdad@behdad.org> +Date: Fri Feb 19 15:56:50 2016 +0700 + + 1.2.0 + + NEWS | 20 ++++++++++++++++++++ + configure.ac | 2 +- + 2 files changed, 21 insertions(+), 1 deletion(-) + commit c3731559042e1730e85d19574321ad850010f7de Author: Behdad Esfahbod <behdad@behdad.org> Date: Fri Feb 19 15:13:07 2016 +0700 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/Makefile.am b/Build/source/libs/harfbuzz/harfbuzz-src/Makefile.am index 8987d5749e8..d56a151a380 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/Makefile.am +++ b/Build/source/libs/harfbuzz/harfbuzz-src/Makefile.am @@ -21,6 +21,7 @@ MAINTAINERCLEANFILES = \ $(srcdir)/INSTALL \ $(srcdir)/ChangeLog \ $(srcdir)/gtk-doc.make \ + $(srcdir)/m4/gtk-doc.m4 \ $(NULL) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS index d8daee76dba..b1b63b2c5af 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS +++ b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS @@ -1,3 +1,16 @@ +Overview of changes leading to 1.2.1 +Friday, February 23, 2016 +==================================== + +- CoreText: Fix bug with wrong scale if font scale was changed later. + https://github.com/libass/libass/issues/212 +- CoreText: Drastically speed up font initialization. +- CoreText: Fix tiny leak. +- Group ZWJ/ZWNJ with previous syllable under cluster-level=0. + https://github.com/behdad/harfbuzz/issues/217 +- Add test/shaping/README.md about how to add tests to the suite. + + Overview of changes leading to 1.2.0 Friday, February 19, 2016 ==================================== diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac index d4c8f953807..d12d4b81413 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac +++ b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.64]) AC_INIT([HarfBuzz], - [1.2.0], + [1.2.1], [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz], [harfbuzz], [http://harfbuzz.org/]) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc index 04cf0570f04..90c6653d00f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc @@ -27,7 +27,6 @@ */ #define HB_SHAPER coretext -#define hb_coretext_shaper_face_data_t CGFont #include "hb-shaper-impl-private.hh" #include "hb-coretext.h" @@ -78,6 +77,29 @@ HB_SHAPER_DATA_ENSURE_DECLARE(coretext, font) * shaper face data */ +static CTFontDescriptorRef +get_last_resort_font_desc (void) +{ + // TODO Handle allocation failures? + CTFontDescriptorRef last_resort = CTFontDescriptorCreateWithNameAndSize (CFSTR("LastResort"), 0); + CFArrayRef cascade_list = CFArrayCreate (kCFAllocatorDefault, + (const void **) &last_resort, + 1, + &kCFTypeArrayCallBacks); + CFRelease (last_resort); + CFDictionaryRef attributes = CFDictionaryCreate (kCFAllocatorDefault, + (const void **) &kCTFontCascadeListAttribute, + (const void **) &cascade_list, + 1, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CFRelease (cascade_list); + + CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes); + CFRelease (attributes); + return font_desc; +} + static void release_data (void *info, const void *data, size_t size) { @@ -87,14 +109,13 @@ release_data (void *info, const void *data, size_t size) hb_blob_destroy ((hb_blob_t *) info); } -hb_coretext_shaper_face_data_t * -_hb_coretext_shaper_face_data_create (hb_face_t *face) +static CGFontRef +create_cg_font (hb_face_t *face) { - hb_coretext_shaper_face_data_t *data = NULL; - + CGFontRef cg_font = NULL; if (face->destroy == (hb_destroy_func_t) CGFontRelease) { - data = CGFontRetain ((CGFontRef) face->user_data); + cg_font = CGFontRetain ((CGFontRef) face->user_data); } else { @@ -107,13 +128,76 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face) CGDataProviderRef provider = CGDataProviderCreateWithData (blob, blob_data, blob_length, &release_data); if (likely (provider)) { - data = CGFontCreateWithDataProvider (provider); + cg_font = CGFontCreateWithDataProvider (provider); + if (unlikely (!cg_font)) + DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed"); CGDataProviderRelease (provider); } } + return cg_font; +} - if (unlikely (!data)) { - DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed"); +static CTFontRef +create_ct_font (CGFontRef cg_font, CGFloat font_size) +{ + CTFontRef ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NULL); + if (unlikely (!ct_font)) { + DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed"); + return NULL; + } + + /* Create font copy with cascade list that has LastResort first; this speeds up CoreText + * font fallback which we don't need anyway. */ + { + CTFontDescriptorRef last_resort_font_desc = get_last_resort_font_desc (); + CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, last_resort_font_desc); + CFRelease (last_resort_font_desc); + if (new_ct_font) + { + CFRelease (ct_font); + ct_font = new_ct_font; + } + else + DEBUG_MSG (CORETEXT, ct_font, "Font copy with empty cascade list failed"); + } + + return ct_font; +} + +struct hb_coretext_shaper_face_data_t { + CGFontRef cg_font; + CTFontRef ct_font; +}; + +hb_coretext_shaper_face_data_t * +_hb_coretext_shaper_face_data_create (hb_face_t *face) +{ + hb_coretext_shaper_face_data_t *data = (hb_coretext_shaper_face_data_t *) calloc (1, sizeof (hb_coretext_shaper_face_data_t)); + if (unlikely (!data)) + return NULL; + + data->cg_font = create_cg_font (face); + if (unlikely (!data->cg_font)) + { + DEBUG_MSG (CORETEXT, face, "CGFont creation failed.."); + free (data); + return NULL; + } + + /* We use 36pt size instead of UPEM, because CoreText implements the 'trak' table, + * which can make the font too tight at large sizes. 36pt should be a good semi-neutral + * size. + * + * Since we always create CTFont at a fixed size, our CTFont lives in face_data + * instead of font_data. Which is good, because when people change scale on + * hb_font_t, we won't need to update our CTFont. */ + data->ct_font = create_ct_font (data->cg_font, 36.); + if (unlikely (!data->ct_font)) + { + DEBUG_MSG (CORETEXT, face, "CTFont creation failed."); + CFRelease (data->cg_font); + free (data); + return NULL; } return data; @@ -122,7 +206,9 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face) void _hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data) { - CFRelease (data); + CFRelease (data->ct_font); + CFRelease (data->cg_font); + free (data); } /* @@ -133,7 +219,7 @@ hb_coretext_face_get_cg_font (hb_face_t *face) { if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL; hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face); - return face_data; + return face_data->cg_font; } @@ -141,86 +227,17 @@ hb_coretext_face_get_cg_font (hb_face_t *face) * shaper font data */ -struct hb_coretext_shaper_font_data_t { - CTFontRef ct_font; - CGFloat x_mult, y_mult; /* From CT space to HB space. */ -}; +struct hb_coretext_shaper_font_data_t {}; hb_coretext_shaper_font_data_t * -_hb_coretext_shaper_font_data_create (hb_font_t *font) +_hb_coretext_shaper_font_data_create (hb_font_t *font HB_UNUSED) { - if (unlikely (!hb_coretext_shaper_face_data_ensure (font->face))) return NULL; - - hb_coretext_shaper_font_data_t *data = (hb_coretext_shaper_font_data_t *) calloc (1, sizeof (hb_coretext_shaper_font_data_t)); - if (unlikely (!data)) - return NULL; - - hb_face_t *face = font->face; - hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face); - - /* Choose a CoreText font size and calculate multipliers to convert to HarfBuzz space. */ - /* TODO: use upem instead of 36? */ - CGFloat font_size = 36.; /* Default... */ - /* No idea if the following is even a good idea. */ - if (font->y_ppem) - font_size = font->y_ppem; - - if (font_size < 0) - font_size = -font_size; - data->x_mult = (CGFloat) font->x_scale / font_size; - data->y_mult = (CGFloat) font->y_scale / font_size; - data->ct_font = CTFontCreateWithGraphicsFont (face_data, font_size, NULL, NULL); - if (unlikely (!data->ct_font)) { - DEBUG_MSG (CORETEXT, font, "Font CTFontCreateWithGraphicsFont() failed"); - free (data); - return NULL; - } - - /* Create font copy with cascade list that has LastResort first; this speeds up CoreText - * font fallback which we don't need anyway. */ - { - // TODO Handle allocation failures? - CTFontDescriptorRef last_resort = CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0); - CFArrayRef cascade_list = CFArrayCreate (kCFAllocatorDefault, - (const void **) &last_resort, - 1, - &kCFTypeArrayCallBacks); - CFRelease (last_resort); - CFDictionaryRef attributes = CFDictionaryCreate (kCFAllocatorDefault, - (const void **) &kCTFontCascadeListAttribute, - (const void **) &cascade_list, - 1, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - CFRelease (cascade_list); - - CTFontDescriptorRef new_font_desc = CTFontDescriptorCreateWithAttributes (attributes); - CFRelease (attributes); - - CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (data->ct_font, 0.0, NULL, new_font_desc); - if (new_ct_font) - { - CFRelease (data->ct_font); - data->ct_font = new_ct_font; - } - else - DEBUG_MSG (CORETEXT, font, "Font copy with empty cascade list failed"); - } - - if (unlikely (!data->ct_font)) { - DEBUG_MSG (CORETEXT, font, "Font CTFontCreateWithGraphicsFont() failed"); - free (data); - return NULL; - } - - return data; + return (hb_coretext_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED; } void _hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data) { - CFRelease (data->ct_font); - free (data); } @@ -246,9 +263,10 @@ _hb_coretext_shaper_shape_plan_data_destroy (hb_coretext_shaper_shape_plan_data_ CTFontRef hb_coretext_font_get_ct_font (hb_font_t *font) { - if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return NULL; - hb_coretext_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font); - return font_data->ct_font; + hb_face_t *face = font->face; + if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL; + hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face); + return face_data->ct_font; } @@ -481,7 +499,10 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, { hb_face_t *face = font->face; hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face); - hb_coretext_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font); + + CGFloat ct_font_size = CTFontGetSize (face_data->ct_font); + CGFloat x_mult = (CGFloat) font->x_scale / ct_font_size; + CGFloat y_mult = (CGFloat) font->y_scale / ct_font_size; /* Attach marks to their bases, to match the 'ot' shaper. * Adapted from hb-ot-shape:hb_form_clusters(). @@ -490,6 +511,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, * B1 M1 B2 M2, and B1-B2 form a ligature, M2's cluster will * continue pointing to B2 even though B2 was merged into B1's * cluster... */ + if (buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES) { hb_unicode_funcs_t *unicode = buffer->unicode; unsigned int count = buffer->len; @@ -612,7 +634,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes); CFRelease (attributes); - range->font = CTFontCreateCopyWithAttributes (font_data->ct_font, 0.0, NULL, font_desc); + range->font = CTFontCreateCopyWithAttributes (face_data->ct_font, 0.0, NULL, font_desc); CFRelease (font_desc); } else @@ -769,7 +791,7 @@ resize_and_retry: CFRelease (lang); } CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len), - kCTFontAttributeName, font_data->ct_font); + kCTFontAttributeName, face_data->ct_font); if (num_features) { @@ -862,7 +884,7 @@ resize_and_retry: */ CFDictionaryRef attributes = CTRunGetAttributes (run); CTFontRef run_ct_font = static_cast<CTFontRef>(CFDictionaryGetValue (attributes, kCTFontAttributeName)); - if (!CFEqual (run_ct_font, font_data->ct_font)) + if (!CFEqual (run_ct_font, face_data->ct_font)) { /* The run doesn't use our main font instance. We have to figure out * whether font fallback happened, or this is just CoreText giving us @@ -902,13 +924,13 @@ resize_and_retry: CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, 0); if (run_cg_font) { - matched = CFEqual (run_cg_font, face_data); + matched = CFEqual (run_cg_font, face_data->cg_font); CFRelease (run_cg_font); } } if (!matched) { - CFStringRef font_ps_name = CTFontCopyName (font_data->ct_font, kCTFontPostScriptNameKey); + CFStringRef font_ps_name = CTFontCopyName (face_data->ct_font, kCTFontPostScriptNameKey); CFStringRef run_ps_name = CTFontCopyName (run_ct_font, kCTFontPostScriptNameKey); CFComparisonResult result = CFStringCompare (run_ps_name, font_ps_name, 0); CFRelease (run_ps_name); @@ -1028,7 +1050,6 @@ resize_and_retry: positions = position_buf; } hb_glyph_info_t *info = run_info; - CGFloat x_mult = font_data->x_mult, y_mult = font_data->y_mult; if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction)) { hb_position_t x_offset = (positions[0].x - advances_so_far) * x_mult; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh index 152230a0e5f..5357ddcf5be 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh @@ -140,7 +140,7 @@ struct TTCHeaderVersion1 protected: Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ - FixedVersion version; /* Version of the TTC Header (1.0), + FixedVersion<>version; /* Version of the TTC Header (1.0), * 0x00010000u */ ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG> table; /* Array of offsets to the OffsetTable for each font @@ -187,7 +187,7 @@ struct TTCHeader union { struct { Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ - FixedVersion version; /* Version of the TTC Header (1.0 or 2.0), + FixedVersion<>version; /* Version of the TTC Header (1.0 or 2.0), * 0x00010000u or 0x00020000u */ } header; TTCHeaderVersion1 version1; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh index 6323da8e573..6a5200087f3 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh @@ -739,9 +739,10 @@ struct CheckSum : ULONG * Version Numbers */ +template <typename FixedType=USHORT> struct FixedVersion { - inline uint32_t to_int (void) const { return (major << 16) + minor; } + inline uint32_t to_int (void) const { return (major << sizeof(FixedType)) + minor; } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -749,10 +750,10 @@ struct FixedVersion return_trace (c->check_struct (this)); } - USHORT major; - USHORT minor; + FixedType major; + FixedType minor; public: - DEFINE_SIZE_STATIC (4); + DEFINE_SIZE_STATIC (2 * sizeof(FixedType)); }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh index 60644be1045..9c3e51eb08f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh @@ -61,9 +61,9 @@ struct head } protected: - FixedVersion version; /* Version of the head table--currently + FixedVersion<>version; /* Version of the head table--currently * 0x00010000u for version 1.0. */ - FixedVersion fontRevision; /* Set by font manufacturer. */ + FixedVersion<>fontRevision; /* Set by font manufacturer. */ ULONG checkSumAdjustment; /* To compute: set it to 0, sum the * entire font as ULONG, then store * 0xB1B0AFBAu - sum. */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh index 24114534a71..c8e9536cf1e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh @@ -56,7 +56,7 @@ struct _hea } public: - FixedVersion version; /* 0x00010000u for version 1.0. */ + FixedVersion<>version; /* 0x00010000u for version 1.0. */ FWORD ascender; /* Typographic ascent. */ FWORD descender; /* Typographic descent. */ FWORD lineGap; /* Typographic line gap. */ 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 bc36436be78..2b4bc5a0218 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 @@ -409,7 +409,7 @@ struct GDEF protected: - FixedVersion version; /* Version of the GDEF table--currently + FixedVersion<>version; /* Version of the GDEF table--currently * 0x00010002u */ OffsetTo<ClassDef> glyphClassDef; /* Offset to class definition table diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh index 3f9d9ca9df7..691334c99af 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh @@ -2277,7 +2277,7 @@ struct GSUBGPOS } protected: - FixedVersion version; /* Version of the GSUB/GPOS table--initially set + FixedVersion<>version; /* Version of the GSUB/GPOS table--initially set * to 0x00010000u */ OffsetTo<ScriptList> scriptList; /* ScriptList table */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh index 7e199c2e14c..c3068491bec 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh @@ -218,7 +218,7 @@ struct JSTF } protected: - FixedVersion version; /* Version of the JSTF table--initially set + FixedVersion<>version; /* Version of the JSTF table--initially set * to 0x00010000u */ RecordArrayOf<JstfScript> scriptList; /* Array of JstfScripts--listed diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh index 094db957071..b5c670f694d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh @@ -365,6 +365,12 @@ _hb_glyph_info_is_zwj (const hb_glyph_info_t *info) return !!(info->unicode_props() & UPROPS_MASK_ZWJ); } +static inline hb_bool_t +_hb_glyph_info_is_joiner (const hb_glyph_info_t *info) +{ + return !!(info->unicode_props() & (UPROPS_MASK_ZWNJ | UPROPS_MASK_ZWJ)); +} + static inline void _hb_glyph_info_flip_joiners (hb_glyph_info_t *info) { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh index 27105af1326..943e3908c71 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh @@ -58,7 +58,7 @@ struct maxp /* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */ protected: - FixedVersion version; /* Version of the maxp table (0.5 or 1.0), + FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0), * 0x00005000u or 0x00010000u. */ USHORT numGlyphs; /* The number of glyphs in the font. */ public: 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 0b02328989f..42b921c6e53 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 @@ -145,7 +145,7 @@ _hb_ot_shaper_face_data_destroy (hb_ot_shaper_face_data_t *data) struct hb_ot_shaper_font_data_t {}; hb_ot_shaper_font_data_t * -_hb_ot_shaper_font_data_create (hb_font_t *font) +_hb_ot_shaper_font_data_create (hb_font_t *font HB_UNUSED) { return (hb_ot_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED; } @@ -267,13 +267,14 @@ hb_form_clusters (hb_buffer_t *buffer) buffer->cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES) return; - /* Loop duplicated in hb_ensure_native_direction(). */ + /* Loop duplicated in hb_ensure_native_direction(), and in _hb-coretext.cc */ unsigned int base = 0; unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; for (unsigned int i = 1; i < count; i++) { - if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i])))) + if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i])) && + !_hb_glyph_info_is_joiner (&info[i]))) { buffer->merge_clusters (base, i); base = i; |