mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
bug 635639 - vowels are not rendered correctly in some Persian/Arabic/Hebrew fonts. r=jdaggett
This commit is contained in:
parent
f1f417485f
commit
645d9c645b
@ -33,6 +33,7 @@
|
||||
#include "hb-ot-layout-gdef-private.hh"
|
||||
#include "hb-ot-layout-gsub-private.hh"
|
||||
#include "hb-ot-layout-gpos-private.hh"
|
||||
#include "hb-ot-shape-private.hh"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -476,8 +477,46 @@ hb_ot_layout_position_lookup (hb_font_t *font,
|
||||
}
|
||||
|
||||
void
|
||||
hb_ot_layout_position_finish (hb_buffer_t *buffer)
|
||||
hb_ot_layout_position_finish (hb_face_t *face, hb_buffer_t *buffer)
|
||||
{
|
||||
/* force diacritics to have zero width */
|
||||
unsigned int count = buffer->len;
|
||||
if (hb_ot_layout_has_glyph_classes (face)) {
|
||||
const GDEF& gdef = _get_gdef (face);
|
||||
if (buffer->props.direction == HB_DIRECTION_RTL) {
|
||||
for (unsigned int i = 1; i < count; i++) {
|
||||
if (gdef.get_glyph_class (buffer->info[i].codepoint) == GDEF::MarkGlyph) {
|
||||
buffer->pos[i].x_advance = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (unsigned int i = 1; i < count; i++) {
|
||||
if (gdef.get_glyph_class (buffer->info[i].codepoint) == GDEF::MarkGlyph) {
|
||||
hb_glyph_position_t& pos = buffer->pos[i];
|
||||
pos.x_offset -= pos.x_advance;
|
||||
pos.x_advance = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* no GDEF classes available, so use General Category as a fallback */
|
||||
if (buffer->props.direction == HB_DIRECTION_RTL) {
|
||||
for (unsigned int i = 1; i < count; i++) {
|
||||
if (buffer->info[i].general_category() == HB_CATEGORY_NON_SPACING_MARK) {
|
||||
buffer->pos[i].x_advance = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (unsigned int i = 1; i < count; i++) {
|
||||
if (buffer->info[i].general_category() == HB_CATEGORY_NON_SPACING_MARK) {
|
||||
hb_glyph_position_t& pos = buffer->pos[i];
|
||||
pos.x_offset -= pos.x_advance;
|
||||
pos.x_advance = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GPOS::position_finish (buffer);
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ hb_ot_layout_position_lookup (hb_font_t *font,
|
||||
|
||||
/* Should be called after all the position_lookup's are done */
|
||||
void
|
||||
hb_ot_layout_position_finish (hb_buffer_t *buffer);
|
||||
hb_ot_layout_position_finish (hb_face_t *face, hb_buffer_t *buffer);
|
||||
|
||||
|
||||
HB_END_DECLS
|
||||
|
@ -121,7 +121,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
|
||||
|
||||
c->plan->map.position (c->font, c->face, c->buffer);
|
||||
|
||||
hb_ot_layout_position_finish (c->buffer);
|
||||
hb_ot_layout_position_finish (c->face, c->buffer);
|
||||
|
||||
c->applied_position_complex = TRUE;
|
||||
return;
|
||||
@ -260,9 +260,26 @@ hb_position_default (hb_ot_shape_context_t *c)
|
||||
}
|
||||
|
||||
static void
|
||||
hb_position_complex_fallback (hb_ot_shape_context_t *c HB_UNUSED)
|
||||
hb_position_complex_fallback (hb_ot_shape_context_t *c)
|
||||
{
|
||||
/* TODO Mark pos */
|
||||
unsigned int count = c->buffer->len;
|
||||
if (c->buffer->props.direction == HB_DIRECTION_RTL) {
|
||||
for (unsigned int i = 1; i < count; i++) {
|
||||
unsigned int gen_cat = c->buffer->info[i].general_category();
|
||||
if ((1<<gen_cat) & ((1<<HB_CATEGORY_NON_SPACING_MARK)|(1<<HB_CATEGORY_ENCLOSING_MARK)|(1<<HB_CATEGORY_FORMAT))) {
|
||||
c->buffer->pos[i].x_advance = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (unsigned int i = 1; i < count; i++) {
|
||||
unsigned int gen_cat = c->buffer->info[i].general_category();
|
||||
if ((1<<gen_cat) & ((1<<HB_CATEGORY_NON_SPACING_MARK)|(1<<HB_CATEGORY_ENCLOSING_MARK)|(1<<HB_CATEGORY_FORMAT))) {
|
||||
hb_glyph_position_t& pos = c->buffer->pos[i];
|
||||
pos.x_offset = -pos.x_advance;
|
||||
pos.x_advance = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user