[GPOS] Fix more brokenness

This commit is contained in:
Behdad Esfahbod 2009-05-20 04:16:35 -04:00
parent ff05d257dd
commit 0f7e6b2cea
4 changed files with 33 additions and 18 deletions

View File

@ -4,7 +4,7 @@ INCLUDES = \
-I $(srcdir) \ -I $(srcdir) \
$(FREETYPE_CFLAGS) \ $(FREETYPE_CFLAGS) \
$(GLIB_CFLAGS) $(GLIB_CFLAGS)
CXX = gcc $(GCCOPTS) -fno-rtti -fno-exceptions -Wabi -Wpadded -Wcast-align CXX = gcc $(GCCOPTS) -g -fno-rtti -fno-exceptions -Wabi -Wpadded -Wcast-align
noinst_LTLIBRARIES = libharfbuzz-1.la noinst_LTLIBRARIES = libharfbuzz-1.la

View File

@ -551,18 +551,6 @@ struct CursivePosFormat1
private: private:
inline bool apply (APPLY_ARG_DEF) const inline bool apply (APPLY_ARG_DEF) const
{ {
struct hb_ot_layout_t::gpos_info_t *gpi = &layout->gpos_info;
hb_codepoint_t last_pos = gpi->last;
gpi->last = 0xFFFF;
/* We don't handle mark glyphs here. */
if (property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
return false;
unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED))
return false;
/* Now comes the messiest part of the whole OpenType /* Now comes the messiest part of the whole OpenType
specification. At first glance, cursive connections seem easy specification. At first glance, cursive connections seem easy
to understand, but there are pitfalls! The reason is that to understand, but there are pitfalls! The reason is that
@ -680,6 +668,18 @@ struct CursivePosFormat1
Since horizontal advance widths or vertical advance heights Since horizontal advance widths or vertical advance heights
can be used alone but not together, no ambiguity occurs. */ can be used alone but not together, no ambiguity occurs. */
struct hb_ot_layout_t::gpos_info_t *gpi = &layout->gpos_info;
hb_codepoint_t last_pos = gpi->last;
gpi->last = 0xFFFF;
/* We don't handle mark glyphs here. */
if (property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
return false;
unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED))
return false;
const EntryExitRecord &record = entryExitRecord[index]; const EntryExitRecord &record = entryExitRecord[index];
hb_position_t entry_x, entry_y, exit_x, exit_y; hb_position_t entry_x, entry_y, exit_x, exit_y;
@ -696,24 +696,27 @@ struct CursivePosFormat1
} }
else else
{ {
POSITION (gpi->last)->x_advance = gpi->anchor_x - entry_x; POSITION (last_pos)->x_advance = gpi->anchor_x - entry_x;
POSITION (gpi->last)->new_advance = TRUE; POSITION (last_pos)->new_advance = TRUE;
} }
if (lookup_flag & LookupFlag::RightToLeft) if (lookup_flag & LookupFlag::RightToLeft)
{ {
POSITION (gpi->last)->cursive_chain = gpi->last - buffer->in_pos; POSITION (last_pos)->cursive_chain = last_pos - buffer->in_pos;
POSITION (gpi->last)->y_pos = entry_y - gpi->anchor_y; POSITION (last_pos)->y_pos = entry_y - gpi->anchor_y;
} }
else else
{ {
POSITION (buffer->in_pos)->cursive_chain = buffer->in_pos - gpi->last; POSITION (buffer->in_pos)->cursive_chain = buffer->in_pos - last_pos;
POSITION (buffer->in_pos)->y_pos = gpi->anchor_y - entry_y; POSITION (buffer->in_pos)->y_pos = gpi->anchor_y - entry_y;
} }
end: end:
if (record.exitAnchor) if (record.exitAnchor)
{
gpi->last = buffer->in_pos;
(this+record.exitAnchor).get_anchor (layout, IN_CURGLYPH (), &gpi->anchor_x, &gpi->anchor_y); (this+record.exitAnchor).get_anchor (layout, IN_CURGLYPH (), &gpi->anchor_x, &gpi->anchor_y);
}
buffer->in_pos++; buffer->in_pos++;
return true; return true;

View File

@ -82,6 +82,13 @@ hb_ot_layout_destroy (hb_ot_layout_t *layout)
free (layout); free (layout);
} }
void
hb_ot_layout_set_direction (hb_ot_layout_t *layout,
hb_bool_t r2l)
{
layout->gpos_info.r2l = !!r2l;
}
/* /*
* GDEF * GDEF
*/ */

View File

@ -47,6 +47,11 @@ hb_ot_layout_create_for_data (const char *font_data,
void void
hb_ot_layout_destroy (hb_ot_layout_t *layout); hb_ot_layout_destroy (hb_ot_layout_t *layout);
/* XXX */
void
hb_ot_layout_set_direction (hb_ot_layout_t *layout,
hb_bool_t r2l);
/* TODO sanitizing API/constructor (make_writable_func_t) */ /* TODO sanitizing API/constructor (make_writable_func_t) */
/* TODO get_table_func_t constructor */ /* TODO get_table_func_t constructor */