/* buffer var allocations */
-#define arabic_shaping_action() var2.u32 /* arabic shaping action */
+#define arabic_shaping_action() complex_var_temporary_u16() /* arabic shaping action */
/*
{
/* TODO Macroize the magic bit operations */
- if (likely (JOINING_TABLE_FIRST <= u && u <= JOINING_TABLE_LAST)) {
+ if (likely (hb_codepoint_in_range (u, JOINING_TABLE_FIRST, JOINING_TABLE_LAST))) {
unsigned int j_type = joining_table[u - JOINING_TABLE_FIRST];
if (likely (j_type != JOINING_TYPE_X))
return j_type;
}
/* Mongolian joining data is not in ArabicJoining.txt yet */
- if (unlikely (0x1800 <= u && u <= 0x18AF))
+ if (unlikely (hb_codepoint_in_range (u, 0x1800, 0x18AF)))
{
/* All letters, SIBE SYLLABLE BOUNDARY MARKER, and NIRUGU are D */
if (gen_cat == HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER || u == 0x1807 || u == 0x180A)
return JOINING_TYPE_D;
}
- if (unlikely ((u & ~(0x200C^0x200D)) == 0x200C)) {
+ if (unlikely (hb_codepoint_in_range (u, 0x200C, 0x200D))) {
return u == 0x200C ? JOINING_TYPE_U : JOINING_TYPE_C;
}
- return ((1<<gen_cat) & ((1<<HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)|(1<<HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK)|(1<<HB_UNICODE_GENERAL_CATEGORY_FORMAT))) ?
+ return (FLAG(gen_cat) & (FLAG(HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | FLAG(HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | FLAG(HB_UNICODE_GENERAL_CATEGORY_FORMAT))) ?
JOINING_TYPE_T : JOINING_TYPE_U;
}
static const struct arabic_state_table_entry {
uint8_t prev_action;
uint8_t curr_action;
- uint8_t next_state;
- uint8_t padding;
+ uint16_t next_state;
} arabic_state_table[][NUM_STATE_MACHINE_COLS] =
{
/* jt_U, jt_R, jt_D, jg_ALAPH, jg_DALATH_RISH */
void
-_hb_ot_shape_complex_collect_features_arabic (hb_ot_shape_planner_t *planner, const hb_segment_properties_t *props)
+_hb_ot_shape_complex_collect_features_arabic (hb_ot_map_builder_t *map, const hb_segment_properties_t *props)
{
- /* ArabicOT spec enables 'cswh' for Arabic where as for basic shaper it's disabled by default. */
- planner->map.add_bool_feature (HB_TAG('c','s','w','h'));
+ /* For Language forms (in ArabicOT speak), we do the iso/fina/medi/init together,
+ * then rlig and calt each in their own stage. This makes IranNastaliq's ALLAH
+ * ligature work correctly. It's unfortunate though...
+ *
+ * This also makes Arial Bold in Windows7 work. See:
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=644184
+ *
+ * TODO: Add test cases for these two.
+ */
+
+ map->add_bool_feature (HB_TAG('c','c','m','p'));
+
+ map->add_gsub_pause (NULL, NULL);
unsigned int num_features = props->script == HB_SCRIPT_SYRIAC ? SYRIAC_NUM_FEATURES : COMMON_NUM_FEATURES;
for (unsigned int i = 0; i < num_features; i++)
- planner->map.add_bool_feature (arabic_syriac_features[i], false);
+ map->add_bool_feature (arabic_syriac_features[i], false);
+
+ map->add_gsub_pause (NULL, NULL);
+
+ map->add_bool_feature (HB_TAG('r','l','i','g'));
+ map->add_gsub_pause (NULL, NULL);
+
+ map->add_bool_feature (HB_TAG('c','a','l','t'));
+ map->add_gsub_pause (NULL, NULL);
+
+ /* ArabicOT spec enables 'cswh' for Arabic where as for basic shaper it's disabled by default. */
+ map->add_bool_feature (HB_TAG('c','s','w','h'));
+}
+
+bool
+_hb_ot_shape_complex_prefer_decomposed_arabic (void)
+{
+ return FALSE;
}
void
-_hb_ot_shape_complex_setup_masks_arabic (hb_ot_shape_context_t *c)
+_hb_ot_shape_complex_setup_masks_arabic (hb_ot_map_t *map, hb_buffer_t *buffer)
{
- unsigned int count = c->buffer->len;
+ unsigned int count = buffer->len;
unsigned int prev = 0, state = 0;
+ HB_BUFFER_ALLOCATE_VAR (buffer, arabic_shaping_action);
+
for (unsigned int i = 0; i < count; i++)
{
- unsigned int this_type = get_joining_type (c->buffer->info[i].codepoint, (hb_unicode_general_category_t) c->buffer->info[i].general_category());
+ unsigned int this_type = get_joining_type (buffer->info[i].codepoint, (hb_unicode_general_category_t) buffer->info[i].general_category());
if (unlikely (this_type == JOINING_TYPE_T)) {
- c->buffer->info[i].arabic_shaping_action() = NONE;
+ buffer->info[i].arabic_shaping_action() = NONE;
continue;
}
const arabic_state_table_entry *entry = &arabic_state_table[state][this_type];
if (entry->prev_action != NONE)
- c->buffer->info[prev].arabic_shaping_action() = entry->prev_action;
+ buffer->info[prev].arabic_shaping_action() = entry->prev_action;
- c->buffer->info[i].arabic_shaping_action() = entry->curr_action;
+ buffer->info[i].arabic_shaping_action() = entry->curr_action;
prev = i;
state = entry->next_state;
}
hb_mask_t mask_array[TOTAL_NUM_FEATURES + 1] = {0};
- unsigned int num_masks = c->buffer->props.script == HB_SCRIPT_SYRIAC ? SYRIAC_NUM_FEATURES : COMMON_NUM_FEATURES;
+ unsigned int num_masks = buffer->props.script == HB_SCRIPT_SYRIAC ? SYRIAC_NUM_FEATURES : COMMON_NUM_FEATURES;
for (unsigned int i = 0; i < num_masks; i++)
- mask_array[i] = c->plan->map.get_1_mask (arabic_syriac_features[i]);
+ mask_array[i] = map->get_1_mask (arabic_syriac_features[i]);
for (unsigned int i = 0; i < count; i++)
- c->buffer->info[i].mask |= mask_array[c->buffer->info[i].arabic_shaping_action()];
+ buffer->info[i].mask |= mask_array[buffer->info[i].arabic_shaping_action()];
+
+ HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
}