< prev index next >
src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-myanmar.cc
Print this page
@@ -22,11 +22,11 @@
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-myanmar-private.hh"
+#include "hb-ot-shape-complex-myanmar.hh"
/*
* Myanmar shaper.
*/
@@ -34,11 +34,11 @@
static const hb_tag_t
basic_features[] =
{
/*
* Basic features.
- * These features are applied in order, one at a time, after initial_reordering.
+ * These features are applied in order, one at a time, after reordering.
*/
HB_TAG('r','p','h','f'),
HB_TAG('p','r','e','f'),
HB_TAG('b','l','w','f'),
HB_TAG('p','s','t','f'),
@@ -46,17 +46,24 @@
static const hb_tag_t
other_features[] =
{
/*
* Other features.
- * These features are applied all at once, after final_reordering.
+ * These features are applied all at once, after clearing syllables.
*/
HB_TAG('p','r','e','s'),
HB_TAG('a','b','v','s'),
HB_TAG('b','l','w','s'),
HB_TAG('p','s','t','s'),
- /* Positioning features, though we don't care about the types. */
+};
+static const hb_tag_t
+positioning_features[] =
+{
+ /*
+ * Positioning features.
+ * We don't care about the types.
+ */
HB_TAG('d','i','s','t'),
/* Pre-release version of Windows 8 Myanmar font had abvm,blwm
* features. The released Windows 8 version of the font (as well
* as the released spec) used 'mark' instead. The Windows 8
* shaper however didn't apply 'mark' but did apply 'mkmk'.
@@ -71,15 +78,15 @@
static void
setup_syllables (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
static void
-initial_reordering (const hb_ot_shape_plan_t *plan,
+reorder (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
static void
-final_reordering (const hb_ot_shape_plan_t *plan,
+clear_syllables (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
static void
collect_features_myanmar (hb_ot_shape_planner_t *plan)
@@ -87,31 +94,37 @@
hb_ot_map_builder_t *map = &plan->map;
/* Do this before any lookups have been applied. */
map->add_gsub_pause (setup_syllables);
- map->add_global_bool_feature (HB_TAG('l','o','c','l'));
+ map->enable_feature (HB_TAG('l','o','c','l'));
/* The Indic specs do not require ccmp, but we apply it here since if
* there is a use of it, it's typically at the beginning. */
- map->add_global_bool_feature (HB_TAG('c','c','m','p'));
+ map->enable_feature (HB_TAG('c','c','m','p'));
- map->add_gsub_pause (initial_reordering);
+ map->add_gsub_pause (reorder);
+
for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++)
{
- map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ);
+ map->enable_feature (basic_features[i], F_MANUAL_ZWJ);
map->add_gsub_pause (nullptr);
}
- map->add_gsub_pause (final_reordering);
+
+ map->add_gsub_pause (clear_syllables);
+
for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++)
- map->add_feature (other_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ);
+ map->enable_feature (other_features[i], F_MANUAL_ZWJ);
+
+ for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++)
+ map->enable_feature (positioning_features[i]);
}
static void
override_features_myanmar (hb_ot_shape_planner_t *plan)
{
- plan->map.add_feature (HB_TAG('l','i','g','a'), 0, F_GLOBAL);
+ plan->map.disable_feature (HB_TAG('l','i','g','a'));
}
enum syllable_type_t {
consonant_syllable,
@@ -259,12 +272,12 @@
/* Sit tight, rock 'n roll! */
buffer->sort (start, end, compare_myanmar_order);
}
static void
-initial_reordering_syllable (const hb_ot_shape_plan_t *plan,
- hb_face_t *face,
+initial_reordering_syllable (const hb_ot_shape_plan_t *plan HB_UNUSED,
+ hb_face_t *face HB_UNUSED,
hb_buffer_t *buffer,
unsigned int start, unsigned int end)
{
syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F);
switch (syllable_type) {
@@ -328,74 +341,73 @@
buffer->output_info (ginfo);
}
else
buffer->next_glyph ();
}
-
buffer->swap_buffers ();
}
static void
-initial_reordering (const hb_ot_shape_plan_t *plan,
+reorder (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
insert_dotted_circles (plan, font, buffer);
foreach_syllable (buffer, start, end)
initial_reordering_syllable (plan, font->face, buffer, start, end);
+
+ HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_category);
+ HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_position);
}
static void
-final_reordering (const hb_ot_shape_plan_t *plan,
+clear_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_font_t *font HB_UNUSED,
hb_buffer_t *buffer)
{
hb_glyph_info_t *info = buffer->info;
unsigned int count = buffer->len;
-
- /* Zero syllables now... */
for (unsigned int i = 0; i < count; i++)
info[i].syllable() = 0;
-
- HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_category);
- HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_position);
}
-/* Uniscribe seems to have a shaper for 'mymr' that is like the
- * generic shaper, except that it zeros mark advances GDEF_LATE. */
-const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old =
+const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar =
{
- nullptr, /* collect_features */
- nullptr, /* override_features */
+ collect_features_myanmar,
+ override_features_myanmar,
nullptr, /* data_create */
nullptr, /* data_destroy */
nullptr, /* preprocess_text */
nullptr, /* postprocess_glyphs */
- HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
+ HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
nullptr, /* decompose */
nullptr, /* compose */
- nullptr, /* setup_masks */
- nullptr, /* disable_otl */
+ setup_masks_myanmar,
+ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */
- HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
- true, /* fallback_position */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
+ false, /* fallback_position */
};
-const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar =
+
+/* Ugly Zawgyi encoding.
+ * Disable all auto processing.
+ * https://github.com/harfbuzz/harfbuzz/issues/1162 */
+const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_zawgyi =
{
- collect_features_myanmar,
- override_features_myanmar,
+ nullptr, /* collect_features */
+ nullptr, /* override_features */
nullptr, /* data_create */
nullptr, /* data_destroy */
nullptr, /* preprocess_text */
nullptr, /* postprocess_glyphs */
- HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
+ HB_OT_SHAPE_NORMALIZATION_MODE_NONE,
nullptr, /* decompose */
nullptr, /* compose */
- setup_masks_myanmar,
- nullptr, /* disable_otl */
+ nullptr, /* setup_masks */
+ HB_TAG_NONE, /* gpos_tag */
nullptr, /* reorder_marks */
- HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
false, /* fallback_position */
};
< prev index next >