From 1094a294f6a44c47fc75867983f2b135a6442bab Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 21 May 2010 17:58:20 +0100 Subject: [PATCH] Add rtlm --- src/hb-ot-shape.cc | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 0452f8e4c..8b1863cae 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -42,6 +42,12 @@ hb_tag_t default_features[] = { HB_TAG('m','k','m','k'), }; +enum { + MASK_ALWAYS_ON = 1 << 0, + MASK_RTLM = 1 << 1 +}; +#define MASK_BITS_USED 2 + struct lookup_map { unsigned int index; hb_mask_t mask; @@ -148,10 +154,7 @@ setup_lookups (hb_face_t *face, break; } - /* Clear buffer masks. */ - buffer->clear_masks (); - - unsigned int next_bit = 1; + unsigned int next_bit = MASK_BITS_USED; hb_mask_t global_mask = 0; for (i = 0; i < num_features; i++) { @@ -310,7 +313,11 @@ hb_mirror_chars (hb_buffer_t *buffer) unsigned int count = buffer->len; for (unsigned int i = 0; i < count; i++) { - buffer->info[i].codepoint = get_mirroring (buffer->info[i].codepoint); + hb_codepoint_t codepoint = get_mirroring (buffer->info[i].codepoint); + if (likely (codepoint == buffer->info[i].codepoint)) + buffer->info[i].mask |= MASK_RTLM; + else + buffer->info[i].codepoint = codepoint; } } @@ -431,6 +438,10 @@ hb_ot_shape (hb_font_t *font, hb_form_clusters (buffer); + /* SUBSTITUTE */ + + buffer->clear_masks (); + hb_substitute_default (font, face, buffer, features, num_features); /* We do this after substitute_default because mirroring needs to @@ -442,6 +453,11 @@ hb_ot_shape (hb_font_t *font, if (substitute_fallback) hb_substitute_complex_fallback (font, face, buffer, features, num_features); + + /* POSITION */ + + buffer->clear_masks (); + hb_position_default (font, face, buffer, features, num_features); position_fallback = !hb_ot_position_complex (font, face, buffer, features, num_features, original_direction);