Commit Graph

3028 Commits

Author SHA1 Message Date
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