Commit Graph

3097 Commits

Author SHA1 Message Date
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
Behdad Esfahbod 763e5466c0 Make it easier to use HB_BUFFER_FLAG_BOT/EOT
Previously, we expected users to provide BOT/EOT flags when the
text *segment* was at paragraph boundaries.  This meant that for
clients that provide full paragraph to HarfBuzz (eg. Pango), they
had code like this:

  hb_buffer_set_flags (hb_buffer,
                       (item_offset == 0 ? HB_BUFFER_FLAG_BOT : 0) |
                       (item_offset + item_length == paragraph_length ?
                        HB_BUFFER_FLAG_EOT : 0));

  hb_buffer_add_utf8 (hb_buffer,
                      paragraph_text, paragraph_length,
                      item_offset, item_length);

After this change such clients can simply say:

  hb_buffer_set_flags (hb_buffer,
                       HB_BUFFER_FLAG_BOT | HB_BUFFER_FLAG_EOT);

  hb_buffer_add_utf8 (hb_buffer,
                      paragraph_text, paragraph_length,
                      item_offset, item_length);

Ie, HarfBuzz itself checks whether the segment is at the beginning/end
of the paragraph.  Clients that only pass item-at-a-time to HarfBuzz
continue not setting any flags whatsoever.

Another way to put it is: if there's pre-context text in the buffer,
HarfBuzz ignores the BOT flag.  If there's post-context, it ignores
EOT flag.
2014-08-02 16:17:44 -04:00
Behdad Esfahbod 0a5ae93362 Merge branch 'win1256' 2014-08-02 15:00:34 -04:00
Behdad Esfahbod 6ab6be32c5 [arabic/win1256] Remove unused MultipleSubst macros 2014-08-02 14:59:41 -04:00
Behdad Esfahbod abfa4252cc [arabic/win1256] Really fix lam-alef this time
https://bugzilla.mozilla.org/show_bug.cgi?id=1045139#c26
b276e897d1 (commitcomment-7243499)
2014-08-02 14:59:32 -04:00
Behdad Esfahbod 55977f2a46 [arabic/win1256] Hook up lamMedi lookup
Restructure lookup array to accommodate.

https://bugzilla.mozilla.org/show_bug.cgi?id=1045139#c18
2014-08-01 16:14:33 -04:00
Behdad Esfahbod e839e2523e [arabic/win1256] Fix TEH MARBUTA final form
https://bugzilla.mozilla.org/show_bug.cgi?id=1045139#c18
2014-08-01 16:09:44 -04:00
Behdad Esfahbod a2de193220 [arabic/win1256] Fix shaping of JEEM, HAH, and KHAH
https://bugzilla.mozilla.org/show_bug.cgi?id=1045139#c16
2014-07-31 18:58:33 -04:00
Behdad Esfahbod 1789ccb1dd [arabic/win1256] Remove GCC'ism
The table can now compile independently too.  If we cannot make it work
on MSVC, we can always generate the data and distribute it.

The code now compiles cleanly with:

gcc -c -xc -std=c99 -Werror -pedantic hb-ot-shape-complex-arabic-win1256.hh
g++ -c -xc -std=c++1x -Werror -pedantic hb-ot-shape-complex-arabic-win1256.hh

See:
a97f537cec (commitcomment-7218736)
2014-07-31 18:58:24 -04:00
Behdad Esfahbod f28b1c823d [arabic] Implement Windows-1256 private shaping
Bug 1045139 - The Arabic text with "MS Sans Serif" font is rendered bad
https://bugzilla.mozilla.org/show_bug.cgi?id=1045139

This is only enabled on Windows platforms, and requires support from
Uniscribe to work.  But for clients that do hook up to Uniscribe, this
fixes shaping of Windows-1256-encoded bitmap fonts like "MS Sans Serif".

The code and table together have just less than a 1kb footprint when
enabled.

UNTESTED.  I might even have broken regular Arabic fallback shaping.
2014-07-31 18:58:24 -04:00
Behdad Esfahbod ac53443f1c [hangul] Don't apply 'calt'
See comments.

Micro-test added.
2014-07-31 18:54:43 -04:00
Behdad Esfahbod 88911e8cc7 Minor 2014-07-29 19:47:26 -04:00
Behdad Esfahbod 9e834e29e0 [hebrew] Zero mark advance by GDEF late
Seems to be what Uniscribe does.

At this point I think it's work checking our default...

Fixes Bug 76767 - Zeroing of advance of 2nd component of multiple
substitution with SBL Hebrew
https://bugs.freedesktop.org/show_bug.cgi?id=76767

Micro-test added.
2014-07-26 20:34:01 -04:00
Behdad Esfahbod 6f2d9ba52a Add old-Myanmar shaper
Looks like Unsicribe responds to the 'mymr' tag by zeroing marks
GDEF_LATE instead of generic-shaper UNICODE_LATE.  Implement that.

Fixes
Bug 81775 - Incorrect Rendering with harfbuzz-ng myanmar unicode
https://bugs.freedesktop.org/show_bug.cgi?id=81775

Micro-test added based on Padauk.
2014-07-26 19:18:59 -04:00
Behdad Esfahbod 595d2b96c3 Minor 2014-07-26 18:44:15 -04:00
Behdad Esfahbod fe6788bc57 Typo 2014-07-25 12:40:56 -04:00
Behdad Esfahbod 6e69200a2a Fix snprintf() format
Patch from Maks Naumov.
Fixes https://github.com/behdad/harfbuzz/pull/22
2014-07-25 12:30:47 -04:00
Behdad Esfahbod 5c5cdbbdf8 Make sure broken feature strings are not partially parsed
If user doesn't check hb_feature_from_string() return value, we
don't want them to end up see the partially-parsed feature.
2014-07-25 12:21:49 -04:00
Behdad Esfahbod a795fe6378 Allow quotation marks around feature tag in hb_feature_from_string()
With this, I believe we accept CSS feature strings completely.
2014-07-25 12:15:49 -04:00
Behdad Esfahbod 3f64618474 Allow space at the end of feature string with values, eg 'dlig=1 ' 2014-07-25 12:13:19 -04:00
Behdad Esfahbod f31f7d2259 Minor 2014-07-25 12:13:19 -04:00
Behdad Esfahbod 60cb18a5de Allow on/off in hb_feature_from_string()
We now allow things like "dlig on" / "dlig=on".
2014-07-25 12:13:16 -04:00
Behdad Esfahbod d9e618eca9 Remove duplicate definition of ISALNUM
It's defined in hb-private.h already.
2014-07-25 12:02:26 -04:00
Behdad Esfahbod 2ee5f665de Fix parsing of features like "- liga" (with the space) 2014-07-25 12:02:22 -04:00
Behdad Esfahbod e15fa7a8cf Do not require the '=' in hb_feature_from_string()
Towards accepting CSS font-feature-settings strings.
2014-07-25 11:46:28 -04:00
Behdad Esfahbod f4fe9baefd Reject tags longer than 4 chars in hb_feature_from_string() 2014-07-25 11:39:55 -04:00
Behdad Esfahbod 7e8c389546 Minor warnings fixes
Some systems insist on -Wmissing-field-initializers.  We have too many,
by design.  Fix a few easy ones.
2014-07-25 11:23:17 -04:00
Behdad Esfahbod fc0daafab0 [indic] Handle old-spec Malayalam reordering with final Halant
See comment.

Micro-tests added.
2014-07-23 16:53:03 -04:00
Behdad Esfahbod d6d349d178 Give CC to gir-scanner
From:
https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-harfbuzz/0001-give-cc-to-gir-scanner.all.patch
2014-07-23 11:38:49 -04:00
Behdad Esfahbod 3f310dc0ca Disallow changing settings on immutable face
Ouch!
2014-07-22 16:26:27 -04:00
Behdad Esfahbod 0fc0a10228 [win] Fix Cygwin build
db30828048 (commitcomment-7077778)
2014-07-21 11:13:27 -04:00
Behdad Esfahbod 1132a7dd0e Add HB_TAG_MAX_SIGNED / _HB_SCRIPT_MAX_VALUE_SIGNED
To make C language police happy.
2014-07-20 01:17:40 -04:00
Behdad Esfahbod df99976398 [gobject] Skip _HB_SCRIPT_MAX_VALUE
Fixes https://github.com/behdad/harfbuzz/pull/38
2014-07-19 17:31:23 -04:00
Behdad Esfahbod f1a8d50a87 [win] Don't define visibility attribtue under Cygwin 2014-07-19 16:52:32 -04:00
Behdad Esfahbod 9c77027d64 [win] Turn STRICT on for including windows.h 2014-07-19 16:37:22 -04:00
Behdad Esfahbod db30828048 [win] Consolidate windows.h include tips and tricks 2014-07-19 16:32:04 -04:00
Behdad Esfahbod f26d59d468 More fixing MemoryBarrier() on Mingw32
Set requested windows header to Vista.  See discussion:

fbb2847f54 (commitcomment-7054700)
2014-07-19 16:10:21 -04:00
Behdad Esfahbod 385cf37cf0 Fix hb_in_range() unused-var warning on Windows 2014-07-17 18:22:07 -04:00
Behdad Esfahbod e3b42f1af4 [arabic] Disable 'cswh' again
Ouch!
2014-07-17 17:13:54 -04:00
Behdad Esfahbod 82f4d9d53f [arabic] Add note re disabled 'cswh' 2014-07-17 15:57:37 -04:00
Behdad Esfahbod 615d00ea25 [arabic] Apply init/medi/isol/fini/... in separate stages
Follows the order of the Arabic/Syriac specs.  Also don't stop
between rlig and calt in non-Arabic scripts.

Micro-tests for Arabic and Mongolian added for the latter.
2014-07-17 15:50:13 -04:00
Behdad Esfahbod 7cd33f2304 Micro optimization 2014-07-17 14:39:07 -04:00
Behdad Esfahbod 164c13d73f Another try to fix Mongolian free variation selectors
This reverts bf029281 and fixes it properly.  That commit
was not enough as it was only inheriting the shaping_action
for prev_action, but not curr_action.

Micro-test added.

https://code.google.com/p/chromium/issues/detail?id=393896
2014-07-17 14:28:04 -04:00
Behdad Esfahbod 5209c50506 Revert "Show U+FFFD REPLACEMENT CHARACTER for invalid Unicode codepoints"
We now handle U+FFFD replacement in hb_buffer_add_utf*().  Any other
manipulation can happen in user callbacks.  No need for this.

efe74214bb (commitcomment-7039404)

This reverts commit efe74214bb.

Conflicts:
	src/hb-ot-shape-normalize.cc
2014-07-17 12:23:44 -04:00
Dominik Röttsches 9e7c720100 Fix CoreText build after a8b89a09f6 2014-07-17 12:18:08 -04:00
Behdad Esfahbod a4d643755a Minor 2014-07-16 20:15:45 -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 bcba8b4502 New API hb_buffer_add_codepoints()
Like hb_buffer_add_utf32, but doesn't do any Unicode validation.
This is like what hb_buffer_add_utf32 used to be until a couple
commits ago.
2014-07-16 14:59:04 -04:00
Behdad Esfahbod 625dbf141a [buffer] Templatize UTF-* functions 2014-07-16 14:52:59 -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 b98c5db32d Minor refactoring 2014-07-16 13:44:01 -04:00
Behdad Esfahbod 3b861421a7 Fix Mongolian Variation Selectors for fonts without GDEF
Originally we fixed those in 79d1007a50.
However, fonts like MongolianWhite don't have GDEF, but have IgnoreMarks
in their LigatureSubstitute init/etc features.  We were synthesizing a
GDEF class of mark for Mongolian Variation Selectors and as such the
ligature lookups where not matching.  Uniscribe doesn't do that.

I tried with more sophisticated fixes, like, if there is no GDEF and
a lookup-flag mismatch happens, instead of rejecting a match, try
skipping that glyph.  That surely produces some interesting behavior,
but since we don't want to support fonts missing GDEF more than we have
to, I went for this simpler fix which is to always mark
default-ignorables as base when synthesizing GDEF.

Micro-test added.

Fixes rest of https://bugs.freedesktop.org/show_bug.cgi?id=65258
2014-07-16 13:30:26 -04:00
Behdad Esfahbod 878a25375b Minor 2014-07-16 13:21:59 -04:00
Behdad Esfahbod ec181e5014 Minor moving around 2014-07-16 13:10:03 -04:00
Behdad Esfahbod e7ce50d9eb [indic] Fix access past end of array 2014-07-16 12:30:39 -04:00
Behdad Esfahbod 73e23b0acf Whitespace 2014-07-15 18:43:49 -04:00
Behdad Esfahbod b7bc0b671d Simplify / speed up UTF-8 code 2014-07-11 16:22:13 -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 7323d385cc Simplify hb_utf_prev<16> to call hb_utf_next<16> 2014-07-11 16:22:13 -04:00
Behdad Esfahbod c09a607a84 Use hb_in_range() for arabic and indic tables
Though, looks like gcc was smart enough to produce the same code
before...
2014-07-11 16:22:13 -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 a8b89a09f6 Simplify hb_in_range()
It's both faster and produces smaller code.  Now I feel stupid for
not writing it this way before.
2014-07-11 14:18:01 -04:00
Behdad Esfahbod db8934faa1 Simplify hb_utf_prev<8> to call hb_utf_next<8> 2014-07-11 13:58:36 -04:00
Behdad Esfahbod efe74214bb Show U+FFFD REPLACEMENT CHARACTER for invalid Unicode codepoints
Only if the font doesn't support it.  Ie, this gives the user to
use non-Unicode codepoints as private values and return a meaningful
glyph for them.  But if it's invalid and font callback doesn't
like it, and if font has U+FFFD, show that instead.

Font functions that do not want this automatic replacement to
happen should return true from get_glyph() if unicode > 0x10FFFF.

Replaces https://github.com/behdad/harfbuzz/pull/27
2014-07-11 11:59:48 -04:00
Behdad Esfahbod 6f13b6d62d When parsing UTF-16, generate invalid codepoint for lonely low surrogate
Test passes now.
2014-07-10 19:39:39 -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 8b16ff1259 [uniscribe] Fix build after recent changes to Offset 2014-07-09 17:41:09 -04:00
Behdad Esfahbod 73f7f8919e Define _POSIX_C_SOURCE only if it is not defined
Fixes https://github.com/behdad/harfbuzz/pull/45
2014-07-09 17:17:18 -04:00
Behdad Esfahbod 0cd94491b9 [ucdn] Update to Unicode 7.0.0 data
From http://github.com/behdad/ucdn
2014-07-09 16:53:06 -04:00
Behdad Esfahbod 68f724484b [indic] Remove some more now-unused special-cases 2014-06-30 15:46:53 -04:00
Behdad Esfahbod e79c948980 [indic] Remove special-casing of U+1CF2,1CF3
These were introduced in a498565ced,
but IndicSyllabicCategory has had the correct value already, so the
special code was never needed.
2014-06-30 15:39:39 -04:00
Behdad Esfahbod d743ce78e1 [indic-table] Update to Unicode 7.0 data
Touch code just enough to preserve previous syllable structure
and functionality as closely as possible.  Many further cleanups
coming later.
2014-06-30 15:24:45 -04:00
Behdad Esfahbod 5fa21b3ab7 [indic-table] Fix category frequency counts in comments 2014-06-30 14:30:54 -04:00
Behdad Esfahbod 5c4e3e9a57 Whitespace 2014-06-30 14:25:18 -04:00
Behdad Esfahbod af528b6674 Fix typo; ouch! 2014-06-27 18:07:00 -04:00
Behdad Esfahbod 7d4ada66c9 Mark unsed members with a "Z" suffix
There may be more.  There are members that are by definition
redundant or reserved and not needed, NOT what we *currently*
don't use.

I'm sure there's more...
2014-06-27 17:32:56 -04:00
Behdad Esfahbod 23afcff1d1 [ot-font] Implement Unicode variation selectors 2014-06-27 17:22:36 -04:00
Behdad Esfahbod a5a4736916 [cmap] Implement subtable format 14 2014-06-27 17:22:31 -04:00
Behdad Esfahbod 586b60622c Minor: final bits of cleanup 2014-06-27 15:39:47 -04:00
Behdad Esfahbod 51d9ba09bc Minor 2014-06-27 15:27:15 -04:00
Behdad Esfahbod 3084767e92 Minor: Remove LongArrayOf 2014-06-27 15:24:35 -04:00
Behdad Esfahbod 41ea594950 Minor: Remove LongSortedArrayOf 2014-06-27 15:23:18 -04:00
Behdad Esfahbod bb6ecf2ce5 Minor: Remove LongOffsetArrayOf and LongOffsetLongArrayOf 2014-06-27 15:21:08 -04:00
Behdad Esfahbod 99d2817123 Minor: Remove GenericOffset 2014-06-27 15:19:15 -04:00
Behdad Esfahbod 9da552dcc5 Minor: Remove some GenericXXX templates 2014-06-27 15:18:36 -04:00
Behdad Esfahbod 36073ede5b Minor: Reorder template parameter order 2014-06-27 15:18:26 -04:00
Behdad Esfahbod 0394ec1bfb Minor: Introduce GenericOffset 2014-06-27 15:18:08 -04:00
Behdad Esfahbod 0d1b3419a7 Minor: Use template parameter default values for OffsetTo 2014-06-27 15:17:47 -04:00
Behdad Esfahbod 546b1adcdc Minor: Use template parameter default values for hb_prealloced_array_t 2014-06-27 15:17:01 -04:00
Behdad Esfahbod 911ca38645 Add back API removed recently
Add hb_ot_layout_language_get_required_feature_index() again, which
is used in Pango.  This was removed in
da13293798 in favor of
hb_ot_layout_language_get_required_feature().

API changes:

  - Added hb_ot_layout_language_get_required_feature_index back.
2014-06-24 10:20:36 -06:00
Behdad Esfahbod 89e4946929 Add new IndicSyllabicCategory short forms for Unicode 7.0 2014-06-22 11:32:13 -06:00
Behdad Esfahbod dcee838e89 Minor 2014-06-22 11:29:59 -06:00
Behdad Esfahbod f2ad86e605 [indic-table-gen] Minor 2014-06-21 15:31:10 -06:00
Behdad Esfahbod 2ec62279aa [indic-table] Update to Unicode 6.3.0
Was from 6.2.0.  It's a no-op.  Committing for the record.
2014-06-21 15:25:59 -06:00
Behdad Esfahbod 5d4d7384ef Minor: format 2014-06-21 14:53:21 -06:00
Behdad Esfahbod 44243ae590 [arabic-table] Update to Unicode 7.0
Old table was from 6.2.  Remove hard-coded Mongolian and Phags-pa data.
This completes support for new scripts Manichian and Psaltar Pahlavi.
2014-06-21 14:19:34 -06:00
Behdad Esfahbod cd86ab9b4f [arabic-table] Add ZWJ/ZWNJ now that table is segmented 2014-06-21 14:16:54 -06:00
Behdad Esfahbod 2390d9b67e [arabic-table] Further tune
In anticipation of Unicode 7.0 data coming in the next commit.
2014-06-21 14:07:02 -06:00
Behdad Esfahbod a133e6067a [indic-table] Minor 2014-06-20 18:01:34 -04:00
Behdad Esfahbod b900fa2c8c [arabic-table] Use segmented table
No functional change.
2014-06-20 17:59:43 -04:00
Behdad Esfahbod c2e1134046 [indic-table] Make output stable 2014-06-20 17:57:03 -04:00
Behdad Esfahbod 55abfbd2ac [indic-table] Minor
No output change.
2014-06-20 16:47:43 -04:00
Behdad Esfahbod f886707490 [arabic-table] Don't write comments
No functional change.
2014-06-20 16:30:10 -04:00
Behdad Esfahbod 200dfe3eb1 [arabic-table] Use short names for values
No functional change.
2014-06-20 16:20:59 -04:00
Behdad Esfahbod 3f5327a41e [arabic-table] Read Blocks.txt and shuffle code around
No functional change.
2014-06-20 16:17:42 -04:00
Behdad Esfahbod 171f970e4f [indic-table] Black-list Thai, Lao, and Tibetan
We don't need Indic table for those.
2014-06-20 15:30:29 -04:00
Behdad Esfahbod 65ac2dae4f [indic-table] Speed up lookup 2014-06-20 15:29:38 -04:00
Behdad Esfahbod 64442a3f4c [indic-table] Fix compiler warning 2014-06-20 15:29:21 -04:00
Behdad Esfahbod 0436e1d505 [indic-table] Make table more compact by not covering full blocks
-#define indic_offset_total 4416
+#define indic_offset_total 3816

-}; /* Table occupancy: 60% */
+}; /* Table occupancy: 69% */
2014-06-20 15:28:38 -04:00
Behdad Esfahbod 190a251479 [indic-table] Remove block range from data table
No functional change.
2014-06-20 14:42:03 -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
Behdad Esfahbod cabfa538ed Adjust unused doc symbols 2014-06-20 14:02:30 -04:00
Jonathan Kew da13293798 Rework handling of requiredFeature to solve problem with rlig in arial.ttf from winxp
https://bugzilla.mozilla.org/show_bug.cgi?id=986802
Fixes https://github.com/behdad/harfbuzz/pull/39

API Change:

-hb_ot_layout_language_get_required_feature_index
+hb_ot_layout_language_get_required_feature

New API takes an extra pointer argument.  Pass NULL in to get
behavior of previous API.

Reworked by behdad
2014-06-19 16:33:48 -04:00
Behdad Esfahbod df554af99d Rename search() to bsearch() and lsearch()
Such that the complexity of the algorithm used is clear at
call site.
2014-06-19 15:39:18 -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
Behdad Esfahbod 577ca48143 [unicode7] Update list of Default_Ignorable codepoints 2014-06-18 12:29:23 -04:00
Behdad Esfahbod 7cfee38276 [unicode7] Route Manichaean and Psalter Pahlavi through Arabic shaper
Still needs update to joining table to fully work.
2014-06-18 12:22:45 -04:00
Behdad Esfahbod a4a7899cd9 [unicode7] Mark right-to-left scripts 2014-06-18 12:22:45 -04:00
Behdad Esfahbod 62587bfc51 [unicode7] Declare Unicode 7 scripts 2014-06-18 12:22:45 -04:00
Behdad Esfahbod dc61294aa9 [unicode7] Add missing ISO 15924 tags 2014-06-18 12:22:45 -04:00
Behdad Esfahbod 7526373e70 [coretext] Remove unused var 2014-06-17 11:45:26 -04:00
Jonathan Kew 798e4185bc When zeroing mark widths for LTR, also adjust offset...
...so that they overstrike preceding glyph.

https://github.com/behdad/harfbuzz/pull/43
2014-06-12 18:34:15 -04:00
Jonathan Kew 80f7405a52 [Thai] set the correct general category on Nikhahit when decomposing Sara-Am. 2014-06-12 18:25:58 -04:00
Behdad Esfahbod 1d634cbb4b Fix base-position when 'pref' is NOT formed
If pre-base reordering Ra is NOT formed (or formed and then
broken up), we should consider that Ra as base.  This is
observable when there's a left matra or dotreph that positions
before base.

Now, it might be that we shouldn't do this if the Ra happend
to form a below form.  We can't quite deduce that right now...

Micro test added.  Also at:

https://code.google.com/a/google.com/p/noto-alpha/issues/detail?id=186#c29
2014-06-12 17:10:35 -04:00
Behdad Esfahbod 04dc52fa15 [indic] Recover OT_H undergone ligation and multiplication
Sometimes font designers form half/pref/etc consonant forms
unconditionally and then undo that conditionally.  Try to
recover the OT_H classification in those cases.

No test number changes expected.
2014-06-09 14:20:06 -04:00
Behdad Esfahbod 39c8201f8e [indic] Improve base re-finding
No test numbers change.
2014-06-09 14:20:06 -04:00
Behdad Esfahbod c04d5f0dd2 [indic] Minor 2014-06-09 14:20:06 -04:00
Behdad Esfahbod 832a6f99b3 [indic] Don't reorder reph/pref if ligature was expanded
Normally if you want to, say, conditionally prevent a 'pref', you
would use blocking contextual matching.  Some designers instead
form the 'pref' form, then undo it in context.  To detect that
we now also remember glyphs that went through MultipleSubst.

In the only place that this is used, Uniscribe seems to only care
about the "last" transformation between Ligature and Multiple
substitions.  Ie. if you ligate, expand, and ligate again, it
moves the pref, but if you ligate and expand it doesn't.  That's
why we clear the MULTIPLIED bit when setting LIGATED.

Micro-test added.  Test: U+0D2F,0D4D,0D30 with font from:

[1]
https://code.google.com/a/google.com/p/noto-alpha/issues/detail?id=186#c29
2014-06-05 20:36:01 -04:00
Behdad Esfahbod b5be231720 [gsub] Adjust single-length ligature subst to act like single subst 2014-06-05 19:00:22 -04:00
Behdad Esfahbod aae69451df [gsub] Minor shuffling 2014-06-05 19:00:08 -04:00
Behdad Esfahbod b6b304f12b [ot] Add TODO re zero-len MultipleSubst sequences 2014-06-05 17:12:54 -04:00
Behdad Esfahbod f1a72fe7bf [ot-font] Fix cmap EncodingRecord cmp order 2014-06-04 19:03:16 -04:00
Behdad Esfahbod ce34f0b07e [ot-font] Use binary search for format12 cmap subtable 2014-06-04 18:57:46 -04:00
Behdad Esfahbod 257d1adfa1 [ot-font] Work around broken cmap subtable format 4 length
Roboto was hitting this.  FreeType also has pretty much the
same code for this, in ttcmap.c:tt_cmap4_validate():

    /* in certain fonts, the `length' field is invalid and goes */
    /* out of bound.  We try to correct this here...            */
    if ( table + length > valid->limit )
    {
      if ( valid->level >= FT_VALIDATE_TIGHT )
        FT_INVALID_TOO_SHORT;

      length = (FT_UInt)( valid->limit - table );
    }
2014-06-04 18:47:55 -04:00
Behdad Esfahbod 51f563579b Move try_set to sanitize context 2014-06-04 18:42:32 -04:00
Behdad Esfahbod 500737e8e1 [ot-font] Don't select a Null cmap subtable
Can happen either in broken fonts, or as a result of sanitize().
2014-06-04 18:17:29 -04:00
Behdad Esfahbod dac86026a6 Fix some cppcheck warnings
Bug 77800 - cppcheck reports
2014-06-03 17:57:00 -04:00
Behdad Esfahbod c306410cab Bug 77732 - Fix unused typedef warning for ASSERT_STATIC with GCC 4.8 2014-06-03 17:00:07 -04:00
Behdad Esfahbod ae2b854eab Move code around 2014-06-03 16:59:09 -04:00
Behdad Esfahbod 17c3b809f4 [indic] Treat U+A8E0..A8F1 as OT_A instead of OT_VD
Apparently they can intermix with other OT_A.

Test: U+0915,A8E2,1CD0
2014-06-02 15:08:18 -04:00
Behdad Esfahbod 6ae13f257c [graphite2] Fix cluster mapping
Patch from Martin Hosken.  I expect this to fix the following bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=75076
https://bugzilla.gnome.org/show_bug.cgi?id=723582
https://bugzilla.redhat.com/show_bug.cgi?id=998812
2014-05-30 17:38:14 -04:00
Behdad Esfahbod 7977ca17aa [indic] Allow decimal and Brahmi digits as placeholders
Tests: U+0967,0951 U+0031,093F
2014-05-29 15:34:26 -04:00
Behdad Esfahbod e8b5d64039 [indic] Do NOT allow reph formation on placeholders
Only allow it on DOTTED CIRCLE.  No effect on test numbers.

Test: U+0930,094D,00A0
2014-05-29 15:20:15 -04:00
Behdad Esfahbod 52b562a6a0 [indic] Clean up a bit
No functional change intended.
2014-05-27 18:19:52 -04:00
Behdad Esfahbod 3bf652b907 [indic] Treat U+002D and U+2010..2014 as placeholders 2014-05-27 18:07:26 -04:00
Behdad Esfahbod e0de95f402 [indic] Treat U+00D7 MULTIPLICATION SIGN as placeholder 2014-05-27 17:58:34 -04:00
Behdad Esfahbod cf78dd483c [indic/myanmar] Rename OT_NBSP to OT_PLACEHOLDER 2014-05-27 17:53:37 -04:00
Behdad Esfahbod 186ece94c8 [myanmar] Use OT_NBSP instead of OT_DOTTEDCIRCLE for OT_GB
No functional change.
2014-05-27 17:49:45 -04:00
Behdad Esfahbod cf71d28c38 [indic/myanmar] Refactor a few macros 2014-05-27 17:47:43 -04:00
Behdad Esfahbod 2307268e01 [indic] Treat U+0A72..0A73 like regular consonants
Unicode 6.x IndicSyllableCategory categorizes them as
placeholders, but they can subjoin.
2014-05-27 17:39:01 -04:00
Behdad Esfahbod e9b2a4cfe5 [indic] Support U+1CED 2014-05-23 15:49:10 -04:00
Behdad Esfahbod d19f8e8570 [indic] Support U+A8F2..A8F7,1CE9..1CEC,1CEE..1CF1 2014-05-23 15:47:36 -04:00
Behdad Esfahbod ddbdfcbf1c [indic] Simplify grammar
No functional change.
2014-05-23 15:39:55 -04:00
Behdad Esfahbod 4e9b1f662b [indic] Always start new syllable for Avagraha
In fact, the previous grammar was ambigious.  No functional
change.
2014-05-23 15:38:42 -04:00
Behdad Esfahbod 9f9bd9bf31 [indic] Rename avagraha cluster to symbol cluster
In anticipation of adding more characters to that class of clusters.
2014-05-23 15:35:38 -04:00
Behdad Esfahbod a498565ced [indic] Support U+1CF2,U+1CF3 2014-05-22 19:39:56 -04:00
Behdad Esfahbod ecb98babba [indic] Support U+1CE2..U+1CE8 2014-05-22 19:36:21 -04:00
Behdad Esfahbod 37bf2c9224 Minor 2014-05-22 19:35:17 -04:00
Behdad Esfahbod 131e17ff9a [indic] Support U+1CF5,1CF6 2014-05-22 19:33:10 -04:00
Behdad Esfahbod 72ead0cc72 [indic] Treat U+1CE1 as a tone-mark too
It's spacing, but otherwise the same as the other ones.
2014-05-22 19:12:10 -04:00
Behdad Esfahbod e848bfae7c [indic] Recategorize U+A8E0..A8F1 as OT_VD
Up to two of them come after all OT_A characters.
2014-05-22 18:50:34 -04:00
Behdad Esfahbod c519536c34 [indic] Allow up to three tone marks
According to Roozbeh, there are valid combinations in Unicode
proposals for up to three.  Previously we were allowing up to two.
2014-05-22 18:43:14 -04:00
Behdad Esfahbod c11fc68339 [indic] Support more extended Devanagari tone marks
Also adjust U+0953,0954 handling.
2014-05-22 18:41:49 -04:00
Behdad Esfahbod 26c836e53d [indic] Handle "Cantillation marks for the Samaveda" 2014-05-21 18:35:48 -04:00
Behdad Esfahbod 29531128f2 [indic] Improve reph formation of Sinhala and Telugu
Sinhala and Telugu use "explicit" reph.  That is, the reph is formed by
a Ra,H,ZWJ sequence.  Previously, upon detecting this sequence, we were
checking checking whether the 'rphf' feature applies to the first two
glyphs of the sequence.  This is how the Microsoft fonts are designed.
However, testing with Noto shows that apparently Uniscribe also forms
the reph if the lookup ligates all three glyphs.  So, try both
sequences.

Doesn't affect test results for Sinhala or Telugu.

https://code.google.com/a/google.com/p/noto-alpha/issues/detail?id=232
2014-05-15 14:04:02 -06:00
Oleg Oshmyan 8c703f13bf Fix build with --coretext on older OS X
Fixes https://github.com/behdad/harfbuzz/pull/40
2014-05-14 17:42:20 -06:00
Behdad Esfahbod 439b05867c [myanmar] Allow MedialYa+Asat in the grammar
The grammar in the OT spec, and the existing Windows implementation
seem to be confused around where to allow Asat around the medial
consonants.

The previous grammar for medial group was allowing an Asat after
the medial group only if there was a medial Wa or Ha, but not if
there was only a medial Ya.  This doesn't make sense to me and
sounds reversed, as both medial Wa and Ha are below marks while
Asat is an above mark.  An Asat can come before the medial group
already (in fact, multiple ones can.  Why?!).  The medial Ya
however is a spacing mark and according to Roozbeh it's valid
to want an Asat on the medial Ya instead of the base, so it looks
to me like we want to allow an Asat after the medial group if
there *was* a Ya but not if there wasn't any.  Not wanting to
produce dotted-circle where Windows is not, this commit changes
the grammar to allow one Asat after the medial group no matter
what comes in the group.

Test: U+1002,103A,103B vs U+1002,103B,103A
2014-05-14 16:44:39 -06:00
Behdad Esfahbod c95587618c [ot] Minor note re cmap subtable format 2 and 8 2014-05-14 00:42:18 -04:00
Behdad Esfahbod b7878cd58e [ot] Implement cmap subtable format 0 2014-05-13 21:47:51 -04:00
Behdad Esfahbod ca7b77431d [ot] Factor out code between cmap sutable format 12 and 13 2014-05-13 21:26:34 -04:00
Behdad Esfahbod 94759e8219 [ot] Factor out code between cmap subtable format 6 and 10 2014-05-13 21:19:49 -04:00
Behdad Esfahbod 1a8ffc5129 Minor 2014-05-13 21:06:39 -04:00
Behdad Esfahbod 91bbfca875 [ot] Implement cmap subtable formats 6 and 10 2014-05-12 18:19:29 -04:00
Behdad Esfahbod d294a2cb16 [ot] Implement cmap subtable format 13 2014-05-12 17:58:31 -04:00
Behdad Esfahbod 0d75793fae [ot] Implement cmap subtable format 12 2014-05-12 17:51:15 -04:00
Behdad Esfahbod 3608a6847e [ot] Hook up cmap table to hb_ot_font_funcs() 2014-05-12 13:46:29 -04:00
Behdad Esfahbod c8a4745299 [ot] Implement cmap subtable format 4 2014-05-09 19:55:51 -04:00
Behdad Esfahbod 4719621f20 Minor 2014-05-09 16:09:11 -04:00
Behdad Esfahbod 41ca1fbebf [ot] Start implementing cmap table 2014-05-09 15:35:56 -04:00
Behdad Esfahbod c7074b8798 [otlayout] Add GenericArrayOf::search() 2014-05-08 18:24:31 -04:00
Behdad Esfahbod 40a479797a [otlayout] Add GenericSortedArrayOf 2014-05-08 18:21:04 -04:00
Behdad Esfahbod 0ddecabc6d [main] Minor improvement to output 2014-05-01 16:01:40 -07:00
Behdad Esfahbod 6faff8e413 Add static storage classifier to inline functions
Before we were just relying on the compiler inlining them and not
leaving a trace in our public API.  Try to fix.  Hopefully not
breaking anyone's build.
2014-04-28 14:30:44 -07:00
Behdad Esfahbod 9c9411839b [tibetan] Reorder PADMA sign to occur after other below marks
Based on suggestion from Andrew Glass.

Test: U+0F40,0FC6,0F83
2014-04-28 12:44:14 -07:00
Behdad Esfahbod b082ef373c Typo 2014-04-25 11:48:10 -07:00
Behdad Esfahbod 828e109c7a [indic] Fix-up zero-context matching
commit b5a0f69e47
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Thu Oct 17 18:04:23 2013 +0200

    [indic] Pass zero-context=false to would_substitute for newer scripts

    For scripts without an old/new spec distinction, use zero-context=false.
    This changes behavior in Sinhala / Khmer, but doesn't seem to regress.
    This will be useful and used in Javanese.

The *intention* was to change zero-context from true to false for scripts that
don't have old-vs-new specs.  However, checking the code, looks like we
essentially change zero-context to always be true; ie. we only changed things
for old-spec, and we broke them.  That's what causes this bug:

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

The root of the bug is here:

  /* Use zero-context would_substitute() matching for new-spec of the main
   * Indic scripts, but not for old-spec or scripts with one spec only. */
  bool zero_context = indic_plan->config->has_old_spec || !indic_plan->is_old_spec;

Note that is_old_spec itself is:

  indic_plan->is_old_spec = indic_plan->config->has_old_spec && ((plan->map.chosen_script[0] & 0x000000FF) != '2');

It's easy to show that zero_context is now always true.  What we really meant was:

  bool zero_context = indic_plan->config->has_old_spec && !indic_plan->is_old_spec;

Ie, "&&" instead of "||".  We made this change supposedly to make Javanese
work.  But apparently we got it working regardless!  So I'm going to fix this
to only change the logic for old-spec and not touch other cases.
2014-04-18 16:53:34 -07:00
Behdad Esfahbod 66c6a48b6c Add HB_NO_MERGE_CLUSTERS
Disables any cluster-merging.  Added for testing purposes while
we investigate what kind of API to add for this.
2014-04-14 15:55:42 -07:00
Behdad Esfahbod 5fd996c4a4 Further adjust check-defs and check-symbols for mipsel
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=74491
2014-04-09 16:38:26 -07:00