platform/upstream/libHarfBuzzSharp.git
5 years agoAdd hb_ot_tags_to_script_and_language
David Corbett [Tue, 24 Jul 2018 01:19:23 +0000 (21:19 -0400)]
Add hb_ot_tags_to_script_and_language

5 years agoSwitch on the first char of a complex language tag
David Corbett [Thu, 19 Jul 2018 17:48:07 +0000 (13:48 -0400)]
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`.

5 years agoMap Quechua languages to closest ones with tags
David Corbett [Tue, 17 Jul 2018 01:14:48 +0000 (21:14 -0400)]
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.

5 years agoTest deprecated tag fallback in a font
David Corbett [Thu, 18 Jan 2018 21:33:39 +0000 (16:33 -0500)]
Test deprecated tag fallback in a font

The font supports the deprecated tag 'DHV ' instead of 'DIV '. dv is
mapped to 'DIV ' and 'DHV ', in that order. The test specifies
`--language=dv`, demonstrating that if a font does not support the first
OpenType tag mapped to a BCP 47 tag, it will fall back to the next tag.

5 years agoMatch extlang subtags
David Corbett [Sat, 20 Jan 2018 20:53:09 +0000 (15:53 -0500)]
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.

5 years agoAutogenerate the BCP 47 to OpenType mappings
David Corbett [Sat, 9 Dec 2017 03:45:52 +0000 (22:45 -0500)]
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`.

5 years agoDeprecate obsolete functions
David Corbett [Fri, 29 Dec 2017 12:19:05 +0000 (20:19 +0800)]
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`.

5 years agoRefactor the selection of script and language tags
David Corbett [Fri, 8 Dec 2017 16:21:14 +0000 (11:21 -0500)]
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.

5 years agoReplace "ISO 639" with "BCP 47"
David Corbett [Thu, 28 Dec 2017 14:59:29 +0000 (22:59 +0800)]
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.

5 years ago[aat] Apply kerx if GPOS kern was not applied
Behdad Esfahbod [Thu, 11 Oct 2018 17:26:58 +0000 (13:26 -0400)]
[aat] Apply kerx if GPOS kern was not applied

Ned tells me this is what Apple does.

5 years agoMinor
Behdad Esfahbod [Thu, 11 Oct 2018 17:24:17 +0000 (13:24 -0400)]
Minor

5 years ago[trak] Add tests
Behdad Esfahbod [Thu, 11 Oct 2018 15:30:45 +0000 (11:30 -0400)]
[trak] Add tests

5 years ago[trak] Implement extrapolation
Behdad Esfahbod [Thu, 11 Oct 2018 15:25:07 +0000 (11:25 -0400)]
[trak] Implement extrapolation

This concludes trak, as well as AAT shaping support!

5 years ago[trak] Fix, and hook up
Behdad Esfahbod [Thu, 11 Oct 2018 15:10:06 +0000 (11:10 -0400)]
[trak] Fix, and hook up

Works beautifully!  Test coming.

5 years ago[trak] Handle nSizes=0 and 1
Behdad Esfahbod [Thu, 11 Oct 2018 14:32:08 +0000 (10:32 -0400)]
[trak] Handle nSizes=0 and 1

5 years ago[trak] Fix counting
Behdad Esfahbod [Thu, 11 Oct 2018 14:30:32 +0000 (10:30 -0400)]
[trak] Fix counting

5 years ago[trak] More
Behdad Esfahbod [Thu, 11 Oct 2018 14:29:02 +0000 (10:29 -0400)]
[trak] More

5 years ago[trak] Only adjust around first glyph
Behdad Esfahbod [Thu, 11 Oct 2018 14:22:01 +0000 (10:22 -0400)]
[trak] Only adjust around first glyph

Assumes graphemes only have one base glyph.

5 years ago[trak] Clean up
Behdad Esfahbod [Thu, 11 Oct 2018 14:18:46 +0000 (10:18 -0400)]
[trak] Clean up

5 years ago[kerx] Implement Format4 action_type=1 contour-point-based attachment
Behdad Esfahbod [Thu, 11 Oct 2018 05:22:29 +0000 (01:22 -0400)]
[kerx] Implement Format4 action_type=1 contour-point-based attachment

Untested.

This concludes kerx table support!

5 years ago[kerx] Implement Format4 action_type=2 coordinate-based attachment
Behdad Esfahbod [Thu, 11 Oct 2018 05:17:57 +0000 (01:17 -0400)]
[kerx] Implement Format4 action_type=2 coordinate-based attachment

Untested.

5 years ago[kerx] Implement Format4 'ankr'-based mark attachment
Behdad Esfahbod [Thu, 11 Oct 2018 05:14:18 +0000 (01:14 -0400)]
[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]

5 years ago[aat] Wire up 'ankr' table to apply context
Behdad Esfahbod [Thu, 11 Oct 2018 04:52:07 +0000 (00:52 -0400)]
[aat] Wire up 'ankr' table to apply context

5 years ago[kerx] Flesh out Format4
Behdad Esfahbod [Thu, 11 Oct 2018 04:12:49 +0000 (00:12 -0400)]
[kerx] Flesh out Format4

Doesn't apply actions yet.

5 years ago[ankr] Implement table access
Behdad Esfahbod [Thu, 11 Oct 2018 03:07:03 +0000 (23:07 -0400)]
[ankr] Implement table access

5 years ago[ankr] Start fixing
Behdad Esfahbod [Thu, 11 Oct 2018 02:56:52 +0000 (22:56 -0400)]
[ankr] Start fixing

5 years agoUgh. Re-enable accidentally disabled GPOS
Behdad Esfahbod [Thu, 11 Oct 2018 02:17:07 +0000 (22:17 -0400)]
Ugh. Re-enable accidentally disabled GPOS

5 years ago[kerx] Allow granularly disabling kerning
Behdad Esfahbod [Thu, 11 Oct 2018 02:15:13 +0000 (22:15 -0400)]
[kerx] Allow granularly disabling kerning

5 years ago[kerx] Comment
Behdad Esfahbod [Thu, 11 Oct 2018 01:53:14 +0000 (21:53 -0400)]
[kerx] Comment

5 years ago[kerx] Make Format1 work
Behdad Esfahbod [Thu, 11 Oct 2018 01:46:58 +0000 (21:46 -0400)]
[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.  ¯\_(ツ)_/¯

5 years agoDisable mark advance zeroing as well as mark fallback positioning if doing kerx
Behdad Esfahbod [Thu, 11 Oct 2018 01:29:46 +0000 (21:29 -0400)]
Disable mark advance zeroing as well as mark fallback positioning if doing kerx

5 years ago[kerx] Implement Format1
Behdad Esfahbod [Thu, 11 Oct 2018 01:18:37 +0000 (21:18 -0400)]
[kerx] Implement Format1

Untested.

5 years ago[kerx] More UnsizedArrayOf<>
Behdad Esfahbod [Thu, 11 Oct 2018 00:43:21 +0000 (20:43 -0400)]
[kerx] More UnsizedArrayOf<>

5 years ago[kerx] Fix bound-checking error introduced a couple commits past
Behdad Esfahbod [Thu, 11 Oct 2018 00:41:16 +0000 (20:41 -0400)]
[kerx] Fix bound-checking error introduced a couple commits past

5 years ago[kerx] Start fleshing out Format1
Behdad Esfahbod [Thu, 11 Oct 2018 00:37:22 +0000 (20:37 -0400)]
[kerx] Start fleshing out Format1

5 years ago[kerx] Implement Format6
Behdad Esfahbod [Thu, 11 Oct 2018 00:10:20 +0000 (20:10 -0400)]
[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.

5 years ago[kerx] Move bounds-checking to subtable length itself
Behdad Esfahbod [Thu, 11 Oct 2018 00:00:44 +0000 (20:00 -0400)]
[kerx] Move bounds-checking to subtable length itself

5 years ago[kerx] Start fleshing out Format6
Behdad Esfahbod [Wed, 10 Oct 2018 23:58:20 +0000 (19:58 -0400)]
[kerx] Start fleshing out Format6

5 years ago[kerx] When rejecting variable kerning, also check for tupleCount
Behdad Esfahbod [Wed, 10 Oct 2018 23:20:06 +0000 (19:20 -0400)]
[kerx] When rejecting variable kerning, also check for tupleCount

5 years ago[kerx] No-op
Behdad Esfahbod [Wed, 10 Oct 2018 23:11:30 +0000 (19:11 -0400)]
[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]

5 years agoComment
Behdad Esfahbod [Wed, 10 Oct 2018 23:02:32 +0000 (19:02 -0400)]
Comment

5 years agoFix option string matching
Behdad Esfahbod [Wed, 10 Oct 2018 22:59:07 +0000 (18:59 -0400)]
Fix option string matching

5 years ago[kern/kerx] Fix offset base
Behdad Esfahbod [Wed, 10 Oct 2018 22:14:41 +0000 (18:14 -0400)]
[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]

5 years ago[kerx] Don't loop over kerning subtables if kerning disabled
Behdad Esfahbod [Wed, 10 Oct 2018 22:10:05 +0000 (18:10 -0400)]
[kerx] Don't loop over kerning subtables if kerning disabled

5 years agoAllow HB_OPTIONS=aat to prefer AAT tables over OT
Behdad Esfahbod [Wed, 10 Oct 2018 21:44:46 +0000 (17:44 -0400)]
Allow HB_OPTIONS=aat to prefer AAT tables over OT

Fixes https://github.com/harfbuzz/harfbuzz/issues/322

5 years ago[kerx] Skip variation subtables
Behdad Esfahbod [Wed, 10 Oct 2018 21:32:32 +0000 (17:32 -0400)]
[kerx] Skip variation subtables

5 years agoRemove HAVE_OT
Behdad Esfahbod [Wed, 10 Oct 2018 20:32:35 +0000 (16:32 -0400)]
Remove HAVE_OT

We never tested compiling without it.  Just kill it.  We always build
our own shaper.

5 years ago[kerx] Actually hook up, and fix crash
Behdad Esfahbod [Wed, 10 Oct 2018 17:24:51 +0000 (13:24 -0400)]
[kerx] Actually hook up, and fix crash

5 years agoAdd per-subtable set-digests
Behdad Esfahbod [Wed, 10 Oct 2018 16:07:49 +0000 (12:07 -0400)]
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.

5 years agoMove apply down into subtables accel
Behdad Esfahbod [Wed, 10 Oct 2018 15:54:48 +0000 (11:54 -0400)]
Move apply down into subtables accel

5 years agoMove subtable array into lookup accel
Behdad Esfahbod [Wed, 10 Oct 2018 15:50:46 +0000 (11:50 -0400)]
Move subtable array into lookup accel

5 years agoMove more code
Behdad Esfahbod [Wed, 10 Oct 2018 15:41:05 +0000 (11:41 -0400)]
Move more code

5 years agoMove code
Behdad Esfahbod [Wed, 10 Oct 2018 15:36:28 +0000 (11:36 -0400)]
Move code

In preparation to move add per-subtable set digests...

5 years agoFix GPOS/kern interaction
Behdad Esfahbod [Wed, 10 Oct 2018 14:57:28 +0000 (10:57 -0400)]
Fix GPOS/kern interaction

Oops.  Was checking for kern feature in GSUB, not GPOS.

5 years agoMore rewriting plan compile
Behdad Esfahbod [Wed, 10 Oct 2018 14:49:45 +0000 (10:49 -0400)]
More rewriting plan compile

Hopefully more clear.

5 years agoMore reshuffle plan compile
Behdad Esfahbod [Wed, 10 Oct 2018 14:42:10 +0000 (10:42 -0400)]
More reshuffle plan compile

5 years ago[kerx] Hook up to shaper
Behdad Esfahbod [Wed, 10 Oct 2018 14:41:08 +0000 (10:41 -0400)]
[kerx] Hook up to shaper

5 years ago[kern] Minor
Behdad Esfahbod [Wed, 10 Oct 2018 14:18:39 +0000 (10:18 -0400)]
[kern] Minor

5 years agoApply TT or fallback kerning when GPOS does not have kern feature
Behdad Esfahbod [Wed, 10 Oct 2018 14:16:09 +0000 (10:16 -0400)]
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.

5 years agoMinor
Behdad Esfahbod [Wed, 10 Oct 2018 14:04:05 +0000 (10:04 -0400)]
Minor

5 years ago[circleci] Add an iOS bot (#1233)
Ebrahim Byagowi [Wed, 10 Oct 2018 13:42:52 +0000 (17:12 +0330)]
[circleci] Add an iOS bot (#1233)

5 years ago[kerx] Comment
Behdad Esfahbod [Wed, 10 Oct 2018 03:35:07 +0000 (23:35 -0400)]
[kerx] Comment

5 years ago[aat] Rename
Behdad Esfahbod [Wed, 10 Oct 2018 03:27:00 +0000 (23:27 -0400)]
[aat] Rename

5 years ago[morx] Use subtable range for embedded sanitizer here as well
Behdad Esfahbod [Wed, 10 Oct 2018 03:18:19 +0000 (23:18 -0400)]
[morx] Use subtable range for embedded sanitizer here as well

5 years ago[aat] Fixup recent commit
Behdad Esfahbod [Wed, 10 Oct 2018 03:17:32 +0000 (23:17 -0400)]
[aat] Fixup recent commit

For 329f2401082011007d9ce12b15ce0225cd267c57

max_ops is signed.

5 years ago[kerx] Use subtable range for runtime checks
Behdad Esfahbod [Wed, 10 Oct 2018 03:07:47 +0000 (23:07 -0400)]
[kerx] Use subtable range for runtime checks

5 years ago[aat] Set embedded sanitizer max ops really high
Behdad Esfahbod [Wed, 10 Oct 2018 03:02:53 +0000 (23:02 -0400)]
[aat] Set embedded sanitizer max ops really high

Since we consume it legitimately during shaping.

5 years ago[kerx] Comment
Behdad Esfahbod [Wed, 10 Oct 2018 02:57:00 +0000 (22:57 -0400)]
[kerx] Comment

5 years ago[kerx] Remove junk
Behdad Esfahbod [Wed, 10 Oct 2018 02:55:47 +0000 (22:55 -0400)]
[kerx] Remove junk

5 years ago[kern/kerx] Adjust bounds check
Behdad Esfahbod [Wed, 10 Oct 2018 02:52:41 +0000 (22:52 -0400)]
[kern/kerx] Adjust bounds check

5 years ago[kerx] Implement Format2 apply()
Behdad Esfahbod [Wed, 10 Oct 2018 02:49:33 +0000 (22:49 -0400)]
[kerx] Implement Format2 apply()

Still, not hooked.

5 years agoFix check
Behdad Esfahbod [Wed, 10 Oct 2018 02:46:30 +0000 (22:46 -0400)]
Fix check

5 years ago[kern] Use kern subtable length for sanitizing in the accelerator
Behdad Esfahbod [Wed, 10 Oct 2018 02:46:12 +0000 (22:46 -0400)]
[kern] Use kern subtable length for sanitizing in the accelerator

5 years ago[kern] Minor
Behdad Esfahbod [Wed, 10 Oct 2018 02:39:31 +0000 (22:39 -0400)]
[kern] Minor

5 years ago[kerx] Implement Format0 apply()
Behdad Esfahbod [Wed, 10 Oct 2018 02:35:22 +0000 (22:35 -0400)]
[kerx] Implement Format0 apply()

Not hooked up to be called yet.

5 years agoMinor
Behdad Esfahbod [Wed, 10 Oct 2018 02:25:53 +0000 (22:25 -0400)]
Minor

5 years ago[kern] Sanitize 4 bytes, not 2
Behdad Esfahbod [Wed, 10 Oct 2018 01:56:37 +0000 (21:56 -0400)]
[kern] Sanitize 4 bytes, not 2

5 years ago[ft] Use mutex to lock access to FT_Face
Behdad Esfahbod [Tue, 9 Oct 2018 20:24:50 +0000 (16:24 -0400)]
[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.

5 years ago[ft] Remove (probably) stale comment
Behdad Esfahbod [Tue, 9 Oct 2018 20:07:55 +0000 (16:07 -0400)]
[ft] Remove (probably) stale comment

5 years agoMinor
Behdad Esfahbod [Tue, 9 Oct 2018 19:55:26 +0000 (15:55 -0400)]
Minor

5 years agoInstall ot-funcs on newly created funcs
Behdad Esfahbod [Tue, 9 Oct 2018 19:39:51 +0000 (15:39 -0400)]
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.

5 years ago[ot-font] Don't pre-load cmap table
Behdad Esfahbod [Tue, 9 Oct 2018 19:12:09 +0000 (15:12 -0400)]
[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!

5 years ago[ot/ft] Implement get_nominal_glyphs() callback
Behdad Esfahbod [Tue, 9 Oct 2018 19:07:04 +0000 (15:07 -0400)]
[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...

5 years agoCall get_nominal_glyphs() for runs of simple clusters at a time
Behdad Esfahbod [Tue, 9 Oct 2018 18:50:57 +0000 (14:50 -0400)]
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.

5 years agoWhitespace
Behdad Esfahbod [Tue, 9 Oct 2018 18:38:23 +0000 (14:38 -0400)]
Whitespace

5 years agoAvoid sort and recompose stages if all clusters simple
Behdad Esfahbod [Tue, 9 Oct 2018 18:37:08 +0000 (14:37 -0400)]
Avoid sort and recompose stages if all clusters simple

Even has measurable speedup...

5 years agoFix warning
Behdad Esfahbod [Tue, 9 Oct 2018 18:36:25 +0000 (14:36 -0400)]
Fix warning

How come this one is not generated by clang everything bot?!

../../../test/api/test-multithread.c:37:26: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 static char *font_path = "fonts/Inconsolata-Regular.abc.ttf";
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../test/api/test-multithread.c:38:21: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]

5 years agoRewrite main normalizer loop to isolate runs of simple clusters
Behdad Esfahbod [Tue, 9 Oct 2018 18:33:24 +0000 (14:33 -0400)]
Rewrite main normalizer loop to isolate runs of simple clusters

5 years agoInline decompose_cluster
Behdad Esfahbod [Tue, 9 Oct 2018 18:12:59 +0000 (14:12 -0400)]
Inline decompose_cluster

Towards separating the common case into its own loop.

5 years ago[font] Add get_nominal_glyphs() callback (note the plural)
Behdad Esfahbod [Tue, 9 Oct 2018 13:23:51 +0000 (09:23 -0400)]
[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.

5 years agoMinor
Behdad Esfahbod [Tue, 9 Oct 2018 13:06:07 +0000 (09:06 -0400)]
Minor

5 years agotest/api/test-subset-*.c: Fix build on pre-C99
Chun-wei Fan [Wed, 25 Jul 2018 10:26:10 +0000 (18:26 +0800)]
test/api/test-subset-*.c: Fix build on pre-C99

Ensure that we have the variables at the beginning of the block.  These
are the only fixes that we need for building HarfBuzz on older
compilers.

5 years agobuilds: Fix and clean up MSVC DLL builds
Chun-wei Fan [Wed, 25 Jul 2018 10:12:34 +0000 (18:12 +0800)]
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.

5 years agoAnother old bot fix
Behdad Esfahbod [Tue, 9 Oct 2018 12:28:07 +0000 (08:28 -0400)]
Another old bot fix

5 years agoTry fixing older bots
Behdad Esfahbod [Tue, 9 Oct 2018 12:20:10 +0000 (08:20 -0400)]
Try fixing older bots

5 years agoAdd const to get_*_advances API
Behdad Esfahbod [Tue, 9 Oct 2018 12:01:49 +0000 (08:01 -0400)]
Add const to get_*_advances API

Ouch!

5 years agoPort test off deprecated API
Behdad Esfahbod [Tue, 9 Oct 2018 11:48:52 +0000 (07:48 -0400)]
Port test off deprecated API

5 years agoMinor
Behdad Esfahbod [Tue, 9 Oct 2018 05:10:15 +0000 (01:10 -0400)]
Minor

5 years ago[icu] Unbreak
Behdad Esfahbod [Tue, 9 Oct 2018 05:07:36 +0000 (01:07 -0400)]
[icu] Unbreak

5 years agoRemove test for deprecated hb_set_invert()
Behdad Esfahbod [Tue, 9 Oct 2018 05:05:28 +0000 (01:05 -0400)]
Remove test for deprecated hb_set_invert()