Commit Graph

5798 Commits

Author SHA1 Message Date
Behdad Esfahbod 7efa38257b [aat] More protection against buffer fail 2018-10-14 19:30:44 -07:00
Behdad Esfahbod e1add2a275 [hmtx] Whitespace 2018-10-14 16:26:03 -07:00
Behdad Esfahbod 62376a7d98 Ignore signed-integer-overflow while kerning
Fixes https://github.com/harfbuzz/harfbuzz/issues/1247
2018-10-14 15:20:50 -07:00
Behdad Esfahbod 40f2b9355c [kerx] Fix Format1 sanitize
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10948
2018-10-14 14:56:32 -07:00
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
Behdad Esfahbod c6bb3a588f [kerx] Clean up Format2 2018-10-07 22:52:53 -04:00
Behdad Esfahbod 8aa83d97f9 [kern/kerx] Fix Format2 offsetting
"The values in the right class table are stored pre-multiplied by the
number of bytes in a single kerning value, and the values in the left
class table are stored pre-multiplied by the number of bytes in one
row. This eliminates needing to multiply the row and column values
together to determine the location of the kerning value. The array can
be indexed by doing the right- and left-hand class mappings, adding the
class values to the address of the array, and fetching the kerning
value to which the new address points."
2018-10-07 22:45:15 -04:00
Behdad Esfahbod ed2a404272 [kerx] Clean up Format0 2018-10-07 22:37:20 -04:00
Behdad Esfahbod 4c3b19d52e Support HBUINT32 BinSearchArrayOf 2018-10-07 22:30:42 -04:00
Behdad Esfahbod 456a68c506 Move code 2018-10-07 22:28:45 -04:00
Behdad Esfahbod 3515c8b187 [aat] Rename 2018-10-07 22:27:00 -04:00
Behdad Esfahbod e42cd58c99 Rename invisible_codepoint to invisible_glyph in API
Deleted recently added API:
    hb_buffer_set_invisible_codepoint()
    hb_buffer_get_invisible_codepoint()

    hb-shape / hb-view --invisible-codepoint

New API:
    hb_buffer_set_invisible_glyph()
    hb_buffer_get_invisible_glyph()

    hb-shape / hb-view --invisible-glyph

Fixes https://github.com/harfbuzz/harfbuzz/issues/1216
2018-10-07 20:47:30 -04:00
Behdad Esfahbod 2a5cb37fdb Revert "[morx] Fix MORX-35"
This reverts commit f62f6e90ad.
2018-10-07 20:37:15 -04:00
Behdad Esfahbod 14ebf8af0c [buffer] Improve shift_forward()
"Improve" is a strong word in this case though, I understand.
2018-10-07 20:35:06 -04:00
Behdad Esfahbod f62f6e90ad [morx] Fix MORX-35
Fixes https://github.com/harfbuzz/harfbuzz/issues/1224
2018-10-07 18:52:48 -04:00
Behdad Esfahbod 94368855c6 Remove some code
We use scratch-flags to short-circuit this function.  No need for previous
early loop.
2018-10-07 18:52:48 -04:00
Behdad Esfahbod fdce1e1543 [kerx] Clean up kerx and KerxTable structures 2018-10-07 14:01:33 -04:00
Behdad Esfahbod 71b65eb27d Add API for setting invisible-codepoint
Fixes https://github.com/harfbuzz/harfbuzz/issues/1216

New API:
hb_buffer_set_invisible_codepoint()
hb_buffer_get_invisible_codepoint()

hb-shape / hb-view --invisible-codepoint
2018-10-07 18:43:26 +02:00
Behdad Esfahbod 13da3be0b3 [ot-font] Load hmtx/vmtx lazily
Since we have get_*_advanes() API now, the overhead is once per shape,
not once per glyph.

Only cmap is warmed-up at set_funcs() time now.
2018-10-07 18:25:41 +02:00
Behdad Esfahbod 856db4c918 Minor 2018-10-07 18:21:15 +02:00
Behdad Esfahbod b2e398c077 [coretext] Fix OS X check
Fixes https://github.com/harfbuzz/harfbuzz/issues/1230
2018-10-07 16:31:33 +02:00
Behdad Esfahbod 7ee50af836 [morx] Fix memory access issues with unsafe_to_break 2018-10-06 21:31:44 +02:00
Behdad Esfahbod 0816a54978 [uniscribe/coretext] Fix for previous change 2018-10-06 02:40:57 +02:00
Behdad Esfahbod 341206eb60 [vector] Make hb_vector_t relocatable / nestable
Ugly, but...
Fixes https://github.com/harfbuzz/harfbuzz/issues/1227
2018-10-05 18:39:48 +02:00
Behdad Esfahbod 5469d80707 Add hb_vector_t::fini_deep () 2018-10-05 18:21:08 +02:00
Behdad Esfahbod 4831e615d1 [morx] Fix memory access issue
If buffer was enlarged, info was being outdated.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1225
2018-10-05 18:14:13 +02:00
Behdad Esfahbod a62f37d6fa Change vendor features from Harf/Buzz to HARF/BUZZ
a01194aaf4 (commitcomment-30772041)

"The tag space of tags consisting of four uppercase letters (A-Z) with no punctuation,
spaces, or numbers, is reserved as a vendor space. Font vendors may use such tags to
identify private features."
2018-10-05 02:49:29 +02:00
Behdad Esfahbod a01194aaf4 Enable two OpenType features, 'Harf' and 'Buzz'
One early, before script-specific features, one late, after.  Allows font
developers to detect us and behave differently if needed.
2018-10-04 13:00:37 +02:00
Behdad Esfahbod 14ff3cbe0f Apply morx if there's no GSUB! 2018-10-04 11:34:21 +02:00
Behdad Esfahbod 3417037eb1 [aat] Add +hb_aat_layout_has_substitution 2018-10-04 11:17:19 +02:00
Sascha Brawer 7810bb1a59 [morx] Only insert glyphs at mark when a mark has been set before
This reverts commit f4072e8cb8.
https://github.com/harfbuzz/harfbuzz/issues/1195
2018-10-04 10:29:23 +02:00
Ebrahim Byagowi 5de2d9cdbd
Minor, fix double-promotion warnings (#1221) 2018-10-04 02:14:18 +03:30
mhosken e4e74c2751 Update Graphite API to latest (#1215) 2018-10-03 23:03:26 +03:30
Behdad Esfahbod b710ea4fde Clean Fitzpatrick hack 2018-10-03 21:17:59 +02:00
Behdad Esfahbod 95e5f1ae69 Unbreak Fitzpatrick
Fixes https://github.com/harfbuzz/harfbuzz/issues/1159
2018-10-03 21:11:40 +02:00
Behdad Esfahbod 03fb6dd4c7 Rewrite grapheme-formation in terms of new work
Also, don't attach ZWNJ to previous cluster.  Closer to Unicode graphemes.
2018-10-03 21:11:40 +02:00
Behdad Esfahbod 68106b1d9b Minor 2018-10-03 21:11:40 +02:00
Behdad Esfahbod 06922acbc4 Fix distcheck 2018-10-03 20:19:42 +02:00
Behdad Esfahbod 4eea2e279b [thai] Set continuation on decomposed nikhahit 2018-10-03 20:19:42 +02:00
Behdad Esfahbod 8edc91022c [indic] Reset continuation on inserted dottedcircle 2018-10-03 20:19:42 +02:00
Behdad Esfahbod 2a6f15213e [buffer] Inline some more 2018-10-03 20:19:42 +02:00
Behdad Esfahbod 6f39c22029 Add code 2018-10-03 20:19:42 +02:00
Behdad Esfahbod 19d50aa262 [indic] Simplify dottedcircle 2018-10-03 20:19:42 +02:00
Behdad Esfahbod 3b78318510 [emoji] Mark emoji contination sequences as continuation
This adds a new grapheme bit.  Not used yet.

Part of https://github.com/harfbuzz/harfbuzz/issues/1159
2018-10-03 20:19:42 +02:00
Behdad Esfahbod 123326e20a Dotted-circle all marks, not just non-spacing, at text beginning 2018-10-03 20:19:42 +02:00
Behdad Esfahbod 674560cf24 Fix build 2018-10-03 19:10:28 +02:00
Behdad Esfahbod 45e55f7080 [indic] Fix clang everything 2018-10-03 18:45:27 +02:00
Behdad Esfahbod 4df02e3240 Minor 2018-10-03 18:45:27 +02:00
Behdad Esfahbod 1e8f195b96 [emoji] Add emoji Extended_Pictographic table and function
Part of https://github.com/harfbuzz/harfbuzz/issues/1159

.
2018-10-03 18:45:27 +02:00
Behdad Esfahbod 1dc601b04a [os2] Minor rename/shuffle 2018-10-03 18:45:27 +02:00
Behdad Esfahbod df32eaae42 [indic] Disallow vowel mark combinations that spoof other vowel marks
Fixes https://github.com/harfbuzz/harfbuzz/issues/1019

New numbers:

BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%)
DEVANAGARI: 707261 out of 707394 tests passed. 133 failed (0.0188014%)
GUJARATI: 366353 out of 366457 tests passed. 104 failed (0.0283799%)
GURMUKHI: 60729 out of 60747 tests passed. 18 failed (0.0296311%)
KANNADA: 951300 out of 951913 tests passed. 613 failed (0.0643966%)
MALAYALAM: 1048136 out of 1048334 tests passed. 198 failed (0.0188871%)
ORIYA: 42327 out of 42329 tests passed. 2 failed (0.00472489%)
SINHALA: 271596 out of 271847 tests passed. 251 failed (0.0923313%)
TAMIL: 1091754 out of 1091754 tests passed. 0 failed (0%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)

Devanagari regressed because Uniscribe doesn't enforce the full set.

Tests added with the *-vowel-letters.txt files in tree and Noto fonts.
2018-10-03 15:53:28 +02:00
Behdad Esfahbod 1b8d5e9991 [thai] Minor 2018-10-03 15:31:33 +02:00
Behdad Esfahbod 0dd9101fd0 Minor 2018-10-03 15:31:33 +02:00
Behdad Esfahbod 9c4ffd10c4 Minor 2018-10-03 15:31:33 +02:00
HinTak bd1be8738f Missing colon for gobject annotation
There should be a colon separating "(transfer full)" and the rest. Warned by g-ir-scanner.
2018-10-03 15:31:26 +02:00
Behdad Esfahbod 75114e01d2 [use] Add Halant_Or_Vowel_Modifier category
Fixes https://github.com/harfbuzz/harfbuzz/issues/1102
2018-10-03 12:30:23 +02:00
Ebrahim Byagowi 6353cc1f83
[circleci] Fix some of warnings from clang-everything bot (#1211)
* -Wshift-sign-overflow
* -Wmissing-prototypes
2018-10-02 21:39:19 +03:30
Behdad Esfahbod fef7af1e22 [tibetan] Remove unused Tibetan shaper 2018-10-02 18:46:13 +02:00
Behdad Esfahbod 32a438166f [tibetan] Route Tibetan through USE
Fixes https://github.com/harfbuzz/harfbuzz/pull/933
https://github.com/harfbuzz/harfbuzz/issues/1012

Tibetan failures go from 0 to 2:

TIBETAN: 208467 out of 208469 tests passed. 2 failed (0.000959375%)
2018-10-02 18:44:57 +02:00
Behdad Esfahbod 77792187be [khmer] Remove unused khmer_position() 2018-10-02 18:20:16 +02:00
Behdad Esfahbod 5101abd42f [indic/use] Factor common expressions in ragel machine
No machine change.
2018-10-02 17:49:06 +02:00
Behdad Esfahbod 6f457f8370 [indic] Minor flip grammar around
No behavior change.
2018-10-02 17:46:27 +02:00
Behdad Esfahbod 40d5d19d5b [ragel] Use ts/te (token-start / token-end) instead of manual tracking 2018-10-02 17:04:05 +02:00
Behdad Esfahbod 9efddb9de8 Treat a base+mark... ligature as base, not ligature
Fixes https://github.com/harfbuzz/harfbuzz/issues/746
2018-10-02 16:05:26 +02:00
Behdad Esfahbod 3cca978723 Move code around 2018-10-02 15:02:35 +02:00
Behdad Esfahbod 0a371fee4d Minor 2018-10-02 14:48:39 +02:00
Behdad Esfahbod 94d15528f8 Minor 2018-10-02 14:45:09 +02:00
Behdad Esfahbod 729f634728 Disable joiner-skipping when looking back for base to attach mark to
Fixes https://github.com/harfbuzz/harfbuzz/issues/1189
2018-10-02 14:41:31 +02:00
Behdad Esfahbod c36f3f5bef [arabic] Use manual-zwj instead of flipping joiners 2018-10-02 14:36:47 +02:00
Behdad Esfahbod 48c513fec9 Minor 2018-10-02 14:19:34 +02:00
Behdad Esfahbod cca757ae56 Minor 2018-10-02 14:10:26 +02:00
Behdad Esfahbod 96eca87f89 Move things 2018-10-02 13:24:40 +02:00
Behdad Esfahbod 588a4ac8bc Rename 2018-10-02 13:16:43 +02:00
Behdad Esfahbod 10b6c7c638 Minor include cleanup 2018-10-02 13:11:18 +02:00
Behdad Esfahbod 1d1734e985 Shuffle code around 2018-10-02 13:04:05 +02:00
Khaled Hosny d27e5ec3a2 Skip BOM in the Python sample file
Fixes https://github.com/harfbuzz/harfbuzz/issues/1208
2018-10-02 08:25:29 +02:00
HinTak f9ea3dc4c6 Missing "out" indicator (#1209)
Missing "out" indicator. Affect gobject introspection.
2018-10-02 09:13:06 +03:30
Ebrahim Byagowi f72b748371
[circleci] Fix "msan" and "everything" bots (#1205) 2018-10-02 00:16:08 +03:30
Behdad Esfahbod 8bf4027d23 [indic] Remove Consonant_Medial from grammar and code
The only Indic CM is U+0A75 GURMUKHI SIGN YAKASH, which Uniscribe doesn't treat
specially, and font designers design for that.  So, do the same.
2018-10-01 20:05:00 +02:00
Behdad Esfahbod 5143654716 [khmer] Rewrite grammar completely
Based on experimenting with Uniscribe to extract grammar and categories.

Failures down from 44 to 35:

KHMER: 299089 out of 299124 tests passed. 35 failed (0.0117008%)

We still don't enforce the one-matra rule pre-decomposition, but enforce
an order and one-matra-per-position post-decomposition.

https://github.com/harfbuzz/harfbuzz/issues/667
2018-10-01 19:23:47 +02:00
Behdad Esfahbod aaaa65baa7 [khmer] Remove unused code 2018-10-01 16:59:48 +02:00
Behdad Esfahbod 81afdbe803 [use] Disable automatic ZWJ for 'akhn' feature
Fixes https://github.com/harfbuzz/harfbuzz/issues/746
2018-10-01 15:27:35 +02:00
Behdad Esfahbod ceef311dca [use] Change categories for Left_And_* matras
These are only relevant to Sinhala, because they decompose in other
cases.  The USE spec categorizes them all as VPst.  No idea why we
weren't following that before.
2018-10-01 13:04:49 +02:00
Behdad Esfahbod 3426a36157 Unbreak bots 2018-10-01 12:55:57 +02:00
Behdad Esfahbod 98ac01d3b3 [morx] Break out if buffer gets into error
Was getting stuck not making progress somehow.
2018-10-01 12:10:00 +02:00
Behdad Esfahbod df827a6ab8 [cache] Fix cache coherency corner-case
If key_bits+value_bits-cache_bits==32 then -1 is ambiguous...
2018-10-01 11:39:29 +02:00
Ebrahim Byagowi 0fa1edbd3b
[circleci] Couple of fixes (#1200)
* Raise error on warnings on -everything
* Enable fontconfig to two bots
* Fix msan bot now that all of its real complain are gone
2018-10-01 09:40:29 +03:30
Behdad Esfahbod ad1c190ecf Correct fix for glib-mkenum warning 2018-09-30 18:26:45 +02:00
Behdad Esfahbod 1dd1e56bf4 Revert "Fix glib-mkenum warning"
This reverts commit 247756a7d8.

Was wrong.  Right fix coming.
2018-09-30 18:25:58 +02:00
Behdad Esfahbod 3f08750fa6 Move _POSIX_SOURCE to hb.hh 2018-09-30 18:23:34 +02:00
Behdad Esfahbod 90dd255e57 Change _HB_SCRIPT_MAX_VALUE from 0xFFFFFFFF to 0x7FFFFFFF
Fixes https://github.com/harfbuzz/harfbuzz/issues/504
2018-09-30 18:19:54 +02:00
Behdad Esfahbod 5c65ed800d Fix bug introduced in 9b0b40b3c1
Also discovered by msan bot.
2018-09-30 17:49:33 +02:00
Behdad Esfahbod 247756a7d8 Fix glib-mkenum warning
GEN      hb-gobject-enums.h
WARNING: Failed to parse "/*< private >*/" in ../../src/hb-buffer.h
2018-09-30 17:49:33 +02:00
Behdad Esfahbod b1e07e1e6c [indic/khmer] Remove use of global constructors
Alternative woul have been to resurrect F_COMBINE that I removed in
70136a78cb

But this does it for now.  I'm not sure why check-static-inits.sh didn't
catch this before.  Clang -Weverything bot did:

  CXX      libharfbuzz_la-hb-ot-shape-complex-indic.lo
hb-ot-shape-complex-indic.cc:99:1: warning: declaration requires a global constructor [-Wglobal-constructors]
indic_features[] =
^
1 warning generated.
  CXX      libharfbuzz_la-hb-ot-shape-complex-khmer.lo
hb-ot-shape-complex-khmer.cc:36:1: warning: declaration requires a global constructor [-Wglobal-constructors]
khmer_features[] =
^
1 warning generated.
2018-09-30 06:08:11 -04:00
Behdad Esfahbod 00cd00e641 Tweak HB_TAG and HB_UNTAG
uint32_t was getting promoted to signed int, which is not what we wanted...

Wow, clang has become good at generating warnings...

../../src/hb-common.h:349:29: warning: signed shift result (0xFF000000) sets the sign bit of the shift expression's type ('int') and becomes negative [-Wshift-sign-overflow]
  _HB_SCRIPT_MAX_VALUE                          = HB_TAG_MAX, /*< skip >*/
                                                  ^~~~~~~~~~
../../src/hb-common.h:93:20: note: expanded from macro 'HB_TAG_MAX'
 define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/hb-common.h:89:57: note: expanded from macro 'HB_TAG'
 define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint8_t)(c1))<<24)|(((uint8_t)(c2))<<16)|(((uint8_t)(c3))<<8)|((uint8_t)(c4))))
                                         ~~~~~~~~~~~~~~~^ ~~
../../src/hb-common.h:349:3: warning: ISO C restricts enumerator values to range of 'int' (4294967295 is too large) [-Wpedantic]
  _HB_SCRIPT_MAX_VALUE                          = HB_TAG_MAX, /*< skip >*/
  ^                                               ~~~~~~~~~~
2018-09-30 06:08:11 -04:00
Behdad Esfahbod 8a31e40629 [font] Make *_advance() fallback to *_advances
And remove redundant implementations.
2018-09-30 06:08:11 -04:00
Behdad Esfahbod bd07d2878f Use buffer scratch_flags to remember if we had any joiners 2018-09-30 06:08:11 -04:00
Behdad Esfahbod ba0f0f156f Document setlocale() threadsafety issue
"Fixes" //github.com/harfbuzz/harfbuzz/issues/1191
2018-09-30 06:08:11 -04:00
Behdad Esfahbod 9b0b40b3c1 Fix fallback kerning to check for current glyph's mask 2018-09-28 20:53:23 -04:00
Behdad Esfahbod f4072e8cb8 [morx] Remove mark_set from Insertion
text-rendering-tests test MORX-32 shows that for Insertion, an unset mark is treated
as mark set at 0.  This is unlike the Reordering lookup where un unset mark performs
nothing.

Fixes MORX-32.
2018-09-28 10:14:23 -04:00
Behdad Esfahbod 0d18ec5467 [morx] unsafe-to-break in Insertion
Makes MORX-29, MORX-30, MORX-31 pass.
2018-09-28 10:01:59 -04:00
Behdad Esfahbod b435df3a5b More atomic tuneup 2018-09-28 09:13:14 -04:00
Behdad Esfahbod d2542cd28c More atomic fixup 2018-09-27 17:23:24 -04:00
Behdad Esfahbod 3ee96984f4 Fixup atomics from recent change 2018-09-27 17:20:26 -04:00
Behdad Esfahbod 305468708d [cache] Use atomic writes in clear()
To help TSan.
2018-09-27 16:54:23 -04:00
Volker Krause 9e9a36ee65 Fix infinite loop when walking up the directory hierarchy (#1183)
A single find_package(harfbuzz) line in user code resulted in this loop
getting stuck when _harfbuzz_libdir_iter became "/".
2018-09-27 18:03:49 +03:30
Behdad Esfahbod 662f7d7e8b [arabic] Do the joiner-flipping only for rlig feature
See comment.
2018-09-26 18:54:09 -04:00
Behdad Esfahbod 7f30629cdd [ft] Make TSan happy 2018-09-26 16:40:59 -04:00
Behdad Esfahbod ec743fce2a Add more atomic intrinsics 2018-09-26 16:40:59 -04:00
Behdad Esfahbod 90a0f9fa0c Make TSan happy with make_immutable() 2018-09-26 15:03:07 -04:00
Behdad Esfahbod 824111d484 Fix iOS build
Fixes https://github.com/harfbuzz/harfbuzz/pull/1179
2018-09-25 12:47:48 -04:00
Behdad Esfahbod 6c0e7eb6a6 Minor 2018-09-24 19:07:23 -04:00
Behdad Esfahbod d748dc7664 More iter inits 2018-09-24 18:30:50 -04:00
Behdad Esfahbod d9867497d0 Minor 2018-09-24 18:11:59 -04:00
Behdad Esfahbod 70136a78cb Remove F_COMBINE
Now I wonder if any bots will be unhappy we calling | in static const initializations...
Or would that cost runtime init?  Our tests don't detect any..
2018-09-24 18:04:17 -04:00
Behdad Esfahbod f048ead84a Some more 2018-09-24 18:04:17 -04:00
Behdad Esfahbod 1676f608c8 Minor refactoring 2018-09-24 18:04:17 -04:00
Behdad Esfahbod 4839807340 [check-static-inits.sh] Allow some if ubsan is in effect 2018-09-24 13:11:34 -04:00
Behdad Esfahbod e45ba31dc7 [check-symbols.sh] Allow weak objects "V"
ubsan generates these.
2018-09-24 13:04:48 -04:00
Behdad Esfahbod 2d93148a0f Ignore weak symbols in check-symbols.sh
Some clang versions leave a std::round(float) weak symbol around...
2018-09-24 11:52:22 -04:00
Behdad Esfahbod 55bae6825e [docs] A few improvements
If we wrote just this much every day...
2018-09-24 10:43:06 -04:00
Behdad Esfahbod 57fa2c23de Readjust Hebrew composition again 2018-09-24 09:57:52 -04:00
Behdad Esfahbod 7f335390f3 Revert change that would decompose text if GPOS mark feature is available
https://github.com/harfbuzz/harfbuzz/issues/653#issuecomment-423905920
2018-09-24 09:56:18 -04:00
Behdad Esfahbod a6f4b2f7cd Fix normalization
62d1e0852a (commitcomment-30613091)
2018-09-24 09:54:37 -04:00
Behdad Esfahbod 3583fb03b1 Simplify ZWJ-skipping a bit
Towards disabling ZWJ-skipping in certain GPOS contexts.

Part of https://github.com/flutter/flutter/issues/16886
2018-09-23 22:33:38 -04:00
Behdad Esfahbod 9516cbd3df Reinit skippy iters when auto_zwj / auto_zwnj change
Ouch.  How did we not hit this bug before...
2018-09-23 22:00:34 -04:00
Behdad Esfahbod 62d1e0852a Prefer decomposed form if font has GPOS mark feature
Fixes https://github.com/harfbuzz/harfbuzz/issues/653
2018-09-23 21:32:18 -04:00
Behdad Esfahbod d7f21777e6 [ot-font] Fix leak
Fixes https://github.com/harfbuzz/harfbuzz/issues/1171

I'm glad we have leak-detector bots now.
2018-09-23 19:12:52 -04:00
Matt Oliver 24dd6c1a9d src/hb-blob.cc: Fix mmap functionality with UWP. 2018-09-23 07:23:58 -07:00
Behdad Esfahbod 5fd8bce945 [morx] Fix mark_set check 2018-09-19 22:34:09 -04:00
Behdad Esfahbod 0739b28169 [aat] Minor 2018-09-19 17:32:21 -04:00
Behdad Esfahbod 7671cb9b04 [coretext] Minor 2018-09-19 17:10:26 -04:00
Behdad Esfahbod dc8ed45292 [morx] Implement forward/backward processing
We reverse too many times. Can be optimized. But I doubt many fonts
use reverse lookups, so doesn't matter.

Other than not applying user features, this completes morx table
implementation.
2018-09-19 16:47:25 -04:00
Behdad Esfahbod 3bccd62196 [morx] Implement horiz-only/vert-only subtables 2018-09-19 16:24:34 -04:00
Behdad Esfahbod 041a08de3d [morx] Improve buffer position in Insertion w DontAdvance and wo
Just speculation. Needs tests to determine which is correct behavior.
2018-09-19 16:02:56 -04:00
Behdad Esfahbod 388ab91642 [morx] Implement InsertionChain 2018-09-17 20:28:32 +02:00
David Corbett d8d1e7df00 Don't enforce a native direction for Old Hungarian 2018-09-17 18:53:25 +02:00
Behdad Esfahbod 606bf57430 Revert forcing use of single-parameter static_assert()
Some clang versions define static_assert as a macro apparently, so we cannot
redefine it...

This reverts commit 94bfea0ce6.
This reverts commit 4e62627831.
2018-09-16 19:34:39 +02:00
Behdad Esfahbod cbcaba6ffd One more bot fix 2018-09-16 19:25:19 +02:00
Behdad Esfahbod 89dd4b9597 Fix bots
"Unused private member" warning turned error.  ugh.
2018-09-16 18:11:46 +02:00
Behdad Esfahbod 4e62627831 Enforce single-param static_assert() only
So we don't accidentally break it again.
2018-09-16 18:09:36 +02:00
Behdad Esfahbod f1a86e1e6f Remove unused try 2018-09-16 18:01:32 +02:00
Behdad Esfahbod ebd50b3c83 Fix static_assert 2018-09-16 17:57:12 +02:00
Behdad Esfahbod 10642b3fbf Disallow null-enabled offsets to unsized structures...
...like UnsizedArrayOf<>.

This fixes a class of crasher bugs, mostly with color and AAT tables.  We
cannot use nullable offsets to varsized data that does not declare min_size,
because it's nost safe to use our fixed-size null pool for types that have
their size external.  So, use non_null'able offsets for these.

A further enhancement would be to make use of min_size in Null<> itself.
Will try that after.
2018-09-15 19:43:33 +02:00
Behdad Esfahbod 9ff76c6025 [morx] Respect default feature settings
Does NOT apply user-selected features.  But at least now enables
correct subtables.
2018-09-15 18:31:14 +02:00
Behdad Esfahbod 2f97da6e2d [aat] Change version field 2018-09-15 14:51:50 +02:00
Behdad Esfahbod 29c2bd1795 [morx] Add stub for InsertionChain 2018-09-15 14:47:18 +02:00
Behdad Esfahbod f8ccb545c4 [dfont] Disable null-processsing for offsets
An offset to unsized arrayis not safe to be redirected to our fixed-sized
null pool.  Plus, we want to reject, not repair, bad-looking dfonts.
2018-09-14 18:59:53 +02:00
Behdad Esfahbod 01b9148d9a [unicode] Move Fitzpatrick hack from ot-layout into unicode.hh 2018-09-14 14:23:09 +02:00
Behdad Esfahbod 6ebbf514ac Minor 2018-09-14 12:15:53 +02:00
Behdad Esfahbod 957dbed388 Fix builds 2018-09-14 12:14:42 +02:00
Behdad Esfahbod 4653e6cf3c [aat] Add enums for pre-defined state and classes
Not sure how I didn't add before...
2018-09-14 11:31:33 +02:00
Behdad Esfahbod 67449c3933 Don't dereference offset before check_struct() 2018-09-14 10:58:00 +02:00
Behdad Esfahbod ca746f261e [dfont] Also check dataLen range in sanitize
Just to disagree with myself re being done with this code...
2018-09-13 20:35:21 +02:00
Behdad Esfahbod 3789c557ca [dfont] Solve the mystery +2 offset thing!
Previously, ResourceForkHeader was defined as 30 bytes, having the typeCountM1 as last member.
There was a mysterious offset-by-2 in the code, derived from FontTools and JDK code this was
ported from.

In testing, I observed that typeListZ offset is actually 28.  Suggesting that the typeCountM1
does NOT actually belong to ResourceForkHeader, but belongs to the array itself.  Adjusting for
that resolves the mystery +2 offset hack, so everything is clean and good now.

This, concludes my dfont hacking.  The code looks great now, and I'm happy to leave it.
Fuzzers might disagree though, we will see!
2018-09-13 20:32:13 +02:00
Behdad Esfahbod effc7ced72 Rename HeadlessArrayOf::len to lenP1
So it doesn't accidentally match our templates, etc.
2018-09-13 20:21:54 +02:00
Behdad Esfahbod 180a88a96c [dfont] Some more 2018-09-13 19:26:44 +02:00
Behdad Esfahbod 0ab0f1e5ac [dfont] Push methods further down 2018-09-13 19:13:01 +02:00
Behdad Esfahbod 8c9bdcc1fe [dfont] Minor 2018-09-13 19:08:22 +02:00
Behdad Esfahbod 4479d3a2ed [dfon]t Sanitize OpenTypeFontFace 2018-09-13 19:06:50 +02:00
Behdad Esfahbod 3fba41906f [dfont] Minor 2018-09-13 18:49:16 +02:00
Behdad Esfahbod bf852f0e62 [dfont] Make test pass
Offset 0 is not null in this context.
2018-09-13 18:47:53 +02:00
Behdad Esfahbod 29faebe911 Allow Offset<>'s that have no 0==null 2018-09-13 18:47:25 +02:00
Behdad Esfahbod 82f4d776c2 [dfont] Minor 2018-09-13 18:27:20 +02:00
Behdad Esfahbod 07e0ca930c [bytes] Rename content to arrayZ 2018-09-13 17:39:51 +02:00
Behdad Esfahbod dbb764dceb [dfont] Clean up sanitize()
I don't think I broke anything.  Fuzzers will let me know..
2018-09-13 17:21:00 +02:00
Behdad Esfahbod 361fc26861 Fix OffsetTo::sanitize() after reshuffling 2018-09-13 16:47:33 +02:00
Behdad Esfahbod 4c6b0fb5f6 OffsetTo::sanitize() Add version with three user_data 2018-09-13 16:39:30 +02:00
Behdad Esfahbod a73bea69c5 OffsetTo::sanitize() more shuffling 2018-09-13 16:31:31 +02:00
Behdad Esfahbod b482e5231c OffsetTo::sanitize() reshuffling 2018-09-13 16:29:49 +02:00
Behdad Esfahbod bd75fd45cd [dfont] Some renaming, plus add link to reference doc 2018-09-11 18:32:25 +02:00
Behdad Esfahbod 4134ec1307 [dfont] Sanitize only sfnt resources as OpenTypeFontFile 2018-09-11 17:56:03 +02:00
Behdad Esfahbod 6b5e4d07ad [dfont] Minor 2018-09-11 17:26:24 +02:00
Behdad Esfahbod d5c509272f [dfont] Fix test expecatation and minor touch up
I have no way to authoritatively know, but looks like test font only has one
face.  So, adjust test expectation instead.
2018-09-11 17:18:21 +02:00
Behdad Esfahbod 9479ffefbf [dfont] Re-enable and fix offset handling
Fixes https://github.com/harfbuzz/harfbuzz/pull/1085
2018-09-11 16:41:26 +02:00
Behdad Esfahbod a1814e2bec Whitespace 2018-09-11 14:45:23 +02:00
Behdad Esfahbod 383060cc33 [ft] Invalidate advance cache if font size changed 2018-09-11 14:41:19 +02:00
Behdad Esfahbod 54998befc4 [ft] Cache advances
I decided to always use the cache, instead of my previous sketch direction
that was to only allocate and use cache if fast advances are not available.
The cache is a mere 1kb, so just use it...

TODO: Invalidate cache on font size change.

Fixes https://github.com/harfbuzz/harfbuzz/issues/651
Fixes https://github.com/harfbuzz/harfbuzz/pull/1082
2018-09-11 14:36:14 +02:00
Behdad Esfahbod 047a84c5dd [ft] Towards caching slow get_h_advance results
Related to https://github.com/harfbuzz/harfbuzz/pull/1082
2018-09-11 14:05:16 +02:00
Behdad Esfahbod 237f215378 [ft] Add advances() callback 2018-09-11 13:05:47 +02:00
Behdad Esfahbod cbea7d49ab [ot-font] Rename 2018-09-11 12:57:41 +02:00
Behdad Esfahbod d8a67dac2a [ot-font] Add advances() callbacks 2018-09-11 12:55:54 +02:00
Behdad Esfahbod 0ea42e117b [cache] Minor 2018-09-11 12:22:42 +02:00
Behdad Esfahbod 0f520adaac Revert "Remove unused hb_cache_t"
This reverts commit 473b17af4d.

Updates to recent changes.
2018-09-11 12:07:39 +02:00
Behdad Esfahbod cfdea88475 [random] Switch to 32bit RNG 2018-09-11 10:57:48 +02:00
Behdad Esfahbod 08260c708a [random] Shuffle 2018-09-11 10:51:19 +02:00
Behdad Esfahbod 71c9f84e7c Make --features rand=1 available to the user
Use rand=255 to mean "randomize".

Part of https://github.com/harfbuzz/harfbuzz/pull/803
2018-09-11 10:47:59 +02:00
Behdad Esfahbod cc1c4fdf88 Respect user's wish if they set rand feature manually
Except if the set it to 1, which would mean "randomize"... Ugly.
2018-09-11 10:47:59 +02:00
Behdad Esfahbod 80de4bcd26 Minor clean up of 'rand' patchset 2018-09-11 10:47:59 +02:00
David Corbett b545e27d88 Don't seed the RNG from the contents of the buffer 2018-09-11 10:47:59 +02:00
David Corbett f05df643b4 Allow requesting a specific glyph for 'rand'
Randomization only happens by default. If the user specifies a value for
'rand', that value is respected.
2018-09-11 10:47:59 +02:00
David Corbett c2a75e07e5 Implement 'rand' 2018-09-11 10:47:59 +02:00
Behdad Esfahbod 96471fe859 [uniscribe] Fix build 2018-09-11 01:39:23 +02:00
Behdad Esfahbod becd84aa2f Add HB_FEATURE_GLOBAL_START/END
Fixes https://github.com/harfbuzz/harfbuzz/issues/1141

New API:
HB_FEATURE_GLOBAL_START
HB_FEATURE_GLOBAL_END
2018-09-11 01:27:25 +02:00
Behdad Esfahbod 13a8786c7c Add (unused) hb_array_t<> 2018-09-11 01:09:07 +02:00
Behdad Esfahbod bccf3e1827 Minor 2018-09-11 01:04:50 +02:00
Behdad Esfahbod dff2c45f1e Port rest from VAR to UnsizedArrayOf<> 2018-09-11 01:01:08 +02:00
Behdad Esfahbod 9507b05a7a Simplify sanitize->check_array()
Fix a bug in CBDT sanitize, and redundant check in avar.
2018-09-10 23:18:23 +02:00
Behdad Esfahbod bc485a9812 Port some VAR arrays to UnsizedArrayOf<>
Fix avar sanitize().
2018-09-10 23:08:18 +02:00
Behdad Esfahbod 1bc7a8d6c4 [indic] Cache hb_options().uniscribe_bug_compatible on indic_plan 2018-09-10 22:51:26 +02:00
Behdad Esfahbod 24f1d96224 Unbreak HB_OPTIONS
Fixes https://github.com/harfbuzz/harfbuzz/issues/1154
2018-09-10 18:19:37 +02:00
Behdad Esfahbod e46c51f1e9 [indic] Do NOT allow matra after Halant,ZWJ
Fixes https://github.com/harfbuzz/harfbuzz/issues/556

Devanagari regresses 12 tests, and Gujarati 2.  See:

  https://github.com/harfbuzz/harfbuzz/issues/556#issuecomment-419957472

New numbers:

BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%)
DEVANAGARI: 707299 out of 707394 tests passed. 95 failed (0.0134296%)
GUJARATI: 366353 out of 366457 tests passed. 104 failed (0.0283799%)
GURMUKHI: 60729 out of 60747 tests passed. 18 failed (0.0296311%)
KANNADA: 951300 out of 951913 tests passed. 613 failed (0.0643966%)
MALAYALAM: 1048136 out of 1048334 tests passed. 198 failed (0.0188871%)
ORIYA: 42327 out of 42329 tests passed. 2 failed (0.00472489%)
SINHALA: 271596 out of 271847 tests passed. 251 failed (0.0923313%)
TAMIL: 1091754 out of 1091754 tests passed. 0 failed (0%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
2018-09-10 17:38:19 +02:00
Behdad Esfahbod 5dfd6e0762 Fix sanitize or Context Rule
Fixes https://github.com/harfbuzz/harfbuzz/issues/1110
2018-09-10 15:45:32 +02:00
Behdad Esfahbod 20a11a824d Revert "[subset] Disable GSUB/GPOS subsetting for now"
This reverts commit 616fd34a69.
2018-09-10 13:56:28 +02:00
Behdad Esfahbod 54d332dd9b 1.9.0 2018-09-10 11:37:24 +02:00
Behdad Esfahbod 616fd34a69 [subset] Disable GSUB/GPOS subsetting for now
So I can get a release out.  I haven't debugged those yet, and they
are producing bad tables.
2018-09-10 11:19:49 +02:00
Behdad Esfahbod d42f0e5809 [atomic] Fix pointer type passed to InterlockedExchangeAdd()
John Emmas reported on mailing list that build with MSVC is failing.
Not sure why bots don't catch it, but this should fix.
2018-09-10 11:05:33 +02:00
Behdad Esfahbod fda994e1d4 Use enum instead of "static const" in class scope
Technically, static const needs an out-of-class definition.  Eg:

  CXXLD    libharfbuzz-subset.la
Undefined symbols for architecture x86_64:
  "OT::FeatureVariationRecord::min_size", referenced from:
      bool OT::GSUBGPOS::subset<OT::PosLookup>(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
      bool OT::GSUBGPOS::subset<OT::SubstLookup>(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
  "OT::Record<OT::LangSys>::min_size", referenced from:
      OT::Script::subset(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
  "OT::IntType<unsigned short, 2u>::min_size", referenced from:
      OT::Script::subset(hb_subset_context_t*) constin libharfbuzz_subset_la-hb-subset.o
      OT::RecordListOf<OT::Feature>::subset(hb_subset_context_t*) const  in libharfbuzz_subset_la-hb-subset.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[4]: *** [libharfbuzz-subset.la] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Exited with code 2
2018-09-07 15:02:57 -04:00
Behdad Esfahbod ebe67137ab Try fixing bots 2018-09-07 10:46:13 -04:00
Behdad Esfahbod 5f17dbc302 [subset] Fix div-by-zero 2018-09-07 10:24:22 -04:00
Garret Rieger 21bf147054 [subset] Fix hdmx subsetted size calculation. 2018-09-05 19:31:55 -07:00
Behdad Esfahbod 1e6599f596 Fix older compilers re '>>' at nested template declarations 2018-09-05 19:29:42 -07:00
Behdad Esfahbod a1e5e07c73 [subset] Hook up GSUB/GPOS, but still disabled
They are still in the drop list.
2018-09-05 16:24:28 -07:00
Behdad Esfahbod 0d160d5ff5 [subset] Implement subsetting of SingleSubst 2018-09-04 14:20:35 -07:00
Behdad Esfahbod 3f00d0b0df [subset] Keep glyph set in plan
Should remove the vector version at some point...
2018-09-03 18:54:32 -07:00
Behdad Esfahbod dc50493a8d [subset] Towards subsetting SingleSubstFormat1
Why does subset plan not have a hb_set_t of glyphs?
2018-09-03 18:23:23 -07:00
Behdad Esfahbod 339d3603b9 [subset] Wire up subset() call down to subtables 2018-09-03 17:40:16 -07:00
Behdad Esfahbod 7b2ef551da Templatize Lookup::sanitize() 2018-09-03 17:16:09 -07:00
Behdad Esfahbod 9c3747c5e5 [subset] More 2018-09-03 16:53:03 -07:00
Behdad Esfahbod 6d618522d6 Templatize GSUBGPOS::sanitize() 2018-09-03 16:41:28 -07:00
Behdad Esfahbod 49c44b58f6 [subset] Fix serialize_subset() calls
Ouch.
2018-09-03 16:37:17 -07:00
Behdad Esfahbod 7c9cfa2b40 Add intersects() method to GSUB/GPOS lookups 2018-09-02 19:47:50 -07:00
Behdad Esfahbod 61ce62e554 [subset] Minor
Remove Lookup::subset().
2018-09-02 17:00:39 -07:00
Behdad Esfahbod bfa72a9a72 [subset] Towards GSUB/GPOS subsetting
Add subset() call for GSUBGPOS struct and its dependencies.
Not hooked up anywhere.
2018-09-01 18:34:50 -07:00
Behdad Esfahbod 6803ed8674 [serialize] Add reset() 2018-08-31 17:11:08 -07:00
Behdad Esfahbod e58b190292 [subset] De-templatize hb_subset_context_t
We're going to (finally) use virtual methods for hb_serialize_context_t
customization, so don't need to carry a Serializer template variable
around...  Simplifies code.
2018-08-31 16:46:35 -07:00
Behdad Esfahbod 22acd424ca [serialize] Add a couple small methods 2018-08-31 16:41:18 -07:00
Behdad Esfahbod d1f29908c2 [subset] Add hb_subset_context_t<> 2018-08-31 16:31:00 -07:00
Behdad Esfahbod aba0a945c5 [subset] Add hb-subset-input.hh and make hb-subset.hh toplevel include 2018-08-31 13:25:19 -07:00
Behdad Esfahbod 18d01eac7f Minor 2018-08-31 13:00:57 -07:00
Behdad Esfahbod a23b892fe6 Shuffle 2018-08-29 18:28:39 -07:00
Behdad Esfahbod 93fe0faaee [subset] Clean up hb_subset_input_t API 2018-08-29 18:24:03 -07:00
Behdad Esfahbod d237ce7181 [subset] Bail if subsetting a table failed 2018-08-29 18:13:52 -07:00
Behdad Esfahbod f39166f0c0 [subset] Remove unused hb_subset_profile_t
We might reintroduce it later, but for now remove, as it was unused.
Some things that should have been in this object (drop_hints, etc)
are already in hb_subset_input_t.  So, for now, keep everything there.
2018-08-29 18:09:55 -07:00
Behdad Esfahbod 2ccc322cf8 [ot-font] Clean up cmap with gid=0
Fixes https://github.com/harfbuzz/harfbuzz/issues/1145
2018-08-29 16:38:25 -07:00
Behdad Esfahbod fee0f41c6c Don't declare extern symbols as inline
clang -O3 was completely removing _get_gdef(), causing link
failure when needed from another compilation unit.  Surprisingly,
"extern inline" didn't fix it.
2018-08-28 18:27:41 -07:00
Behdad Esfahbod 967741e4c4 Add explicit to hb_auto_t 1param constructors 2018-08-28 18:18:02 -07:00
Behdad Esfahbod c0a3f38f78 Fix distcheck 2018-08-28 17:22:59 -07:00
Behdad Esfahbod 2dde6c803a Explicitly pass reference in hb_auto_t constructor
Fixes clang bots as well as fuzzer issue.
2018-08-28 11:07:24 -07:00
Behdad Esfahbod a268068010 [ot-face] Remove tables_t. The face_data_t is what tables_t was 2018-08-26 15:18:46 -07:00
Behdad Esfahbod 3a0b3a29cc Free up hb-ot-face.hh from includes
There might be a better way to do this, but I couldn't find...
2018-08-26 15:11:24 -07:00
Behdad Esfahbod a84309afc8 [face] Use saved cmap in collect_unicodes() APIs 2018-08-26 09:33:01 -07:00
Behdad Esfahbod c624e18a24 [OT] Move code around 2018-08-26 09:19:20 -07:00
Behdad Esfahbod 3999094682 [OT] Use relaxed ops for recursing into GSUB/GPOS lookups again 2018-08-26 09:12:25 -07:00
Behdad Esfahbod d8c57e85d9 [GDEF] Move code around 2018-08-26 09:04:34 -07:00
Behdad Esfahbod 453e0c60b1 Add template keyword
I swear I have no idea why this is needed, but it is...
2018-08-26 01:30:52 -07:00
Behdad Esfahbod c44b0caf0d Fixup 2018-08-26 01:29:30 -07:00
Behdad Esfahbod 4096fbe487 [ot-face] Port GDEF to unified table accelerator model as well 2018-08-26 01:25:54 -07:00
Behdad Esfahbod b929100f87 [ot-face] Unify GSUB/GPOS accelerators in the table accelerator framework 2018-08-26 01:15:47 -07:00
Behdad Esfahbod 963413fc54 WIP 2018-08-26 00:47:55 -07:00
Behdad Esfahbod e6cb938065 [ot-face] Unify accelerators and tables 2018-08-26 00:21:29 -07:00
Behdad Esfahbod 7f8b6fe67d Minor 2018-08-26 00:07:12 -07:00
Behdad Esfahbod 59bca0d2cb [ot-font] Rename 2018-08-26 00:06:12 -07:00
Behdad Esfahbod 1c48a7ef06 [ot-font] Cache tables on face, not font 2018-08-25 23:57:16 -07:00
Behdad Esfahbod 71f8893eff [ot-font] Use init0 2018-08-25 23:27:45 -07:00
Behdad Esfahbod f36ae6f8a8 [ot-font] Make everything (cmap/metrics) lazy 2018-08-25 23:26:45 -07:00
Behdad Esfahbod 62fc54725a [ot-font] Fallback vertical advance to UPEM
Used to be ascent+descent.  Whatever. This is more convenient for
upcoming changes.
2018-08-25 23:15:52 -07:00
Behdad Esfahbod d950022c8a Add hb-ot-face.cc/hh 2018-08-25 23:06:37 -07:00
Behdad Esfahbod dae39c58fb [face] Introduce character-map API
New API:
+hb_face_collect_unicodes
+hb_face_collect_variation_selectors
+hb_face_collect_variation_unicodes
2018-08-25 22:44:39 -07:00
Behdad Esfahbod 66384db97c Minor 2018-08-25 22:39:17 -07:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00
Behdad Esfahbod 82b12bcadd [unicode] Add HB_UNICODE_MAX
New API:
HB_UNICODE_MAX
2018-08-25 22:07:17 -07:00
Behdad Esfahbod b09a0336ca [cmap] More hb_auto_t<>(...) 2018-08-25 22:04:39 -07:00
Behdad Esfahbod 28634db07e [cmap] Fix skipping gid0 in Format4 collect_unicodes() 2018-08-25 21:23:43 -07:00
Behdad Esfahbod acce1fa3ea Use new hb_auto_t<> constructor with Coverage::Iter 2018-08-25 21:15:39 -07:00
Behdad Esfahbod ddea4d19cf Add 1-param passthrough constructor to hb_auto_t<>
And use.
2018-08-25 21:08:15 -07:00
Behdad Esfahbod c8cfb702e9 [cmap] Minor 2018-08-25 16:18:00 -07:00
Behdad Esfahbod 1dcf5fb038 [cmap Add hb_subset_collect_variation_unicodes()
To be moved to hb-face.h later.
2018-08-25 16:12:18 -07:00
Behdad Esfahbod 4806b3800d [cmap] Add hb_subset_collect_variation_selectors()
To be moved to hb-face later.
2018-08-25 15:58:40 -07:00
Behdad Esfahbod 3336de2479 [cmap] Remove unused code 2018-08-25 15:41:25 -07:00
Behdad Esfahbod 1becabe06c [cmap] Use bsearch to find subtables 2018-08-25 15:37:56 -07:00
Behdad Esfahbod 02fe03e09a [cmap] Factor out find_best_subtable 2018-08-25 15:33:05 -07:00
Behdad Esfahbod b41c43b4e1 Minor 2018-08-25 15:25:03 -07:00
Behdad Esfahbod 7d382fa276 [cmap] Implement collect_unicodes() for Format0/6/10 2018-08-25 09:42:52 -07:00
Behdad Esfahbod bd0e542525 [cmap] Simplify collect_unicodes()
Don't use accelerator (almost).  Hooks up Format13 as well.
2018-08-25 09:33:30 -07:00
Behdad Esfahbod d60c465627 Rename get_all_codepoints() to collect_unicodes() 2018-08-25 08:48:42 -07:00
Behdad Esfahbod 531051b8b9 [ot-font] Return char-not-found if mapped to gid 0
OpenType cmap table can use gid=0 to mean "not covered" to produce
more optimized cmap subtables.  Return false from get_nominal_glyph()
for those.  hb-ft already does this.
2018-08-25 08:44:18 -07:00
Behdad Esfahbod aadb2a9188 Add face-builder
New API:
+hb_face_builder_create
+hb_face_builder_add_table
2018-08-25 08:18:53 -07:00
Behdad Esfahbod 6cac9dc9cc [blob] Add as_bytes() 2018-08-24 10:29:45 -07:00
Behdad Esfahbod 29a9a08838 [sanitize] Document how sanitize machinery works 2018-08-24 10:24:45 -07:00
Behdad Esfahbod 142ac5a6be [serialize] Add copy_bytes() and copy_blob() 2018-08-24 10:07:49 -07:00
Behdad Esfahbod 1c6b369324 [ot] Rename hb_ot_layout_t to hb_ot_face_data_t 2018-08-23 11:30:21 -07:00
Emil A Eklund 22defe0965 Add guard around free_static_C_locale
Add HB_USE_ATEXIT guard around free_static_C_locale missed by previous
commit.
2018-08-14 18:10:17 -07:00
Emil A Eklund 7112c6413c Guard free_static function definitions with macro
Add HB_USE_ATEXIT macros around free_static function definitions to
avoid unused function compiler warnings/errors.
2018-08-14 14:04:10 -07:00
Behdad Esfahbod 63be5dcdde 1.8.8 2018-08-14 10:59:34 -07:00
Behdad Esfahbod c9a22fa124 [icu] Pass normalizer instance down as user_data 2018-08-13 17:02:21 -07:00
Behdad Esfahbod f0ef096b8c Don't add reference in get_unicode_funcs() functions
Users don't expect a new reference returned from a get() function.
Indeed, all users of that API I foud where NOT destroying the reference.
Just change the implementations to NOT return a reference.

This applies to the following APIs:
hb_unicode_funcs_get_default()
hb_glib_get_unicode_funcs()
hb_icu_get_unicode_funcs()

Fixes https://github.com/harfbuzz/harfbuzz/issues/1134
2018-08-13 10:30:41 -07:00
Behdad Esfahbod 9bbd1cdf06 [uniscribe] Use lazy loader
Fixes https://github.com/harfbuzz/harfbuzz/issues/1129
2018-08-12 18:20:53 -07:00
Behdad Esfahbod 2663689936 Another clang bot fix 2018-08-12 18:10:59 -07:00
Behdad Esfahbod 989e71a982 Silence clang 2018-08-12 17:47:59 -07:00
Behdad Esfahbod 6750ec692c [lazy] Use for C_locale 2018-08-12 17:42:16 -07:00
Behdad Esfahbod 747d2564e6 [lazy] Port more 2018-08-12 17:32:10 -07:00
Behdad Esfahbod 7bd508a0c4 [lazy] Rename free() 2018-08-12 17:19:55 -07:00
Behdad Esfahbod a3b97db910 [lazy] Port more to it 2018-08-12 17:14:32 -07:00
Behdad Esfahbod 6901090945 [lazy] Make hb_lazy_loader_t<> more usable 2018-08-12 16:59:37 -07:00
Behdad Esfahbod bb905e9afc [lazy] Minor 2018-08-12 16:44:44 -07:00
Behdad Esfahbod 3945cd78a9 Minor 2018-08-12 16:33:48 -07:00
Behdad Esfahbod c21a1b95df [icu] Use get_relaxed for normalizer access
We've had the proper barriers already.  No need for more with every access.
2018-08-12 16:30:39 -07:00
Behdad Esfahbod 125fefa2a6 [icu] Fix for breakage after recent change 2018-08-12 16:29:41 -07:00
Behdad Esfahbod 53442be1ed [lazy] Use for ft_library 2018-08-12 16:20:11 -07:00
Behdad Esfahbod 7a8d480378 [lazy] Add .free() 2018-08-12 16:00:13 -07:00