[aat] Adjust fallback positioning logic

Fixes https://github.com/harfbuzz/harfbuzz/issues/1528

Wish could add a test...

$ ./hb-view --font-file Thonburi.ttc --unicodes U+0E17,U+0E35,U+0E48,U+0E4A --shaper ot

                   ▃

         ▂▃▃▄▃▂▁▊        ▃  ▃       ▎
      ▗   ▅▆▆▅          ▌ ▆▆▅▆▙ ▌▗
     ▗                  ▙ ▂  ▎▗   ▟
     ▅▆▆▆▇▇▇▇▇▇▇▆▆▅▄     ▇▅▅▅ ▙▆▇
    ▁▁▂▁       ▁▁
         ▖                    ▖ ▂▂
  ▉   ▁        ▆▆        ▌   ▆  ▙▄ ▁▁
   ▙            ▉      ▃▖           ▟
      ▊         ▉      ▅▟           ▗▄
      ▊         ▉     ▗ ▏           ▇▆
      ▊    ▟    ▉      ▆             ▖
      ▊         ▉        ▌        ▂
      ▊   ▏     ▉           ▌ ▗   ▄▟
      ▊                        ▆
pull/1911/head
Behdad Esfahbod 5 years ago
parent fa7edf87c9
commit f47cbade18
  1. 20
      src/hb-ot-shape-complex-default.cc
  2. 5
      src/hb-ot-shape-complex.hh
  3. 5
      src/hb-ot-shape.cc

@ -49,5 +49,25 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
true, /* fallback_position */
};
/* Same as default but no mark advance zeroing / fallback positioning.
* Dumbest shaper ever, basically. */
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_dumber =
{
nullptr, /* collect_features */
nullptr, /* override_features */
nullptr, /* data_create */
nullptr, /* data_destroy */
nullptr, /* preprocess_text */
nullptr, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
nullptr, /* decompose */
nullptr, /* compose */
nullptr, /* setup_masks */
HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
false, /* fallback_position */
};
#endif

@ -50,8 +50,9 @@ enum hb_ot_shape_zero_width_marks_type_t {
/* Master OT shaper list */
#define HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS \
HB_COMPLEX_SHAPER_IMPLEMENT (default) /* should be first */ \
HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \
HB_COMPLEX_SHAPER_IMPLEMENT (default) \
HB_COMPLEX_SHAPER_IMPLEMENT (dumber) \
HB_COMPLEX_SHAPER_IMPLEMENT (hangul) \
HB_COMPLEX_SHAPER_IMPLEMENT (hebrew) \
HB_COMPLEX_SHAPER_IMPLEMENT (indic) \
@ -60,7 +61,7 @@ enum hb_ot_shape_zero_width_marks_type_t {
HB_COMPLEX_SHAPER_IMPLEMENT (myanmar_zawgyi) \
HB_COMPLEX_SHAPER_IMPLEMENT (thai) \
HB_COMPLEX_SHAPER_IMPLEMENT (use) \
/* ^--- Add new shapers here */
/* ^--- Add new shapers here; keep sorted. */
struct hb_ot_complex_shaper_t

@ -78,8 +78,9 @@ hb_ot_shape_planner_t::hb_ot_shape_planner_t (hb_face_t *fac
script_zero_marks = shaper->zero_width_marks != HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE;
script_fallback_mark_positioning = shaper->fallback_position;
if (apply_morx)
shaper = &_hb_ot_complex_shaper_default;
/* https://github.com/harfbuzz/harfbuzz/issues/1528 */
if (apply_morx && shaper != &_hb_ot_complex_shaper_default)
shaper = &_hb_ot_complex_shaper_dumber;
}
void

Loading…
Cancel
Save