[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

                   ▃

         ▂▃▃▄▃▂▁▊        ▃  ▃       ▎
      ▗   ▅▆▆▅          ▌ ▆▆▅▆▙ ▌▗
     ▗                  ▙ ▂  ▎▗   ▟
     ▅▆▆▆▇▇▇▇▇▇▇▆▆▅▄     ▇▅▅▅ ▙▆▇
    ▁▁▂▁       ▁▁
         ▖                    ▖ ▂▂
  ▉   ▁        ▆▆        ▌   ▆  ▙▄ ▁▁
   ▙            ▉      ▃▖           ▟
      ▊         ▉      ▅▟           ▗▄
      ▊         ▉     ▗ ▏           ▇▆
      ▊    ▟    ▉      ▆             ▖
      ▊         ▉        ▌        ▂
      ▊   ▏     ▉           ▌ ▗   ▄▟
      ▊                        ▆
This commit is contained in:
Behdad Esfahbod 2019-12-09 18:10:34 -06:00
parent fa7edf87c9
commit f47cbade18
3 changed files with 26 additions and 4 deletions

View File

@ -49,5 +49,25 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
true, /* fallback_position */ 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 #endif

View File

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

View File

@ -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_zero_marks = shaper->zero_width_marks != HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE;
script_fallback_mark_positioning = shaper->fallback_position; script_fallback_mark_positioning = shaper->fallback_position;
if (apply_morx) /* https://github.com/harfbuzz/harfbuzz/issues/1528 */
shaper = &_hb_ot_complex_shaper_default; if (apply_morx && shaper != &_hb_ot_complex_shaper_default)
shaper = &_hb_ot_complex_shaper_dumber;
} }
void void