Skip to content

Chakma vowel decomposition (1112E and 1112F) not working with USE #381

@punchcutter

Description

@punchcutter

These vowel signs are getting a dotted circle inserted between them instead of just decomposing. Looking at the shaping code they are decomposed in hb-ot-shape-complex-indic.cc, but Chakma is shaped with USE so shouldn't the decomposition be in hb-ot-shape-complex-use.cc? There are also other decompositions in the indic shaper for scripts shaped by USE:

    case 0x0F77u  : *a = 0x0FB2u; *b= 0x0F81u; return true;  // Tibetan
    case 0x0F79u  : *a = 0x0FB3u; *b= 0x0F81u; return true;  // Tibetan
    case 0x17BEu  : *a = 0x17C1u; *b= 0x17BEu; return true;
    case 0x17BFu  : *a = 0x17C1u; *b= 0x17BFu; return true;
    case 0x17C0u  : *a = 0x17C1u; *b= 0x17C0u; return true;
    case 0x17C4u  : *a = 0x17C1u; *b= 0x17C4u; return true;
    case 0x17C5u  : *a = 0x17C1u; *b= 0x17C5u; return true;
    case 0x1925u  : *a = 0x1920u; *b= 0x1923u; return true;  // Limbu
    case 0x1926u  : *a = 0x1920u; *b= 0x1924u; return true;  // Limbu
    case 0x1B3Cu  : *a = 0x1B42u; *b= 0x1B3Cu; return true;  // Balinese
    case 0x1112Eu  : *a = 0x11127u; *b= 0x11131u; return true;  // Chakma
    case 0x1112Fu  : *a = 0x11127u; *b= 0x11132u; return true;  // Chakma
    case 0x0B57u  : *a = no decomp, -> RIGHT; return true;
    case 0x1C29u  : *a = no decomp, -> LEFT; return true;  // Lepcha
    case 0xA9C0u  : *a = no decomp, -> RIGHT; return true;  // Javanese
    case 0x111BuF  : *a = no decomp, -> ABOVE; return true;

Shouldn't these all be in hb-ot-shape-complex-use.cc? To test Chakma I added a decompose function to hb-ot-shape-complex-use.cc and it works as expected:

static bool
decompose_use (const hb_ot_shape_normalize_context_t *c,
		 hb_codepoint_t  ab,
		 hb_codepoint_t *a,
		 hb_codepoint_t *b)
{
  switch (ab)
  {
    case 0x1112Eu  : *a = 0x11127u; *b= 0x11131u; return true;
    case 0x1112Fu  : *a = 0x11127u; *b= 0x11132u; return true;
  }


  return (bool) c->unicode->decompose (ab, a, b);
}

static bool
compose_use (const hb_ot_shape_normalize_context_t *c,
	     hb_codepoint_t  a,
	     hb_codepoint_t  b,
	     hb_codepoint_t *ab)
{
  /* Avoid recomposing split matras. */
  if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (c->unicode->general_category (a)))
    return false;

  return (bool)c->unicode->compose (a, b, ab);
}


const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use =
{
  "use",
  collect_features_use,
  NULL, /* override_features */
  data_create_use,
  data_destroy_use,
  NULL, /* preprocess_text */
  NULL, /* postprocess_glyphs */
  HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
  decompose_use,
  compose_use,
  setup_masks_use,
  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
  false, /* fallback_position */
};

A simple test: 𑄇𑄮
Before the change 11127 gets a dotted circle. After the change it decomposes properly. This font has other issues, but for this test it seems to work.
SuzMoriz.ttf.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions