This commit is contained in:
Behdad Esfahbod 2018-10-02 14:17:42 +02:00
parent cca757ae56
commit 48c513fec9
13 changed files with 19 additions and 36 deletions

View File

@ -731,7 +731,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
nullptr, /* decompose */ nullptr, /* decompose */
nullptr, /* compose */ nullptr, /* compose */
setup_masks_arabic, setup_masks_arabic,
nullptr, /* disable_otl */ HB_TAG_NONE, /* gpos_tag */
reorder_marks_arabic, reorder_marks_arabic,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */ true, /* fallback_position */

View File

@ -39,7 +39,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
nullptr, /* decompose */ nullptr, /* decompose */
nullptr, /* compose */ nullptr, /* compose */
nullptr, /* setup_masks */ nullptr, /* setup_masks */
nullptr, /* disable_otl */ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */ true, /* fallback_position */

View File

@ -424,7 +424,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hangul =
nullptr, /* decompose */ nullptr, /* decompose */
nullptr, /* compose */ nullptr, /* compose */
setup_masks_hangul, setup_masks_hangul,
nullptr, /* disable_otl */ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
false, /* fallback_position */ false, /* fallback_position */

View File

@ -154,18 +154,6 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c,
return found; return found;
} }
static bool
disable_otl_hebrew (const hb_ot_shape_plan_t *plan)
{
/* For Hebrew shaper, use fallback if GPOS does not have 'hebr'
* script. This matches Uniscribe better, and makes fonts like
* Arial that have GSUB/GPOS/GDEF but no data for Hebrew work.
* See:
* https://github.com/harfbuzz/harfbuzz/issues/347#issuecomment-267838368
*/
return plan->map.chosen_script[1] != HB_TAG ('h','e','b','r');
}
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew = const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew =
{ {
@ -179,7 +167,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew =
nullptr, /* decompose */ nullptr, /* decompose */
compose_hebrew, compose_hebrew,
nullptr, /* setup_masks */ nullptr, /* setup_masks */
disable_otl_hebrew, HB_TAG ('h','e','b','r'), /* gpos_tag. https://github.com/harfbuzz/harfbuzz/issues/347#issuecomment-267838368 */
nullptr, /* reorder_marks */ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */ true, /* fallback_position */

View File

@ -1620,7 +1620,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic =
decompose_indic, decompose_indic,
compose_indic, compose_indic,
setup_masks_indic, setup_masks_indic,
nullptr, /* disable_otl */ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
false, /* fallback_position */ false, /* fallback_position */

View File

@ -29,9 +29,7 @@
#include "hb.hh" #include "hb.hh"
#include "hb-ot-shape-complex.hh" #include "hb-ot-shape-complex.hh"
#include "hb-ot-shape.hh" /* XXX Remove */
/* buffer var allocations */ /* buffer var allocations */

View File

@ -496,7 +496,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_khmer =
decompose_khmer, decompose_khmer,
compose_khmer, compose_khmer,
setup_masks_khmer, setup_masks_khmer,
nullptr, /* disable_otl */ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
false, /* fallback_position */ false, /* fallback_position */

View File

@ -389,7 +389,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old =
nullptr, /* decompose */ nullptr, /* decompose */
nullptr, /* compose */ nullptr, /* compose */
nullptr, /* setup_masks */ nullptr, /* setup_masks */
nullptr, /* disable_otl */ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */ true, /* fallback_position */
@ -407,7 +407,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar =
nullptr, /* decompose */ nullptr, /* decompose */
nullptr, /* compose */ nullptr, /* compose */
setup_masks_myanmar, setup_masks_myanmar,
nullptr, /* disable_otl */ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
false, /* fallback_position */ false, /* fallback_position */

View File

@ -376,7 +376,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai =
nullptr, /* decompose */ nullptr, /* decompose */
nullptr, /* compose */ nullptr, /* compose */
nullptr, /* setup_masks */ nullptr, /* setup_masks */
nullptr, /* disable_otl */ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
false,/* fallback_position */ false,/* fallback_position */

View File

@ -56,7 +56,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_tibetan =
nullptr, /* decompose */ nullptr, /* decompose */
nullptr, /* compose */ nullptr, /* compose */
nullptr, /* setup_masks */ nullptr, /* setup_masks */
nullptr, /* disable_otl */ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */ true, /* fallback_position */

View File

@ -597,7 +597,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use =
nullptr, /* decompose */ nullptr, /* decompose */
compose_use, compose_use,
setup_masks_use, setup_masks_use,
nullptr, /* disable_otl */ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
false, /* fallback_position */ false, /* fallback_position */

View File

@ -34,7 +34,6 @@
#include "hb-ot-shape-normalize.hh" #include "hb-ot-shape-normalize.hh"
/* buffer var allocations, used by complex shapers */ /* buffer var allocations, used by complex shapers */
#define complex_var_u8_0() var2.u8[2] #define complex_var_u8_0() var2.u8[2]
#define complex_var_u8_1() var2.u8[3] #define complex_var_u8_1() var2.u8[3]
@ -148,13 +147,11 @@ struct hb_ot_complex_shaper_t
hb_buffer_t *buffer, hb_buffer_t *buffer,
hb_font_t *font); hb_font_t *font);
/* disable_otl() /* gpos_tag()
* Called during shape(). * If not HB_TAG_NONE, then must match found GPOS script tag for
* If set and returns true, GDEF/GSUB/GPOS of the font are ignored * GPOS to be applied. Otherwise, fallback positioning will be used.
* and fallback operations used.
* May be nullptr.
*/ */
bool (*disable_otl) (const hb_ot_shape_plan_t *plan); hb_tag_t gpos_tag;
/* reorder_marks() /* reorder_marks()
* Called during shape(). * Called during shape().

View File

@ -63,9 +63,9 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
plan.kerning_requested = !!plan.kern_mask; plan.kerning_requested = !!plan.kern_mask;
plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k')); plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
bool disable_otl = plan.shaper->disable_otl && plan.shaper->disable_otl (&plan); bool disable_gpos = plan.shaper->gpos_tag &&
//plan.fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (face); plan.shaper->gpos_tag != plan.map.chosen_script[1];
plan.fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (face); plan.fallback_positioning = disable_gpos || !hb_ot_layout_has_positioning (face);
plan.fallback_glyph_classes = !hb_ot_layout_has_glyph_classes (face); plan.fallback_glyph_classes = !hb_ot_layout_has_glyph_classes (face);
} }