Commit Graph

280 Commits

Author SHA1 Message Date
Behdad Esfahbod
7997144b5f [color] Revamp palette API 2018-10-22 14:22:31 -07:00
Behdad Esfahbod
1de17bdb80 [colr] Add hb_ot_color_layer_t
We never return parallel arrays from functions.  That's inconvenient
and hard to bind.
2018-10-22 14:21:23 -07:00
Behdad Esfahbod
3b3668acc8 [color] Rename / reorder a bit
Implement has_data() for realz.
2018-10-22 14:21:23 -07:00
Behdad Esfahbod
9085a72deb [cpal] Touch up palette flags 2018-10-22 13:03:29 -07:00
Ebrahim Byagowi
d440c8d3fb
Add chromacheck Emoji test fonts and minor preparations (#1294) 2018-10-22 22:07:59 +03:30
Ebrahim Byagowi
44f79b4bf8 Remove _palette_entry_count as can be done with _palette_colors 2018-10-22 10:17:31 +02:00
Ebrahim Byagowi
6795dcfc08 [test] Test hb_ot_color_has_{colr,cpal}_data 2018-10-22 10:17:31 +02:00
Ebrahim Byagowi
b8ee3a0ec8 [CPAL] Add palette entry and enable palette flag API 2018-10-22 10:17:31 +02:00
Ebrahim Byagowi
d4261b4bb6 Add API test for hb_ot_color_get_color_layers 2018-10-22 10:17:31 +02:00
Ebrahim Byagowi
456978d408 Address COLR/CPAL reviews and revive cpal_v1 tests 2018-10-22 10:17:31 +02:00
Ebrahim Byagowi
e9d798dc12 [test] Use hb_test_open_font_file 2018-10-22 10:17:31 +02:00
Ebrahim Byagowi
e8a6f5b803 Add three macros for separating color channels 2018-10-22 10:17:31 +02:00
Ebrahim Byagowi
0e33467e52 Make ot-color tests pass 2018-10-22 10:17:31 +02:00
Khaled Hosny
d4e928b142 [color] Minimal API for COLR/CPAL 2018-10-22 10:17:31 +02:00
Ebrahim Byagowi
c110878cb6 [test] Unify font file opening across the tests 2018-10-21 11:27:05 +03:30
Ebrahim Byagowi
8931bc4a6b
[test] Fix -Wunused-parameter on test-font.c 2018-10-20 23:23:32 +03:30
Behdad Esfahbod
f11c557662 [test] Fix leak 2018-10-20 12:20:57 -07:00
Behdad Esfahbod
f70f994112 Minor 2018-10-19 20:00:36 -07:00
Behdad Esfahbod
4e09fb8f7a Oops. Fix build 2018-10-19 19:59:41 -07:00
Behdad Esfahbod
9e288d29d8 [test-map] Cosmetic 2018-10-19 19:47:27 -07:00
Behdad Esfahbod
77d5c3df07 [font] Add failing test amongst font-func parallels infinite-looping
Reported by Nona while updating Android to HarfBuzz 2.0.0.
2018-10-19 19:01:01 -07:00
Ebrahim Byagowi
114f66dda6 Fix hb_map_is_empty logic
This needs reviewing
2018-10-19 20:23:36 +03:30
Ebrahim Byagowi
9df2fb1611 Add API tests for hb_map_t 2018-10-19 20:23:36 +03:30
Ebrahim Byagowi
8a5eba7110 [test] cosmetic, use g_assert_cmpint 2018-10-19 20:23:36 +03:30
Ebrahim Byagowi
c6eb5e852c Don't report deprecated symbols as unused symbols 2018-10-19 20:23:36 +03:30
Ebrahim Byagowi
34f357c78a Add test for hb_set_del 2018-10-19 20:23:36 +03:30
Behdad Esfahbod
535ca678bf [test] Don't use newer glib API 2018-10-18 05:58:04 -07:00
Behdad Esfahbod
3341c7fbfb [fuzzing] Move fuzzing fonts from api/ here 2018-10-17 15:04:35 -07:00
Ebrahim Byagowi
61510b63c1
[test] Minor cleanup in test-multithread and test-ot-name (#1256) 2018-10-16 14:17:21 +03:30
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
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
David Corbett
28d091d045 Parse Indic3 tags 2018-10-11 17:44:13 -04:00
Behdad Esfahbod
1d995a340b Minor 2018-10-11 15:42:54 -04:00
Behdad Esfahbod
57b05210b1 [test] Fix use of deprecated symbols 2018-10-11 15:03:21 -04:00
David Corbett
7f1fbfe2e3 Add hb_ot_tags_to_script_and_language 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
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
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
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
9f79365c3b 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]
2018-10-09 14:36:25 -04:00
Chun-wei Fan
4035158de4 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.
2018-10-09 09:43:36 -04:00
Behdad Esfahbod
eb2be97f86 Port test off deprecated API 2018-10-09 07:48:52 -04:00
Behdad Esfahbod
a353c1768d Remove test for deprecated hb_set_invert() 2018-10-09 01:05:28 -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
f92330b5e0 Minor 2018-10-07 17:51:50 +02:00
Ebrahim Byagowi
4146c00caa
[test] Use an in-repo font for test-multithread (#1218)
As Khaled's suggestion, hard-coded font paths was only for my own testing.
2018-10-03 21:26:58 +03:30
lantw44
7a1ab0464d Fix test-multithread build on FreeBSD (#1217)
Add the default font path used by FreeBSD ports.
2018-10-03 18:52:43 +03:30
Ebrahim Byagowi
bf5088b3dc
Minor, fix -Weverthing bot warnings (#1210) 2018-10-02 11:07:06 +03:30