static void
-arabic_fallback_shape (hb_buffer_t *buffer)
+arabic_fallback_shape (hb_font_t *font, hb_buffer_t *buffer)
{
unsigned int count = buffer->len;
+ hb_codepoint_t glyph;
/* Shape to presentation forms */
for (unsigned int i = 0; i < count; i++)
- buffer->info[i].codepoint = get_arabic_shape (buffer->info[i].codepoint, buffer->info[i].arabic_shaping_action());
+ if (hb_font_get_glyph (font, buffer->info[i].codepoint, 0, &glyph))
+ buffer->info[i].codepoint = get_arabic_shape (buffer->info[i].codepoint, buffer->info[i].arabic_shaping_action());
/* Mandatory ligatures */
buffer->clear_output ();
for (buffer->idx = 0; buffer->idx + 1 < count;) {
uint16_t ligature = get_ligature (buffer->info[buffer->idx].codepoint,
buffer->info[buffer->idx + 1].codepoint);
- if (likely (!ligature)) {
+ if (likely (!ligature) || !(hb_font_get_glyph (font, ligature, 0, &glyph))) {
buffer->next_glyph ();
continue;
}
}
void
-_hb_ot_shape_complex_setup_masks_arabic (hb_ot_map_t *map, hb_buffer_t *buffer)
+_hb_ot_shape_complex_setup_masks_arabic (hb_ot_map_t *map, hb_buffer_t *buffer, hb_font_t *font)
{
unsigned int count = buffer->len;
unsigned int prev = 0, state = 0;
* Most probably it's safe to assume that init/medi/fina/isol
* still mean Arabic shaping, although they do not have to.
*/
- arabic_fallback_shape (buffer);
+ arabic_fallback_shape (font, buffer);
}
HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
void
-_hb_ot_shape_complex_setup_masks_indic (hb_ot_map_t *map, hb_buffer_t *buffer)
+_hb_ot_shape_complex_setup_masks_indic (hb_ot_map_t *map, hb_buffer_t *buffer, hb_font_t *font)
{
HB_BUFFER_ALLOCATE_VAR (buffer, indic_category);
HB_BUFFER_ALLOCATE_VAR (buffer, indic_position);
}
void
-_hb_ot_shape_complex_setup_masks_default (hb_ot_map_t *map, hb_buffer_t *buffer)
+_hb_ot_shape_complex_setup_masks_default (hb_ot_map_t *map, hb_buffer_t *buffer, hb_font_t *font)
{
}
}
void
-_hb_ot_shape_complex_setup_masks_hangul (hb_ot_map_t *map, hb_buffer_t *buffer)
+_hb_ot_shape_complex_setup_masks_hangul (hb_ot_map_t *map, hb_buffer_t *buffer, hb_font_t *font)
{
}
}
void
-_hb_ot_shape_complex_setup_masks_thai (hb_ot_map_t *map, hb_buffer_t *buffer)
+_hb_ot_shape_complex_setup_masks_thai (hb_ot_map_t *map, hb_buffer_t *buffer, hb_font_t *font)
{
/* The following is NOT specified in the MS OT Thai spec, however, it seems
* to be what Uniscribe and other engines implement. According to Eric Muller:
* Shapers should use map to get feature masks and set on buffer.
*/
-typedef void hb_ot_shape_complex_setup_masks_func_t (hb_ot_map_t *map, hb_buffer_t *buffer);
+typedef void hb_ot_shape_complex_setup_masks_func_t (hb_ot_map_t *map, hb_buffer_t *buffer, hb_font_t *font);
#define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
HB_INTERNAL hb_ot_shape_complex_setup_masks_func_t _hb_ot_shape_complex_setup_masks_##name;
HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
static inline void
hb_ot_shape_complex_setup_masks (hb_ot_complex_shaper_t shaper,
hb_ot_map_t *map,
- hb_buffer_t *buffer)
+ hb_buffer_t *buffer,
+ hb_font_t *font)
{
switch (shaper) {
default:
#define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
- case hb_ot_complex_shaper_##name: _hb_ot_shape_complex_setup_masks_##name (map, buffer); return;
+ case hb_ot_complex_shaper_##name: _hb_ot_shape_complex_setup_masks_##name (map, buffer, font); return;
HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
#undef HB_COMPLEX_SHAPER_IMPLEMENT
}
hb_mask_t global_mask = c->plan->map.get_global_mask ();
c->buffer->reset_masks (global_mask);
- hb_ot_shape_complex_setup_masks (c->plan->shaper, &c->plan->map, c->buffer);
+ hb_ot_shape_complex_setup_masks (c->plan->shaper, &c->plan->map, c->buffer, c->font);
for (unsigned int i = 0; i < c->num_user_features; i++)
{