Commit Graph

5494 Commits

Author SHA1 Message Date
Behdad Esfahbod 44af1f93ee [aat] Whitespace 2018-10-14 14:52:17 -07:00
Behdad Esfahbod 56b8dd17f6 [aat] Finish off massaging table 2018-10-13 19:03:33 -04:00
Behdad Esfahbod e0c5e0d91b [aat] WIP remove feature mapping here from hb-coretext
Need to map enum values to numerics since we don't have CoreText headers.
2018-10-13 18:46:52 -04:00
Behdad Esfahbod cb05774913 [coretext] Prepare AAT feature mapping to be moved 2018-10-13 17:03:32 -04:00
Behdad Esfahbod de6e414c56 [kerx] Sanitize more 2018-10-13 13:48:22 -04:00
Behdad Esfahbod 71f76f2f39 [kerx] Fix-up previous commit
A "&" was missing.  Go back to using pointers that are less error-prone.
2018-10-13 13:36:27 -04:00
Behdad Esfahbod 6d4b054234 [kerx] Use sanitizer instead of handcoded runtime sanitization 2018-10-13 12:20:33 -04:00
Behdad Esfahbod 5733113662 [kerx] Wire up context down to get_kerning 2018-10-13 12:16:12 -04:00
Behdad Esfahbod c4502833b7 [kerx] Use sanitizer.get_num_glyphs() instead of face->get_num_glyphs() 2018-10-13 12:09:59 -04:00
Behdad Esfahbod fc45e698f2 [kerx] Protext against overflows 2018-10-13 12:09:59 -04:00
Behdad Esfahbod ed2ee78136 [hangul] Fix use-after-free issue
out_info might have moved since we copied it's position into local
info var.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=894937
2018-10-13 12:09:59 -04:00
Ebrahim Byagowi 63109432cf Cosmetic and minor changes 2018-10-13 07:23:33 -04:00
Behdad Esfahbod c0a6814b49 Touch up new API
New API:
+hb_ot_layout_feature_get_name_ids()
+hb_ot_layout_feature_get_characters()
2018-10-12 16:06:39 -04:00
Behdad Esfahbod 477bc9aafe Add hb-ot-name.h
Actual name-fetching API to come later.

New API:
hb_name_id_t
HB_NAME_ID_INVALID
2018-10-12 16:06:39 -04:00
Ebrahim Byagowi dc49bd8d81 Add two APIs for getting stylistic set labels
* hb_ot_layout_feature_get_characters
* hb_ot_layout_feature_get_name_ids

However HarfBuzz currently doesn't expose an API for retrieving the actual
information associated with NameId from the `name` table and that should be
done separately.
2018-10-12 16:06:39 -04:00
Behdad Esfahbod e9f9c0d81c [sanitize] Reorder condition to silence bogus gcc warning
Was givin a dozen of:

../../src/hb-machinery.hh: In member function ‘bool AAT::ankr::sanitize(hb_sanitize_context_t*) const’:
../../src/hb-machinery.hh:307:23: warning: missed loop optimization, the loop counter may overflow [-Wunsafe-loop-optimizations]
     bool ok = --this->max_ops > 0 &&
               ~~~~~~~~~~~~~~~~~~~~~~
        this->start <= p &&
        ~~~~~~~~~~~~~~~~~~~
        p <= this->end &&
        ~~~~~~~~~~~~~~~^~
        (unsigned int) (this->end - p) >= len;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I believe those are bogus, but this silences them and does not introduce
logic issues I believe.
2018-10-12 16:06:39 -04:00
Behdad Esfahbod 1a6b5ac6c3 Add HB_DEPRECATED_FOR and mark relevant symbols 2018-10-12 16:06:39 -04:00
Behdad Esfahbod c9413d7bb5 [graphite] Add HB_DEPRECATED annotation 2018-10-12 16:06:39 -04:00
Behdad Esfahbod 68c86af187 Always compile deprecated symbols
We haven't been keeping this updated.  So, while we don't expose the
symbols in the headers if HB_DISABLE_DEPRECATED is defined, we still
always build them.
2018-10-12 16:06:39 -04:00
David Corbett c55100000b Add missing colons to GObject annotations 2018-10-11 22:47:35 -04:00
David Corbett 1e816d62ef Fix Indic script tags in Graphite 2018-10-11 20:51:08 -04:00
Behdad Esfahbod bf8469be9a Attach CursivePositioning backwards, not forward
This is how Uniscribe does it.  So, adjust.  This is only relevant
to fonts that apply cursive positioning from a contextual lookup.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1181
2018-10-11 20:45:40 -04:00
Behdad Esfahbod bdb53ca24a [myanmar] Implement Zawgyi shaper
Enabled if script tag 'Qaag' is passed to HarfBuzz.  Disables mark
advance-zeroing and fallback mark-positioning.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1162
2018-10-11 20:20:29 -04:00
Behdad Esfahbod 00c5c4a79d [myanmar] Shuffle 2018-10-11 20:15:31 -04:00
Behdad Esfahbod ec8f493bf9 [graphite] Remove assert 2018-10-11 20:15:00 -04:00
Behdad Esfahbod 5646dcbd11 Minor 2018-10-11 19:39:07 -04:00
Behdad Esfahbod 654365dc89 Pass indic3 tags to USE shaper
Fixes https://github.com/harfbuzz/harfbuzz/issues/539
2018-10-11 17:51:21 -04:00
David Corbett 28d091d045 Parse Indic3 tags 2018-10-11 17:44:13 -04:00
Behdad Esfahbod 2c824d3644 [aat] Fix two wrongs that made a right before!
Unfortunately our static asserts (DEFINE_SIZE_STATIC) don't actually
fail when used in templates, thanks to SFINAE.  Le sighs.

Probably fixes https://oss-fuzz.com/v2/testcase-detail/5740171484463104
2018-10-11 16:43:05 -04:00
Behdad Esfahbod e940530c97 [aat] Fix mul overflow
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10897
2018-10-11 15:56:17 -04:00
Behdad Esfahbod 0744a02cb1 [arabic] Update to latest UTR#53
From Lorna Evans: "That was a new character added to Unicode 11.0"
2018-10-11 15:14:18 -04:00
Behdad Esfahbod 4f9e36e8cf [graphite] Remove deprecated symbol use 2018-10-11 14:32:59 -04:00
Behdad Esfahbod da591f2a9d Whitespace 2018-10-11 14:30:15 -04:00
Behdad Esfahbod 4d205f0462 [graphite] Fix deva/dev2 resolution
See https://github.com/harfbuzz/harfbuzz/pull/730#issuecomment-428277800
2018-10-11 14:25:48 -04:00
Behdad Esfahbod 8061664ad1 Add doc stubs for recently added API
Thanks to David Corbett who revamped our script and language processing
and implemented full BCP 47 support.

https://github.com/harfbuzz/harfbuzz/pull/730

New API:
+hb_ot_layout_table_select_script()
+hb_ot_layout_script_select_language()
+HB_OT_MAX_TAGS_PER_SCRIPT
+HB_OT_MAX_TAGS_PER_LANGUAGE
+hb_ot_tags_from_script_and_language()
+hb_ot_tags_to_script_and_language()

Deprecated API:
-hb_ot_layout_table_choose_script()
-hb_ot_layout_script_find_language()
-hb_ot_tags_from_script()
-hb_ot_tag_from_language()
2018-10-11 14:17:17 -04:00
Behdad Esfahbod cf975ac653 Remove use of deprecated function 2018-10-11 14:07:44 -04:00
David Corbett 66790d64c7 Increase HB_OT_MAX_TAGS_PER_SCRIPT to 3
No script has 3 tags yet, but the plan is for the Indic scripts to each
get a third tag someday.
2018-10-11 13:54:28 -04:00
David Corbett bca7a16938 Update language system tag registry to OT 1.8.3 2018-10-11 13:54:28 -04:00
David Corbett 7f1fbfe2e3 Add hb_ot_tags_to_script_and_language 2018-10-11 13:54:28 -04:00
David Corbett 3f8877473f Switch on the first char of a complex language tag
This results in a tenfold speed-up for the common case of tags that are
not complex, in the sense of `hb_ot_tags_from_complex_language`.
2018-10-11 13:54:28 -04:00
David Corbett a754d44195 Map Quechua languages to closest ones with tags
OpenType only officially maps four ISO 639 codes to Quechua languages,
but prior versions of HarfBuzz also mapped qu to 'QUZ '. Because qu is a
macrolanguage, the mapping now applies to all individual Quechua
languages. OpenType calls 'QUZ ' "Quechua", but it really corresponds to
Cusco Quechua, so the individual Quechua languages should not all
necessarily be mapped to it.
2018-10-11 13:54:28 -04:00
David Corbett 7c7cb2a989 Match extlang subtags
If the second subtag of a BCP 47 tag is three letters long, it denotes
an extended language. The tag converter ignores the language subtag and
uses the extended language instead.

There are some grandfathered exceptions, which are handled earlier.
2018-10-11 13:54:28 -04:00
David Corbett 2f1f961cc0 Autogenerate the BCP 47 to OpenType mappings
The new script, gen-tag-table.py, generates `ot_languages` automatically
from the [OpenType language system tag registry][ot] and the [IANA
Language Subtag Registry][bcp47] with some manual modifications. If an
OpenType tag maps to a BCP 47 macrolanguage, all the macrolanguage's
individual languages are mapped to the same OpenType tag, except for
individual languages with their own OpenType mappings. Deprecated
BCP 47 tags are canonicalized.

[ot]: https://docs.microsoft.com/en-us/typography/opentype/spec/languagetags
[bcp47]: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry

Some OpenType tags correspond to multiple ISO 639 codes. The mapping
from ISO 639 codes lists OpenType tags in priority order, such that more
specific or more likely tags appear first.

Some OpenType tags have no corresponding ISO 639 code in the registry so
their mappings use BCP 47 subtags besides the language. For example, any
BCP 47 tag with a fonipa variant subtag is mapped to 'IPPH', and 'IPPH'
is mapped back to und-fonipa.

Other OpenType tags have no corresponding ISO 639 code because it is not
clear what they are for. HarfBuzz just ignores these tags.

One such ignored tag is 'ZHP ' (Chinese Phonetic). It probably means
zh-Latn. However, it is used in Microsoft JhengHei and Microsoft YaHei
with the script tag 'hani', implying that it is not a romanization
scheme after all. It would be simple enough to add this mapping to
gen-tag-table.py once a definitive mapping is determined.

The manual modifications are mainly either obvious mappings that the
OpenType registry omits or mappings for compatibility with previous
versions of HarfBuzz. Some of the old mappings were discarded, though,
for homophonous language names. For example, OpenType maps 'KUI ' to
kxu; previous versions of HarfBuzz also mapped it to kvd, because kvd
and kxu both happen to be called "Kui".

gen-tag-table.py also generates a function to convert multi-subtag tags
like el-polyton and zh-HK to OpenType tags, replacing `ot_languages_zh`
and the hard-coded list of special cases in `hb_ot_tags_from_language`.
It also generates a function to convert OpenType tags to BCP 47,
replacing the hard-coded list of special cases in
`hb_ot_tag_to_language`.
2018-10-11 13:54:28 -04:00
David Corbett 2c7d4db7af Deprecate obsolete functions
`hb_ot_tags` replaces `hb_ot_tags_from_script` and
`hb_ot_tag_from_language`.

`hb_ot_layout_table_select_script` replaces
`hb_ot_layout_table_choose_script`.

`hb_ot_layout_script_select_language` replaces
`hb_ot_layout_script_find_language`.
2018-10-11 13:54:28 -04:00
David Corbett 91067716f5 Refactor the selection of script and language tags
The old hb-ot-tag.cc functions, `hb_ot_tags_from_script` and
`hb_ot_tag_from_language`, are now wrappers around a new function:
`hb_ot_tags`. It converts a script and a language to arrays of script
tags and language tags. This will make it easier to add new script tags
to scripts, like 'dev3'. It also allows for language fallback chains;
nothing produces more than one language yet though.

Where the old functions return the default tags 'DFLT' and 'dflt',
`hb_ot_tags` returns an empty array. The caller is responsible for
using the default tag in that case.

The new function also adds a new private use subtag syntax for script
overrides: "x-hbscabcd" requests a script tag of 'abcd'.

The old hb-ot-layout.cc functions,`hb_ot_layout_table_choose_script` and
`hb_ot_layout_script_find_language` are now wrappers around the new
functions `hb_ot_layout_table_select_script` and
`hb_ot_layout_script_select_language`. They are essentially the same as
the old ones plus a tag count parameter.

Closes #495.
2018-10-11 13:54:28 -04:00
David Corbett a03f5f4dfb Replace "ISO 639" with "BCP 47"
`hb_language_from_string` accepts not only ISO 639 but also BCP 47. Not
all ISO 639 codes are valid BCP 47 tags but the function does not accept
overlong language subtags anyway.
2018-10-11 13:54:28 -04:00
Behdad Esfahbod 0b9d60e1a1 [aat] Apply kerx if GPOS kern was not applied
Ned tells me this is what Apple does.
2018-10-11 13:26:58 -04:00
Behdad Esfahbod b59a428af0 Minor 2018-10-11 13:24:17 -04:00
Behdad Esfahbod 04f72e8990 [trak] Implement extrapolation
This concludes trak, as well as AAT shaping support!
2018-10-11 11:25:07 -04:00
Behdad Esfahbod d6a12dba6d [trak] Fix, and hook up
Works beautifully!  Test coming.
2018-10-11 11:10:06 -04:00
Behdad Esfahbod 3d7dea6dfd [trak] Handle nSizes=0 and 1 2018-10-11 10:32:08 -04:00
Behdad Esfahbod 451f3de521 [trak] Fix counting 2018-10-11 10:30:32 -04:00
Behdad Esfahbod a5be380cae [trak] More 2018-10-11 10:29:02 -04:00
Behdad Esfahbod d06c4a867f [trak] Only adjust around first glyph
Assumes graphemes only have one base glyph.
2018-10-11 10:22:01 -04:00
Behdad Esfahbod 071a2cbcdd [trak] Clean up 2018-10-11 10:18:46 -04:00
Behdad Esfahbod fbbd926dba [kerx] Implement Format4 action_type=1 contour-point-based attachment
Untested.

This concludes kerx table support!
2018-10-11 01:22:29 -04:00
Behdad Esfahbod b6bc0d4ff6 [kerx] Implement Format4 action_type=2 coordinate-based attachment
Untested.
2018-10-11 01:17:57 -04:00
Behdad Esfahbod 1622ba5943 [kerx] Implement Format4 'ankr'-based mark attachment
Tested with Kannada MN:

$ HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0CCD,0C95,0CD6
[kn_ka.vattu=0+230|kn_ai_length_mark=1@326,0+607]
2018-10-11 01:17:33 -04:00
Behdad Esfahbod 7bb4da7d95 [aat] Wire up 'ankr' table to apply context 2018-10-11 00:52:07 -04:00
Behdad Esfahbod 28f0367aab [kerx] Flesh out Format4
Doesn't apply actions yet.
2018-10-11 00:46:12 -04:00
Behdad Esfahbod 947962a287 [ankr] Implement table access 2018-10-10 23:07:03 -04:00
Behdad Esfahbod 7281cb3eeb [ankr] Start fixing 2018-10-10 22:56:52 -04:00
Behdad Esfahbod 34caadc5c7 Ugh. Re-enable accidentally disabled GPOS 2018-10-10 22:17:07 -04:00
Behdad Esfahbod f7c45bc33e [kerx] Allow granularly disabling kerning 2018-10-10 22:15:13 -04:00
Behdad Esfahbod 2b72c4b63d [kerx] Comment 2018-10-10 21:53:14 -04:00
Behdad Esfahbod 9f450f07b0 [kerx] Make Format1 work
Tested using Kannada MN:

$ HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0C95,0CCd,C95,CCD
[kn_ka.virama=0+1299|kn_ka.vattu=0+115|_blank=0@-115,0+385]

$ HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0C95,0CCd,C95,CCD --features=-kern
[kn_ka.virama=0+1799|kn_ka.vattu=0+230|_blank=0+0]

I don't see the GPOS table in the font do the same.  ¯\_(ツ)_/¯
2018-10-10 21:46:58 -04:00
Behdad Esfahbod 504cb68fc9 Disable mark advance zeroing as well as mark fallback positioning if doing kerx 2018-10-10 21:29:46 -04:00
Behdad Esfahbod 8496753796 [kerx] Implement Format1
Untested.
2018-10-10 21:18:37 -04:00
Behdad Esfahbod c9165f5450 [kerx] More UnsizedArrayOf<> 2018-10-10 20:43:21 -04:00
Behdad Esfahbod ca54eba484 [kerx] Fix bound-checking error introduced a couple commits past 2018-10-10 20:41:16 -04:00
Behdad Esfahbod 339036dd97 [kerx] Start fleshing out Format1 2018-10-10 20:37:22 -04:00
Behdad Esfahbod ab1f30bd05 [kerx] Implement Format6
Untested.  The only Apple font shipping with this format is San Francisco fonts
that use this for their kerx variation tables, which we don't support.
2018-10-10 20:10:20 -04:00
Behdad Esfahbod c9a2ce9e05 [kerx] Move bounds-checking to subtable length itself 2018-10-10 20:00:44 -04:00
Behdad Esfahbod 22955b23cd [kerx] Start fleshing out Format6 2018-10-10 19:58:20 -04:00
Behdad Esfahbod f6aaad9b4f [kerx] When rejecting variable kerning, also check for tupleCount 2018-10-10 19:20:06 -04:00
Behdad Esfahbod 7ed5366d3c [kerx] No-op
Tested that Format0 works with Kannada MN font:

$ make -j5 lib -s && HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0C95,0CC2
[kn_ka=0+1000|kn_matra_uu=0@-30,0+1345]

$ make -j5 lib -s && HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0C95,0CC2 --features=-kern
[kn_ka=0+1030|kn_matra_uu=0+1375]

Note that GPOS does the same with 'dist' feature, and applies the whole difference to the
same glyph:

$ make -j5 lib -s && ./hb-shape Kannada\ MN.ttc -u 0C95,0CC2
[kn_ka=0+970|kn_matra_uu=0+1375]

$ make -j5 lib -s && ./hb-shape Kannada\ MN.ttc -u 0C95,0CC2 --features=-dist
[kn_ka=0+1030|kn_matra_uu=0+1375]
2018-10-10 19:12:27 -04:00
Behdad Esfahbod 7fa69e92ca Comment 2018-10-10 19:02:32 -04:00
Behdad Esfahbod 7e6e5bf614 Fix option string matching 2018-10-10 18:59:07 -04:00
Behdad Esfahbod 5d34164d98 [kern/kerx] Fix offset base
Disable kern Format2.

Fix kerx Format2.  Manually tested this with Tamil MN font and it works:

$ HB_OPTIONS=aat ./hb-shape Tamil\ MN.ttc -u 0B94,0B95
[tgv_au=0+3435|tgc_ka=1@-75,0+1517]

 HB_OPTIONS=aat ./hb-shape Tamil\ MN.ttc -u 0B94,0B95 --features=-kern
[tgv_au=0+3510|tgc_ka=1+1592]
2018-10-10 18:23:09 -04:00
Behdad Esfahbod 60f86d32d7 [kerx] Don't loop over kerning subtables if kerning disabled 2018-10-10 18:10:05 -04:00
Behdad Esfahbod 38a7a8a89e Allow HB_OPTIONS=aat to prefer AAT tables over OT
Fixes https://github.com/harfbuzz/harfbuzz/issues/322
2018-10-10 17:44:46 -04:00
Behdad Esfahbod 44f09afd5b [kerx] Skip variation subtables 2018-10-10 17:32:32 -04:00
Behdad Esfahbod 1e8fdd285f Remove HAVE_OT
We never tested compiling without it.  Just kill it.  We always build
our own shaper.
2018-10-10 16:32:35 -04:00
Behdad Esfahbod 7727e73756 [kerx] Actually hook up, and fix crash 2018-10-10 13:24:51 -04:00
Behdad Esfahbod b3390990f5 Add per-subtable set-digests
This speeds up Roboto shaping by ~10%.  I was hoping for more.
Still, good defense against lookups with many subtables.
2018-10-10 12:13:25 -04:00
Behdad Esfahbod e78549edfb Move apply down into subtables accel 2018-10-10 11:54:48 -04:00
Behdad Esfahbod 78c09bf213 Move subtable array into lookup accel 2018-10-10 11:50:46 -04:00
Behdad Esfahbod 97e5913d5a Move more code 2018-10-10 11:41:05 -04:00
Behdad Esfahbod c8f2d9334c Move code
In preparation to move add per-subtable set digests...
2018-10-10 11:36:28 -04:00
Behdad Esfahbod a03850a356 Fix GPOS/kern interaction
Oops.  Was checking for kern feature in GSUB, not GPOS.
2018-10-10 10:57:28 -04:00
Behdad Esfahbod d1be805e78 More rewriting plan compile
Hopefully more clear.
2018-10-10 10:49:45 -04:00
Behdad Esfahbod 961ab46b24 More reshuffle plan compile 2018-10-10 10:42:10 -04:00
Behdad Esfahbod 2091b509e3 [kerx] Hook up to shaper 2018-10-10 10:41:08 -04:00
Behdad Esfahbod 8d00c39bfc [kern] Minor 2018-10-10 10:19:07 -04:00
Behdad Esfahbod e655fd38cf Apply TT or fallback kerning when GPOS does not have kern feature
Previously we only did if there was no GPOS whatsoever.  This applies
to Arial, Times New Roman, etc in Win7.  Was not kerning before.  It
is now.
2018-10-10 10:19:07 -04:00
Behdad Esfahbod 754cf440bf Minor 2018-10-10 10:19:07 -04:00
Behdad Esfahbod 0537a40193 [kerx] Comment 2018-10-09 23:37:00 -04:00
Behdad Esfahbod 362d324119 [aat] Rename 2018-10-09 23:27:00 -04:00
Behdad Esfahbod 54c9ecb92d [morx] Use subtable range for embedded sanitizer here as well 2018-10-09 23:18:19 -04:00
Behdad Esfahbod d35315cc02 [aat] Fixup recent commit
For 329f240108

max_ops is signed.
2018-10-09 23:17:32 -04:00
Behdad Esfahbod 948f59a13a [kerx] Use subtable range for runtime checks 2018-10-09 23:07:47 -04:00
Behdad Esfahbod 329f240108 [aat] Set embedded sanitizer max ops really high
Since we consume it legitimately during shaping.
2018-10-09 23:03:20 -04:00
Behdad Esfahbod ad76307486 [kerx] Comment 2018-10-09 22:57:00 -04:00
Behdad Esfahbod db9600bbe1 [kerx] Remove junk 2018-10-09 22:55:47 -04:00
Behdad Esfahbod 27db859416 [kern/kerx] Adjust bounds check 2018-10-09 22:55:17 -04:00
Behdad Esfahbod c66f7f8c5d [kerx] Implement Format2 apply()
Still, not hooked.
2018-10-09 22:49:33 -04:00
Behdad Esfahbod 4b461785bd Fix check 2018-10-09 22:46:30 -04:00
Behdad Esfahbod 4df8eb200d [kern] Use kern subtable length for sanitizing in the accelerator 2018-10-09 22:46:12 -04:00
Behdad Esfahbod 8bff1d2994 [kern] Minor 2018-10-09 22:39:31 -04:00
Behdad Esfahbod 53e5594500 [kerx] Implement Format0 apply()
Not hooked up to be called yet.
2018-10-09 22:35:22 -04:00
Behdad Esfahbod 60318f8715 Minor 2018-10-09 22:25:53 -04:00
Behdad Esfahbod 210f899aca [kern] Sanitize 4 bytes, not 2 2018-10-09 21:58:04 -04:00
Behdad Esfahbod be2f148da4 [ft] Use mutex to lock access to FT_Face
Makes our FT-backed hb_font_t safe to use from multiple threads.  Still,
the underlying FT_Face should NOT be used from other threads by client
or other libraries.

Maybe I add a lock()/unlock() public API ala PangoFT2 and cairo-ft.
Maybe not.
2018-10-09 16:24:50 -04:00
Behdad Esfahbod d18c3c5861 [ft] Remove (probably) stale comment 2018-10-09 16:09:53 -04:00
Behdad Esfahbod 7003b601af Minor 2018-10-09 15:55:26 -04:00
Behdad Esfahbod 07899435b8 Install ot-funcs on newly created funcs
**Finally**!  Casual users can stop caring about font-funcs completely now,
like they haven't been needing to care re unicode-funcs for a few years.
2018-10-09 15:39:51 -04:00
Behdad Esfahbod 5515355367 [ot-font] Don't pre-load cmap table
Now that we have get_h_advances() and get_nominal_glyphs() implemented, the
overhead of doing a proper atomic load would be once per run, NOT once per
glyph.  So, no need to pre-load the tables to avoid that overhead.

As such, hb_ot_font_set_funcs() has become really cheap.  Can *finally* make
it be default font functions on all newly created fonts!
2018-10-09 15:12:09 -04:00
Behdad Esfahbod ec84460e46 [ot/ft] Implement get_nominal_glyphs() callback
Some more measurable speedup.  The recent commits' speedups are as follows:

Testing with Roboto, ****when disabling kern and liga****:

Before:

FT --features=-kern,-liga
user↦   0m0.521s

OT --features=-liga,-kern
user↦   0m0.568s

After:

FT --features=-liga,-kern
user↦   0m0.428s

OT --features=-liga,-kern
user↦   0m0.470s

So, 17% speedup.

Note that FT callbacks are faster than OT these days since we added an advance
cache to FT.  I don't think the difference is enough to justify adding a cache
to OT.

When not disabling kern, the thing is three times slower, so the speedups
are three times less impressive...  Still, 5% not bad for a codebase that I
otherwise thought is optimized out.

Note that, because of this and other optimiztions in our main shaper,
disabling kern and liga, the OT shaper is now *faster* than the fallback
shaper.  So, that's my recommendation to clients that need the absolute
fastest...
2018-10-09 15:07:04 -04:00
Behdad Esfahbod e883f52732 Call get_nominal_glyphs() for runs of simple clusters at a time
Even without FT or OT font funcs implementing get_nominal_glyphs(), there's measurable
speedup.
2018-10-09 14:50:57 -04:00
Behdad Esfahbod 8008bca83b Whitespace 2018-10-09 14:43:03 -04:00
Behdad Esfahbod 30c114ffec Avoid sort and recompose stages if all clusters simple
Even has measurable speedup...
2018-10-09 14:37:08 -04:00
Behdad Esfahbod 24382debe8 Rewrite main normalizer loop to isolate runs of simple clusters 2018-10-09 14:33:24 -04:00
Behdad Esfahbod b5371f18ef Inline decompose_cluster
Towards separating the common case into its own loop.
2018-10-09 14:12:59 -04:00
Behdad Esfahbod b314c4e9ab [font] Add get_nominal_glyphs() callback (note the plural)
Unused as of now.  To be wired up to normalizer, which would remove
overhead and allow hb-ot-font initialization to become a no-op, so
we can enable it by default.
2018-10-09 09:43:44 -04:00
Behdad Esfahbod ca6a317012 Minor 2018-10-09 09:43:44 -04:00
Chun-wei Fan 8e4ad1d7a0 builds: Fix and clean up MSVC DLL builds
Instead of passing a CFLAG/CXXFLAG to define HB_EXTERN, define it
directly in src/hb.hh as __declspec(dllexport) extern when we are
building HarfBuzz as DLLs on Visual Studio.  Define HB_INTERNAL
as nothing without defining HB_NO_VISIBILITY when building HarfBuzz as
DLLs to avoid linker errors on Visual Studio builds.

Also "install" harfbuzz-subset.dll into $(PREFIX)\bin as the
hb-subset utility will depend on that DLL at runtime, when HarfBuzz is
built as DLLs.  Since it consists of private APIs that are subject to
change, we do not install its headers nor .lib file.
2018-10-09 09:43:36 -04:00
Behdad Esfahbod e640f3a6b1 Another old bot fix 2018-10-09 08:28:07 -04:00
Behdad Esfahbod e4f27f368f Try fixing older bots 2018-10-09 08:20:10 -04:00
Behdad Esfahbod bee93e2697 Add const to get_*_advances API
Ouch!
2018-10-09 08:02:25 -04:00
Behdad Esfahbod cc126f2817 Minor 2018-10-09 01:10:15 -04:00
Behdad Esfahbod b2fbe55b82 [icu] Unbreak 2018-10-09 01:07:36 -04:00
Behdad Esfahbod a52bc039c3 Properly remove deprecated stuff 2018-10-09 00:56:33 -04:00
Behdad Esfahbod fc50916589 Remove deprecated decompose_compatibility stuff 2018-10-09 00:39:42 -04:00
Behdad Esfahbod eed737f672 Remove deprecated eastasian_width 2018-10-09 00:37:10 -04:00
Behdad Esfahbod 47030b1855 [ft/ot] Remove implementation of deprecated kerning funcs 2018-10-09 00:30:45 -04:00
Behdad Esfahbod 977c8a8e5c [kern] Minor 2018-10-09 00:22:08 -04:00
Behdad Esfahbod ed5cfa42c7 [kern] Minor 2018-10-09 00:20:35 -04:00
Behdad Esfahbod d219f899f4 Deprecate font kern API 2018-10-09 00:01:09 -04:00
Behdad Esfahbod a51958819f Apply TrueType/OpenType kern table when GPOS kern feature is not available
Fixes https://github.com/harfbuzz/harfbuzz/issues/250
2018-10-08 23:57:45 -04:00
Behdad Esfahbod 09ad2613c8 Separate fallback kern vs mark positioning 2018-10-08 23:30:24 -04:00
Behdad Esfahbod 3c23ff9b7c [kern] Add kerning driver to TT kern table 2018-10-08 23:26:26 -04:00
Behdad Esfahbod 683c3a9533 [kern] Abstract away kerning machine 2018-10-08 23:09:48 -04:00
Behdad Esfahbod fb4f438381 Add HB_DEPRECATED
Fixes https://github.com/harfbuzz/harfbuzz/issues/1232
2018-10-08 22:44:16 -04:00
Behdad Esfahbod 80e3102b8a [kerx] Process coverage flags 2018-10-08 22:41:08 -04:00
Behdad Esfahbod 26d7305da7 Deprecate decompose_compatibility stuff 2018-10-08 22:31:35 -04:00
Behdad Esfahbod 42b51eee54 Deprecate eastasian_width stuff 2018-10-08 22:26:39 -04:00
Behdad Esfahbod 286a45641f Minor 2018-10-08 16:41:08 -04:00
Behdad Esfahbod c0d3bf1baf Minor 2018-10-08 16:32:44 -04:00
Behdad Esfahbod 1a5a3325a2 [kerx] Minor 2018-10-07 23:08:39 -04:00
Behdad Esfahbod d62b4011cc [kern] Shout less 2018-10-07 22:58:06 -04:00