Commit Graph

471 Commits

Author SHA1 Message Date
Behdad Esfahbod 815bdd7700 In cluster-level=0, group ZWJ/ZWNJ with previous cluster
This better emulates Unicode grapheme clusters.

Note that Uniscribe does NOT do this, but should be harmless with most clients,
and improve fallback with clients that use HarfBuzz cluster as unit of fallback.

Fixes https://github.com/behdad/harfbuzz/issues/217
2016-02-22 18:22:44 +09:00
Behdad Esfahbod 89137e325a Minor 2016-02-22 16:00:59 +09:00
Behdad Esfahbod 62c2711121 [coretext] Limit grapheme-cluster forming to cluster-level=0 2016-02-22 15:07:20 +09:00
Behdad Esfahbod 7d8d58ac81 [GPOS] Divide position_finish() into two phases, for advances and offsets
Right now the position_finish_advances() is empty.  To be used for
spacing attachments proposal later.
2016-02-11 16:34:28 +07:00
Behdad Esfahbod 8474231567 [ot] Minor shuffling code around 2016-02-11 16:27:41 +07:00
Behdad Esfahbod 660c9d3fc2 Remove font-dependent ASCII-only perf hack
Is confusing.  I already hit it myself.  Remove.  We can optimize
ASCII based on Unicode properties.  But should not do based on
assumptions on the font.
2016-02-11 12:14:27 +07:00
Behdad Esfahbod eaadcbbc53 Remove now-unused mark zeroing BY_UNICODE 2016-02-10 18:29:54 +07:00
Behdad Esfahbod 35d18585fc Fix a few docs blocks 2015-11-26 19:30:37 -05:00
Behdad Esfahbod ea512f7108 Use C-style casts instead of compare to 0, to convert hb_bool_t to bool 2015-11-26 19:22:22 -05:00
Behdad Esfahbod 67a36a725e Fix vertical GPOS
This was brorken earlier, though, it's really hard to notice it.
Unlike the glyph_h_origin(), an unset glyph_v_origin() does NOT
mean that the vertical origin is at 0,0.

Related to https://github.com/behdad/harfbuzz/issues/187
2015-11-26 18:49:54 -05:00
Behdad Esfahbod 766963adba Merge pull request #114 from ThePhD/vc++-fixes
Fix all VC++ warnings and errors
2015-11-24 15:38:43 -06:00
Behdad Esfahbod abadc1717d Try to better handle OOM situations
Fixes assert fail in https://github.com/behdad/harfbuzz/issues/161
with libharfbuzz-fuzzing.
2015-11-18 17:52:08 -08:00
Behdad Esfahbod 4301703bdd Limit buffer max size growth
https://github.com/behdad/harfbuzz/issues/161
2015-11-05 23:44:59 -08:00
Behdad Esfahbod 136863371c Add new shaper method postprocess_glyphs()
Unused currently.  To be used for Syriac stretch implementation.

https://github.com/behdad/harfbuzz/issues/141
2015-11-05 13:24:15 -08:00
Behdad Esfahbod e95eb23a4e Don't try zeroing marks by GDEF if there are no non-ASCII
This one is a hack, but should be ok.
2015-11-04 22:59:28 -08:00
Behdad Esfahbod 7fa54ed75a Don't try zeroing mark attachments by Unicode if there's no non-ASCII 2015-11-04 22:59:24 -08:00
Behdad Esfahbod 0f407325f6 Minor 2015-11-04 22:28:44 -08:00
Behdad Esfahbod 497a6c2071 Skip forming clusters if text is all ASCII 2015-11-04 22:24:19 -08:00
Behdad Esfahbod 5bc28b5f68 Optimize positioning for when h_origin is nil 2015-11-04 21:53:16 -08:00
Behdad Esfahbod bee901b38e Optimize positioning direction calculations
It makes the binary smaller AND faster.  Yumm!
2015-11-04 19:28:17 -08:00
Behdad Esfahbod e3e4bb011a Don't do fractions if buffer is ASCII-only 2015-11-04 18:58:02 -08:00
Behdad Esfahbod 6986208ba3 Optimize runs without Default_Ignorable's
Now that we have a buffer-wide scratch flags facility, use it to
optimize away a few passes.
2015-11-04 18:46:41 -08:00
Behdad Esfahbod 49ef630936 Adjust the width of various spaces if font does not cover them
See discussion here:
81ef4f407d

There's no way to disable this fallback, but I don't think it would
be needed.  Let's hope for the best!

Fixes https://github.com/behdad/harfbuzz/issues/153
2015-11-04 17:27:07 -08:00
Behdad Esfahbod aa7044de0c Generalize flags types 2015-11-04 16:25:57 -08:00
Behdad Esfahbod f883de664f [OT] Merge /before/ reordering 2015-09-01 16:23:40 +01:00
Behdad Esfahbod e47b772a56 [ot] Change buffer content type right after we map to glyphs
Needed for upcoming debug output changes.
2015-08-18 18:42:47 +01:00
ThePhD 5c99cf93d6 Merge branch 'master' into vc++-fixes 2015-08-14 01:02:00 -04:00
Behdad Esfahbod 0f98fe88f4 [ot] Search globally for 'vert' feature if not found in specified script/lang
Fixes https://github.com/behdad/harfbuzz/issues/63
2015-07-23 11:52:11 +01:00
Behdad Esfahbod f327aacfa1 [ot] Minor 2015-07-23 11:32:59 +01:00
Behdad Esfahbod 8cfbc304ee Fix hide-default-ignorables after f0010dfd01
We can't delete things before hb_ot_layout_position_finish().  So,
just zero the advance before it, and remove later.
2015-07-22 18:41:10 +01:00
Behdad Esfahbod 2dbd3d29d6 Fix hide-ignorables if font doesn't have space glyph
Was broken by 82b521aeb7, as we have
positioning data by then and can't use the output buffer.  Ouch!
2015-07-22 18:29:47 +01:00
Behdad Esfahbod 4ba796b26e Refactor _hb_glyph_info_is_default_ignorable() 2015-07-22 17:41:31 +01:00
Behdad Esfahbod f0010dfd01 [ot] Hide default-ignorables before finishing off positioning
For example, fixes the following sequence with Arial XP:
628 25cc 651 25cc 64e 3a 20 628 651 34f 64e
628 25cc 64e 25cc 651 3a 20 628 64e 34f 651

Discovered as part of:
https://bugs.freedesktop.org/show_bug.cgi?id=85873
2015-07-22 17:36:23 +01:00
Behdad Esfahbod 376d587f36 Implement more granular cluster-merging
TODO: Documentation.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=71445
2015-07-22 16:51:12 +01:00
Behdad Esfahbod a60e2cfa39 [ot] Don't rely on cluster numbers for ensure_native_direction() 2015-07-22 15:49:08 +01:00
Behdad Esfahbod 701112dad9 [ot] Simplify form_clusters() 2015-07-22 15:42:20 +01:00
Behdad Esfahbod 7b8b63adc5 [ot] Don't mirror character if font doesn't support mirrored character! 2015-07-22 15:24:26 +01: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
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 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 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 595d2b96c3 Minor 2014-07-26 18:44:15 -04:00
Behdad Esfahbod 7cd33f2304 Micro optimization 2014-07-17 14:39:07 -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 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
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
Behdad Esfahbod 8de20b1e8a Add font->has_glyph() 2014-01-02 14:30:45 +08:00
Behdad Esfahbod 5497a8a274 Cache various masks on the shape plan 2013-12-22 20:48:53 -05:00
Behdad Esfahbod a7e8bbb080 Minor fraction mask setting improvement 2013-12-22 19:33:35 -05:00
Behdad Esfahbod 76fff252a9 Don't form fractions if only one of numr/dnom exist 2013-12-22 17:55:59 -05:00
Behdad Esfahbod 3aeee519f0 Bug 72698 - Automatically support frac / numr / dnom
When seeing U+2044 FRACTION SLASH in the text, find decimal
digits (Unicode General Category Decimal_Number) around it,
and mark the pre-slash digits with 'numr' feature, the post-slash
digits with 'dnom' feature, and the whole sequence with 'frac'
feature.

This beautifully renders fractions with major Windows fonts,
and any other font that implements those features (numr/dnom is
enough for most fonts.)

Not the fastest way to do this, but good enough for a start.
2013-12-22 16:17:54 -05:00
Behdad Esfahbod 739325178a Initialize masks before mirroring
We were throwing away the rtlm feature mask set during
mirroring...
2013-12-21 00:18:18 -05:00
Behdad Esfahbod 71b4c999a5 Revert "Zero marks by GDEF for Tibetan"
This reverts commit d5bd0590ae.

The reasoning behind that logic was flawed and made under
a misunderstanding of the original problem, and caused
regressions as reported by Jonathan Kew in thread titled
"tibetan marks" in Oct 2013.  Apparently I have had fixed
the original problem with this commit:

  7e08f1258d

So, revert the faulty commit and everything seems to be in good
shape.
2013-10-28 00:43:27 +01:00
Behdad Esfahbod ac8cd51191 Refactor 2013-10-18 19:33:09 +02:00
Behdad Esfahbod d5bd0590ae Zero marks by GDEF for Tibetan
See:
http://lists.freedesktop.org/archives/harfbuzz/2013-April/003101.html
2013-10-18 18:17:29 +02:00
Behdad Esfahbod a1f7b28561 [otlayout] Switch over from old is_a_ligature() to IS_LIGATED
Impact should be minimal and positive.
2013-10-18 11:25:24 +02:00
Behdad Esfahbod 101303dbf7 [otlayout] More shuffling around 2013-10-18 11:21:15 +02:00
Behdad Esfahbod 91689de260 [otlayout] Add _hb_glyph_info_set_glyph_props()
No functional change.
2013-10-18 11:21:15 +02:00
Behdad Esfahbod 3ddf892b53 [otlayout] Renaming 2013-10-18 11:21:15 +02:00
Behdad Esfahbod 3d2c4f0c2f Fix hiding of default_ignorables if font doesn't have space glyph
Based on patch from Jonathan Kew.  See discussion on the list.
2013-09-27 17:06:29 -04:00
Behdad Esfahbod 4b011094d5 Move code around
I believe I didn't break anything...
2013-09-13 20:17:42 -04:00
Behdad Esfahbod d71c0df2d1 Remove vrt2, vkrn, vpal, and valt from default vertical features
See thread by John Dagget on the list.
2013-08-09 09:29:29 -04:00
Behdad Esfahbod d785fa0c45 Minor refactoring 2013-05-20 09:18:52 -04:00
Behdad Esfahbod 127daf15e0 Arabic mark width-zeroing regression
Mozilla Bug 873902 - Display Arabic text with diacritics is bad
https://bugzilla.mozilla.org/show_bug.cgi?id=873902
2013-05-20 09:11:35 -04:00
Behdad Esfahbod ba87b8fc89 Move code around 2013-02-21 15:23:39 -05:00
Behdad Esfahbod c462b32dcb Disable automatic segment properties guessing
Before, if one called hb_shape() without setting script, language, and
direction on the buffer, hb_shape() was calling
hb_buffer_guess_segment_properties() on the user's behalf to guess
these.

This is very dangerous, since any serious user of HarfBuzz must set
these properly (specially important is direction).  So now, we don't
guess properties by default.  People not setting direction will get
an abort() now.  If the old behavior is desired (fragile, good for
simple testing only), users can call
hb_buffer_guess_segment_properties() on the buffer just before calling
hb_shape().
2013-02-15 07:51:47 -05:00
Behdad Esfahbod 038c98f686 Allow disabling of TrueType kerning
Responds to the same feature tag that GPOS kerning does:
'kern' for horizontal and 'vkrn' for vertical.
2013-02-15 07:41:07 -05:00
Behdad Esfahbod ee9c3a17d0 Minor refactoring 2013-02-15 06:22:52 -05:00
Behdad Esfahbod ec5448667b Add hb_ot_map_feature_flags_t
Code cleanup.  No (intended) functional change.
2013-02-14 12:53:57 -05:00
Behdad Esfahbod e7ffcfafb1 Clean-up add_bool_feature 2013-02-14 11:58:13 -05:00
Behdad Esfahbod 0291a65286 Further adjust mark advance zeroing
This is a followup to 568000274c.
Looks like in the Latin shaper, Uniscribe zeroes all Unicode NSM
advances *after* GPOS, not before.  Match that.

Can be tested using DejaVu Sans Mono, since that font has GPOS
rules to zero the mark advances on its own.
2013-02-13 05:57:24 -05:00
Behdad Esfahbod 568000274c Adjust mark advance-width zeroing logic for Myanmar
Before, we were zeroing advance width of attached marks for
non-Indic scripts, and not doing it for Indic.

We have now three different behaviors, which seem to better
reflect what Uniscribe is doing:

  - For Indic, no explicit zeroing happens whatsoever, which
    is the same as before,

  - For Myanmar, zero advance width of glyphs marked as marks
    *in GDEF*, and do that *before* applying GPOS.  This seems
    to be what the new Win8 Myanmar shaper does,

  - For everything else, zero advance width of glyphs that are
    from General_Category=Mn Unicode characters, and do so
    before applying GPOS.  This seems to be what Uniscribe does
    for Latin at least.

With these changes, positioning of all tests matches for Myanmar,
except for the glitch in Uniscribe not applying 'mark'.  See preivous
commit.
2013-02-12 09:44:57 -05:00
Behdad Esfahbod 51bb498b7b Minor 2012-11-16 14:08:05 -08:00
Behdad Esfahbod 5a08ecf920 Implement hb_ot_layout_get_glyph_class() 2012-11-16 13:34:29 -08:00
Behdad Esfahbod eba312c8d1 Plumbing to get shape plan and font into complex decompose function
So we can handle Sinhala split matras smartly...  Coming soon.
2012-11-16 12:58:38 -08:00
Behdad Esfahbod 3f82f8ff07 Rename hb_buffer_guess_properties() to hb_buffer_guess_segment_properties() 2012-11-15 18:48:10 -08:00
Behdad Esfahbod f30641038b Bunch of independent changes (ouch)
API additions:

	hb_segment_properties_t
	HB_SEGMENT_PROPERTIES_DEFAULT
	hb_segment_properties_equal()
	hb_segment_properties_hash()

	hb_buffer_set_segment_properties()
	hb_buffer_get_segment_properties()

	hb_ot_layout_glyph_class_t

	hb_shape_plan_t
	hb_shape_plan_create()
	hb_shape_plan_create_cached()
	hb_shape_plan_get_empty()
	hb_shape_plan_reference()
	hb_shape_plan_destroy()
	hb_shape_plan_set_user_data()
	hb_shape_plan_get_user_data()
	hb_shape_plan_execute()

	hb_ot_shape_plan_collect_lookups()

API changes:

	Rename hb_ot_layout_feature_get_lookup_indexes() to
	hb_ot_layout_feature_get_lookups().

New header file:

	hb-shape-plan.h

And a bunch of prototyped but not implemented stuff.  Coming soon.
(Tests fail because of the prototypes right now.)
2012-11-15 18:48:10 -08:00
Behdad Esfahbod aec89de564 Add / modify set API a bit 2012-11-15 16:15:42 -08:00
Behdad Esfahbod 865745b5b8 Don't do fallback positioning for Indic and Thai shapers 2012-11-14 13:48:26 -08:00
Behdad Esfahbod 0c7df22228 Add buffer flags
New API:

	hb_buffer_flags_t

	HB_BUFFER_FLAGS_DEFAULT
	HB_BUFFER_FLAG_BOT
	HB_BUFFER_FLAG_EOT
	HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES

	hb_buffer_set_flags()
	hb_buffer_get_flags()

We use the BOT flag to decide whether to insert dottedcircle if the
first char in the buffer is a combining mark.

The PRESERVE_DEFAULT_IGNORABLES flag prevents removal of characters like
ZWNJ/ZWJ/...
2012-11-13 14:42:35 -08:00
Behdad Esfahbod 0736915b8e [Indic] Decompose Sinhala split matras the way old HarfBuzz / Pango did
Had to do some refactoring to make this happen...

Under uniscribe bug compatibility mode, we still plit them
Uniscrie-style, but Jonathan and I convinced ourselves that there is no
harm doing this the Unicode way.  This change makes that happen, and
unbreaks free Sinhala fonts.
2012-11-13 12:35:35 -08:00
Behdad Esfahbod 9b37b4c580 Make planner available to complex shaper choosing logic 2012-11-12 18:23:38 -08:00
Behdad Esfahbod cf3afd8979 Rename and revamp is_zero_width() to be is_default_ignorable()
That's really the logic desired.  Except that MONGOLIAN VOWEL SEPARATOR
is not default_ignorable but it really should be.  Reported to Unicode.

Based on suggestion from Konstantin Ritt.
2012-10-25 16:32:54 -07:00
Behdad Esfahbod fecdfa95da Fixup hb_ot_shape_closure()
Broke it when merged cmap mapping and normalizer.  Ouch!
2012-10-07 17:19:58 -04:00
Behdad Esfahbod f2eb3fa9dc [OT] Only insert dottedcircle if at the beginning of paragraph
If the first char in the run is a combining mark, but there is text
before the run, don't insert dottedcircle.

Part of addressing:
https://bugzilla.redhat.com/show_bug.cgi?id=858736
2012-09-25 21:35:35 -04:00
Behdad Esfahbod 028a1706f8 Refactor common macro 2012-09-06 14:25:48 -04:00
Behdad Esfahbod fabd3113a9 [OT] Port Arabic fallback shaping to synthetic GSUB
All of init/medi/fina/isol and rlig implemented.

Let there be dragons... ⻯
2012-09-06 00:51:44 -04:00
Behdad Esfahbod 6912e476dd [OT] Insert dotted-circle for run-initial marks
Unfortunately if the font has GPOS and 'mark' feature does
not position mark on dotted-circle, our inserted dotted-circle
will not get the mark repositioned to itself.  Uniscribe cheats
here.

If there is no GPOS however, the fallback positioning kicks in
and sorts this out.

I'm not willing to address the first case.
2012-09-01 20:38:45 -04:00
Behdad Esfahbod 3992b5ec4c Move code around 2012-09-01 19:20:41 -04:00
Behdad Esfahbod 784f29d061 Minor 2012-08-31 14:06:26 -04:00
Behdad Esfahbod 0ccf9b6473 Move code around 2012-08-29 14:02:37 -04:00
Behdad Esfahbod 2fcbbdb41a Port Arabic fallback ligating to share code with GSUB
This will eventually allow us to skip marks, as well as (fallback)
attach marks to ligature components of fallback-shaped Arabic.
That would be pretty cool.  I kludged GDEF props in, so mark-skipping
works, but the produced ligature id/components will be cleared later
by substitute_start() et al.

Perhaps using a synthetic table for Arabic fallback shaping was a better
idea.  The current approach has way too many layering violations...
2012-08-29 14:01:22 -04:00
Behdad Esfahbod 9f9f04c222 [OT] Unbreak Thai shaping and fallback Arabic shaping
The merger of normalizer and glyph-mapping broke shapers that
modified text stream.  Unbreak them by adding a new preprocess_text
shaping stage that happens before normalizing/cmap and disallow
setup_mask modification of actual text.
2012-08-11 18:34:13 -04:00
Behdad Esfahbod 07d6828063 Minor 2012-08-10 03:28:50 -04:00
Behdad Esfahbod b00321ea78 [OT] Avoid calling get_glyph() twice
Essentially move the glyph mapping to normalization process.
The effect on Devanagari is small (but observable).  Should be more
observable in simple text, like ASCII.
2012-08-09 22:33:32 -04:00
Behdad Esfahbod 12c0875eaf [OT] Remove redundant check 2012-08-09 22:02:54 -04:00
Behdad Esfahbod 5c60b70c89 [OT] More code shuffling around
Preparing for merging map_glyphs() and normalize().
2012-08-09 21:58:07 -04:00
Behdad Esfahbod a02d86484b Add check-exported-symbols.sh
And misc linking fixes.
2012-08-08 18:04:29 -04:00
Behdad Esfahbod 4c8ac4f47e Misc minor fixes 2012-08-08 17:44:19 -04:00
Behdad Esfahbod 9c929abdcf Minor renaming 2012-08-08 14:33:37 -04:00
Behdad Esfahbod affaf8a0e5 [OT] Start adding fallback positioning
Used when there is no GPOS.
2012-08-07 22:43:07 -04:00
Behdad Esfahbod 7e4920fd15 Minor 2012-08-07 22:32:23 -04:00
Behdad Esfahbod f4e48adcdd [OT] Apply 'rclt' feature in horizontal mode
'rclt' is "Required Contextual Forms" being proposed by Microsoft.
It's like 'calt', but supposedly always on.  We apply 'calt' anyway,
and now apply this too.
2012-08-07 21:12:49 -04:00
Behdad Esfahbod 71baea0062 [OT] Use general-category, not GDEF class, to decide to zero mark advances
At this point, the GDEF glyph synthesis looks pointless.  Not that I
have many fonts without GDEF lying around.

As for mark advance zeroing when GPOS not available, that also is being
replaced by proper fallback mark positioning soon.
2012-08-03 17:40:07 -07:00
Behdad Esfahbod a8c6da90f4 [OT] Add per-complex-shaper shape_plan data
Hookup some Indic data to it.  More to come.
2012-08-02 10:46:34 -04:00
Behdad Esfahbod 8bb5deba96 [OT] Pipe shape_plan down to pause_callbacks 2012-08-02 10:07:58 -04:00
Behdad Esfahbod 16c6a27b4b [OT] Port complex_shaper to planner/plan 2012-08-02 09:38:28 -04:00
Behdad Esfahbod 5393e3a62b [OT] Minor refactoring 2012-08-02 09:24:35 -04:00
Behdad Esfahbod afbcc24be0 [GSUB] Wire the font, not just the face, down to substitute()
We need the font for glyph lookup during GSUB pauses in Indic shaper.
Could perhaps be avoided, but at this point, we don't mean to support
separate substitute()/position() entry points (anymore), so there is
no point in not providing the font to GSUB.
2012-08-02 08:36:40 -04:00
Behdad Esfahbod 8fbfda920e Inline font getters 2012-08-01 19:03:46 -04:00
Behdad Esfahbod 208f70f055 Inline Unicode callbacks internally 2012-08-01 17:13:10 -04:00
Behdad Esfahbod 1e7d860613 [GPOS] Adjust mark advance-width zeroing logic
If there is no GPOS, zero mark advances.

If there *is* GPOS and the shaper requests so, zero mark advances for
attached marks.

Fixes regression with Tibetan, where the font has GPOS, and marks a
glyph as mark where it shouldn't get zero advance.
2012-07-31 23:41:06 -04:00
Behdad Esfahbod 2bc3b9a616 [OT] Zero mark advances if the shaper desires so
Enabled for all shapers except for Indic.
2012-07-31 23:17:22 -04:00
Behdad Esfahbod 5fecd8b035 [OT] Synthesize glyph classes 2012-07-31 23:17:22 -04:00
Behdad Esfahbod 693918ef85 [OT] Streamline complex shaper enumeration
Add a shaper class struct.
2012-07-30 21:08:51 -04:00
Behdad Esfahbod 05bd1b6342 [GSUB/GPOS] Move glyph props matching around 2012-07-30 19:30:01 -04:00
Behdad Esfahbod 7e34601ded Unbreak Hangul jamo composition
When we removed the separate Hangul shaper, the specific normalization
preference of Hangul was lost.  Fix that.  Also, the Thai shaper was
copied from Hangul, so had the fully-composed normalization behavior,
which was unnecessary.  So, fix that too.
2012-07-30 14:53:41 -04:00
Behdad Esfahbod 4ba647eecf Fix leak 2012-07-30 09:53:06 -04:00
Behdad Esfahbod e82061e8db Move ot shaper completely to shape_plan 2012-07-27 02:29:32 -04:00
Behdad Esfahbod ea278d3895 Partially switch ot shaper to shape_plan 2012-07-27 02:12:28 -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 b70021f7c8 When removing zero-width marks, don't remove ligatures
If a mark ligated, it probably should NOT be removed.
2012-07-23 20:18:17 -04:00
Behdad Esfahbod d96838ef95 Allow complex shapers overriding common features
In a new callback...  Currently unused by all complex shapers.
2012-07-16 20:26:57 -04:00
Behdad Esfahbod 330a2af3ff Use merge_clusters when forming Unicode clusters 2012-06-08 20:40:02 -04:00
Behdad Esfahbod 5f68f8675e Minor 2012-06-08 19:23:43 -04:00
Behdad Esfahbod 0594a24484 Cleanup TRUE/FALSE vs true/false 2012-06-05 20:35:40 -04:00
Behdad Esfahbod 99c2695759 Add accessort to buffer for current info, current pos, and prev info 2012-05-13 15:45:18 +02:00
Behdad Esfahbod d1deaa2f5b Replace zerowidth invisible chars with a zero-advance space glyph
Like Uniscribe does.
2012-05-09 15:04:13 +02:00
Behdad Esfahbod 1827dc208c Add hb_ot_shape_glyphs_closure()
Experimental API for now.
2012-04-24 16:56:37 -04:00
Behdad Esfahbod a4385f0b0a Improve clustering 2012-04-23 22:20:14 -04:00
Behdad Esfahbod a5f1834f57 Apply 'liga' for vertical writing mode too
Apparently that's what Kazuraki uses to form vertical ligatures,
which suggests that it's what Adobe does.
2012-04-16 15:55:13 -04:00
Behdad Esfahbod 683b503f30 Minor 2012-04-14 20:47:14 -04:00
Behdad Esfahbod b9f199c8e3 Move code around 2012-04-14 20:25:37 -04:00
Behdad Esfahbod d4adade217 Add assert 2012-04-14 19:23:17 -04: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 0e3361464b Fix bug with not setting Unicode props of the first character
Fixes Mongolian shaping issue:
https://bugs.freedesktop.org/show_bug.cgi?id=45695
2012-04-12 10:06:52 -04:00
Behdad Esfahbod acd88e659f In Arabic fallback shaping, check that the font has glyph for new char 2012-04-10 18:02:20 -04:00
Behdad Esfahbod 7752aa73e7 Minor 2012-04-10 17:22:14 -04:00
Behdad Esfahbod 11138ccff7 Add normalize mode
In preparation for Hangul shaper.
2012-04-05 17:25:19 -04:00
Behdad Esfahbod 6769f21d57 More moving code around 2012-04-05 16:46:46 -04:00
Behdad Esfahbod 0501573ded Fix const correctness in the API 2011-08-10 16:25:56 +02:00
Behdad Esfahbod 02aeca985b [API] Changes to main shape API
hb_shape() now accepts a shaper_options and a shaper_list argument.
Both can be set to NULL to emulate previous API.  And in most situations
they are expected to be set to NULL.

hb_shape() also returns a boolean for now.  If shaper_list is NULL, the
return value can be ignored.

shaper_options is ignored for now, but otherwise it should be a
NULL-terminated list of strings.

shaper_list is a NULL-terminated list of strings.  Currently recognized
strings are "ot" for native OpenType Layout implementation, "uniscribe"
for the Uniscribe backend, and "fallback" for the non-complex backend
(that will be implemented shortly).  The fallback backend never fails.

The env var HB_SHAPER_LIST is also parsed and honored.  It's a
colon-separated list of shaper names.  The fallback shaper is invoked if
none of the env-listed shapers succeed.

New API hb_buffer_guess_properties() added.
2011-08-04 22:38:09 -04:00
Behdad Esfahbod c605bbbb6d Remove C++ guards from source files
Where causing issues for people with MSVC.
2011-08-04 20:00:53 -04:00
Behdad Esfahbod 2118fdb9f5 Fix fallback shaping
Broke it a few commits ago.
2011-08-02 14:06:51 -04:00
Behdad Esfahbod 9f9bcceca6 Register buffer vars in Indic shaper 2011-07-28 17:07:50 -04:00
Behdad Esfahbod b65c06025d Formalize buffer var allocations 2011-07-28 16:49:29 -04:00
Behdad Esfahbod 651e8dd79e Start cleaning up buffer var allocation
I've messed up a lot of stuff recently, different parts of the
shaping process are stumbling on eachother's toes because
manually tracking what's in which buffer var is hard.  I'm
going to add some internal API to track those such that mistakes
are discovered as soon as they are introduced.
2011-07-25 14:54:08 -04:00
Behdad Esfahbod c86f932015 Move code around 2011-07-25 00:44:50 -04:00
Behdad Esfahbod 34c22f8168 Implement Unicode Canonical Reordering Algorithm 2011-07-22 17:04:20 -04:00
Behdad Esfahbod 4ff0d2d9df Decomposition works now! 2011-07-22 16:15:32 -04:00
Behdad Esfahbod 468e9cb25c Move buffer methods into the object 2011-07-22 14:49:14 -04:00
Behdad Esfahbod 45412523dc More normalization kick 2011-07-22 11:07:05 -04:00
Behdad Esfahbod 5d90a342e3 Document normalization design 2011-07-21 15:25:01 -04:00
Behdad Esfahbod d63adfc7d0 No need to handle variation-selectors seperately, they are GC=Mn 2011-07-21 11:48:57 -04:00
Behdad Esfahbod aa7264123a Only form clusters if we are reversing
This produces more accurate cluster mappings.  Cluster mappings are
minimal now.  Combining marks get their own cluster value most of
the time.
2011-07-21 11:34:59 -04:00
Behdad Esfahbod 5c6f5982d7 Towards normalization 2011-07-21 11:31:08 -04:00
Behdad Esfahbod cf7f43ec33 Remove stale comment 2011-07-21 01:12:26 -04:00
Behdad Esfahbod 54d1a0d2b2 Form clusters before ensuring native direciton
This is essential as ensure_native_direction uses cluster info that
is set by form_clusters().
2011-07-21 01:11:09 -04:00
Behdad Esfahbod 9111b21ef9 Add _hb_buffer_output_glyph() and _hb_buffer_skip_glyph() 2011-07-21 00:59:15 -04:00
Behdad Esfahbod 655586fe5e Towards normalization 2011-07-21 00:52:42 -04:00
Behdad Esfahbod 49741c8633 Include variation-selectors in cluster calculation 2011-07-21 00:35:37 -04:00
Behdad Esfahbod 4a68684654 When forming clusters, participate all mark types 2011-07-21 00:14:01 -04:00
Behdad Esfahbod f6fd3780e1 Let shapers decide when to apply ccmp and locl
Instead of always applying those two features before the complex shaper,
let the complex shaper decide whether they should be applied first.

Also add stub for Indic's final_reordering().
2011-07-08 00:22:40 -04:00
Behdad Esfahbod c4641723fb [API] Add compose() and decompose() unicode funcs, rename other ones
Add compose() and decompose() unicode funcs.  These implement
pair-wise canonical composition/decomposition.

The glib/icu implementations are lacking for now.  We are adding
API for this to glib, but I cannot find any useful API in ICU.
May end of implementing these in-house.

Changed all unicode_funcs callback names to remove the "_get" part.
Eg, hb_unicode_get_script_func_t is now hb_unicode_script_func_t,
and hb_unicode_get_script() is hb_unicode_script() now.
2011-07-08 00:09:31 -04:00
Behdad Esfahbod 891c4755ba Humm, undo some shuffling
In preparation for adding more advanced unicode funcs.
2011-07-07 23:27:27 -04:00
Behdad Esfahbod 76f76812ac Shuffle code around, remove shape_plan from complex shapers 2011-07-07 22:25:25 -04:00
Behdad Esfahbod 359dcaa0d3 Update copyright headers 2011-07-07 21:55:05 -04:00
Behdad Esfahbod b9452bfc16 Fix compiler warnings with -pedantic 2011-06-14 14:47:07 -04:00
Behdad Esfahbod 63b177e45c Minor 2011-06-07 15:51:40 -04:00
Behdad Esfahbod 89a2bc9ba6 [Vertical] Apply vertical features
We apply all of vert, vrt2, vkrn, valt, and vpal.
2011-05-31 15:18:13 -04:00
Behdad Esfahbod 90645fb24b [OT] Separate map_builder from the actual map
Respectively, separate planner from the actual plan.
2011-05-27 18:13:31 -04:00
Behdad Esfahbod 376dafa6ed Hide internal symbols 2011-05-27 03:40:04 -04:00
Behdad Esfahbod 7403e055cd [Vertical] fix vertical gpos
Wow, it took me a few days to find the right fix!

We now set the advance for attached marks to zero, but we
do this in the _finish() state of gpos, so it shouldn't
regress with fonts like DejaVuSansMono that explicitly
decrease the mark advance width to set it to zero.
2011-05-25 10:52:15 -04:00
Behdad Esfahbod 60fbb36096 [Vertical] GPOS is always done with horizontal origin 2011-05-19 18:46:15 -04:00
Behdad Esfahbod 8b38faeede More vertical
Starting to get there, but not without yet another round of changes.

I think I know wheere to go now.
2011-05-19 13:08:00 -04:00
Behdad Esfahbod 7e2c85de30 [API] Vertical support, take 2
I like this API *much* better.  Implementation still incomplete, but
horizontal works.
2011-05-17 17:55:03 -04:00
Behdad Esfahbod 744970af4d [API] Add support for vertical text
Design not final yet, and in fact I'm going to change it immediately,
but this is an standalone change for itself.
2011-05-17 17:12:34 -04:00
Behdad Esfahbod 0fd8c2f1be [API] Make get_glyph() callback return a boolean
We need to know whether the glyph exists, so we can fallback to
composing / decomposing.  Assuming that glyph==0 means "doesn't exist"
wouldn't work for applications like Pango that want to use different
"doesn't exist" glyph codes for different characters.  An explicit
return value fixes that.
2011-05-12 15:14:13 -04:00
Behdad Esfahbod e06d4eda7b Use constructor/destructor for hb_ot_shape_plan_t 2011-05-11 22:18:31 -04:00
Behdad Esfahbod 6a7ac79e26 Plug leaks 2011-05-11 14:19:18 -04:00
Behdad Esfahbod a513dbcf73 [API] Change signature of get_contour_point and get_kerning ffuncs
get_contour_point now takes glyph id before point_index.

get_kerning now takes a vector to fill-in.
2011-05-11 00:38:22 -04:00
Behdad Esfahbod 6843569d2c Replace fixed-size feature_maps array with hb_array_t 2011-05-05 14:30:51 -04:00
Behdad Esfahbod 72657e4ce7 [API] Make hb_font_create() take a face and reference it 2011-05-02 20:47:23 -04:00
Behdad Esfahbod 2409d5f8d7 Update Copyright headers 2011-04-21 17:14:28 -04:00
Behdad Esfahbod fb194b8794 unicode: Cleanup implementation 2011-04-20 02:27:39 -04:00
Ryan Lortie 2fd0c577e3 [API] unicode: rework virtual functions for subclassing
Unicode data providers can now be subclassed, including support for
chain-up.  The interface should now be nicely bindable, as well.

Also fix glib unicode funcs that where broken after hb_script_t
changes.  Nicely caught by the test-unicode.c added in this commit.
2011-04-20 00:19:20 -04:00
Behdad Esfahbod 8f0d7e0c3f Remove hb_buffer_clear_positions(), add hb_ot_layout_position_start() 2011-04-15 19:08:43 -04:00
Behdad Esfahbod 5814dfa3f5 Cosmetic 2011-04-15 14:41:04 -04:00
Behdad Esfahbod 99b74760a4 Rename hb_category_t to hb_unicode_general_category_t 2011-04-11 15:47:40 -04:00
Behdad Esfahbod a71b9c8579 Disable 'cswh' by default except for Arabic shaper
That better matches OpenType spec.  Note that we enable it for all
Arabic-shaper scripts.  Ie. we enable it by default for Syriac too,
but the SyriacOT spec does not require it.  I think this is a more
useful compromise than special-casing for Arabic script alone.
2011-04-06 14:04:56 -04:00
Behdad Esfahbod 3286fc0e9a Let hb_shape() guess script and direction...
- Rename HB_SCRIPT_INVALID_CODE to HB_SCRIPT_INVALID

- Add HB_DIRECTION_INVALID

- Make hb_script_get_horizontal_direction() public

- Make hb_shape() guess script from buffer text (first non-common
  non-inherit script) if buffer script is set to HB_SCRIPT_INVALID (this
  is NOT the default.)

- Make hb_shape() guess direction from buffer script if buffer direction
is set to HB_DIRECTION_INVALID (this is NOT the default.)

- Make hb-view.c set INVALID script and direction on the buffer.

The above changes are meant to make hb-view fairly useful for uni-script
uni-direction text.  The guessing behavior however is NOT the default of
hb_shape() and must be asked for explicitly.  This is intended, because
the guess is not a suitable substitute to full-fledged bidi and script
segmentation.  It's just a testing tool.
2011-03-16 14:53:32 -03:00
Behdad Esfahbod bbbbe80ec9 Rename original_direction to target_direction 2010-12-07 16:22:02 -05:00
Behdad Esfahbod ee8aaf976a Fix arabic shaping of LTR text
We should ensure-direction before doing any complex work.  The only
exception is mirroring that needs to see the original / final direction,
not the native.  Handle that.
2010-12-07 16:20:42 -05:00
Behdad Esfahbod 3a852ae7fe Save general category and combining class in the buffer for reuse 2010-11-03 16:37:24 -04:00
Behdad Esfahbod 1e7c1fcbc3 Move code around 2010-11-02 19:12:59 -04:00
Behdad Esfahbod 98370e89d1 WIP removing external synthesized GDEF support and implementing it internally 2010-11-02 19:12:58 -04:00
Behdad Esfahbod dd2ffd282c Minor renaming 2010-11-02 19:12:58 -04:00
Behdad Esfahbod 248e3c2ba4 Oops, remove extra mask setting that broke complex shaping 2010-10-27 01:23:14 -04:00
Behdad Esfahbod 502f4cba3e Divide get_metrics into get_advance and get_extents
Graphite module not updated.
Bump version to 0.3.
2010-10-27 01:13:56 -04:00
Behdad Esfahbod bd7378b2ef Massage mask setting a bit more
Still finding the exact correct way the masks should be set.
2010-10-13 18:33:16 -04:00
Behdad Esfahbod 39dede9fff Make sure boolean features always use value=1
Previously boolean features turned on the entire feature mask.  This is
wrong if feature is Alternate and user has provided values bigger than one.
Though, I don't think other engines support such corner cases.
2010-10-13 15:54:06 -04:00
Behdad Esfahbod 2989be4919 Set user masks after complex masks 2010-10-13 15:18:29 -04:00
Behdad Esfahbod 13403bc67a Hookup Arabic shaper!
Not tested yet.
2010-10-12 17:23:54 -04:00
Behdad Esfahbod 57ac0ecb78 Merge clearing masks and setting global masks 2010-10-12 17:07:02 -04:00
Behdad Esfahbod fc96596b7c Form clusters before setting masks 2010-10-12 17:00:40 -04:00
Behdad Esfahbod 1e80782244 Clear masks before setting them up, not after! 2010-10-12 17:00:07 -04:00
Behdad Esfahbod fd3d32d31c Add hb_ot_shape_execute()
Not public yet.
2010-10-12 16:57:47 -04:00
Behdad Esfahbod 49baa1f69e Add hb_ot_complex_shaper_t stuff and start hooking Arabic shaper up 2010-10-12 16:50:36 -04:00
Behdad Esfahbod 605ed468f3 Add hb_ot_shape_plan_t
This is the object that a separate plan/execute shaping API will use in
between the two stages.
2010-10-12 16:19:38 -04:00
Behdad Esfahbod 895fb5d364 Refactor, in a different direction 2010-10-12 16:00:21 -04:00
Behdad Esfahbod d2ba016ca1 More refactoring 2010-10-12 15:35:45 -04:00
Behdad Esfahbod 52601275d5 More separation 2010-10-08 20:38:46 -04:00
Behdad Esfahbod 6b7e675862 Minor 2010-10-08 20:30:04 -04:00
Behdad Esfahbod aa9c450bb2 Enable 'rtlm' mirroring 2010-10-08 20:27:38 -04:00
Behdad Esfahbod 36925f695d Rename hb_mask_allocator_t to hb_ot_map_t
hb_ot_plan_t may be a better name, donno.
2010-10-08 20:21:09 -04:00
Behdad Esfahbod 4924affe0f Add hb-ot-map-private.hh 2010-10-08 19:18:16 -04:00
Behdad Esfahbod b897c607d9 Flip the OT bit-allocation vs gsub/gpos inside-out
We now build our entire attack plan before jumping in.
2010-10-08 18:41:57 -04:00
Behdad Esfahbod e89b7d2a61 Logically separate feature collection 2010-10-08 12:29:59 -04:00
Behdad Esfahbod 5b88908f12 Minor 2010-10-08 12:23:01 -04:00
Behdad Esfahbod 5360ce0c5c Move some more code around 2010-10-07 21:21:11 -04:00
Behdad Esfahbod d9c7260788 Minor 2010-10-07 21:19:54 -04:00
Behdad Esfahbod efe0d682e8 Simplify compiling lookups 2010-10-07 21:12:46 -04:00
Behdad Esfahbod 476c94218b Rename 2010-10-07 17:47:33 -04:00
Behdad Esfahbod 98aa3f6544 Call hb_ot_shape_setup_lookups_complex() 2010-10-06 00:23:36 -04:00
Behdad Esfahbod f1d07885dc Rename setup_lookups() 2010-10-06 00:21:37 -04:00
Behdad Esfahbod affc5abac7 Move table_tag to hb_ot_shape_context_t 2010-10-06 00:18:16 -04:00
Behdad Esfahbod 967240dd8b Add internal hb_ot_shape_context_t 2010-10-05 23:00:05 -04:00
Behdad Esfahbod 4e573715ae Improve cmp function parameter namings and casts
No semantic change.
2010-09-28 16:28:57 -04:00
Behdad Esfahbod 2422c4b96d Add TODO 2010-08-13 14:00:34 -04:00
Behdad Esfahbod 27f0b092a1 Logically separate feature allocation from application 2010-07-23 17:35:54 -04:00
Behdad Esfahbod 6cf63132dc Minor 2010-07-23 17:32:26 -04:00
Behdad Esfahbod 4e4ef24e46 Towards separating bit allocation from shaping 2010-07-23 17:22:11 -04:00
Behdad Esfahbod acdba3f90b Prefer C linkage 2010-07-23 15:39:27 -04:00
Behdad Esfahbod f2a1b411b1 Followup fix for variation-selectors
Patch from Jonathan Kew
2010-06-03 11:37:51 -04:00
Behdad Esfahbod a224b4d502 Fix skipping variation-selectors 2010-06-02 22:31:41 -04:00
Behdad Esfahbod 81a77b115d Make feature sorting stable 2010-06-01 23:03:54 -04:00
Behdad Esfahbod fdc322a820 Minor 2010-05-28 20:55:52 -04:00
Behdad Esfahbod f062ec6bb2 Further simplify mask allocator 2010-05-28 20:54:43 -04:00
Behdad Esfahbod 8af45fda47 Fix global feature handling 2010-05-28 20:41:20 -04:00
Behdad Esfahbod e04685ee7b Simplify mask allocation 2010-05-28 20:37:06 -04:00
Behdad Esfahbod 0e235d0fc9 Towards a mask allocator 2010-05-28 20:27:30 -04:00
Behdad Esfahbod 81c5e8724b Allow disabling default features
Patch from Jonathan Kew
2010-05-28 18:31:16 -04:00