[ot] Improve shaper selection heuristic

This commit is contained in:
Behdad Esfahbod 2017-10-02 18:21:27 +02:00
parent 5680ef884c
commit 57c55ef834
1 changed files with 8 additions and 4 deletions

View File

@ -253,10 +253,12 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
case HB_SCRIPT_SINHALA: case HB_SCRIPT_SINHALA:
/* If the designer designed the font for the 'DFLT' script, /* If the designer designed the font for the 'DFLT' script,
* use the default shaper. Otherwise, use the specific shaper. * (or we ended up arbitrarily pick 'latn'), use the default shaper.
* Otherwise, use the specific shaper.
* Note that for some simple scripts, there may not be *any* * Note that for some simple scripts, there may not be *any*
* GSUB/GPOS needed, so there may be no scripts found! */ * GSUB/GPOS needed, so there may be no scripts found! */
if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T')) if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
planner->map.chosen_script[0] == HB_TAG ('l','a','t','n'))
return &_hb_ot_complex_shaper_default; return &_hb_ot_complex_shaper_default;
else else
return &_hb_ot_complex_shaper_indic; return &_hb_ot_complex_shaper_indic;
@ -368,10 +370,12 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
case HB_SCRIPT_ZANABAZAR_SQUARE: case HB_SCRIPT_ZANABAZAR_SQUARE:
/* If the designer designed the font for the 'DFLT' script, /* If the designer designed the font for the 'DFLT' script,
* use the default shaper. Otherwise, use the specific shaper. * (or we ended up arbitrarily pick 'latn'), use the default shaper.
* Otherwise, use the specific shaper.
* Note that for some simple scripts, there may not be *any* * Note that for some simple scripts, there may not be *any*
* GSUB/GPOS needed, so there may be no scripts found! */ * GSUB/GPOS needed, so there may be no scripts found! */
if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T')) if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
planner->map.chosen_script[0] == HB_TAG ('l','a','t','n'))
return &_hb_ot_complex_shaper_default; return &_hb_ot_complex_shaper_default;
else else
return &_hb_ot_complex_shaper_use; return &_hb_ot_complex_shaper_use;