Commit Graph

245 Commits

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