Commit Graph

3386 Commits

Author SHA1 Message Date
Behdad Esfahbod 9cd59db1af [USE] Implement topographical features for non-Arabic-joining scripts
This works per-syllable as per the spec, but we think it should be per
spacing/base/??? glyph instead.
2015-07-22 13:31:07 +01:00
Behdad Esfahbod ecb0b24ef3 Use foreach_cluster in Indic shaper 2015-07-22 12:02:09 +01:00
Behdad Esfahbod 56f71ff988 Use foreach_syllable in Myanmar shaper 2015-07-22 11:58:11 +01:00
Behdad Esfahbod ac596511a8 Add foreach_syllable
Use it in USE.
2015-07-22 11:54:02 +01:00
Behdad Esfahbod 8ba9e68968 [USE] Do Arabic-like shaping 2015-07-22 11:17:34 +01:00
Behdad Esfahbod 9daf2dfb6b Add hb-ot-shape-complex-arabic-private.hh 2015-07-22 10:49:13 +01:00
Behdad Esfahbod a51a661fe1 [USE] Only reorder the first component of a split left mark 2015-07-21 18:24:21 +01:00
Behdad Esfahbod a08a278b15 [USE] Don't compose split matras
Same logic as in Indic shaper.
2015-07-21 18:09:40 +01:00
Behdad Esfahbod 21cb08a417 Remove unused SEA shaper 2015-07-21 17:47:06 +01:00
Behdad Esfahbod db1e9cdd41 Retire SEA shaper in favor of USE 2015-07-21 17:46:06 +01:00
Behdad Esfahbod 87dde9c647 [USE] Only use USE shaper if script system is not DFLT
Same logic as Indic and SEA.
2015-07-21 17:31:43 +01:00
Behdad Esfahbod 29832d797f Route misc untested scripts through USE shaper instead of Indic
These were never tested with Indic shaper, and indeed wouldn't work there
because they didn't have their viramas and other config defined.  They are
all also supported by MS through USE, so route them there.
2015-07-21 17:24:18 +01:00
Behdad Esfahbod 40c4a991c7 [USE] Implement dotted-circle
This makes USE feature-complete as far as the Indic-like features
are concerned.
2015-07-21 17:14:54 +01:00
Behdad Esfahbod 7ce03ebe7c [USE] Move pref 2015-07-21 16:55:26 +01:00
Behdad Esfahbod 2d4b62ead9 [USE] Fix-up variation selectors and word joiner in table 2015-07-21 16:46:37 +01:00
Behdad Esfahbod ad7178227f [USE] Use a couple warnings 2015-07-21 16:43:27 +01:00
Behdad Esfahbod a85c4da9b1 [USE] Move rphf 2015-07-21 16:07:10 +01:00
Behdad Esfahbod 5b5617e066 Add FLAG_UNSAFE()
Unused right now.
2015-07-21 15:52:15 +01:00
Behdad Esfahbod f8160a4959 Add FLAG_SAFE() for values known to be small-enough
And add check to FLAG()
2015-07-21 15:50:02 +01:00
Behdad Esfahbod 366aeaad00 Add note re ASSERT_STATIC_EXPR_ZERO() 2015-07-21 15:45:48 +01:00
Behdad Esfahbod d6adca9fbb Remove unused macro ASSERT_STATIC_EXPR() 2015-07-21 15:17:27 +01:00
Behdad Esfahbod 1025e1a9e7 Use unsigned in FLAG() 2015-07-21 15:05:35 +01:00
Behdad Esfahbod cf59c7589c [USE] Use use_category() for rphf/pref memory 2015-07-21 14:51:45 +01:00
Behdad Esfahbod 595936ec25 [USE] Hook of rphf and pref custom processing
Still no reordering.
2015-07-21 14:15:35 +01:00
Behdad Esfahbod ba72801325 [USE] Add CGJ to table 2015-07-21 11:57:23 +01:00
Behdad Esfahbod 4febed61ed [USE] Set up features 2015-07-21 10:38:48 +01:00
Behdad Esfahbod 52a9577956 [USE] Hook up new scripts to USE shaper
Don't reroute scripts that we were routing to other shapers
before (just yet).
2015-07-21 10:02:04 +01:00
Behdad Esfahbod b4c0829bc1 [USE] Remove unused Unicode data enums from USE C++ side 2015-07-21 09:31:19 +01:00
Behdad Esfahbod 44910cef62 [USE] Finish converting Unicode positional categories to USE
Even compiles.
2015-07-20 18:01:10 +01:00
Behdad Esfahbod ad72555252 [USE] Map from Unicode data to USE syllabic categories
Positional sub-categories not applied yet.
2015-07-20 17:00:06 +01:00
Behdad Esfahbod 20e246e674 [USE] Start moving Unicode-to-USE mapping into Python code 2015-07-20 15:56:19 +01:00
Behdad Esfahbod eb74535cc2 [USE] Fix Number clusters
The spec wrongly has "H" where "HN" is meant.
2015-07-20 15:33:25 +01:00
Behdad Esfahbod a9663958fe [USE] Start putting together the shaper body 2015-07-20 14:24:55 +01:00
Behdad Esfahbod e0eabd7f67 [USE] Put a Ragel machine together
Grammar from the spec!
2015-07-20 13:50:38 +01:00
Behdad Esfahbod fd74b939b1 Minor 2015-07-20 13:30:45 +01:00
Behdad Esfahbod 5e5c8560cc [USE] Minor optimization of USE table 2015-07-20 12:01:20 +01:00
Behdad Esfahbod c48ff28852 [USE] Build Universal Shaping Engine data table from Unicode 8 files 2015-07-20 11:46:17 +01:00
Behdad Esfahbod e2c95116e1 [USE] Add Universal Shaping Engine to Makefile 2015-07-20 11:33:27 +01:00
Behdad Esfahbod 41a29af805 Update Arabic shaping table for Unicode 8.0 2015-07-15 01:39:57 +01:00
Behdad Esfahbod 64a2726e2c Add Unicode 8.0 scripts
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1183209
2015-07-15 01:36:39 +01:00
Behdad Esfahbod 9ae156b768 Fix pragma usage
https://bugs.freedesktop.org/show_bug.cgi?id=91228

Commit cdcdfe61b9 changed two `#pragma
message` to `#pragma error` in hb-unicode.cc, however MSVC uses #error,
just like the #else branch. `#pragma error` is an unknown pragma so
MSVC does not fail the build because of it, which I believe was the
intention of that commit.

If it's meant to be an #error, then the #ifdef for _MSC_VER can be
removed entirely.
2015-07-05 22:43:17 +01:00
ThePhD 8ad89f057d Spelling words is not my strong point. 2015-06-23 09:09:24 -04:00
ThePhD e0a828ecbd Back to using regular `strdup`, with an `hb-private.hh` fix that special-cases VC++'s
definition and usage of the words
2015-06-23 09:07:17 -04:00
ThePhD 8e545d5961 Fix all VC++ warnings and errors in the current commit's builds. 2015-06-22 22:29:04 -04:00
Behdad Esfahbod 5f13bbd9d4 When removing default-ignorables, merge clusters
Fixes test-shape, and:
https://code.google.com/p/chromium/issues/detail?id=497578
2015-06-19 13:31:49 -07:00
Behdad Esfahbod 82b521aeb7 Rewrite hide_default_ignorables
Separate the loops for the two cases of replacing with space
and deleting.  For deleting, use the out-buffer machinery.

Needed for upcoming cluster merge fix.
2015-06-19 13:26:03 -07:00
Behdad Esfahbod 351f68f4e0 [bindings] Fix hb_language_get_default() and hb_ot_tag_to_language()
Part of https://github.com/behdad/harfbuzz/issues/91
2015-06-12 17:46:06 -07:00
Behdad Esfahbod a5e4f6d608 Fix warnings: "member call on null pointer of type"
https://bugzilla.mozilla.org/show_bug.cgi?id=1167119
2015-06-10 10:57:46 -07:00
Behdad Esfahbod 8dacb7f8b4 Add include check to hb-ot-font.h 2015-06-03 11:53:42 -07:00
Sascha Brawer 01c3a88543 Fix "Since:" tags
Based on data from http://upstream-tracker.org/versions/harfbuzz.html
Resolves #103
2015-06-01 13:25:27 +02:00
Behdad Esfahbod f1b44303df Fix unary minus operator applied to unsigned int
Applying unary minus operator to unsigned int causes the following
warning on MSVS:

  warning C4146: unary minus operator applied to unsigned type, result still unsigned

Based on patch from Koji Ishi.

Fixes https://github.com/behdad/harfbuzz/pull/110
2015-05-21 14:00:15 -07:00
Behdad Esfahbod 1ae6cdb365 [gobject] Remove hb_language_t workarounds for g-i shortcomings
Using latest gobject-introspection, I don't seem to be having this
problem anymore:

  https://bugzilla.gnome.org/show_bug.cgi?id=707656

Removing that kludge makes language_t behave more like the way I expect it
in Python.

Also fixes:
https://github.com/behdad/harfbuzz/issues/91
2015-05-19 17:42:30 -07:00
Behdad Esfahbod ece434fa0f [gobject] Macroize value types
Fixes user_data_t
2015-05-19 17:20:58 -07:00
Behdad Esfahbod 9df099b483 [ft] Don't set *glyph in get_glyph() if glyph not found 2015-05-18 18:37:46 -07:00
Behdad Esfahbod 5801521532 Add note re OpenType 1.7 language tags 2015-05-06 00:40:31 -07:00
Roozbeh Pournader f6266ad291 [minor] Remove comment about Navajo OpenType code.
Apparently the code is already standardized:
https://www.microsoft.com/typography/otspec/languagetags.htm
2015-05-05 22:39:04 -07:00
Behdad Esfahbod 42b00118ea Merge pull request #102 from roozbehp/master
Add OpenType language tag 'NAV ' for Navajo.
2015-05-05 14:49:47 -07:00
Behdad Esfahbod be66ec5373 Use TRUE/FALSE instead of true/false in docs 2015-04-30 18:27:13 -04:00
Khaled Hosny d055e1fc78 Some attempt into initial hb-shape documentation
Very anaemic, needs to descripe the format understood by
hb_feature_from_string() etc., but it is just start.
2015-04-30 18:24:45 -04:00
Behdad Esfahbod 81bedda58c New API: hb_buffer_reverse_range() 2015-04-30 13:04:16 -04:00
Roozbeh Pournader cfeb0562eb Add OpenType language tag 'NAV ' for Navajo.
The code is not standardized yet, but is used in some Google fonts.
2015-04-29 09:32:42 -07:00
Jonathan Kew f724cc3516 Don't apply Arabic shaping to vertical text. 2015-04-24 12:19:02 -07:00
Behdad Esfahbod 97942420bb Update check-libstdc++ for clang 2015-04-23 18:56:24 -07:00
Behdad Esfahbod 39851ce84e [coretext] Oops; fix issue number for previous commit 2015-04-21 19:23:27 -07:00
Behdad Esfahbod 24f17afeaf [coretext] Fix positioning with trailing whitespace
Fixes https://code.google.com/p/chromium/issues/detail?id=476913
2015-04-21 19:21:32 -07:00
Behdad Esfahbod dba482fc44 [ot-font] Accept MS Symbol cmap if nothing else found 2015-04-17 13:08:08 -07:00
Behdad Esfahbod 3029e8b59d Revert "Add MSVC pragma for UTF-8 source code"
This reverts commit 89cbd4d953.

See discussion:
https://bugzilla.gnome.org/show_bug.cgi?id=747772
2015-04-14 13:32:22 -07:00
Behdad Esfahbod 89cbd4d953 Add MSVC pragma for UTF-8 source code
Not sure we have any right now; motivated by this:
https://bugzilla.gnome.org/show_bug.cgi?id=747772
2015-04-13 12:27:08 -07:00
Behdad Esfahbod 713f99ff61 Merge pull request #99 from khaledhosny/introspection-fixes2
More ntrospection fixes
2015-04-10 14:34:05 -07:00
Khaled Hosny 22524a514f [bindings] Fix hb_buffer_get_segment_properties
Annotate the output parameter.
2015-04-10 22:57:38 +02:00
Behdad Esfahbod 1086f21e54 Merge branch 'hb-fc' 2015-04-10 12:21:04 -07:00
Khaled Hosny 04f89e8f7d [bindings] Fix ownership of returned hb_language_t
It should not be freed by the caller.
2015-04-10 18:17:02 +02:00
Konstantin Ritt 855a5d7cb8 Fix build on WEC2013
Based on patch from Björn Breitmeyer
2015-04-10 17:18:01 +04: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 9c974360fe Minor rename 2015-04-09 12:04:14 -07:00
Behdad Esfahbod f3b170bdd9 Minor 2015-04-08 16:26:24 -07:00
Behdad Esfahbod 2958f2c147 Fixup 2015-04-08 16:26:16 -07:00
Behdad Esfahbod b931e0b0ce Fix warnings
Part of https://github.com/behdad/harfbuzz/pull/68
2015-04-08 14:43:33 -07:00
Behdad Esfahbod cdcdfe61b9 Err, instead of warn, if mutex / atomic / unicode funcs are missing
Hopefully this results in fewer badly built HarfBuzz integrations.
2015-04-08 13:25:04 -07:00
Behdad Esfahbod fc3c59a1d7 Fix unused var warnings 2015-04-08 13:04:29 -07:00
Konstantin Ritt 3f174cd020 Minor refactoring to the atomics implementation
s/atomic_int/atomic_int_impl/ and s/atomic_ptr/atomic_ptr_impl/
to bring it in par with hb_mutex_impl_t, then re-introduce
hb_atomic_int_t as a wrapper around hb_atomic_int_impl_t.

In hb_reference_count_t, make it clear the non-atomic get and set
are intentional due to nature of the cases they are used in
(comparison to -1 and the debug output/tracing).
2015-04-08 13:04:22 -07:00
Behdad Esfahbod 24930d544e Minor 2015-04-08 12:52:06 -07:00
Behdad Esfahbod 45a8b46f47 Allow implementing atomic and mutex ops in config
Motivated by
https://github.com/behdad/harfbuzz/pull/92
2015-04-08 12:49:38 -07:00
Behdad Esfahbod 3fe4e92bc5 Minor 2015-04-08 12:49:23 -07:00
Behdad Esfahbod ce01ad7c2f MSVC 2015 supports snprintf and not _snprintf 2015-04-01 11:05:59 -07:00
Behdad Esfahbod 560718862f Move WinCE define to better place 2015-04-01 11:04:58 -07:00
Behdad Esfahbod aee685086c Fix VC++ /analyze warnings
out\debug\hb-buffer-deserialize-text.rl(47) : warning C6001: Using
uninitialized memory 'pos'.
2015-03-26 14:13:53 -04:00
Khaled Hosny a394bb6670 [bindings] Fix *_from_string functions
Without the element-type they will be getting garbage, at least with
Python.
2015-03-22 20:29:10 +02:00
Behdad Esfahbod 9e401f6890 Fix reverse_range() for empty range
Fixes coretext notdef loop consisting of all default_ignorable glyphs

https://code.google.com/p/chromium/issues/detail?id=464755
2015-03-20 16:08:38 -04:00
Behdad Esfahbod 98e3ea8e34 Fix hb-uniscribe build 2015-03-04 12:03:39 -08:00
Behdad Esfahbod 8ac345e5c0 Fix reverse_range() to only reverse alt array if positions are used
In hb-coretext, when we were using scratch buffer for book-keeping,
a reverse_range() caused by the notdef-insertion loop could mess up
our log_clusters.  Ouch!
2015-03-02 16:06:55 -08:00
Behdad Esfahbod 5f541f8f7b Minor refactoring 2015-02-25 15:43:35 -08:00
Behdad Esfahbod ef79bdf73b Minor 2015-02-25 15:43:35 -08:00
Behdad Esfahbod 68e04afbb1 Typo 2015-02-25 15:43:34 -08:00
Behdad Esfahbod 55553699b3 Minor 2015-02-25 15:43:34 -08:00
Behdad Esfahbod 5175300fba [layout] Fix comparison of GlyphID and hb_codepoint_t
Before, the IntType::cmp functions providing this and was truncating
the hb_codepoint_t to 16bits before comparison.  I have no idea how
this was never discovered, and I'm too lazy to try to reproduce this
with Pango (which uses non-16bit codepoint numbers for missing glyphs).
2015-02-25 15:43:34 -08:00
Behdad Esfahbod 7cce809cb1 Remove unused (and wrong as of a few commits ago) cmp() function 2015-02-25 15:43:34 -08:00
Behdad Esfahbod 8e3d4bae03 Minor 2015-02-25 15:43:33 -08:00
Behdad Esfahbod f47cf1f12d Minor 2015-02-25 15:43:33 -08:00
Behdad Esfahbod 640b66c634 [layout] If lookup has only one subtable, move the forward loop down to subtable
I was hoping to see a nice speedup, but it resulted in a very minor one.
2015-02-25 15:43:33 -08:00
Behdad Esfahbod e2f50f2a7e [layout] Add apply_forward / apply_backward 2015-02-25 15:43:32 -08:00
Behdad Esfahbod 1d4a328472 [layout] Remove unneeded return value from apply() 2015-02-25 15:43:32 -08:00
Behdad Esfahbod bbdd6fd21c Minor simpilfy BEInt 2015-02-25 15:43:32 -08:00
Behdad Esfahbod 88a399acdc Optimize IntType comparison to avoid branches for 16bit numbers 2015-02-25 15:43:32 -08:00
Behdad Esfahbod 37de2d5331 Minor simplify IntType 2015-02-25 15:43:31 -08:00
Behdad Esfahbod bd047d3b7f [layout] Minor 2015-02-25 15:43:31 -08:00
Behdad Esfahbod b9d3f60520 [layout] Minor 2015-02-25 15:43:31 -08:00
Behdad Esfahbod 1a2322134a [layout] Don't check glyph props against lookup flags when recursing
Shouldn't be needed.  I have a hard time imagining this breaking any
legitimate use case.
2015-02-25 15:43:30 -08:00
Behdad Esfahbod 095a1257cc [layout] Port sanitize() to use dispatch()
Needed some rework of Extension table.  Hopefully I got it right, and
the new template usage doesn't break any compilers...
2015-02-25 15:43:30 -08:00
Behdad Esfahbod 758fb20630 Remove unused macro 2015-02-25 15:43:30 -08:00
Behdad Esfahbod 40c58923cb [layout] Refactor Lookup::dispatch() 2015-02-25 15:43:30 -08:00
Behdad Esfahbod 70366f5d19 [layout] Refactor get_subtable() 2015-02-25 15:43:29 -08:00
Behdad Esfahbod f72f326aea Minor 2015-02-25 15:43:29 -08:00
Behdad Esfahbod 8e36ccfd4f [layout] Use dispatch() for add_coverage() 2015-02-25 15:43:29 -08:00
Behdad Esfahbod 50b8dc79da [layout] Add may_dispatch()
No functional change right now.
2015-02-25 15:43:29 -08:00
Behdad Esfahbod de2118ed7a Make sanitize() a const method
This makes a lot of code safer.  We only try modifying the object in one
place, after making sure it's safe to do so.  So, do a const_cast<> in
that one place...
2015-02-25 15:43:28 -08:00
Behdad Esfahbod 6759ed95a3 Minor 2015-02-25 15:43:28 -08:00
Behdad Esfahbod 6b599dac1f Remove unnecessary check in sanitize 2015-02-25 15:43:28 -08:00
Behdad Esfahbod 365576d246 [layout] Allocate iters in the context
Can be further optimized, but I think I didn't break anything.

Saves another 3% off Roboto shaping.
2015-02-25 15:43:28 -08:00
Behdad Esfahbod 514564f544 [layout] Move skippy_iter setup from constructor into init() 2015-02-25 15:43:27 -08:00
Behdad Esfahbod b051be542a [lookup] Add skippy_iter.reset()
Towards reducing the cost of initializing skippy_iter()
2015-02-25 15:43:27 -08:00
Behdad Esfahbod 2cecc38c7c [layout] Shuffle code around 2015-02-25 15:43:27 -08:00
Behdad Esfahbod 696266981d [layout] Merge forward and backward iterators 2015-02-25 15:43:26 -08:00
Behdad Esfahbod 1f038eec3c [layout] Fix backward reject()
Has no functional effect since reject was never used with
match_glyph_data.
2015-02-25 15:43:26 -08:00
Behdad Esfahbod 37d13acd8d [layout] Remove some unnecessary checks in skippy 2015-02-25 15:43:26 -08:00
Behdad Esfahbod baa14e1814 [lookup] Don't initialize skippy if coverage match fails
Currently:

  - Initializing skippy is very expensive,

  - Our lookup accelerator (using set-digests) can be very ineffecite,

As such, we end up many times initializing skippy but then failing
coverage check.  Reordering fixes that.

When, later, we fix our accelerator to have truly small false-positive
rate (for example by using the frozen-sets), then we might want to
reorder these checks such that we wouldn't calculate coverage number
if skippy is going to fail.

This shows a 5% speedup with Roboto already.
2015-02-25 15:43:26 -08:00
Behdad Esfahbod 7788993bc1 [layout] Use setter method to set c->lookup_props 2015-02-25 15:43:25 -08:00
Behdad Esfahbod f4ee48fd7b [layout] Remove unused wrapper method 2015-02-25 15:43:25 -08:00
Behdad Esfahbod 7b7129c7a9 Add hb_frozen_set_t
I experimented with replacing use of hb_set_digest_t with this new
hb_frozen_set_t, hoping to get a huge speedup for busy lookups
(like kern lookup in Roboto), but I only got 6% speendup in Roboto
and 4% in NotoNastaliqUrduDraft :(.
2015-02-25 15:43:25 -08:00
Behdad Esfahbod 241eac9559 Hide internals of lookup accelerators 2015-02-25 15:43:25 -08:00
Konstantin Ritt 9768e651be Fix build with MSVC on CE
This code is C++ only. There isn't a single C++ compiler that fails to
understand the "inline" keyword, since it's required by C++98. Any
compiler older than C++98 is likely to choke on the template usage
further down, so this isn't necessary.

Moreover, the C++ standard says you cannot define macros.
[lib.macro.names] says "Nor shall such a translation unit define macros
for names lexically identical to keywords." -- technically, it's a
promise that the Standard Library headers won't do it, the wording means
that the entire translation unit won't do it, which implies no source
can do it.

MSVC complains about it:
fatal error C1189: #error : The C++ Standard Library forbids macroizing
keywords. Enable warning C4005 to find the forbidden macro.

Author: Thiago Macieira <thiago.macieira@intel.com>
2015-02-14 00:58:51 +04:00
Behdad Esfahbod 7888a6b07a [ft] Handle negative scales with vertical writing 2015-01-28 12:40:40 -08:00
Behdad Esfahbod 982d94eaa2 [coretext] Don't generate notdef glyph for default-ignorables
As discovered on Chrome Mac:
https://code.google.com/p/chromium/issues/detail?id=452326
2015-01-28 10:51:33 -08:00
Behdad Esfahbod 6917a045fd [coretext] Unbreak glyph positioning in presence of notdef runs
As discovered on Chrome Mac:
https://code.google.com/p/chromium/issues/detail?id=452326

This was originally broken in:

	commit 5a0eed3b50
	Author: Behdad Esfahbod <behdad@behdad.org>
	Date:   Mon Aug 11 23:47:16 2014 -0400

	    [coretext] Implement vertical shaping
2015-01-28 10:50:54 -08:00
Behdad Esfahbod 1eff435023 Minor optimization 2015-01-27 12:26:04 -08:00
Konstantin Ritt 675956aca0 Do not leak hb_language_t on hb_language_item_t destruction 2015-01-27 10:06:56 -08:00
Konstantin Ritt b306f9674a Minor improvement to HB_SHAPER_DATA_DESTROY 2015-01-27 10:02:34 -08:00
Behdad Esfahbod 61820bc4ca [API] Add hb_buffer_add_latin1()
This is by no ways to promote non-Unicode encodings.  This is an entry
point that takes Unicode codepoints that happen to all be the first
256 characters and hence fit in 8bit strings.  This is useful eg in Chrome
where strings that can fit in 8bit are implemented that way, and this
avoids copying into UTF-8 or UTF-16.

Perhaps we should rename this to hb_buffer_add_codepoints8().  I'm also
curious if anyone would be really interested in hb_buffer_add_codepoints16().

Please discuss!
2015-01-26 14:25:52 -08:00
Behdad Esfahbod 78c6e86c04 Fix hb_buffer_add_codepoints to actually NOT validate 2015-01-26 14:08:36 -08:00
Konstantin Ritt f3537b620b Move some code around
Just to keep Windows specific workarounds in a single place.
2015-01-25 09:50:51 +04:00
Konstantin Ritt afb62d88d7 Do not define MemoryBarrier on WinCE
There is a _HBMemoryBarrier() wrapper function that emulates
MemoryBarrier() behavior when it is not defined.
2015-01-25 08:16:26 +04:00
Konstantin Ritt 7db326a15b Fix build on WinRT
There is no environment (like WinCE) and the basic version
of InitializeCriticalSection is unsupported.

https://codereview.qt-project.org/#/c/92496/
2015-01-25 08:13:24 +04:00
Behdad Esfahbod a319d0777b [ft] Handle negative x_scale / y_scale 2015-01-23 12:44:24 -08:00
Behdad Esfahbod b0b38bb892 [coretext] Fix positioning of notdef 2015-01-21 19:19:33 -08:00
Behdad Esfahbod 70622e5089 [coretext] Fix scaling
Before we were not accounting for possible differences in x_scale and
y_scale, as well as the signs of those.  All should be in good shape
now.
2015-01-21 18:51:42 -08:00
Behdad Esfahbod 221ba02b08 [coretext] Use vertical advance for notdef in vertical direction 2015-01-21 18:51:42 -08:00
Behdad Esfahbod 7988da24c5 Add convenience make target "make lib" in src/ 2015-01-21 18:33:50 -08:00
Behdad Esfahbod 67dfa8c7c2 When matching second glyph of kerning pairs, use bsearch
Roboto has glyphs (like 'F') that have 200 kerning pairs.
Add a handcoded bsearch instead of previous linear search.

This doesn't show much speedup though, apparently we spend the
bulk of the time somewhere before here.
2015-01-19 17:00:31 -08:00
Behdad Esfahbod e9f5c65be0 [bindings] Minor 2015-01-19 16:15:32 -08:00
Roozbeh Pournader 5eb939ddfe Change New Tai Lue shaping engine from SEA to default
This is to reflect the UTC decision to change the encoding model of
New Tai Lue from logical to visual to be similar to Thai, Lao, and
Tai Viet: http://www.unicode.org/L2/L2014/14250.htm#141-C26

The visual encoding is already the current practice of encoding New
Tai Lue on the web anyway:
http://www.unicode.org/L2/L2014/14195-newtailue.txt

Fixes behdad/harfbuzz#66.
2015-01-18 14:39:18 -08:00
Behdad Esfahbod 1aaa7d6799 [indic] Fix out-of-bounds access 2015-01-17 20:16:56 -08:00
Behdad Esfahbod 238d6a38f2 [bindings] Update sample.py 2015-01-07 10:51:44 -08:00
Behdad Esfahbod 2cd5323531 [bindings] Use hb_glib_blob_create() in sample
hb_blob_create() is considered C-only API.
2015-01-06 19:16:38 -08:00
Behdad Esfahbod 0ef179e2dc [glib] Add hb_glib_blob_create() that takes GBytes 2015-01-06 16:58:33 -08:00
Behdad Esfahbod b91904a40d [bindings] Replace deprecated allow-none with optional and nullable 2015-01-06 15:43:14 -08:00
Behdad Esfahbod 81a31f3eff [bindings] Make sample Python 2/3 compatible 2015-01-06 15:37:31 -08:00
Behdad Esfahbod b632e7997d Fix up gobject-introspection a bit
Minimal shaping works now!
2015-01-06 14:05:26 -08:00
Chris Peterson fb85d618f5 Add #ifdef HB_USE_ATEXIT to fix -Wunused-function warnings 2015-01-04 19:31:10 -08:00
Chris Peterson d1897a98d8 Fix hb_atomic_ptr_cmpexch -Wunused-value warnings 2015-01-03 19:46:19 -08:00
Behdad Esfahbod f34aaba868 [ft] Don't set font ppem
For discussion see:

  http://lists.freedesktop.org/archives/harfbuzz/2012-April/001905.html

Over time we have had added NO_HINTING all over the place in hb-ft.  Finish it off.
Not setting ppem on hb-font disables get_contour_point() calls which is good anyway.

See comments in the commit.
2014-12-28 18:56:15 -08:00
Behdad Esfahbod 350f3a02ce [ft] Add hb_ft_face_create_referenced() and hb_ft_font_create_referenced()
When I originally wrote hb-ft, FreeType objects did not support reference
counting.  As such, hb_ft_face_create() and hb_ft_font_create() had a
"destroy" callback and client was responsible for making sure FT_Face is
kept around as long as the hb-font/face are alive.

However, since this was not clearly documented, some clienets didn't
correctly did that.  In particular, some clients assumed that it's safe
to destroy FT_Face and then hb_face_t.  This, indeed, used to work, until
45fd9424c7, which make face destroy access
font tables.

Now, I fixed that issue in 395b35903e since
the access was not needed, but the problem remains that not all clients
handle this correctly.  See:

  https://bugs.freedesktop.org/show_bug.cgi?id=86300

Fortunately, FT_Reference_Face() was added to FreeType in 2010, and so we
can use it now.  Originally I wanted to change hb_ft_face_create() and
hb_ft_font_create() to reference the face if destroy==NULL was passed in.
That would improve pretty much all clients, with little undesired effects.
Except that FreeType itself, when compiled with HarfBuzz support, calls
hb_ft_font_create() with destroy==NULL and saves the resulting hb-font on
the ft-face (why does it not free it immediately?).  Making hb-face
reference ft-face causes a cycling reference there.  At least, that's my
current understanding.

At any rate, a cleaner approach, even if it means all clients will need a
change, is to introduce brand new API.  Which this commit does.

Some comments added to hb-ft.h, hoping to make future clients make better
choices.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=75299
2014-12-28 17:59:28 -08:00
Behdad Esfahbod 9a3b74884b Remove redundant check for FT_Face_GetCharVariantIndex
We require FreeType >= 2.8.3.  This symbol was introduced earlier
than that.
2014-12-28 17:27:39 -08:00
Behdad Esfahbod affacf2f37 [ft] Open blob in READONLY mode
HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE is deprecated and fairly
useless now.
2014-12-28 16:20:31 -08:00
Behdad Esfahbod 395b35903e Avoid accessing layout tables at face destruction
"Fixes" https://bugs.freedesktop.org/show_bug.cgi?id=86300

Based on discussion someone else who had a similar issue, most probably
the user is releasing FT_Face before destructing hb_face_t / hb_font_t.
While that's a client bug, and while we can (and should) use FreeType
refcounting to help avoid that, it happens that we were accessing
the table when we didn't really have to.  Avoid that.
2014-12-28 16:03:26 -08: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 d5a5052098 Assert that blob length doesn't overflow address.
This will crash now, if blob was created with wrong length.
Check for that coming next commit.
2014-12-18 18:09:41 -08:00
Behdad Esfahbod 093c520de5 [otlayout] Mark variables that are C arrays as opposed to OT::ArrayOf 2014-12-12 21:07:53 -08:00
Behdad Esfahbod 9df0a52030 [otlayout] Avoid invalid access with Context format 3 2014-12-12 20:54:28 -08:00
Behdad Esfahbod 295ef1dd52 [ot] Debug get_coverage 2014-12-12 20:43:18 -08:00
Behdad Esfahbod 00f6a8e334 [ot] Print format in dispatch trace 2014-12-12 20:36:49 -08:00
Behdad Esfahbod 5c7d6f02d7 Minor 2014-12-12 20:28:49 -08:00
Behdad Esfahbod 153beebba9 [ot] Make sure all toplevel tables have tableTag 2014-12-12 19:46:09 -08:00
Behdad Esfahbod 282b13f9b4 [sanitize] Improve debug output some more 2014-12-12 19:34:49 -08:00
Behdad Esfahbod 0766ee1f4e [sanitize] Improve debug output 2014-12-12 18:23:20 -08:00
Behdad Esfahbod e6f80fa104 [indic] Allow ZWJ/ZWNJ before SM
In Oriya, a ZWJ/ZWNJ might be added before candrabindu to encourage
or stop ligation of the candrabindu.  This is clearly specified in
the Unicode section on Oriya.  Allow it there.  Note that Uniscribe
doesn't allow this.

Micro tests added using Noto Sans Oriya draft.

No changes in numbers.  Currently at:

BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%)
DEVANAGARI: 707307 out of 707394 tests passed. 87 failed (0.0122987%)
GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%)
GURMUKHI: 60732 out of 60747 tests passed. 15 failed (0.0246926%)
KANNADA: 951190 out of 951913 tests passed. 723 failed (0.0759523%)
KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%)
MALAYALAM: 1048147 out of 1048334 tests passed. 187 failed (0.0178378%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271662 out of 271847 tests passed. 185 failed (0.068053%)
TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
2014-12-10 12:05:24 -08:00
Behdad Esfahbod fde3e4a423 In hb_ot_collect_glyphs(), don't recurse to a lookup more than once
Otherwise, we might process a lookup thousands of times, with no
benefit.  This pathological case was hit by Noto Nastaliq Urdu Draft
in Firefox's code to determine whether space glyph is involved in
any GSUB/GPOS rules.  A test page is at http://behdad.org/urdu

See:
https://bugzilla.mozilla.org/show_bug.cgi?id=1090869
2014-10-29 11:23:08 -07:00
Behdad Esfahbod 5a5640d850 Move code around 2014-10-14 21:26:13 -07:00
Behdad Esfahbod 666b42f73b Move macros around
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=84491
2014-10-14 21:24:59 -07:00
Behdad Esfahbod 5c87120b81 Fix misc warnings
Fixes https://github.com/behdad/harfbuzz/pull/51
2014-10-14 20:07:31 -07:00
Behdad Esfahbod 8afaf09687 [ft] Add NO_HINTING in a couple other places 2014-10-02 16:40:41 -04:00
Behdad Esfahbod 5de0407337 Help clang with gcov 2014-10-01 18:18:25 -04:00
Behdad Esfahbod c0b82ba32a Create ragel-generated files in srcdir 2014-10-01 14:24:07 -04:00
Behdad Esfahbod 79bbb10b0d Clean ragel-generated headers in maintainercleanfiles 2014-10-01 13:33:21 -04:00
Behdad Esfahbod 8971cac83e Don't use tmp files in Makefile
Useful for code-coverage generation of the ragel-generated files
as they will now contain the correct .hh filename in them.
2014-10-01 12:42:16 -04:00
Behdad Esfahbod 2272318665 check-static-inits: Filter out zero-length sections
When compiling with -O0, zero-sized constructors were showing up
and confusing the test.
2014-10-01 11:56:07 -04:00
Behdad Esfahbod b695a3dc23 check-static-inits: check for static finalizers 2014-10-01 11:55:14 -04:00
Behdad Esfahbod 250398b1e4 Hide other bubble-sort 2014-10-01 11:28:59 -04:00
Behdad Esfahbod c1e8744262 Hide bubble-sort! 2014-10-01 11:07:08 -04:00
Behdad Esfahbod 156852991e [ot-font] Add hb_ot_face_cmap_accelerator_t 2014-09-25 17:45:49 +03:00
Behdad Esfahbod d088ccaf11 [ot-font] Minor 2014-09-25 17:26:56 +03:00
Behdad Esfahbod d7c160a153 [ot-font] Handle missing vertical metrics tables 2014-09-25 17:15:35 +03:00
Behdad Esfahbod be1cca2702 [ot-font] Add metrics_accel_t 2014-09-25 16:53:24 +03:00
Behdad Esfahbod d41b809e9d [ot-font] Start adding vertical support 2014-09-25 13:22:01 +03:00
Behdad Esfahbod 22f0de5025 Fix build 2014-08-25 12:54:57 -04:00
Behdad Esfahbod d457e3f0ff [arabic] Don't #include __FILE__
Fine!

https://code.google.com/p/chromium/issues/detail?id=406957
2014-08-25 12:31:19 -04:00
Behdad Esfahbod 9ceb673d9c [arabic] Allow disabling win1256 fallback code
By defining HB_NO_WIN1256.
2014-08-25 11:48:12 -04:00
Behdad Esfahbod 8a93195021 [ot] Prefer Windows platform cmap tables / accept all Unicode encodingIDs
Some fonts on the Mac ship with (0,1).
2014-08-22 12:06:57 -04:00
Behdad Esfahbod 270971a0fc [win32] Avoid preprocessor warnings re macros 2014-08-15 14:28:04 -04:00
Behdad Esfahbod 8c6bd34d38 Fix check-symbols on OS X 2014-08-14 13:33:37 -04:00
Behdad Esfahbod 522b1cc526 [coretext] Hide feature_mappings 2014-08-14 13:29:30 -04:00
Behdad Esfahbod 0d2c2f238b Simplify hb-object 2014-08-14 13:25:55 -04:00
Behdad Esfahbod 9d861b81f3 Really fix clang build this time 2014-08-14 13:15:21 -04:00
Behdad Esfahbod 272226f294 Revert "Fix build on clang after previous commit"
This reverts commit 9c80cbc87f.
2014-08-14 13:11:33 -04:00
Behdad Esfahbod 9c80cbc87f Fix build on clang after previous commit 2014-08-14 13:09:52 -04:00
Behdad Esfahbod a5a27073cf Rewrite this==NULL checks to avoid undefined behavior
Fixes https://code.google.com/p/chromium/issues/detail?id=403594
2014-08-14 13:05:36 -04:00
Behdad Esfahbod cc3b2d432b Remove this==NULL check from face->reference_table()
Not supposed to happen, and apparently this is undefined in C++.
https://code.google.com/p/chromium/issues/detail?id=403594
2014-08-14 13:00:47 -04:00
Behdad Esfahbod cd7ea4f791 Make hb_object_t members private
In preparation for fixing:
https://code.google.com/p/chromium/issues/detail?id=403594
2014-08-14 12:57:02 -04:00
Behdad Esfahbod 20076cc41e [coretext] Add version guards for kCTLanguageAttributeName 2014-08-12 19:26:35 -04:00
Behdad Esfahbod 1b3011c27d [coretext] Pass buffer language to CoreText 2014-08-12 19:17:49 -04:00
Behdad Esfahbod 3eb6a4dbf2 [coretext] Minor 2014-08-12 19:17:45 -04:00
Behdad Esfahbod 08acfe0d3a [hb-coretext] Fix cluster order of notdef runs in RTL text 2014-08-12 19:17:45 -04:00
Behdad Esfahbod 30eed75de2 [shape-plan] Fix typo!
The only effect is, if shaper_list was not NULL and no shaper was found,
we now don't insert anything into cache and return earlier.
2014-08-12 17:15:09 -04:00
Behdad Esfahbod dc9aba6fc5 [shape-plan] Better debug messages 2014-08-12 17:14:36 -04:00
Behdad Esfahbod e956c65bf7 [shape-plan] Simplify macro 2014-08-12 17:06:50 -04:00
Behdad Esfahbod 29e25550ce Fix gcc warning 2014-08-12 17:06:50 -04:00
Behdad Esfahbod 8d5eebc0c6 [shape-plan] Fix shape-plan caching with more than one requested shaper
Wasn't breaking out of loop, ouch!

http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1246370.html
2014-08-12 17:06:50 -04:00
Behdad Esfahbod bc3d0dc601 [shape-plan] Add debug tracing 2014-08-12 17:06:50 -04:00
Behdad Esfahbod 81b8d9777b [coretext] Fix buffer resizing
Was very broken.  Now fixed and tested.
2014-08-12 15:50:15 -04:00
Behdad Esfahbod c3e924fb9e [coretext] Rewind scratch-allocated arrays when not needed anymore 2014-08-12 15:50:15 -04:00
Behdad Esfahbod 8fd4d70b14 [wince] Two more Windows CE fixes
Report has it that it builds (and works) now:

  https://codereview.qt-project.org/#/c/92087/
2014-08-12 13:12:31 -04:00
Behdad Esfahbod fd0001d7db [coretext] Compare CGFont and PS name, if CTFont didn't match
See comments.

Fixes vertical text.  CoreText backend is in very good shape now!

Also see:
5a0eed3b50
25f4fb9b56

Fixes http://github.com/behdad/harfbuzz/pull/36
2014-08-12 10:34:01 -04:00
Behdad Esfahbod 5a0eed3b50 [coretext] Implement vertical shaping
Currently doesn't work though, we detect font fallback.  Apparently
matching on ct_font is not safe for this.  Looks like commit
25f4fb9b56 wasn't enough after all.
2014-08-11 23:47:16 -04:00
Behdad Esfahbod 1b55077f03 [coretext] Remove unnecessary alt_size
Wasn't needed after a6b8dc8742.
2014-08-11 20:45:12 -04:00
Behdad Esfahbod 10b1104d79 [coretext] Use CFRunStatus
Assert that all runs had expected direction, and take hint for
non-monotone clusters.
2014-08-11 20:02:45 -04:00
Behdad Esfahbod fd1a6aa8d0 [coretext] Minor 2014-08-11 20:01:37 -04:00
Behdad Esfahbod 130856c705 [coretext] Remove debug printf! 2014-08-11 19:16:26 -04: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 104484cefe Minor 2014-08-11 18:24:36 -04:00
Behdad Esfahbod 4acce77db7 [coretext] Pass buffer direction to CoreText
Have to use a CTTypesetter for this.
2014-08-11 17:46:50 -04:00
Behdad Esfahbod 5ec45dd37c [coretext] Minor
It's hard to handle all possible NULL returns from CoreText.  Add one
more...
2014-08-11 17:46:12 -04:00
Behdad Esfahbod 624a299b82 [coretext] Attach marks to base clusters
Fixes https://githu.com/behdad/harfbuzz/issues/49
to the extent that it can be fixed.
2014-08-11 15:29:18 -04:00
Behdad Esfahbod 3c41ccb535 [coretext] Use input clusters
Before, this shaper was returning UTF-16 cluster indices instead of
returning whatever cluster values the user had had set up in the buffer.
Ouch!
2014-08-11 15:11:59 -04:00
Behdad Esfahbod a6b8dc8742 [coretext] Fix buffer resize handling
We can't really resize buffer and continue in this shaper as we are
using the scratch buffer for string_ref and log_cluster.  Restructure
shaper to retry from (almost) scratch.
2014-08-11 15:08:53 -04:00
Behdad Esfahbod 9b3c60c88b [coretext] Always compute log_clusters
To be used soon.
2014-08-11 13:46:56 -04:00
Behdad Esfahbod 15c633dd1f Minor 2014-08-11 13:42:59 -04:00
Behdad Esfahbod 9ce067c775 [coretext] Simplify cluster mapping 2014-08-11 02:44:50 -04:00
Behdad Esfahbod 49f7fb6376 [coretext] Minor 2014-08-10 19:19:38 -04:00
Behdad Esfahbod 25f4fb9b56 [coretext] Fix fallback detection
Fixes http://github.com/behdad/harfbuzz/pull/36
2014-08-10 19:05:52 -04:00
Behdad Esfahbod 77a7a53ace [coretext] Fix last range
Test with:

hb-view /Library/Fonts/Zapfino.ttf ZapfinoZapfino --features=-dlig[7:] --shaper=coretext
2014-08-10 19:05:52 -04:00
Behdad Esfahbod c2b151d952 Fix hb_in_range() for types smaller than int
As exercised by hb-coretext .notdef code.
2014-08-10 19:05:52 -04:00
Behdad Esfahbod 26a963b9cb [wince] Try to fix some stuff on Windows CE
Based on errors seen here:
http://testresults.qt-project.org/ci/QtBase_dev_Integration/build_03837/wince70embedded-armv4i-msvc2008_Windows_7/log.txt.gz

Fully untested.
2014-08-10 18:05:24 -04:00
Behdad Esfahbod 92aeee3f04 Minor 2014-08-10 17:42:19 -04:00
Behdad Esfahbod b9993d8d6d [coretext] Fix assert on Yosemite
Apparently those functions documented as sometimes returning NULL
actually exercise that right in OS X 10.10 Yosemite.  The scratch
was too small for that.  I *think* I fixed it, but haven't tested
as I don't have Yosemite.
2014-08-10 17:40:24 -04:00
Behdad Esfahbod 087733dd66 [coretext] Use CGFont as face_data 2014-08-10 17:33:16 -04:00
Behdad Esfahbod d277c3d7ee [arabic] Bug 82306 - Mandaic had errors in its Unicode Joining_Type
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=82306
2014-08-07 15:38:52 -04:00
Behdad Esfahbod 38fb30d742 Use atexit() only if it's safe to call from shared library
Apparently they are not (advertised as?) safe on BSD systems.
We ignore the case of static libraries.

Whitelisted on glibc, Android, and MSVC / mingw.

https://bugs.freedesktop.org/show_bug.cgi?id=82246
2014-08-06 13:34:49 -04:00
Behdad Esfahbod d5e61470fa [arabic] Fix fallback shaping regression
Was broken in 615d00ea25.

Fixes https://github.com/behdad/harfbuzz/pull/48

Micro-test added.
2014-08-05 14:19:36 -04:00
Behdad Esfahbod d7c850f803 [uniscribe] Minor 2014-08-02 19:07:53 -04:00
Behdad Esfahbod 8f3eebf7ee Make sure gsubgpos buffer vars are available during fallback_position
Add buffer var allocation asserts to a few key places.
2014-08-02 19:07:49 -04:00
Behdad Esfahbod 2053f369f8 Disable 'liga' for vertical text
The reason we turned it on is because Kazuraki uses it.  But that's
not reason enough.  Until the OpenType spec gets its act together re
adding design-direction to lookups, this is better user experience.
2014-08-02 16:31:16 -04:00