Commit Graph

6242 Commits

Author SHA1 Message Date
Behdad Esfahbod
9940504e93 [indic] Adjust left-matra repositioning and Halant,ZWJ sequence
From the new code (first paragraph is from the OT Devanagari spec.):

  /*   o Reorder matras:
   *
   *     If a pre-base matra character had been reordered before applying basic
   *     features, the glyph can be moved closer to the main consonant based on
   *     whether half-forms had been formed. Actual position for the matra is
   *     defined as “after last standalone halant glyph, after initial matra
   *     position and before the main consonant”. If ZWJ or ZWNJ follow this
   *     halant, position is moved after it.
   *
   * IMPLEMENTATION NOTES:
   *
   * It looks like the last sentence is wrong.  Testing, with Windows 7 Uniscribe
   * and Devanagari shows that the behavior is best described as:
   *
   * "If ZWJ follows this halant, matra is NOT repositioned after this halant.
   *  If ZWNJ follows this halant, position is moved after it."
   *
   * Test case, with Adobe Devanagari or Nirmala UI:
   *
   *   U+091F,U+094D,U+200C,U+092F,U+093F
   *   (Matra moves to the middle, after ZWNJ.)
   *
   *   U+091F,U+094D,U+200D,U+092F,U+093F
   *   (Matra does NOT move, stays to the left.)

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

Test case added with Adobe Devanagari.
2018-07-03 14:34:38 +04:30
Behdad Esfahbod
2cb075fe26 Fix unused function '_hb_mapped_file_destroy' if no mmap 2018-07-03 13:04:05 +04:30
Behdad Esfahbod
343e8c694b 1.8.2 2018-07-03 12:43:59 +04:30
Behdad Esfahbod
29e7879bcf Disable .dfont code for now
The get_table imple was wrong, as table offsets in a dfont are
relative to the resource.  We were treating them as relative to
the big blob itself.  To be fixed.

Part of https://github.com/harfbuzz/harfbuzz/pull/1085
2018-07-03 12:38:21 +04:30
Ebrahim Byagowi
32348a43c1
Fix trak table apply logic
In collaboration with Behdad
2018-07-01 15:32:43 +04:30
Ebrahim Byagowi
225b92b7d4
Support dfont font files (#949) 2018-07-01 14:32:00 +04:30
Ebrahim Byagowi
5d8cafcf6a
Improve nommap naming and use C style comments on create_from_file (#1084) 2018-07-01 01:54:14 +04:30
Behdad Esfahbod
d3c0980ac2 Adjust MarkBasePos heuristic in presence of MultipleSubst
From the issue:
"In this font, the virama,ya first forms a ligature, then decomposes back to
virama,ya. This causes those two to be marked parts of a MultipleSubst
sequence. When attaching the matra, we look for the first of the MultipleSubst
sequence because that's where we attach to (because of eg #740). In this case,
the first glyph in the MultipleSubst sequence is a mark, so we skip it and
attach to the base char before it."

Font in question is Nirmala UI from Windows 10. Test sequence:

  U+0926,U+094D,U+092F,U+0941

Fixes https://github.com/harfbuzz/harfbuzz/issues/1020
2018-06-30 15:59:25 +04:30
Behdad Esfahbod
8b9cbe3b24 [indic] Tweak for old-spec Bengali and halant-ya-halant
Fixes https://github.com/harfbuzz/harfbuzz/issues/1073
2018-06-30 12:28:39 +04:30
punchcutter
9541c9dae1 Rebase and update USE overrides for Bhaiksuki Gap Fillers and Grantha Anusvara 2018-06-30 10:02:34 +04:30
Behdad Esfahbod
7b8dfac560 [khmer] Fix infinite-loop in cluster merging
Indic shaper already had this check.  We removed it when forking
Khmer shaper by mistake.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1464623
2018-06-30 09:16:54 +04:30
Ebrahim Byagowi
25970a93aa
armcc compatibility, don't use EINTR if doesn't exist
Fixes #1081
2018-06-28 14:32:36 +04:30
Ebrahim Byagowi
8a51f91b70
Minor on hb_blob_create_from_file, reuse ferror result
Oops
2018-06-28 13:22:21 +04:30
Ebrahim Byagowi
71971800ed
[ci] Don't fail on apt update and revive clang-O3-O0 2018-06-27 18:14:52 +04:30
Ebrahim Byagowi
7b4099f35f
Minor, rename blob to data on blob_from_file 2018-06-27 16:54:44 +04:30
Ebrahim Byagowi
fa090ed4d4
Minor touches on hb_blob_create_from_file (#1079)
* Handle EINTR on fallback reader
* Increase fallback reader limitation size limitation to 2 << 28
* Ensure _O_BINARY does exist if MMAP is used on Windows
  (maybe superfluous but makes me more confident)
2018-06-27 14:13:26 +04:30
Behdad Esfahbod
01dff1ea1a Make round() fallback portable to systems that do have round()
Makes compiling without HAVE_ROUND on systems that do have it work.
2018-06-26 18:00:58 -04:00
Ebrahim Byagowi
7db2e9ea38
Minor on hb_blob_create_from_file
Add one more "unlikely" annotation and use explicit nullptr check for more consistency.
2018-06-26 10:46:10 +04:30
Garret Rieger
4f8753464a [subset] Add fuzzer test case that caused a timeout to the corpus. 2018-06-25 18:37:59 -06:00
Ebrahim Byagowi
35ce8f31d3
Unify our pipe reader with the fallback reader (#1068)
And assign one bot to use the path always using NOMMAPFILEREADER token.

It's limited to 200mb so no more fun with using /dev/zero on hb-view!
2018-06-25 22:23:43 +04:30
Ebrahim Byagowi
f57804a8a5
Resolve ttx absolute path before use (#1075) 2018-06-25 18:45:49 +04:30
Ebrahim Byagowi
159ddb8729
Treat - just as /dev/stdin and remove one extra file reader (#1065) 2018-06-24 23:09:16 +04:30
Behdad Esfahbod
b2a1879187 In Coverage iterator, bail out if table smells
In particular, if CoverageFormat2 has unsorted ranges, bail out.
Otherwise, 64k ranges of each 64k glyphs can DoS closure() method.

We can do the same for CoverageFormat1, but that one does not expose
the quadratic behavior, so, fine.
2018-06-23 10:32:28 -04:00
Ebrahim Byagowi
941f2b8548
Support pipe and friends on hb_blob_create_from_file (#1061)
With this hb-view/hb-shape support pipes and possibly socket and named pipe
also, anything fails just on mmap.

We can later do the same for Windows also.

This however reveals two issues, the fact most of our bots don't have HAVE_MMAP and using
this instead the other fread/fopen reader can make failure on CI. I should look at them separately
this change however is very low risk I believe.
2018-06-18 20:35:40 +04:30
Ebrahim Byagowi
d0c2889dfc
Revert file blob sanitization and index checking (#1062)
As https://github.com/harfbuzz/harfbuzz/pull/1059#issuecomment-397912812 we
like to still work with blobs that harfbuzz itself can't handle directly that are failing sanitization
currently apparently.
2018-06-18 19:59:33 +04:30
Ebrahim Byagowi
c53697d3f2
Verbose fail when something is wrong with hb-shape/hb-view input font file (#1059)
This checks if the blob isn't empty and uses `hb_face_count`
to see if the font file passes the simple font file sanitization
so can detect if the input is actually a font and checks also
whether input font-index is out of range.
2018-06-17 17:04:55 +04:30
Ebrahim Byagowi
aa0c5df419
Fix reading fonts from stdin (#1060)
We were passing the font path directly to freetype so rendering
was broken when we are getting the font from stdin.

This fixes it by using FT_New_Memory_Face instead.

This fixes:
* build/util/hb-view /dev/stdin text < font.ttf
* build/util/hb-view - text < font.ttf
* cat font.ttf | build/util/hb-view - text

but doesn't work on
* cat font.ttf | build/util/hb-view /dev/stdin text

which I will try to fix separately.
2018-06-17 16:49:34 +04:30
Behdad Esfahbod
3654d9be6b 1.8.1 2018-06-12 19:38:04 -04:00
Behdad Esfahbod
f3e58ab8a9 [docs] Enlist misc new symbols 2018-06-12 19:33:08 -04:00
Behdad Esfahbod
f6893ef82c Move hb-version.h generation to Makefile
Fixes https://github.com/harfbuzz/harfbuzz/issues/864

Unfortunately 1.7.7 and 1.8.0 went out with the wrong hb-version.h contents.
2018-06-12 19:26:15 -04:00
Behdad Esfahbod
cc0b04f48f [subset] Remove HB_SUBSET_BUILTIN
Just include hb-static.cc in libharfbuzz-subset.so source list as
well.  Those building it built-in will include hb-static.cc once
already.  No need for any gymnastics.
2018-06-12 18:24:54 -04:00
Behdad Esfahbod
ba0ea56efa [substitute-closure] Rename function for clarity 2018-06-12 01:17:00 -04:00
Behdad Esfahbod
7b5ce41638 Whitespace 2018-06-12 01:17:00 -04:00
Behdad Esfahbod
c4d0d11c55 [vector] Always 0-fill new items 2018-06-12 01:17:00 -04:00
Behdad Esfahbod
a7e1b4a3b2 Fix compiler warning re reordering of initializations 2018-06-12 01:17:00 -04:00
Behdad Esfahbod
f56cd9df10 Style 2018-06-12 01:17:00 -04:00
Jonathan Kew
a95cde15af [hb-set] Additional testcase for hb-set-intersect. 2018-06-12 01:16:42 -04:00
Jonathan Kew
82484b05ca [hb-set] Don't shrink vectors until after processing their contents.
Fixes #1054.
2018-06-12 01:16:42 -04:00
Ebrahim Byagowi
eb585033ca
Fetch the updated dwrite_1.h header from a better place
Following to https://ci.appveyor.com/project/harfbuzz/harfbuzz/build/1.0.1693/job/mfkjdhcdykjuqdfc
2018-06-11 03:47:43 +04:30
Behdad Esfahbod
b8e406f0c7 More fixes for SunStudio 12.6 build
Followup to https://github.com/harfbuzz/harfbuzz/pull/1053
2018-06-10 17:22:38 -04:00
prrace
498e4373dc Fix SunStudio 12.6 build (#1053) 2018-06-10 03:34:28 +04:30
Garret Rieger
46f7e7760f [subset] Use REPLACEME instead of version. 2018-06-08 12:09:34 -06: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
Garret Rieger
37eab27be3 [subset] Add fuzzing of gsub closure to hb-subset-fuzzer. 2018-06-08 12:09:34 -06:00
Garret Rieger
feb23892a3 [subset] Use gsub closure if ot layout is not being dropped. 2018-06-08 12:09:34 -06:00
Garret Rieger
a5673da9be [subset] Add drop_ot_layout setting to subset input. 2018-06-08 12:09:34 -06:00
Garret Rieger
57badadb76 [subset] add a new closure call to hb-ot-layout that can compute the closure over multiple lookups. 2018-06-06 17:50:12 -06:00
Behdad Esfahbod
11f1f4131b [set] Add is_subset
New API:
+hb_set_is_subset()
2018-06-06 16:47:13 -07:00
Garret Rieger
45186b9b8c [subset] Add memoization of GSUB lookup closures. 2018-06-06 16:53:50 -06:00