< prev index next >
src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex.hh
Print this page
*** 22,39 ****
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
! #ifndef HB_OT_SHAPE_COMPLEX_PRIVATE_HH
! #define HB_OT_SHAPE_COMPLEX_PRIVATE_HH
! #include "hb-private.hh"
!
! #include "hb-ot-shape-private.hh"
! #include "hb-ot-shape-normalize-private.hh"
/* buffer var allocations, used by complex shapers */
#define complex_var_u8_0() var2.u8[2]
#define complex_var_u8_1() var2.u8[3]
--- 22,39 ----
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
! #ifndef HB_OT_SHAPE_COMPLEX_HH
! #define HB_OT_SHAPE_COMPLEX_HH
! #include "hb.hh"
+ #include "hb-ot-layout.hh"
+ #include "hb-ot-shape.hh"
+ #include "hb-ot-shape-normalize.hh"
/* buffer var allocations, used by complex shapers */
#define complex_var_u8_0() var2.u8[2]
#define complex_var_u8_1() var2.u8[3]
*** 55,85 ****
HB_COMPLEX_SHAPER_IMPLEMENT (hangul) \
HB_COMPLEX_SHAPER_IMPLEMENT (hebrew) \
HB_COMPLEX_SHAPER_IMPLEMENT (indic) \
HB_COMPLEX_SHAPER_IMPLEMENT (khmer) \
HB_COMPLEX_SHAPER_IMPLEMENT (myanmar) \
! HB_COMPLEX_SHAPER_IMPLEMENT (myanmar_old) \
HB_COMPLEX_SHAPER_IMPLEMENT (thai) \
- HB_COMPLEX_SHAPER_IMPLEMENT (tibetan) \
HB_COMPLEX_SHAPER_IMPLEMENT (use) \
/* ^--- Add new shapers here */
struct hb_ot_complex_shaper_t
{
/* collect_features()
* Called during shape_plan().
* Shapers should use plan->map to add their features and callbacks.
! * May be nullptr.
*/
void (*collect_features) (hb_ot_shape_planner_t *plan);
/* override_features()
* Called during shape_plan().
* Shapers should use plan->map to override features and add callbacks after
* common features are added.
! * May be nullptr.
*/
void (*override_features) (hb_ot_shape_planner_t *plan);
/* data_create()
--- 55,84 ----
HB_COMPLEX_SHAPER_IMPLEMENT (hangul) \
HB_COMPLEX_SHAPER_IMPLEMENT (hebrew) \
HB_COMPLEX_SHAPER_IMPLEMENT (indic) \
HB_COMPLEX_SHAPER_IMPLEMENT (khmer) \
HB_COMPLEX_SHAPER_IMPLEMENT (myanmar) \
! HB_COMPLEX_SHAPER_IMPLEMENT (myanmar_zawgyi) \
HB_COMPLEX_SHAPER_IMPLEMENT (thai) \
HB_COMPLEX_SHAPER_IMPLEMENT (use) \
/* ^--- Add new shapers here */
struct hb_ot_complex_shaper_t
{
/* collect_features()
* Called during shape_plan().
* Shapers should use plan->map to add their features and callbacks.
! * May be NULL.
*/
void (*collect_features) (hb_ot_shape_planner_t *plan);
/* override_features()
* Called during shape_plan().
* Shapers should use plan->map to override features and add callbacks after
* common features are added.
! * May be NULL.
*/
void (*override_features) (hb_ot_shape_planner_t *plan);
/* data_create()
*** 91,166 ****
/* data_destroy()
* Called when the shape_plan is being destroyed.
* plan->data is passed here for destruction.
* If nullptr is returned, means a plan failure.
! * May be nullptr.
*/
void (*data_destroy) (void *data);
/* preprocess_text()
* Called during shape().
* Shapers can use to modify text before shaping starts.
! * May be nullptr.
*/
void (*preprocess_text) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
hb_font_t *font);
/* postprocess_glyphs()
* Called during shape().
* Shapers can use to modify glyphs after shaping ends.
! * May be nullptr.
*/
void (*postprocess_glyphs) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
hb_font_t *font);
hb_ot_shape_normalization_mode_t normalization_preference;
/* decompose()
* Called during shape()'s normalization.
! * May be nullptr.
*/
bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t ab,
hb_codepoint_t *a,
hb_codepoint_t *b);
/* compose()
* Called during shape()'s normalization.
! * May be nullptr.
*/
bool (*compose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t a,
hb_codepoint_t b,
hb_codepoint_t *ab);
/* setup_masks()
* Called during shape().
* Shapers should use map to get feature masks and set on buffer.
* Shapers may NOT modify characters.
! * May be nullptr.
*/
void (*setup_masks) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
hb_font_t *font);
! /* disable_otl()
! * Called during shape().
! * If set and returns true, GDEF/GSUB/GPOS of the font are ignored
! * and fallback operations used.
! * May be nullptr.
*/
! bool (*disable_otl) (const hb_ot_shape_plan_t *plan);
/* reorder_marks()
* Called during shape().
* Shapers can use to modify ordering of combining marks.
! * May be nullptr.
*/
void (*reorder_marks) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
unsigned int start,
unsigned int end);
--- 90,163 ----
/* data_destroy()
* Called when the shape_plan is being destroyed.
* plan->data is passed here for destruction.
* If nullptr is returned, means a plan failure.
! * May be NULL.
*/
void (*data_destroy) (void *data);
/* preprocess_text()
* Called during shape().
* Shapers can use to modify text before shaping starts.
! * May be NULL.
*/
void (*preprocess_text) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
hb_font_t *font);
/* postprocess_glyphs()
* Called during shape().
* Shapers can use to modify glyphs after shaping ends.
! * May be NULL.
*/
void (*postprocess_glyphs) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
hb_font_t *font);
hb_ot_shape_normalization_mode_t normalization_preference;
/* decompose()
* Called during shape()'s normalization.
! * May be NULL.
*/
bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t ab,
hb_codepoint_t *a,
hb_codepoint_t *b);
/* compose()
* Called during shape()'s normalization.
! * May be NULL.
*/
bool (*compose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t a,
hb_codepoint_t b,
hb_codepoint_t *ab);
/* setup_masks()
* Called during shape().
* Shapers should use map to get feature masks and set on buffer.
* Shapers may NOT modify characters.
! * May be NULL.
*/
void (*setup_masks) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
hb_font_t *font);
! /* gpos_tag()
! * If not HB_TAG_NONE, then must match found GPOS script tag for
! * GPOS to be applied. Otherwise, fallback positioning will be used.
*/
! hb_tag_t gpos_tag;
/* reorder_marks()
* Called during shape().
* Shapers can use to modify ordering of combining marks.
! * May be NULL.
*/
void (*reorder_marks) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
unsigned int start,
unsigned int end);
*** 232,260 ****
case HB_SCRIPT_HANGUL:
return &_hb_ot_complex_shaper_hangul;
- /* Unicode-2.0 additions */
- case HB_SCRIPT_TIBETAN:
-
- return &_hb_ot_complex_shaper_tibetan;
-
-
/* Unicode-1.1 additions */
case HB_SCRIPT_HEBREW:
return &_hb_ot_complex_shaper_hebrew;
- /* ^--- Add new shapers here */
-
- #if 0
- /* Unicode-4.1 additions */
- case HB_SCRIPT_NEW_TAI_LUE:
- #endif
-
/* Unicode-1.1 additions */
case HB_SCRIPT_BENGALI:
case HB_SCRIPT_DEVANAGARI:
case HB_SCRIPT_GUJARATI:
case HB_SCRIPT_GURMUKHI:
--- 229,244 ----
*** 268,312 ****
case HB_SCRIPT_SINHALA:
/* If the designer designed the font for the 'DFLT' script,
* (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*
! * GSUB/GPOS needed, so there may be no scripts found! */
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;
else
return &_hb_ot_complex_shaper_indic;
case HB_SCRIPT_KHMER:
- /* A number of Khmer fonts in the wild don't have a 'pref' feature,
- * and as such won't shape properly via the Indic shaper;
- * however, they typically have 'liga' / 'clig' features that implement
- * the necessary "reordering" by means of ligature substitutions.
- * So we send such pref-less fonts through the generic shaper instead. */
- if (planner->map.found_script[0] &&
- hb_ot_layout_language_find_feature (planner->face, HB_OT_TAG_GSUB,
- planner->map.script_index[0],
- planner->map.language_index[0],
- HB_TAG ('p','r','e','f'),
- nullptr))
return &_hb_ot_complex_shaper_khmer;
- else
- return &_hb_ot_complex_shaper_default;
case HB_SCRIPT_MYANMAR:
! if (planner->map.chosen_script[0] == HB_TAG ('m','y','m','2'))
! return &_hb_ot_complex_shaper_myanmar;
! else if (planner->map.chosen_script[0] == HB_TAG ('m','y','m','r'))
! return &_hb_ot_complex_shaper_myanmar_old;
! else
return &_hb_ot_complex_shaper_default;
/* Unicode-2.0 additions */
! //case HB_SCRIPT_TIBETAN:
/* Unicode-3.0 additions */
//case HB_SCRIPT_MONGOLIAN:
//case HB_SCRIPT_SINHALA:
--- 252,298 ----
case HB_SCRIPT_SINHALA:
/* If the designer designed the font for the 'DFLT' script,
* (or we ended up arbitrarily pick 'latn'), use the default shaper.
* Otherwise, use the specific shaper.
! *
! * If it's indy3 tag, send to USE. */
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;
+ else if ((planner->map.chosen_script[0] & 0x000000FF) == '3')
+ return &_hb_ot_complex_shaper_use;
else
return &_hb_ot_complex_shaper_indic;
case HB_SCRIPT_KHMER:
return &_hb_ot_complex_shaper_khmer;
case HB_SCRIPT_MYANMAR:
! /* If the designer designed the font for the 'DFLT' script,
! * (or we ended up arbitrarily pick 'latn'), use the default shaper.
! * Otherwise, use the specific shaper.
! *
! * If designer designed for 'mymr' tag, also send to default
! * shaper. That's tag used from before Myanmar shaping spec
! * was developed. The shaping spec uses 'mym2' tag. */
! if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
! planner->map.chosen_script[0] == HB_TAG ('l','a','t','n') ||
! planner->map.chosen_script[0] == HB_TAG ('m','y','m','r'))
return &_hb_ot_complex_shaper_default;
+ else
+ return &_hb_ot_complex_shaper_myanmar;
+
+
+ /* https://github.com/harfbuzz/harfbuzz/issues/1162 */
+ case HB_SCRIPT_MYANMAR_ZAWGYI:
+
+ return &_hb_ot_complex_shaper_myanmar_zawgyi;
/* Unicode-2.0 additions */
! case HB_SCRIPT_TIBETAN:
/* Unicode-3.0 additions */
//case HB_SCRIPT_MONGOLIAN:
//case HB_SCRIPT_SINHALA:
*** 370,382 ****
case HB_SCRIPT_SIDDHAM:
case HB_SCRIPT_TIRHUTA:
/* Unicode-8.0 additions */
case HB_SCRIPT_AHOM:
- //case HB_SCRIPT_MULTANI:
/* Unicode-9.0 additions */
case HB_SCRIPT_BHAIKSUKI:
case HB_SCRIPT_MARCHEN:
case HB_SCRIPT_NEWA:
/* Unicode-10.0 additions */
--- 356,368 ----
case HB_SCRIPT_SIDDHAM:
case HB_SCRIPT_TIRHUTA:
/* Unicode-8.0 additions */
case HB_SCRIPT_AHOM:
/* Unicode-9.0 additions */
+ //case HB_SCRIPT_ADLAM:
case HB_SCRIPT_BHAIKSUKI:
case HB_SCRIPT_MARCHEN:
case HB_SCRIPT_NEWA:
/* Unicode-10.0 additions */
*** 385,395 ****
--- 371,383 ----
case HB_SCRIPT_ZANABAZAR_SQUARE:
/* Unicode-11.0 additions */
case HB_SCRIPT_DOGRA:
case HB_SCRIPT_GUNJALA_GONDI:
+ //case HB_SCRIPT_HANIFI_ROHINGYA:
case HB_SCRIPT_MAKASAR:
+ //case HB_SCRIPT_SOGDIAN:
/* If the designer designed the font for the 'DFLT' script,
* (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*
*** 401,406 ****
return &_hb_ot_complex_shaper_use;
}
}
! #endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */
--- 389,394 ----
return &_hb_ot_complex_shaper_use;
}
}
! #endif /* HB_OT_SHAPE_COMPLEX_HH */
< prev index next >