[kerx] Implement Format0 apply()
Not hooked up to be called yet.
This commit is contained in:
parent
60318f8715
commit
53e5594500
|
@ -518,6 +518,7 @@ struct hb_aat_apply_context_t :
|
||||||
static return_t default_return_value (void) { return false; }
|
static return_t default_return_value (void) { return false; }
|
||||||
bool stop_sublookup_iteration (return_t r) const { return r; }
|
bool stop_sublookup_iteration (return_t r) const { return r; }
|
||||||
|
|
||||||
|
hb_ot_shape_plan_t *plan;
|
||||||
hb_font_t *font;
|
hb_font_t *font;
|
||||||
hb_face_t *face;
|
hb_face_t *face;
|
||||||
hb_buffer_t *buffer;
|
hb_buffer_t *buffer;
|
||||||
|
@ -527,10 +528,11 @@ struct hb_aat_apply_context_t :
|
||||||
unsigned int lookup_index;
|
unsigned int lookup_index;
|
||||||
unsigned int debug_depth;
|
unsigned int debug_depth;
|
||||||
|
|
||||||
inline hb_aat_apply_context_t (hb_font_t *font_,
|
inline hb_aat_apply_context_t (hb_ot_shape_plan_t *plan_,
|
||||||
|
hb_font_t *font_,
|
||||||
hb_buffer_t *buffer_,
|
hb_buffer_t *buffer_,
|
||||||
hb_blob_t *table) :
|
hb_blob_t *table) :
|
||||||
font (font_), face (font->face), buffer (buffer_),
|
plan (plan_), font (font_), face (font->face), buffer (buffer_),
|
||||||
sanitizer (), lookup_index (0), debug_depth (0)
|
sanitizer (), lookup_index (0), debug_depth (0)
|
||||||
{
|
{
|
||||||
sanitizer.init (table);
|
sanitizer.init (table);
|
||||||
|
|
|
@ -59,7 +59,9 @@ struct KerxSubTableFormat0
|
||||||
{
|
{
|
||||||
TRACE_APPLY (this);
|
TRACE_APPLY (this);
|
||||||
|
|
||||||
/* TODO */
|
hb_kern_machine_t<KerxSubTableFormat0> machine (*this);
|
||||||
|
|
||||||
|
machine.kern (c->font, c->buffer, c->plan->kern_mask);
|
||||||
|
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
@ -111,8 +113,6 @@ struct KerxSubTableFormat2
|
||||||
unsigned int r = *(this+rightClassTable).get_value (right, num_glyphs);
|
unsigned int r = *(this+rightClassTable).get_value (right, num_glyphs);
|
||||||
unsigned int offset = l + r;
|
unsigned int offset = l + r;
|
||||||
const FWORD *arr = &(this+array);
|
const FWORD *arr = &(this+array);
|
||||||
if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end))
|
|
||||||
return 0;
|
|
||||||
const FWORD *v = &StructAtOffset<FWORD> (arr, offset);
|
const FWORD *v = &StructAtOffset<FWORD> (arr, offset);
|
||||||
if (unlikely ((const void *) v < (const void *) arr || (const void *) (v + 1) > (const void *) end))
|
if (unlikely ((const void *) v < (const void *) arr || (const void *) (v + 1) > (const void *) end))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -124,6 +124,13 @@ struct KerxSubTableFormat2
|
||||||
TRACE_APPLY (this);
|
TRACE_APPLY (this);
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
#if 0
|
||||||
|
accelerator_t accel (*this,
|
||||||
|
c->blob->data + c->blob->len,
|
||||||
|
c->face->get_num_glyphs ());
|
||||||
|
hb_kern_machine_t<accelerator_t> machine (accel);
|
||||||
|
machine.kern (c->font, c->buffer, c->plan->kern_mask);
|
||||||
|
#endif
|
||||||
|
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
@ -138,6 +145,22 @@ struct KerxSubTableFormat2
|
||||||
array.sanitize (c, this)));
|
array.sanitize (c, this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct accelerator_t
|
||||||
|
{
|
||||||
|
const KerxSubTableFormat2 &table;
|
||||||
|
const char *end;
|
||||||
|
unsigned int num_glyphs;
|
||||||
|
|
||||||
|
inline accelerator_t (const KerxSubTableFormat2 &table_,
|
||||||
|
const char *end_, unsigned int num_glyphs_)
|
||||||
|
: table (table_), end (end_), num_glyphs (num_glyphs_) {}
|
||||||
|
|
||||||
|
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
|
||||||
|
{
|
||||||
|
return table.get_kerning (left, right, end, num_glyphs);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HBUINT32 rowWidth; /* The width, in bytes, of a row in the table. */
|
HBUINT32 rowWidth; /* The width, in bytes, of a row in the table. */
|
||||||
LOffsetTo<Lookup<HBUINT16> >
|
LOffsetTo<Lookup<HBUINT16> >
|
||||||
|
|
|
@ -62,12 +62,14 @@ hb_aat_layout_has_substitution (hb_face_t *face)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer)
|
hb_aat_layout_substitute (hb_ot_shape_plan_t *plan,
|
||||||
|
hb_font_t *font,
|
||||||
|
hb_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
hb_blob_t *blob;
|
hb_blob_t *blob;
|
||||||
const AAT::morx& morx = _get_morx (font->face, &blob);
|
const AAT::morx& morx = _get_morx (font->face, &blob);
|
||||||
|
|
||||||
AAT::hb_aat_apply_context_t c (font, buffer, blob);
|
AAT::hb_aat_apply_context_t c (plan, font, buffer, blob);
|
||||||
morx.apply (&c);
|
morx.apply (&c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,17 +29,19 @@
|
||||||
|
|
||||||
#include "hb.hh"
|
#include "hb.hh"
|
||||||
|
|
||||||
#include "hb-font.hh"
|
#include "hb-ot-shape.hh"
|
||||||
#include "hb-buffer.hh"
|
|
||||||
#include "hb-open-type.hh"
|
|
||||||
|
|
||||||
HB_INTERNAL hb_bool_t
|
HB_INTERNAL hb_bool_t
|
||||||
hb_aat_layout_has_substitution (hb_face_t *face);
|
hb_aat_layout_has_substitution (hb_face_t *face);
|
||||||
|
|
||||||
HB_INTERNAL void
|
HB_INTERNAL void
|
||||||
hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer);
|
hb_aat_layout_substitute (hb_ot_shape_plan_t *plan,
|
||||||
|
hb_font_t *font,
|
||||||
|
hb_buffer_t *buffer);
|
||||||
|
|
||||||
HB_INTERNAL void
|
HB_INTERNAL void
|
||||||
hb_aat_layout_position (hb_font_t *font, hb_buffer_t *buffer);
|
hb_aat_layout_position (hb_ot_shape_plan_t *plan,
|
||||||
|
hb_font_t *font,
|
||||||
|
hb_buffer_t *buffer);
|
||||||
|
|
||||||
#endif /* HB_AAT_LAYOUT_HH */
|
#endif /* HB_AAT_LAYOUT_HH */
|
||||||
|
|
|
@ -668,7 +668,7 @@ hb_ot_substitute_complex (const hb_ot_shape_context_t *c)
|
||||||
hb_synthesize_glyph_classes (c);
|
hb_synthesize_glyph_classes (c);
|
||||||
|
|
||||||
if (unlikely (c->plan->apply_morx))
|
if (unlikely (c->plan->apply_morx))
|
||||||
hb_aat_layout_substitute (c->font, c->buffer);
|
hb_aat_layout_substitute (c->plan, c->font, c->buffer);
|
||||||
else
|
else
|
||||||
c->plan->substitute (c->font, buffer);
|
c->plan->substitute (c->font, buffer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue