Commit Graph

138 Commits

Author SHA1 Message Date
Behdad Esfahbod 91126aa11a [uniscribe] Update for recent changes 2018-08-02 02:03:13 -07:00
Behdad Esfahbod ed7b2e58fc Remove OT namespace from hb-machinery-private.hh 2018-08-02 00:08:08 -07:00
Behdad Esfahbod 3d22aefede Rename 2018-08-01 18:03:32 -07:00
Behdad Esfahbod e7737b41d7 Add sanitizer reference_table, also fix clang build
Clang is being really peculiar.  Fix with:

-  inline hb_blob_t *sanitize (hb_blob_t *blob) { return c->sanitize<Type> (blob); }
+  inline hb_blob_t *sanitize (hb_blob_t *blob) { return c[0].template/*clang idiosyncrasy*/sanitize_blob<Type> (blob); }
2018-07-22 22:24:31 -07:00
Behdad Esfahbod be458eb059 Include more basic internal headers from hb-private.hh 2018-07-10 14:41:04 +02:00
Behdad Esfahbod f7515769fd [vector] Use Crap pool in push() as well 2018-06-01 17:48:37 -07:00
Behdad Esfahbod 65aeabd622 Add hb_vector_t::push(const Type &v)
Makes for cleaner code.
2018-05-24 13:53:02 -07:00
Ebrahim Byagowi 93bdf9b2df
Use arrayZ on hb-coretext and hb-uniscribe and fix macOS/Win bots (#1024)
Following to 63f57f4
2018-05-09 23:24:17 +04:30
Behdad Esfahbod 37b95612d4 Remove hb_auto_array_t
Part of https://github.com/harfbuzz/harfbuzz/issues/1017
2018-05-01 19:09:00 -04:00
Ebrahim Byagowi 70d36543aa Make atexit callbacks threadsafe (#930) 2018-03-29 17:30:28 -07:00
Behdad Esfahbod 48baf7e389 [uniscribe] Fixup for previous commit
Fixes https://github.com/harfbuzz/harfbuzz/issues/934
2018-03-28 13:38:51 -07:00
Behdad Esfahbod b17e1a4088 [uniscribe] Fix assertion fail in checksum calc
Program: Z:\Users\ebrahim\Desktop\harfbuzz\winbuild\util\.libs\hb-shape.exe
File: ../../src/hb-open-type-private.hh, Line 769

Expression: 0 == (Length & 3)

abnormal program termination
2018-03-28 10:45:26 -07:00
David Corbett 21646cc4a6 Do not mark the first glyph as unsafe to break
Fixes #791.
2018-02-17 13:35:34 -08:00
Behdad Esfahbod 470fe5b603 [aat] Implement Lookup table
Untested, but compiles.
2018-01-10 02:50:49 +01:00
Behdad Esfahbod e4da380200 [coretext/uniscribe/directwrite/graphite/fallback] Update for unsafe-to-break
Fixes https://github.com/behdad/harfbuzz/issues/615

We'll see which bots I broke.
2017-11-10 17:14:27 -08:00
Behdad Esfahbod 40ec3bbb55 Consolidate debug stuff into hb-debug.hh
Part of fixing https://github.com/behdad/harfbuzz/pull/605
2017-11-03 17:18:17 -04:00
Behdad Esfahbod 2c439210c9 [uniscribe] Fix a couple of VS warnings 2017-11-01 18:13:35 -06:00
Behdad Esfahbod 98acdde3c6 [coretext/uniscribe] Fix build
https://travis-ci.org/behdad/harfbuzz/jobs/295039536#L3468
https://ci.appveyor.com/project/behdad/harfbuzz/build/1.0.697/job/dr1ujlntxafeqbej#L142
2017-10-31 11:17:43 -06:00
Behdad Esfahbod dbdbfe3d7b Use nullptr instead of NULL 2017-10-15 12:11:08 +02:00
Behdad Esfahbod c3448e8d21 Use static_assert instead of custom ASSERT_STATIC 2017-10-15 12:02:00 +02:00
Behdad Esfahbod 239119a631 [unsafe-to-break] Mark all positions as unsafe in alternative shapers 2017-08-13 15:08:34 -07:00
Behdad Esfahbod 466b3e58bd Shuffle things around a bit 2017-02-03 16:57:15 -08:00
Behdad Esfahbod 72ada4f0c6 [GX] Hook up feature variations
Shape-plan caching is not implemented.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod 333173103b Fix sign of shift operators
This one:

  map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit);

before the fix, the shift was done as an int, causing overflow
if it ever got to 1 << 31.  Sprinkle 'u's around.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=634805
2016-08-08 17:28:14 -07:00
Behdad Esfahbod e6d5e4c310 [uniscribe] Fix negative advance
This happens with at least one test font I have.
2016-01-06 12:29:50 +00:00
Behdad Esfahbod eaf1e93ef1 [uniscribe] Handle E_NOT_SUFFICIENT_BUFFER as well as E_OUTOFMEMORY
On Windows 10 we are seeing that other error message...

Test sequence: U+0995,U+-9CD,U+09B0
With Nirmala shipped on Windows 10, this failed to form the below form.
Works now.

Reported by Sairus.
2015-12-17 17:28:35 +00:00
Behdad Esfahbod 163c435f18 [uniscribe] Fix negative offsets
Ouch!
2015-08-20 15:39:06 +01:00
Behdad Esfahbod 7c5bee09d9 [uniscribe] Fix font scale handling
By default shape at upem (or ppem), and scale results.
Similar to work done in CoreText backend, but using upem as default.
2015-08-19 13:20:31 +01: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 15c633dd1f Minor 2014-08-11 13:42:59 -04:00
Behdad Esfahbod 92aeee3f04 Minor 2014-08-10 17:42:19 -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 d7c850f803 [uniscribe] Minor 2014-08-02 19:07:53 -04:00
Behdad Esfahbod db30828048 [win] Consolidate windows.h include tips and tricks 2014-07-19 16:32:04 -04:00
Behdad Esfahbod 7627100f42 Mark unsigned integer literals with the u suffix
Simplifies hb_in_range() calls as the type can be inferred.
The rest is obsessiveness, I admit.
2014-07-11 16:22:13 -04:00
Behdad Esfahbod fb8cc86ff9 Rename sort() to qsort()
In an effort to make the algorithm used clear.
2014-06-19 15:31:09 -04:00
Jonathan Kew 62cb28dfc6 fixup for 64-bit windows build 2014-01-22 07:31:54 -05:00
Behdad Esfahbod 3216e44feb [uniscribe] Fix scratch-buffer accounting 2013-12-23 14:39:23 -05:00
Behdad Esfahbod 68c372ed2e More scratch-buffer cleanup 2013-11-13 14:45:43 -05:00
Behdad Esfahbod 16f175cb2e Fix scratch-buffer alignment warnings 2013-11-12 17:22:49 -05:00
Behdad Esfahbod 757a7a9018 [uniscribe] Fixed build with wide chars
f65dafa413
2013-08-28 12:38:37 -04:00
Behdad Esfahbod 3409fb1c76 [uniscribe] Ask Uniscribe to return shaping results in logical order
See discussion on the list in the thread "Arabic presentation forms
and the uniscribe backend".

Based on patch from Jonathan Kew.
2013-08-21 17:22:21 -04:00
Behdad Esfahbod 1d05fdd09f [uniscribe] Print run info 2013-08-20 13:22:50 -04:00
Behdad Esfahbod 3613696b57 [coretext] Fully support user features
Based on patch from Jonathan Kew and data from Apple.

It's not working correctly though, and I suspect I'm hitting a bug in
CoreText.  When I do this:

hb-shape /Library/Fonts/Zapfino.ttf ZapfinoZapfino --shaper coretext \
--features=-liga

I expect both ligatures to turn off, but only the second one does:

[Z_a_p_f_i_n_o=0+2333|Z=7+395|a=8+285|p_f=9+433|i=11+181|n=12+261|o=13+250]

whereas if I disable 'dlig' instead of 'liga', both are turned off.
Smells...

Doesn't resolve conflicting feature settings.
2013-08-12 12:01:05 -04:00
Behdad Esfahbod 9a175914d7 [uniscribe] Support feature ranges
As Khaled pointed out, right now setting any features, turns kern
and possibly other features off.
2013-08-07 17:29:32 -04:00
Behdad Esfahbod 38d5c58d23 [uniscribe] Half-support user features
Turning features on globally works now.
2013-08-06 14:45:36 -04:00
Behdad Esfahbod 8b427c78ef [uniscribe] Sanitize font file 2013-07-22 10:57:05 -04:00
Behdad Esfahbod 12ff69df21 [uniscribe] Handle TTC when renaming font 2013-07-22 10:52:12 -04:00
Behdad Esfahbod 05bad3b8c2 [uniscribe] Use OT::* types 2013-07-21 17:19:09 -04:00
Behdad Esfahbod bdeea605fe [uniscribe] Move name generation into separate function 2013-07-21 17:19:09 -04:00
Behdad Esfahbod 73f947e2a7 [uniscribe] Use blob to pass data around 2013-07-21 17:19:09 -04:00
Behdad Esfahbod 8ac2e88def [uniscribe] Use unique font name
When installing per-process fonts using AddFontMemResourceEx(),
if a font with the same family name is already installed, sometimes
that one gets used.  Which is problematic for us.  As such, we
now mangle the font to install a new 'name' table with a unique
name, which we then use to choose the font.

Patch from Jonathan Kew.
2013-07-21 17:17:44 -04:00
Behdad Esfahbod 29b596ac67 [uniscribe] Fix buffer allocation
Email from Jonathan Kew:

My cygwin build kept aborting on certain test words when run with the
uniscribe backend. Turned out this was caused by a bug in the allocation
of scratch buffers in hb-uniscribe.cc.

Commit 2a17f9568d introduced a new line

  ALLOCATE_ARRAY (SCRIPT_VISATTR, vis_attr, glyphs_size);

but it failed to account for this in the computation of glyphs_size
(the number of glyphs for which scratch buffer space is available),
with the result that the vis_clusters array ends up overrunning the
end of the scratch buffer and clobbering the beginning of the buffer's
info[].

AFAICS, the vis_attr array is not actually used, so the simple fix is
to remove the line that allocates it. (If/when we -do- need to use
vis_attr for something, we'll need to add another term to the earlier
calculation of glyphs_size.)

With this patch, the uniscribe backend runs reliably again.

JK
2013-07-08 08:37:15 -06:00
Chun-wei Fan 93a04b8b5e hb-uniscribe.cc: Re-enable build under Visual Studio
-Declare hinstLib at the top of block
-Fix the definitions of the typedefs of ScriptItemizeOpenType,
 ScriptShapeOpenType and ScriptPlaceOpenType
2013-06-03 18:32:59 -04:00
Behdad Esfahbod 2a17f9568d Bug 55494 - ScriptItemizeOpenType doesn't exists under Windows XP
Fallback to older API if OpenType variants are not available.
2013-05-28 13:13:46 -04:00
Behdad Esfahbod 0ae6dbf1b4 Minor 2012-12-09 18:37:38 -05:00
Behdad Esfahbod 3fe5c159d3 Remove excess return
Oops!
2012-12-09 18:20:19 -05:00
Behdad Esfahbod 7c8e844d92 Use namespace for OpenType tables
Avoids USHORT, SHORT, ULONG, LONG clashes with Windows API.
2012-08-28 17:57:49 -04:00
Behdad Esfahbod 45c1383cc7 Minor 2012-08-14 09:33:18 -04:00
Behdad Esfahbod eb56f6ae96 Minor 2012-08-07 21:44:25 -04:00
Behdad Esfahbod 713914d320 [Uniscribe] Clean up a bit 2012-07-30 17:54:38 -04:00
Behdad Esfahbod a00ad60bc0 [Uniscribe] Remove hb_uniscribe_font_ensure()
Wasn't a huge fan of putting the burden on the user.  Just remove it and
do what we've got to do transparently.
2012-07-28 21:16:08 -04:00
Behdad Esfahbod cfe9882610 Add hb_ot_layout_ensure() and hb_uniscribe_font_ensure() 2012-07-27 03:06:30 -04:00
Behdad Esfahbod e82061e8db Move ot shaper completely to shape_plan 2012-07-27 02:29:32 -04:00
Behdad Esfahbod b6b7ba1313 Switch old and uniscribe backends to shape_plan 2012-07-27 01:37:18 -04:00
Behdad Esfahbod 5b95c148cc Start implementing shape_plan 2012-07-27 01:02:24 -04:00
Behdad Esfahbod bd26b4d21f Minor 2012-07-26 22:18:24 -04:00
Behdad Esfahbod 027857d041 Start adding a unified shaper access infrastructure
Add global shape_plan.  Unused so far.
2012-07-26 21:14:02 -04:00
Behdad Esfahbod 91e721ea86 [hb-old] Fix clusters
Unlike its "documentation", hb-old's log_clusters are, well, indeed
logical, not visual.  Fixup.  Adapted / copied from hb-uniscribe.
2012-07-25 19:20:34 -04:00
Behdad Esfahbod e9c0f152a3 [Uniscribe] Fix script fallback
Gurmukhi failures half now.  Others changed slightly.
2012-07-20 17:37:48 -04:00
Behdad Esfahbod 552bf3a9f9 Bump WINNT version requested from 500 to 600
Since we use the OpenType versions of Uniscribe functions, we are
relying on that version of the WINNT API.  Otherwise, usp10.h will hide
those symbols.
2012-07-11 18:00:28 -04:00
Behdad Esfahbod 8729691267 Increase Uniscribe MAX_ITEMS 2012-06-08 14:39:31 -04:00
Behdad Esfahbod dbffa4c83d Fix Uniscribe charset matching
Previously was failing to match fonts that didn't support CHARSET_ANSI.

There still remains a problem with the Uniscribe backend, in that if a
font with the same family name is installed, and is newer, the native
one is preferred over the font we provide.  Fixing it requires rewriting
the name table with a unique family name...
2012-06-08 14:39:31 -04:00
Behdad Esfahbod 82e8bd8628 Remove unused code 2012-06-08 14:39:31 -04:00
Behdad Esfahbod 0dd86f9f68 Whitespace 2012-06-08 10:23:03 -04:00
Behdad Esfahbod 8e7beba7c3 Fix Uniscribe clusters with direction-overriden Arabic 2012-06-08 10:22:06 -04:00
Behdad Esfahbod b069c3c31b Really fix override-direction in Uniscribe 2012-06-08 10:10:29 -04:00
Behdad Esfahbod fcd6f53261 Unbreak Uniscribe
Oops.  hb_tag_t and OPENTYPE_TAG have different endianness.  Perhaps
something to add API for in hb-uniscribe.h
2012-06-08 09:59:43 -04:00
Behdad Esfahbod 29eac8f591 Override direction in Uniscribe backend
Matches OT backend now.
2012-06-08 09:26:17 -04:00
Behdad Esfahbod 1c1233e576 Make Uniscribe backend respect selected script 2012-06-08 09:20:53 -04:00
Behdad Esfahbod 0594a24484 Cleanup TRUE/FALSE vs true/false 2012-06-05 20:35:40 -04:00
Behdad Esfahbod dfa0cade7f Fix Uniscribe clusters with multiple items 2012-05-09 19:10:07 +02:00
Behdad Esfahbod 6bd9b479b8 Hide backend-specific shape functions
Also remove shaper_options argument to hb_shape_full().  That was
unused and for "future".  Let it go.

More shaper API coming in preparation for plan/planned API.
2012-04-12 14:53:53 -04:00
Behdad Esfahbod 5c29934311 [uniscribe] Various improvements 2011-09-19 14:53:26 -04:00
Behdad Esfahbod a3bd8a0e18 [graphite] Rewrite properly 2011-08-24 03:25:57 +02:00
Behdad Esfahbod 5072934c35 Minor 2011-08-24 02:24:27 +02:00
Behdad Esfahbod 71388b3ee7 [uniscribe] Minor 2011-08-24 02:09:04 +02:00
Behdad Esfahbod 0e6d36d8a3 Minor 2011-08-24 01:31:29 +02:00