Commit Graph

713 Commits

Author SHA1 Message Date
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
Michiharu Ariza a6b6faf2b8 Replaced CFF1 J subset font for better coverage
in api test-ot-extents-cff
2018-10-11 10:53:44 -07:00
Michiharu Ariza b5aa5dbb11 Merge branch 'master' into cff-subset 2018-10-10 18:36:35 -07:00
Michiharu Ariza af61c3b10f added vsindex test & fixed process_vsindex 2018-10-10 18:35:12 -07: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
Michiharu Ariza c06a5dff0b Merge branch 'master' into cff-subset 2018-10-09 22:00:10 -07:00
Michiharu Ariza 83c5298f33 added cff1_legacyops.otf as test-ot-extents-cff test case
fixed roll operator bugs uncovered by the test
2018-10-09 21:59:36 -07:00
Michiharu Ariza 588518ea51 fixed test-ot-extents-cff failure on some platforms 2018-10-09 14:48:04 -07: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
Michiharu Ariza f5f505b512 Merge branch 'master' into cff-subset 2018-10-09 10:10:35 -07: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
Michiharu Ariza 8b349040e9 Merge branch 'master' into cff-subset 2018-10-08 21:46:23 -07: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
Michiharu Ariza a90fd8b9fe Merge branch 'master' into cff-subset 2018-10-08 15:07:58 -07:00
Michiharu Ariza b51418f596 added CFF2 get_extents
added source hb-ot-cff2-table.cc
augmented VariationData to return scalars
misc bug fixes, renaming, cleanup
2018-10-08 15:05:36 -07:00
Behdad Esfahbod f92330b5e0 Minor 2018-10-07 17:51:50 +02:00
Michiharu Ariza 6238edbd8b added CFF glyph extents API test 2018-10-04 13:59:36 -07:00
Michiharu Ariza 1aeaee9dfc fixed cff2 subset test data 2018-10-03 17:44:45 -07:00
Michiharu Ariza 8be5a9186b Merge branch 'master' into cff-subset 2018-10-03 17:06:18 -07: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
Michiharu Ariza 9cdd70b344 Merge branch 'master' into cff-subset 2018-10-02 13:43:21 -07:00
Ebrahim Byagowi bf5088b3dc
Minor, fix -Weverthing bot warnings (#1210) 2018-10-02 11:07:06 +03:30
Michiharu Ariza 3dd43f0234 Merge branch 'master' into cff-subset 2018-10-01 10:22:06 -07:00
Behdad Esfahbod dcfcb950b8 [test] Fix -Wunused-parameter warnings 2018-09-30 18:14:50 +02:00
Behdad Esfahbod be0b2ed316 More warning fixes 2018-09-30 18:02:04 +02:00
Ebrahim Byagowi cefdef0247
Minor on test-multithread, align the actual and expected results 2018-09-29 10:19:54 +03:30
Behdad Esfahbod c763b94401 [test-multithread] Disable FreeType funcs 2018-09-28 20:53:23 -04:00
Ebrahim Byagowi 7b68edf2ab
[tests] Don't try to get glyph names on failures
As it may cause a race unrelated to the issue actually happened
2018-09-28 20:53:48 +03:30
Behdad Esfahbod 33231a855f Fix pthread fail for real
Using a hack...
2018-09-28 11:06:49 -04:00
Behdad Esfahbod 8cb8209c91 Fix bot fails 2018-09-28 10:55:28 -04:00
Behdad Esfahbod 4cd342baea Fix ubsan bot 2018-09-28 09:47:45 -04:00
Behdad Esfahbod 7e6e094abd [test-multithread] Install ot funcs before filling ref buffer 2018-09-28 08:45:57 -04:00
Behdad Esfahbod 21fbee831e [test-multithread] Take num-threads and num-iters from command-line 2018-09-28 08:43:37 -04:00
Behdad Esfahbod 598be3bb38 Minor 2018-09-28 08:43:15 -04:00
Ebrahim Byagowi c09bf3d505
test-multithread, check the results on every iteration (#1194) 2018-09-28 16:13:01 +03:30
Ebrahim Byagowi dbc3070a15
Make test-multithread pass the tsan bot test (#1193) 2018-09-28 16:01:15 +03:30
Michiharu Ariza dac70f252a Added CFF1 J font subset to api test
Also fixed FDSelect3_4::get_fd
Fixed test_subset_cff1_strip_hints (wrong font names!)
2018-09-26 16:30:26 -07:00
Behdad Esfahbod d183b33c1d Rename test 2018-09-26 16:40:59 -04:00
Ebrahim Byagowi 39da1914b4
Test freetype funcs on test-multithread (#1187) 2018-09-26 23:32:45 +03:30
Ebrahim Byagowi e88009a93f
Minor, remove the no longer needed comment on test-multithread 2018-09-26 22:53:02 +03:30
Behdad Esfahbod 34d5a25953 Fix test-multithread and increase num_threads to 30
What were you thinking? ;)
2018-09-26 15:02:21 -04:00
Ebrahim Byagowi 8bb73dad7f
Add a multithreaded test (#1184) 2018-09-26 20:50:51 +03:30
Michiharu Ariza 258b456566 Added CFF1 & CFF2 api tests 2018-09-24 16:50:47 -07:00
Behdad Esfahbod d07f3111b4 Link API test programs with C++ linker
Needed to make ubsan work.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1174
2018-09-24 13:01:35 -04:00
Ebrahim Byagowi 403019482b
Fix test-subset-* leak issues
See also https://github.com/harfbuzz/harfbuzz/pull/1169
2018-09-22 17:24:03 +03:30
Ebrahim Byagowi f6ebe1f4dc
Fix test-ot-math leak issue
See also https://github.com/harfbuzz/harfbuzz/pull/1169
2018-09-22 17:05:52 +03:30
Ebrahim Byagowi 669ac81ac5
Fix test-set leak issue
See also https://github.com/harfbuzz/harfbuzz/pull/1169
2018-09-22 16:49:23 +03:30
Ebrahim Byagowi ef9307fd22
Fix test-font leak issue
See also https://github.com/harfbuzz/harfbuzz/pull/1169
2018-09-22 16:45:31 +03:30
Garret Rieger 21bf147054 [subset] Fix hdmx subsetted size calculation. 2018-09-05 19:31:55 -07:00
Behdad Esfahbod 93fe0faaee [subset] Clean up hb_subset_input_t API 2018-08-29 18:24:03 -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 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 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 d60c465627 Rename get_all_codepoints() to collect_unicodes() 2018-08-25 08:48:42 -07:00
Garret Rieger 2bdd903c69 [subset] limit the max codepoint value to the unicode limit.
When collecting all codepoints in the cmap avoid using large amount of memory for fonts that declare coverage over all 32 bit integers.
2018-07-31 18:40:38 -07:00
Garret Rieger 7278d9df30 [subset] Add hb_ot_layout_collect_features to harfbuzz-sections.txt.
Add the fuzzer test case for feature collection timeout.
2018-07-31 18:26:09 -07:00
Garret Rieger 5edf454aa6 [subset] During lookup collection remember the features we've already processed. 2018-07-27 17:29:00 -07:00
Behdad Esfahbod 019d18e9ae Minor 2018-07-17 11:00:24 +02:00
Behdad Esfahbod 58cb4d9f73 Minor 2018-07-11 16:44:21 +02:00
Garret Rieger 4f8753464a [subset] Add fuzzer test case that caused a timeout to the corpus. 2018-06-25 18:37:59 -06:00
Jonathan Kew a95cde15af [hb-set] Additional testcase for hb-set-intersect. 2018-06-12 01:16:42 -04:00
Garret Rieger fc246ec985 [subset] Move variable declaration out of loop. 2018-06-08 12:09:34 -06:00
Garret Rieger 197cb18b22 [subset] Add test cases for gsub closure in subsetting. 2018-06-08 12:09:34 -06:00
Behdad Esfahbod 11f1f4131b [set] Add is_subset
New API:
+hb_set_is_subset()
2018-06-06 16:47:13 -07:00
Behdad Esfahbod 0644d92ef3
Merge pull request #1018 from googlefonts/cmap4
[subset] Add cmap format 4 subsetting.
2018-05-08 15:21:09 -07:00
Behdad Esfahbod f673cfbd64 Support scripts that are written both LTR and RTL
Right now only Old Italic is marked as such.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1000
2018-05-07 14:12:17 -07:00
Garret Rieger a8e7f9b958 [subset] Get cmap tests passing again. 2018-05-04 11:20:03 -07:00
Garret Rieger c817992f49 [subset] Write out a format 4, plat 0 encoding record to match fontTools. 2018-05-04 11:20:03 -07:00
Ebrahim Byagowi ce17340b23 Add hb_blob_create_from_file, a new API (#926) 2018-04-20 07:59:06 +02:00
Garret Rieger 4fa1c6705a [subset] Check instruction offsets in glyph to ensure they are in bounds. 2018-04-19 17:19:38 -06:00
Garret Rieger e29c8e33f3 [subset] Add a test for previous cmap breakage. 2018-04-19 12:51:51 -06:00
Garret Rieger 5dadbb0fa0 [subset] Add implementation of cmap format 12 codepoint listing. (#988) 2018-04-17 15:00:23 +02:00
Garret Rieger 21a181af2b [subset] sketch out support for a call that lists all codepoints present in a font. Implement support for it in format 4 cmap sub table. 2018-04-16 16:29:26 -06:00
Ebrahim Byagowi f24b0b9728 Update the links and revive the dead ones 2018-04-12 13:44:32 +04:30
Garret Rieger 1c3372786c [subset] fix infinite loop bug in looping through tables for subsetting. 2018-03-27 13:47:42 -06:00
Garret Rieger 07851aae9d [subset] Couple of fixes for fuzzer discovered issues. (#924)
* [subset] sanitize individual DeviceRecord's as part of hdmx sanitization.

* [subset] Fix out of bounds read with non-two byte align glyphs.

* [subset] Just use size_device_record >= DeviceRecord::min_size.

* [subset] Add TODO.

* [subset] Re-order checks in hdmx sanitize.
2018-03-26 19:56:56 -07:00
Behdad Esfahbod 44b6c77c64 Try fixing linking again
Before 1.7.5, we were setting -fno-exceptions etc on CXXFLAGS. In 1.7.6
we set it as CPPFLAGS. Try fixing. Also, I'm fairly sure it's safe to
set these unconditionally.

Fixes https://github.com/harfbuzz/harfbuzz/issues/880 (or so I hope)
2018-03-26 14:26:45 -07:00
Garret Rieger 1396614040 [subset] don't use pointers returned from push after array has resized in hb-subset-glyf.cc 2018-03-20 19:47:36 -06:00
Garret Rieger 3531efdb4c [subset] Fixed out of bounds read when subsetting hdmx. 2018-03-20 19:47:36 -06:00
Garret Rieger e597436b99 [subset] Disable glyf accelerator_t methods if it didn't successfully init. 2018-03-20 19:47:36 -06:00
Garret Rieger 7251181b56 [subset] Fix infinite loop in there are more then 32 tables. 2018-03-20 19:47:36 -06:00
Garret Rieger 1a94804d35 [subset] Add a fix for segfault in hmtx/vmtx subsetting code. 2018-03-20 19:47:36 -06:00
Garret Rieger 31281d6a17 [subset] Add a test demonstrating a seg fault while subsetting hmtx. 2018-03-20 19:47:36 -06:00
Behdad Esfahbod e6e2ee2b92 Remove extra stdbool includes
They are handled in our common header.
2018-03-15 09:05:22 -07:00
Chun-wei Fan 831d4a2dab test/api: Fix building subset tests
Include stdbool.h in hb-setset-test.h instead of in the individual
sources, if it is found; otherwise use a simplistic fallback for it if
it is not found.

Also declare variables at the top of the block, to build on pre-C99
compiliers.
2018-03-13 20:17:58 +08:00
Chun-wei Fan eda6a5ea80 CMake: Fix running tests on Windows
For the API tests, output the test programs at $(TOP_BUILDDIR) so that
the freshly-built DLLs will be available for the test programs.  For
those that are run through the Python wrapper scripts, use
${PYTHON_EXECUTABLE} instead of plain 'python' in case the Python
interpreter is not in the PATH.
2018-03-13 20:17:58 +08:00
Garret Rieger ec47cd95ba [subset] Unit test to check that post subsetting drops glyph names. 2018-03-07 11:36:54 -08:00
Garret Rieger 362f282406 [subset] fix author. 2018-03-07 11:08:55 -08:00
Garret Rieger 89465cb1c7 [subset] s/hmetrics/vmetrics. 2018-03-07 10:29:15 -08:00
Garret Rieger 91867cda6a [subset] cleanup. 2018-03-07 10:17:06 -08:00
Garret Rieger d9263f0230 [subset] add unit tests for vmtx subsetting. 2018-03-07 10:08:47 -08:00
Behdad Esfahbod 70ad69f244 [test] Fix build with older glib 2018-03-07 16:11:44 +01:00
Garret Rieger 9a6f9b4d42 [set] add a test demonstrating a bug in hb_set_union. 2018-03-07 09:25:53 +01:00
rsheeter 588a4e0f9b
Merge pull request #845 from googlefonts/drophints
[subset] drop hints from composites
2018-02-28 13:52:29 -08:00
Ebrahim Byagowi 772274625e
Merge pull request #841 from ebraminio/color
Support CPAL table
2018-02-28 12:05:49 +03:30
Ebrahim Byagowi 0eec33154a
[cmake] cleanup (#846) 2018-02-28 11:53:39 +03:30
Ebrahim Byagowi 5b9c234043 [CPAL] Refactor and address the reviews 2018-02-28 11:25:29 +03:30
Rod Sheeter ffcb5cbf71 [subset] update the test file for composite, fix an offset calculation 2018-02-27 20:17:04 -08:00
Rod Sheeter c8b230e437 Merge branch 'expand-tests' of github.com:googlefonts/harfbuzz into drophints 2018-02-27 17:25:32 -08:00
Rod Sheeter b3790a65a1 [subset] add a (failing for now) test for composite glyf hint dropping 2018-02-27 17:23:30 -08:00
Garret Rieger f14d1b64c2 [subset] when dropping hints, clear hint related fields in maxp. 2018-02-27 13:49:43 -08:00
Ebrahim Byagowi 101850f9e6 Merge with master 2018-02-27 20:17:25 +03:30
rsheeter 4a1d51ef15
Merge pull request #818 from googlefonts/drophints
[subset] Drop hints
2018-02-26 20:23:41 -08:00
Ebrahim Byagowi cd28eb9f5d
Add -Werror=unused-function check to Travis (#832) 2018-02-24 14:17:54 +03:30
Rod Sheeter 5267520e07 [subset] update hdmx test to create input explicitly 2018-02-23 18:36:22 -08:00
Rod Sheeter d78393b554 Merge branch 'master' of https://github.com/harfbuzz/harfbuzz into drophints 2018-02-23 17:53:26 -08:00
Rod Sheeter 0ac8c0c1e6 [subset] zero glyf and loca memory before writing so pads are clean. Test just the part of maxp we care about 2018-02-23 17:43:00 -08:00
Rod Sheeter 9bd6d25254 [subset] clone trim logic from fonttools glyf handling 2018-02-23 13:05:58 -08:00
Garret Rieger 15fc45bfed [subset] Add a unit test for hdmx subsetting. 2018-02-22 15:42:39 -08:00
Rod Sheeter 4f07437dfe [subset] sketch out dropping in-glyf instructions. Sometimes yields differnet size glyphs than fonttools, possibly due to padding not being corrected 2018-02-21 22:23:05 -08:00
Behdad Esfahbod 0bff6991de Ugh. Really fix build. 2018-02-19 11:51:25 -08:00
Behdad Esfahbod 279c70a5b3
Merge pull request #796 from ebraminio/dev-run
Add a continuous builder using fswatch
2018-02-18 14:04:33 -08:00
Ebrahim Byagowi 89b82814b6 Add a continuous builder using fswatch 2018-02-18 23:56:00 +03:30
Behdad Esfahbod 0bd2d76bdd [test] Fix a couple of coverity_scan issues 2018-02-18 11:55:46 -08:00
Behdad Esfahbod fe8f40a418
Merge branch 'master' into bitops 2018-02-18 10:45:33 -08:00
Behdad Esfahbod 04dedec96b [test] Remove unused var 2018-02-16 18:32:57 -08:00
Behdad Esfahbod 6d56db8983 [test/api] Distribute all fonts 2018-02-16 18:29:29 -08:00
Garret Rieger df9e22656d [subset] add a glyf subsetting test for a font with composite glyphs. 2018-02-16 18:29:29 -08:00
Garret Rieger c36d015b0e [subset] missing return. 2018-02-16 18:29:29 -08:00
Behdad Esfahbod 7b5ce74047 Fix warnings 2018-02-16 15:38:02 -08:00
Rod Sheeter c7a633f957 [subset] try to get more info from bot where g_assert_cmpmem fails 2018-02-16 11:11:20 -08:00
Rod Sheeter 0bb2d7ac12 [subset] fix int type for blob length in hb-subset-test.h 2018-02-16 06:26:02 -08:00
Rod Sheeter 6122ad2442 [subset] add files to EXTRA_DIST 2018-02-15 11:40:28 -08:00
Rod Sheeter 27012526f9 [subset] whitespace 2018-02-14 19:01:00 -08:00
Garret Rieger e0ffebead6 [subset] In hb-subset-test use hb_set_union instead of manually copying set. 2018-02-14 16:01:08 -08:00
Rod Sheeter fa87770372 [subset] First pass at hmtx 2018-02-14 14:53:10 -08:00
Garret Rieger e5edcc81bf [subset] Fix codepoint iteration in hb-subset-test. 2018-02-14 11:17:53 -08:00
Garret Rieger 8b1dbbef1a Fix compile error in hb-subset-test. 2018-02-14 11:05:19 -08:00
Behdad Esfahbod f53627e191 [test] Fix warning 2018-02-14 10:59:22 -08:00
Garret Rieger d008b62887 Merge remote-tracking branch 'upstream/master' into fixed 2018-02-14 10:38:52 -08:00
Garret Rieger df6d780355 [subset] Extract maxp subsetting into hb-ot-maxp-table. 2018-02-14 10:19:50 -08:00
Garret Rieger 865b6971ad [subset] Add a test for OS/2 fixes during subsetting. 2018-02-14 10:19:50 -08:00
Behdad Esfahbod 694eaf6367 [set] Add backwards iterator
New API:
- hb_set_previous()
- hb_set_previous_range()
2018-02-14 01:00:10 -08:00
Behdad Esfahbod 9046e92442 [subset] Rename constructor to hb_subset_input_create_or_fail()
To signify that unlike rest of library, returns nullptr on failure.
2018-02-13 22:07:12 -08:00
Behdad Esfahbod d5b33f2fe1 [subset] hb_subset_input_t changes 2018-02-13 13:55:10 -08:00
Garret Rieger 8cf8b78faa [subset] whitespace 2018-02-12 16:30:21 -08:00
Rod Sheeter 89ee20f1a3 basic wiring for a (failing) cmap test 2018-02-12 16:01:15 -08:00
Garret Rieger 1639bdd331 [subset] Remove test-subset, testing is planned to be done at the table level here with test/subset covering the complete subsetting operation. 2018-02-12 13:40:42 -08:00
Garret Rieger 4cdd1b16c9 [subset] added todo in test-subset-glyf. 2018-02-12 13:36:28 -08:00
Garret Rieger 1714feef4f [subset] re-enable test-subset-glyf. Refactor to use common functions in hb-subset-test.h 2018-02-12 13:35:17 -08:00
Garret Rieger d8d8bd8405 [subset] Add some helper functions for writing tests around subsetting. 2018-02-12 13:34:08 -08:00
Behdad Esfahbod d33ba16361 Fix more warnings 2018-02-11 18:26:41 -08:00
Behdad Esfahbod 6c1848b1e3 Misc warning fixes 2018-02-10 15:52:35 -06:00
Behdad Esfahbod 4c5bdb4b39 [test] Disable test-subset-glyf for now 2018-02-10 15:40:54 -06:00
Behdad Esfahbod 43314ff4c0 More fixes
test-subset-glyf still failing. No idea why :(
2018-02-10 15:40:03 -06:00
Behdad Esfahbod 9682ef135f Minor fixups 2018-02-08 17:35:57 -06:00
Garret Rieger 0f3c756cbf Add CMake config for building a separate harfbuzz-subset. 2018-02-08 17:31:11 -06:00
Garret Rieger f2ceb5ee4d Comment out failing assert in test-subset-glyf for now. Should be re-enabled once hb_subset is writing out a new face. 2018-02-08 17:31:11 -06:00
Garret Rieger 89dbebd4ad Add a basic test for glyf subsetting. 2018-02-08 17:31:11 -06:00
Behdad Esfahbod c479a59988 [subset] Assemble font 2018-02-07 21:26:04 -06:00
Behdad Esfahbod f70100417c [test] Minor 2018-02-07 13:58:23 -05:00
Behdad Esfahbod af02812fc5 [subset] Change hb_subset API to remove hb_subset_face_t 2018-02-07 13:07:46 -05:00
Garret Rieger 7481f0ce21 Add codepoints to subset input. 2018-02-07 12:41:21 -05:00
Ebrahim Byagowi 8cb8bfd5b5
[test] Fix test-subset on old distros (#758)
https://developer.gnome.org/glib/stable/glib-Testing.html#g-assert-cmpmem
2018-02-06 20:40:42 +03:30
Behdad Esfahbod b7b7f0ac59 [test] Minor 2018-02-05 19:40:31 -05:00
Garret Rieger 5f6eb1256f Add libharfbuzz-subset.la to linking when building api tests. 2018-02-05 10:23:38 -08:00
Garret Rieger 76b84c36b9 Whitespace 2018-02-04 12:57:34 -08:00
Garret Rieger a2965f2ea5 Add a basic implementation of hb-subset to enable compilation of test-subset. 2018-02-04 12:57:33 -08:00
Garret Rieger b59c08eb04 Add the beginning of a unit test for hb-subset 2018-02-04 12:57:33 -08:00
Ebrahim Byagowi e849b8a85b
[cmake] Always put test/api/CMakeLists.txt on distributions 2018-01-19 16:12:24 +03:30
Ebrahim Byagowi 2dbdeb1421
[cmake] Run fuzzing and shaping tests (#666) 2017-12-29 23:13:29 +03:30
Ebrahim Byagowi 50163976d2
[cmake] Enable cmake tests on distribution and test it (#664) 2017-12-25 01:55:48 +03:30
Khaled Hosny c860955148 Add API tests to cmake build 2017-12-06 15:25:10 +02:00
Khaled Hosny f19126dd35 We are already inside “if HAVE_GLIB” check 2017-12-06 15:25:10 +02:00
Behdad Esfahbod 20b4672754 [set] Fix recent changes
Ouch!

Add tests.
2017-12-02 15:15:50 -08:00
ebraminio 7c6937e7c7
Move all references of old url to the new address (#622) 2017-11-20 14:49:22 -05:00
Behdad Esfahbod cb6c6b0c42 Fix warning
49a41dc759 (commitcomment-25203194)
2017-10-26 11:43:33 -06:00
Jonathan Kew 7339926525 [test] Extend hb_set test for issue 579 (currently failing) 2017-10-26 12:33:05 -05:00
Jonathan Kew 3d6f7df42a [test] Additional coverage in test_set_iter.
This adds a couple extra entries to the set used, such that iteration
would fail in 1.6.2 due to the bug in hb_set_t::page_t::next().
2017-10-26 12:30:52 -05:00
Behdad Esfahbod 49a41dc759 [test] Add more hb-set tests
https://github.com/behdad/harfbuzz/issues/579
2017-10-25 16:17:45 -06:00
Behdad Esfahbod deed4a48d1 Faster hb_set_t
Fixes https://github.com/behdad/harfbuzz/pull/23
2017-10-15 16:45:33 -03:00
Behdad Esfahbod c4712f8e37 Fix test 2017-08-10 20:27:21 -07:00
Philip Withnall a6ced90efc test: Fix some memory leaks in test-font.c (#409)
Coverity IDs: 141039, 141040, 141041
2017-02-07 18:18:33 -08:00
Behdad Esfahbod a8a5e81a52 [test-ot-math] Add test with nil face/font 2017-01-19 16:55:04 -08:00
Behdad Esfahbod 331d07bd40 Minor 2017-01-19 16:51:36 -08:00
Behdad Esfahbod b5ecf1bfa4 Fix warnings 2017-01-19 16:50:29 -08:00
Behdad Esfahbod 2f2ceee185 Minor 2017-01-19 16:48:01 -08:00
Sascha Brawer 1337428e4f Update language tags to OpenType 1.8.1 (#403)
Resolves https://github.com/behdad/harfbuzz/issues/324
2017-01-18 04:51:02 -08:00
Mike Hommey 1c98ff87c7 Support building with older glib versions
It is desirable to be able to build against older versions of glib.

fd7a245 changed the configure check to require glib > 2.38 for
G_TEST_DIST. Before that, version 2.16 was required, but in fact,
since aafe395, G_PASTE is being used, which was introduced in 2.19.1.
And since 0ef179e2, hb-glib uses GBytes, which were introduced in
2.31.10.

2.19.1 is rather old, but 2.38 is rather new. For Firefox, building
against 2.22 is still supported, although we could probably get away
with bumping that to 2.28. Either way, GBytes is not available.

Arguably, if you build against a glib that doesn't support GBytes,
you're not going to use the hb_glib_blob_create function, so we hide
the function when building against such a glib.

As for G_TEST_DIST, when building against versions of glib that don't
support it, we can fallback to the previous behavior, which, AIUI, was
just making the test not work when building in a separate directory.
2016-12-18 01:37:07 -06:00
Frédéric Wang c3fa5d0e03 Remove inexistent file ttx file from test/api/Makefile.am 2016-10-24 21:42:04 +02:00
Behdad Esfahbod 34fc4a2cfa Fix dist 2016-10-04 14:47:12 -07:00
Behdad Esfahbod 46cc4a3a2a [MATH] Rename hb_math_*_t types to hb_ot_math_*_t
With this, I believe MATH table API is not ready to be merged.
2016-09-27 16:44:22 +02:00
Frédéric Wang 8d622f1114 Add tests for get_mathvariant (#329) 2016-09-27 13:53:34 +02:00
Frédéric Wang 485e4873fb Add tests for hb_ot_math_get_glyph_variants (#328) 2016-09-27 13:18:00 +02:00
Behdad Esfahbod a5629a2ed9 [MATH] Simplify test 2016-09-27 11:31:29 +02:00
Frédéric Wang edcfa789bf test-ot-math: Use different scales for vertical and horizontal directions and add test for hb_ot_math_get_min_connector_overlap. (#327) 2016-09-27 11:02:08 +02:00
Behdad Esfahbod cdc9eef7da [MATH] Enable tests for glyph-assembly italics-correction 2016-09-26 22:18:41 +02:00
Behdad Esfahbod 86106c7528 [MATH] Rename all API to hb_ot_math_* 2016-09-26 22:14:29 +02:00
Frédéric Wang 51da7a1cd6 MATH table: Add API to access math variants. 2016-09-26 15:18:16 +01:00
Frédéric Wang 722e620f20 Use G_TEST_DIST to build the path of math test fonts 2016-09-26 13:49:18 +01:00
Behdad Esfahbod 17ff30e9af [MATH] Clean up get_top_accent_attachment()
Note, the function now returns "half of horizontal advance width"
if top accent attachment for glyph is not explicitly defined.
This is what the spec requires.  Updated tests.
2016-09-26 12:21:27 +01:00
Behdad Esfahbod 8bcf517fe5 [MATH] Clean up get_italics_correction() 2016-09-26 12:13:14 +01:00
Frédéric Wang d7182d1296 MATH Table: Add API to access glyph info. 2016-09-26 11:32:25 +01:00
Frédéric Wang 319ff59161 MATH Table: Add API to access math contants. 2016-09-26 10:49:09 +01:00
Behdad Esfahbod 4d3892e9b0 [MATH] Fixups for previous commit 2016-09-26 10:45:58 +01:00
Frédéric Wang 5fbcb992bd MATH Table: Add API to check availability of math data. 2016-09-26 10:27:33 +01:00
Sascha Brawer e7ecbba2cc Support Americanist Phonetic Notation
OpenType language system tag: `APPH`
https://www.microsoft.com/typography/otspec/languagetags.htm

IETF BCP47 variant tag: `fonnapa`
http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
2016-08-18 14:13:26 +02:00
Behdad Esfahbod 18c19dd34d Fix build 2016-08-09 13:03:14 -07:00
Sascha Brawer 5967eaba72 [CPAL] Return 0xFFFF as name id for unnamed palettes
The name id 0 is used as Copyright notice. It's quite unlikely that a
font supplies a color palette with the exact same name as the font's
copyright notice, but the API should not prevent this.

Also, try to fix a problem with GObject introspection, where the
auto-generated Python bindings could not return palette colors.
2016-06-24 16:46:49 +02:00
Sascha Brawer d34d3ac985 Support CPAL table 2016-06-19 13:17:57 +02:00
Behdad Esfahbod dd8598c1c7 [test] Pass closure to hb_font_set_glyph_func()
Exercises fix in c335fd7986
2016-02-25 11:20:05 +09:00
Behdad Esfahbod da29b43794 Separate nil font-funcs from parent-peeking font-funcs
API change: all fonts created with hb_font_create() now inherit from
(ie have parent) hb_font_get_empty().
2015-11-04 20:22:44 -08:00
Behdad Esfahbod 3e905e396b Add hb_font_set_parent()
No reason to not have it.  Makes life easier later.
We (hb-ft, hb-ot-font, etc) can use this API to inject new
parent into a font...
2015-10-08 12:51:02 -04:00
Behdad Esfahbod 88da7bba9f Default font scale to face upem
Makes for a better default and avoids nasty inheritance issues.
See mailing list thread "Default hb_font_t scale".
2015-10-02 14:38:20 +01:00
Behdad Esfahbod 1866e17114 Make hb_font_create_sub_font() NOT make parent immutable
We don't rely on that.  However, whenever hb_font_make_immutable()
is called, it makes its parenting chain immutable.
2015-10-02 14:21:29 +01:00
Sascha Brawer f2ad935e19 Handle language tags that indicate phonetic IPA transcription
The BCP-47 registry defines a variant subtag "fonipa" that can be used
in combination with arbitrary other language tags. For example,
"rm-CH-fonipa-sursilv" indicates the Sursilvan dialect of Romansh
as used in Switzerland, transcribed used the International Phonetic
Alphabet.

http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
2015-09-29 14:32:06 +01:00
Behdad Esfahbod fad2674874 Minor 2015-09-01 14:45:46 +01:00
Behdad Esfahbod 31594b98af [test] Fix test-object
See previous commit.
2015-08-30 17:33:04 +01:00
Romain Naour 160f635523 fix static linking with icu-uc
When linking test-unicode statically it needs $(ICU_LIBS)
which contains all required flags.
Especially -lstdc++.

Fixes:
http://autobuild.buildroot.net/results/210/2107f9dfb39eeb6559fb4271c7af8b39aef521ca/

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
2015-07-31 16:12:26 +02:00
Behdad Esfahbod b3a2f6afba [test] Add test for cluster merging
Based on test from https://code.google.com/p/chromium/issues/detail?id=497578

Currently fails.  Basically, if there's a default_ignorable at the
start of text, and font has no space glyph, we remove the default_ignorable,
and that makes the first char in text to correspond to no cluster.

Fix coming.
2015-06-18 17:15:33 -07:00
Behdad Esfahbod eb0bf3ae66 Relax inert checks
Previously, when creating an object from inert inputs (eg:
"hb_font_create(hb_face_get_empty())") we returned the inert
empty object.  This is not helpful as there are legitimate
usecases to do that.

We now never return the inert object unless allocation failed.

Tests are revised to reflect.
2015-04-09 19:16:57 -07:00
Behdad Esfahbod 7d5e7613ce Fail blob creation if length overflows or is too large
Fail if blob start plus length overflows; or if blob length
is greater than 2GB.  It takes a while for fonts to get to that
size.  In the mean time, it protects against bugs like this:

  http://www.icu-project.org/trac/ticket/11450

Also avoids some weird issues with 32bit vs 64bit systems
as we accept length as unsigned int.  As such, a length of
-1 will cause overflow on 32bit machines, but happily
accepted on a 64bit machine.  Avoid that.
2014-12-18 18:22:21 -08:00
Behdad Esfahbod b5fbc3b8f5 API: Do not clear buffer-flags in hb_buffer_clear_contents()
After 763e5466c0, one doesn't
need to set flags for different pieces of text.  The flags now
are something the client sets up once, depending on how it
actually uses the buffer.  As such, don't clear it in
clear_contents().

Tests updated.
2014-08-11 18:40:01 -04:00
Behdad Esfahbod 976c8f4552 New API: hb_buffer_[sg]et_replacement_codepoint()
With this change, we now by default replace broken UTF-8/16/32 bits
with U+FFFD.  This can be changed by calling new API on the buffer.
Previously the replacement value used to be (hb_codepoint_t)-1.

Note that hb_buffer_clear_contents() does NOT reset the replacement
character.

See discussion here:

6f13b6d62d

New API:

  hb_buffer_set_replacement_codepoint()
  hb_buffer_get_replacement_codepoint()
2014-07-16 15:34:20 -04:00
Behdad Esfahbod e634fed428 [buffer] Validate UTF-32 input
Same as what we do for UTF-8 and UTF-16.
2014-07-16 14:17:26 -04:00
Behdad Esfahbod af2490c095 Only accept well-formed UTF-8 sequences
Enable tests that were disabled before, and adjust one test,
and add more tests.
2014-07-11 16:22:13 -04:00
Behdad Esfahbod 24b2ba9dfa [test-buffer] Add test for lonely low-surrogate
Currenty fails.  Ouch!
2014-07-10 19:31:16 -04:00
Behdad Esfahbod 6334495ac1 Use zh-Hans / zh-Hant when converting OT language tag to hb_language_t 2014-07-10 19:22:07 -04:00
Behdad Esfahbod f381e320df Fix lang matching logic
Previous code was broken logically, but harmless.
2014-07-10 19:20:35 -04:00
Behdad Esfahbod ee5350d667 Accept BCP 47 zh-Hans / zh-Hant language tags 2014-07-10 19:18:56 -04:00
Behdad Esfahbod 2b051c6057 Rename HB_VERSION_CHECK and hb_version_check to "atleast"
HB_VERSION_CHECK's comparison was originally written wrongly
by mistake.  When API tests were written, they were also written
wrongly to pass given the wrong implementation... Sigh.

Given the purpose of this API, there's no point in fixing it
without renaming it.  As such, rename.

API changes:

  HB_VERSION_CHECK -> HB_VERSION_ATLEAST
  hb_version_check -> hb_version_atleast
2014-06-20 14:09:57 -04:00
Luis de Bethencourt 1eacde00cc check hb_set_is_emtpy in test-set.c 2014-02-10 13:48:43 -05:00
Behdad Esfahbod c77d1ade68 Fix warnings 2013-10-27 23:53:55 +01:00
Behdad Esfahbod 20cbc1f8eb Annotate hb-set a bit; add HB_SET_VALUE_INVALID 2013-09-06 15:31:22 -04:00
Behdad Esfahbod 4dc798de19 Add hb-deprecated.h, and rename a couple enum values
Add deprecated alias for old name.
2013-08-27 11:46:08 -04:00
Behdad Esfahbod 54e6f6c588 Clean up list of Unicode scripts
Rename HB_SCRIPT_CANADIAN_ABORIGINAL to HB_SCRIPT_CANADIAN_SYLLABICS
and a macro for the old name.
2013-08-09 14:36:18 -04:00
Behdad Esfahbod 7235f33f9e Fix misc warnings reported by cppcheck
https://bugs.freedesktop.org/show_bug.cgi?id=65544
2013-06-10 15:08:49 -04:00
Behdad Esfahbod a4446b10bf Fix build for C89 compilers 2013-06-03 18:39:14 -04:00
Behdad Esfahbod 2966d36032 Fix test build 2013-05-28 17:34:37 -04:00
Behdad Esfahbod d9afa11133 Build hb-icu into libharfbuzz-icu.so 2013-05-28 15:27:40 -04:00
Behdad Esfahbod 7d395c2a25 Minor 2013-05-28 15:25:06 -04:00
Behdad Esfahbod dfbd115e6c [test] Add test for hb_set_get_min() bug
Failing now.

Bug 64476 - Typo in hb_set_t.get_min()
2013-05-14 15:30:17 -04:00
Behdad Esfahbod 0a2b2a505b Remove gthread leftovers
We don't use gthread anymore, remove leftovers.
2013-03-21 16:26:39 -04:00
Behdad Esfahbod ea11abfc5d [build] Port to newer automake recommended syntax 2013-03-06 20:21:11 -05:00
Behdad Esfahbod c39def9bc7 Move valgrind suppressions to the correct directory 2013-03-06 20:20:45 -05:00
Behdad Esfahbod 9e5ac7b8c0 Fix blob test to match c3ba49b6fa 2013-02-25 18:19:02 -05:00
Behdad Esfahbod 5898fa94d1 Don't use $(ENV)
As reported by Peter Breitenlohner:

I think this is a very bad idea because ENV is used to specify a startup
file to be read by some/all shells.
2013-02-06 15:29:07 -05:00
Behdad Esfahbod 1172dc7362 Rename hb_buffer_clear() to hb_buffer_clear_contents()
The previous name was clashing with harfbuzz.old.  There are systems
that need to link both...

Clash-free now again.
2013-01-07 16:46:37 -06:00
Behdad Esfahbod e81aff9ef7 [tests] Finish test-set.c
All passing now.
2013-01-02 23:22:54 -06:00
Behdad Esfahbod 8165f2765b [tests] Start adding tests for hb-set.h
Fails now.  Fixing.
2013-01-02 22:50:36 -06:00
Behdad Esfahbod b9d28f696c [tests] Add set object to test-object.c 2013-01-02 22:49:58 -06:00
Behdad Esfahbod d04b128531 Fix test 2012-11-14 10:53:10 -08:00
Behdad Esfahbod 0c7df22228 Add buffer flags
New API:

	hb_buffer_flags_t

	HB_BUFFER_FLAGS_DEFAULT
	HB_BUFFER_FLAG_BOT
	HB_BUFFER_FLAG_EOT
	HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES

	hb_buffer_set_flags()
	hb_buffer_get_flags()

We use the BOT flag to decide whether to insert dottedcircle if the
first char in the buffer is a combining mark.

The PRESERVE_DEFAULT_IGNORABLES flag prevents removal of characters like
ZWNJ/ZWJ/...
2012-11-13 14:42:35 -08:00
Behdad Esfahbod c8d4f8b0fe Minor 2012-11-13 14:10:19 -08:00
Behdad Esfahbod 82ecaff736 Add hb_buffer_clear()
Which is like _reset(), but does NOT clear unicode-funcs.
2012-11-13 14:10:00 -08:00
Behdad Esfahbod de796a6fb9 Add "new" Myanmar OT Script tag
Windows 8 added support for Myanmar shaping using the "mym2" script tag,
even though Windows never supported the old "mymr" tag.
2012-11-12 17:27:51 -08:00
Behdad Esfahbod 431bef2e16 Minor build fix 2012-11-01 16:26:01 -07:00
Behdad Esfahbod 378d279bbf Implement Unicode compatibility decompositions
Based on patch from Philip Withnall.
https://bugs.freedesktop.org/show_bug.cgi?id=41095
2012-07-31 21:36:16 -04:00
Behdad Esfahbod 5e113a4b79 g_thread_init() is deprecated 2012-06-16 15:26:13 -04:00
Behdad Esfahbod a18280a8ce Fix warnings produced by clang analyzer 2012-06-07 15:44:12 -04:00
Behdad Esfahbod fe28b997fb Add HB_DIRECTION_IS_VALID 2012-04-14 19:19:26 -04:00
Behdad Esfahbod 4bf90f6483 Make HB_DIRECTION_INVALID be zero
This changes all the HB_DIRECTION_* enum member values, but is
nicer, in preparation for making hb_segment_properties_t public.
2012-04-12 17:38:23 -04:00
Behdad Esfahbod 66aa080033 Remove test-shape-complex
New shaping testsuite and framework coming.
2012-01-20 17:36:10 -05:00
Behdad Esfahbod 36fe87d1b4 More Indic tests from Pravin 2012-01-19 16:55:26 -05:00
Behdad Esfahbod 4d6dafd47f Rename test/ to test/api/ 2012-01-19 14:52:02 -05:00