mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-13 00:32:59 +00:00
Bunch of independent changes (ouch)
API additions: hb_segment_properties_t HB_SEGMENT_PROPERTIES_DEFAULT hb_segment_properties_equal() hb_segment_properties_hash() hb_buffer_set_segment_properties() hb_buffer_get_segment_properties() hb_ot_layout_glyph_class_t hb_shape_plan_t hb_shape_plan_create() hb_shape_plan_create_cached() hb_shape_plan_get_empty() hb_shape_plan_reference() hb_shape_plan_destroy() hb_shape_plan_set_user_data() hb_shape_plan_get_user_data() hb_shape_plan_execute() hb_ot_shape_plan_collect_lookups() API changes: Rename hb_ot_layout_feature_get_lookup_indexes() to hb_ot_layout_feature_get_lookups(). New header file: hb-shape-plan.h And a bunch of prototyped but not implemented stuff. Coming soon. (Tests fail because of the prototypes right now.)
This commit is contained in:
parent
75da37dcb1
commit
f30641038b
18 changed files with 305 additions and 118 deletions
|
@ -43,7 +43,6 @@ HBSOURCES = \
|
|||
hb-shape.cc \
|
||||
hb-shape-plan-private.hh \
|
||||
hb-shape-plan.cc \
|
||||
hb-shape-plan.h \
|
||||
hb-shaper-list.hh \
|
||||
hb-shaper-impl-private.hh \
|
||||
hb-shaper-private.hh \
|
||||
|
@ -62,6 +61,7 @@ HBHEADERS = \
|
|||
hb-font.h \
|
||||
hb-set.h \
|
||||
hb-shape.h \
|
||||
hb-shape-plan.h \
|
||||
hb-unicode.h \
|
||||
hb-version.h \
|
||||
$(NULL)
|
||||
|
|
|
@ -36,47 +36,10 @@
|
|||
#include "hb-unicode-private.hh"
|
||||
|
||||
|
||||
|
||||
ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
|
||||
ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
|
||||
|
||||
|
||||
/*
|
||||
* hb_segment_properties_t
|
||||
*/
|
||||
|
||||
typedef struct hb_segment_properties_t {
|
||||
hb_direction_t direction;
|
||||
hb_script_t script;
|
||||
hb_language_t language;
|
||||
ASSERT_POD ();
|
||||
} hb_segment_properties_t;
|
||||
|
||||
#define _HB_BUFFER_PROPS_DEFAULT { HB_DIRECTION_INVALID, HB_SCRIPT_INVALID, HB_LANGUAGE_INVALID }
|
||||
|
||||
static inline hb_bool_t
|
||||
hb_segment_properties_equal (const hb_segment_properties_t *a,
|
||||
const hb_segment_properties_t *b)
|
||||
{
|
||||
return a->direction == b->direction &&
|
||||
a->script == b->script &&
|
||||
a->language == b->language;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static inline unsigned int
|
||||
hb_segment_properties_hash (const hb_segment_properties_t *p)
|
||||
{
|
||||
/* TODO improve */
|
||||
return (unsigned int) p->direction +
|
||||
(unsigned int) p->script +
|
||||
(intptr_t) (p->language);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* hb_buffer_t
|
||||
*/
|
||||
|
|
|
@ -35,6 +35,29 @@
|
|||
#define HB_DEBUG_BUFFER (HB_DEBUG+0)
|
||||
#endif
|
||||
|
||||
|
||||
hb_bool_t
|
||||
hb_segment_properties_equal (const hb_segment_properties_t *a,
|
||||
const hb_segment_properties_t *b)
|
||||
{
|
||||
return a->direction == b->direction &&
|
||||
a->script == b->script &&
|
||||
a->language == b->language &&
|
||||
a->reserved1 == b->reserved1 &&
|
||||
a->reserved2 == b->reserved2;
|
||||
|
||||
}
|
||||
|
||||
unsigned int
|
||||
hb_segment_properties_hash (const hb_segment_properties_t *p)
|
||||
{
|
||||
return (unsigned int) p->direction ^
|
||||
(unsigned int) p->script ^
|
||||
(intptr_t) (p->language);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Here is how the buffer works internally:
|
||||
*
|
||||
* There are two info pointers: info and out_info. They always have
|
||||
|
@ -151,7 +174,7 @@ hb_buffer_t::clear (void)
|
|||
if (unlikely (hb_object_is_inert (this)))
|
||||
return;
|
||||
|
||||
hb_segment_properties_t default_props = _HB_BUFFER_PROPS_DEFAULT;
|
||||
hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT;
|
||||
props = default_props;
|
||||
flags = HB_BUFFER_FLAGS_DEFAULT;
|
||||
|
||||
|
@ -589,7 +612,7 @@ hb_buffer_get_empty (void)
|
|||
HB_OBJECT_HEADER_STATIC,
|
||||
|
||||
const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_nil),
|
||||
_HB_BUFFER_PROPS_DEFAULT,
|
||||
HB_SEGMENT_PROPERTIES_DEFAULT,
|
||||
HB_BUFFER_FLAGS_DEFAULT,
|
||||
|
||||
HB_BUFFER_CONTENT_TYPE_INVALID,
|
||||
|
@ -725,6 +748,24 @@ hb_buffer_get_language (hb_buffer_t *buffer)
|
|||
return buffer->props.language;
|
||||
}
|
||||
|
||||
void
|
||||
hb_buffer_set_segment_properties (hb_buffer_t *buffer,
|
||||
const hb_segment_properties_t *props)
|
||||
{
|
||||
if (unlikely (hb_object_is_inert (buffer)))
|
||||
return;
|
||||
|
||||
buffer->props = *props;
|
||||
}
|
||||
|
||||
void
|
||||
hb_buffer_get_segment_properties (hb_buffer_t *buffer,
|
||||
hb_segment_properties_t *props)
|
||||
{
|
||||
*props = buffer->props;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hb_buffer_set_flags (hb_buffer_t *buffer,
|
||||
hb_buffer_flags_t flags)
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
HB_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct hb_buffer_t hb_buffer_t;
|
||||
|
||||
typedef struct hb_glyph_info_t {
|
||||
hb_codepoint_t codepoint;
|
||||
hb_mask_t mask;
|
||||
|
@ -64,6 +62,36 @@ typedef struct hb_glyph_position_t {
|
|||
} hb_glyph_position_t;
|
||||
|
||||
|
||||
typedef struct hb_segment_properties_t {
|
||||
hb_direction_t direction;
|
||||
hb_script_t script;
|
||||
hb_language_t language;
|
||||
/*< private >*/
|
||||
void *reserved1;
|
||||
void *reserved2;
|
||||
} hb_segment_properties_t;
|
||||
|
||||
#define HB_SEGMENT_PROPERTIES_DEFAULT {HB_DIRECTION_INVALID, \
|
||||
HB_SCRIPT_INVALID, \
|
||||
HB_LANGUAGE_INVALID, \
|
||||
NULL, \
|
||||
NULL}
|
||||
|
||||
hb_bool_t
|
||||
hb_segment_properties_equal (const hb_segment_properties_t *a,
|
||||
const hb_segment_properties_t *b);
|
||||
|
||||
unsigned int
|
||||
hb_segment_properties_hash (const hb_segment_properties_t *p);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* hb_buffer_t
|
||||
*/
|
||||
|
||||
typedef struct hb_buffer_t hb_buffer_t;
|
||||
|
||||
hb_buffer_t *
|
||||
hb_buffer_create (void);
|
||||
|
||||
|
@ -127,9 +155,21 @@ void
|
|||
hb_buffer_set_language (hb_buffer_t *buffer,
|
||||
hb_language_t language);
|
||||
|
||||
|
||||
hb_language_t
|
||||
hb_buffer_get_language (hb_buffer_t *buffer);
|
||||
|
||||
void
|
||||
hb_buffer_set_segment_properties (hb_buffer_t *buffer,
|
||||
const hb_segment_properties_t *props);
|
||||
|
||||
void
|
||||
hb_buffer_get_segment_properties (hb_buffer_t *buffer,
|
||||
hb_segment_properties_t *props);
|
||||
|
||||
void
|
||||
hb_buffer_guess_properties (hb_buffer_t *buffer);
|
||||
|
||||
|
||||
typedef enum {
|
||||
HB_BUFFER_FLAGS_DEFAULT = 0x00000000,
|
||||
|
@ -171,9 +211,6 @@ hb_buffer_reverse (hb_buffer_t *buffer);
|
|||
void
|
||||
hb_buffer_reverse_clusters (hb_buffer_t *buffer);
|
||||
|
||||
void
|
||||
hb_buffer_guess_properties (hb_buffer_t *buffer);
|
||||
|
||||
|
||||
/* Filling the buffer in */
|
||||
|
||||
|
|
|
@ -49,14 +49,6 @@
|
|||
* GDEF
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0001,
|
||||
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 0x0002,
|
||||
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 0x0004,
|
||||
HB_OT_LAYOUT_GLYPH_CLASS_MARK = 0x0008,
|
||||
HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 0x0010
|
||||
} hb_ot_layout_glyph_class_t;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -374,12 +374,12 @@ hb_ot_layout_language_find_feature (hb_face_t *face,
|
|||
}
|
||||
|
||||
unsigned int
|
||||
hb_ot_layout_feature_get_lookup_indexes (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
unsigned int feature_index,
|
||||
unsigned int start_offset,
|
||||
unsigned int *lookup_count /* IN/OUT */,
|
||||
unsigned int *lookup_indexes /* OUT */)
|
||||
hb_ot_layout_feature_get_lookups (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
unsigned int feature_index,
|
||||
unsigned int start_offset,
|
||||
unsigned int *lookup_count /* IN/OUT */,
|
||||
unsigned int *lookup_indexes /* OUT */)
|
||||
{
|
||||
const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
|
||||
const OT::Feature &f = g.get_feature (feature_index);
|
||||
|
|
|
@ -50,6 +50,27 @@ HB_BEGIN_DECLS
|
|||
hb_bool_t
|
||||
hb_ot_layout_has_glyph_classes (hb_face_t *face);
|
||||
|
||||
typedef enum {
|
||||
HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0001,
|
||||
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 0x0002,
|
||||
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 0x0004,
|
||||
HB_OT_LAYOUT_GLYPH_CLASS_MARK = 0x0008,
|
||||
HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 0x0010
|
||||
} hb_ot_layout_glyph_class_t;
|
||||
|
||||
#ifdef HB_NOT_IMPLEMENTED
|
||||
hb_ot_layout_glyph_class_t
|
||||
hb_ot_layout_get_glyph_class (hb_face_t *face,
|
||||
hb_codepoint_t glyph);
|
||||
#endif
|
||||
|
||||
#ifdef HB_NOT_IMPLEMENTED
|
||||
hb_ot_layout_get_glyphs_in_class (hb_face_t *face,
|
||||
hb_ot_layout_glyph_class_t klass,
|
||||
hb_set_t *glyphs /* OUT */);
|
||||
#endif
|
||||
|
||||
|
||||
/* Not that useful. Provides list of attach points for a glyph that a
|
||||
* client may want to cache */
|
||||
unsigned int
|
||||
|
@ -154,12 +175,64 @@ hb_ot_layout_language_find_feature (hb_face_t *face,
|
|||
unsigned int *feature_index);
|
||||
|
||||
unsigned int
|
||||
hb_ot_layout_feature_get_lookup_indexes (hb_face_t *face,
|
||||
hb_ot_layout_feature_get_lookups (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
unsigned int feature_index,
|
||||
unsigned int start_offset,
|
||||
unsigned int *lookup_count /* IN/OUT */,
|
||||
unsigned int *lookup_indexes /* OUT */);
|
||||
|
||||
#ifdef HB_NOT_IMPLEMENTED
|
||||
void
|
||||
hb_ot_layout_collect_lookups (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
const hb_tag_t *scripts,
|
||||
const hb_tag_t *languages,
|
||||
const hb_tag_t *features,
|
||||
hb_set_t *lookup_indexes /* OUT */);
|
||||
#endif
|
||||
|
||||
void
|
||||
hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
|
||||
hb_tag_t table_tag,
|
||||
hb_set_t *lookup_indexes /* OUT */);
|
||||
|
||||
#ifdef HB_NOT_IMPLEMENTED
|
||||
void
|
||||
hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
unsigned int lookup_index,
|
||||
hb_set_t *glyphs_before, /* OUT. May be NULL */
|
||||
hb_set_t *glyphs_input, /* OUT. May be NULL */
|
||||
hb_set_t *glyphs_after, /* OUT. May be NULL */
|
||||
hb_set_t *glyphs_output /* OUT. May be NULL */);
|
||||
#endif
|
||||
|
||||
#ifdef HB_NOT_IMPLEMENTED
|
||||
typedef struct
|
||||
{
|
||||
const hb_codepoint_t *before,
|
||||
unsigned int before_length,
|
||||
const hb_codepoint_t *input,
|
||||
unsigned int input_length,
|
||||
const hb_codepoint_t *after,
|
||||
unsigned int after_length,
|
||||
} hb_ot_layout_glyph_sequence_t;
|
||||
|
||||
typedef hb_bool_t
|
||||
(*hb_ot_layout_glyph_sequence_func_t) (hb_font_t *font,
|
||||
hb_tag_t table_tag,
|
||||
unsigned int lookup_index,
|
||||
const hb_ot_layout_glyph_sequence_t *sequence,
|
||||
void *user_data);
|
||||
|
||||
void
|
||||
hb_ot_layout_lookup_enumerate_sequences (hb_face_t *face,
|
||||
hb_tag_t table_tag,
|
||||
unsigned int feature_index,
|
||||
unsigned int start_offset,
|
||||
unsigned int *lookup_count /* IN/OUT */,
|
||||
unsigned int *lookup_indexes /* OUT */);
|
||||
unsigned int lookup_index,
|
||||
hb_ot_layout_glyph_sequence_func_t callback,
|
||||
void *user_data);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -179,7 +252,21 @@ hb_ot_layout_lookup_would_substitute (hb_face_t *face,
|
|||
void
|
||||
hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
|
||||
unsigned int lookup_index,
|
||||
hb_set_t *glyphs);
|
||||
hb_set_t *glyphs
|
||||
/*TODO , hb_bool_t inclusive */);
|
||||
|
||||
#ifdef HB_NOT_IMPLEMENTED
|
||||
/* Note: You better have GDEF when using this API, or marks won't do much. */
|
||||
hb_bool_t
|
||||
hb_ot_layout_lookup_substitute (hb_font_t *font,
|
||||
unsigned int lookup_index,
|
||||
const hb_ot_layout_glyph_sequence_t *sequence,
|
||||
unsigned int out_size,
|
||||
hb_codepoint_t *glyphs_out, /* OUT */
|
||||
unsigned int *clusters_out, /* OUT */
|
||||
unsigned int *out_length /* OUT */);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* GPOS
|
||||
|
@ -188,6 +275,15 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
|
|||
hb_bool_t
|
||||
hb_ot_layout_has_positioning (hb_face_t *face);
|
||||
|
||||
#ifdef HB_NOT_IMPLEMENTED
|
||||
/* Note: You better have GDEF when using this API, or marks won't do much. */
|
||||
hb_bool_t
|
||||
hb_ot_layout_lookup_position (hb_font_t *font,
|
||||
unsigned int lookup_index,
|
||||
const hb_ot_layout_glyph_sequence_t *sequence,
|
||||
hb_glyph_position_t *positions /* IN / OUT */);
|
||||
#endif
|
||||
|
||||
|
||||
HB_END_DECLS
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ struct hb_ot_map_t
|
|||
*lookup_count = end - start;
|
||||
}
|
||||
|
||||
HB_INTERNAL void substitute_closure (const struct hb_ot_shape_plan_t *plan, hb_face_t *face, hb_set_t *glyphs) const;
|
||||
HB_INTERNAL void collect_lookups (unsigned int table_index, hb_set_t *lookups) const;
|
||||
HB_INTERNAL void substitute (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
|
||||
HB_INTERNAL void position (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
|
||||
|
||||
|
|
|
@ -41,11 +41,11 @@ hb_ot_map_t::add_lookups (hb_face_t *face,
|
|||
offset = 0;
|
||||
do {
|
||||
len = ARRAY_LENGTH (lookup_indices);
|
||||
hb_ot_layout_feature_get_lookup_indexes (face,
|
||||
table_tags[table_index],
|
||||
feature_index,
|
||||
offset, &len,
|
||||
lookup_indices);
|
||||
hb_ot_layout_feature_get_lookups (face,
|
||||
table_tags[table_index],
|
||||
feature_index,
|
||||
offset, &len,
|
||||
lookup_indices);
|
||||
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
hb_ot_map_t::lookup_map_t *lookup = lookups[table_index].push ();
|
||||
|
@ -138,11 +138,10 @@ void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_
|
|||
hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask);
|
||||
}
|
||||
|
||||
void hb_ot_map_t::substitute_closure (const hb_ot_shape_plan_t *plan, hb_face_t *face, hb_set_t *glyphs) const
|
||||
void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const
|
||||
{
|
||||
unsigned int table_index = 0;
|
||||
for (unsigned int i = 0; i < lookups[table_index].len; i++)
|
||||
hb_ot_layout_lookup_substitute_closure (face, lookups[table_index][i].index, glyphs);
|
||||
hb_set_add (lookups_out, lookups[table_index][i].index);
|
||||
}
|
||||
|
||||
void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func)
|
||||
|
|
|
@ -46,7 +46,16 @@ struct hb_ot_shape_plan_t
|
|||
hb_ot_map_t map;
|
||||
const void *data;
|
||||
|
||||
inline void substitute_closure (hb_face_t *face, hb_set_t *glyphs) const { map.substitute_closure (this, face, glyphs); }
|
||||
inline void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const
|
||||
{
|
||||
unsigned int table_index;
|
||||
switch (table_tag) {
|
||||
case HB_OT_TAG_GSUB: table_index = 0; break;
|
||||
case HB_OT_TAG_GPOS: table_index = 1; break;
|
||||
default: return;
|
||||
}
|
||||
map.collect_lookups (table_index, lookups);
|
||||
}
|
||||
inline void substitute (hb_font_t *font, hb_buffer_t *buffer) const { map.substitute (this, font, buffer); }
|
||||
inline void position (hb_font_t *font, hb_buffer_t *buffer) const { map.position (this, font, buffer); }
|
||||
|
||||
|
|
|
@ -572,16 +572,35 @@ _hb_ot_shape (hb_shape_plan_t *shape_plan,
|
|||
}
|
||||
|
||||
|
||||
|
||||
static inline void
|
||||
hb_ot_map_glyphs_dumb (hb_font_t *font,
|
||||
hb_buffer_t *buffer)
|
||||
void
|
||||
hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
|
||||
hb_tag_t table_tag,
|
||||
hb_set_t *lookup_indexes /* OUT */)
|
||||
{
|
||||
unsigned int count = buffer->len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
font->get_glyph (buffer->info[i].codepoint, 0, &buffer->info[i].codepoint);
|
||||
HB_SHAPER_DATA_GET (shape_plan)->collect_lookups (table_tag, lookup_indexes);
|
||||
}
|
||||
|
||||
|
||||
/* TODO Move this to hb-ot-shape-normalize, make it do decompose, and make it public. */
|
||||
static void
|
||||
add_char (hb_font_t *font,
|
||||
hb_unicode_funcs_t *unicode,
|
||||
hb_bool_t mirror,
|
||||
hb_codepoint_t u,
|
||||
hb_set_t *glyphs)
|
||||
{
|
||||
hb_codepoint_t glyph;
|
||||
if (font->get_glyph (u, 0, &glyph))
|
||||
glyphs->add (glyph);
|
||||
if (mirror)
|
||||
{
|
||||
hb_codepoint_t m = unicode->mirroring (u);
|
||||
if (m != u && font->get_glyph (m, 0, &glyph))
|
||||
glyphs->add (glyph);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hb_ot_shape_glyphs_closure (hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
|
@ -593,26 +612,27 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
|
|||
|
||||
buffer->guess_properties ();
|
||||
|
||||
/* TODO cache / ensure correct backend, etc. */
|
||||
hb_shape_plan_t *shape_plan = hb_shape_plan_create (font->face, &buffer->props, features, num_features, NULL);
|
||||
const char *shapers[] = {"ot", NULL};
|
||||
hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props,
|
||||
features, num_features, shapers);
|
||||
|
||||
/* TODO: normalization? have shapers do closure()? */
|
||||
/* TODO: Deal with mirrored chars? */
|
||||
hb_ot_map_glyphs_dumb (font, buffer);
|
||||
bool mirror = hb_script_get_horizontal_direction (buffer->props.script) == HB_DIRECTION_RTL;
|
||||
|
||||
/* Seed it. It's user's responsibility to have cleard glyphs
|
||||
* if that's what they desire. */
|
||||
unsigned int count = buffer->len;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
glyphs->add (buffer->info[i].codepoint);
|
||||
add_char (font, buffer->unicode, mirror, buffer->info[i].codepoint, glyphs);
|
||||
|
||||
hb_set_t lookups;
|
||||
lookups.init ();
|
||||
hb_ot_shape_plan_collect_lookups (shape_plan, HB_OT_TAG_GSUB, &lookups);
|
||||
|
||||
/* And find transitive closure. */
|
||||
hb_set_t copy;
|
||||
copy.init ();
|
||||
|
||||
do {
|
||||
copy.set (glyphs);
|
||||
HB_SHAPER_DATA_GET (shape_plan)->substitute_closure (font->face, glyphs);
|
||||
for (hb_codepoint_t lookup_index = -1; hb_set_next (&lookups, &lookup_index);)
|
||||
hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs);
|
||||
} while (!copy.is_equal (glyphs));
|
||||
|
||||
hb_shape_plan_destroy (shape_plan);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
HB_BEGIN_DECLS
|
||||
|
||||
/* TODO remove */
|
||||
void
|
||||
hb_ot_shape_glyphs_closure (hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
|
|
|
@ -28,9 +28,8 @@
|
|||
#define HB_SHAPE_PLAN_PRIVATE_HH
|
||||
|
||||
#include "hb-private.hh"
|
||||
|
||||
#include "hb-shape-plan.h"
|
||||
|
||||
#include "hb-object-private.hh"
|
||||
#include "hb-shaper-private.hh"
|
||||
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb-private.hh"
|
||||
|
||||
#include "hb-shape-plan-private.hh"
|
||||
#include "hb-shaper-private.hh"
|
||||
#include "hb-font-private.hh"
|
||||
|
@ -119,7 +117,7 @@ hb_shape_plan_get_empty (void)
|
|||
|
||||
true, /* default_shaper_list */
|
||||
NULL, /* face */
|
||||
_HB_BUFFER_PROPS_DEFAULT, /* props */
|
||||
HB_SEGMENT_PROPERTIES_DEFAULT, /* props */
|
||||
|
||||
NULL, /* shaper_func */
|
||||
|
||||
|
@ -153,9 +151,26 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan)
|
|||
free (shape_plan);
|
||||
}
|
||||
|
||||
hb_bool_t
|
||||
hb_shape_plan_set_user_data (hb_shape_plan_t *shape_plan,
|
||||
hb_user_data_key_t *key,
|
||||
void * data,
|
||||
hb_destroy_func_t destroy,
|
||||
hb_bool_t replace)
|
||||
{
|
||||
return hb_object_set_user_data (shape_plan, key, data, destroy, replace);
|
||||
}
|
||||
|
||||
void *
|
||||
hb_shape_plan_get_user_data (hb_shape_plan_t *shape_plan,
|
||||
hb_user_data_key_t *key)
|
||||
{
|
||||
return hb_object_get_user_data (shape_plan, key);
|
||||
}
|
||||
|
||||
|
||||
hb_bool_t
|
||||
hb_shape_plan_execute (hb_shape_plan *shape_plan,
|
||||
hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
const hb_feature_t *features,
|
||||
|
|
|
@ -24,52 +24,68 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#ifndef HB_H_IN
|
||||
#error "Include <hb.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef HB_SHAPE_PLAN_H
|
||||
#define HB_SHAPE_PLAN_H
|
||||
|
||||
/* TODO To become public one day */
|
||||
#include "hb-common.h"
|
||||
#include "hb-font.h"
|
||||
|
||||
#include "hb-private.hh"
|
||||
HB_BEGIN_DECLS
|
||||
|
||||
#include "hb-buffer-private.hh"
|
||||
typedef struct hb_shape_plan_t hb_shape_plan_t;
|
||||
|
||||
|
||||
typedef struct hb_shape_plan_t hb_shape_plan;
|
||||
|
||||
/*
|
||||
* hb_shape_plan_t
|
||||
*/
|
||||
|
||||
HB_INTERNAL hb_shape_plan_t *
|
||||
hb_shape_plan_t *
|
||||
hb_shape_plan_create (hb_face_t *face,
|
||||
const hb_segment_properties_t *props,
|
||||
const hb_feature_t *user_features,
|
||||
unsigned int num_user_features,
|
||||
const char * const *shaper_list);
|
||||
|
||||
HB_INTERNAL hb_shape_plan_t *
|
||||
hb_shape_plan_t *
|
||||
hb_shape_plan_create_cached (hb_face_t *face,
|
||||
const hb_segment_properties_t *props,
|
||||
const hb_feature_t *user_features,
|
||||
unsigned int num_user_features,
|
||||
const char * const *shaper_list);
|
||||
|
||||
HB_INTERNAL hb_shape_plan_t *
|
||||
hb_shape_plan_t *
|
||||
hb_shape_plan_get_empty (void);
|
||||
|
||||
HB_INTERNAL hb_shape_plan_t *
|
||||
hb_shape_plan_t *
|
||||
hb_shape_plan_reference (hb_shape_plan_t *shape_plan);
|
||||
|
||||
HB_INTERNAL void
|
||||
void
|
||||
hb_shape_plan_destroy (hb_shape_plan_t *shape_plan);
|
||||
|
||||
hb_bool_t
|
||||
hb_shape_plan_set_user_data (hb_shape_plan_t *shape_plan,
|
||||
hb_user_data_key_t *key,
|
||||
void * data,
|
||||
hb_destroy_func_t destroy,
|
||||
hb_bool_t replace);
|
||||
|
||||
HB_INTERNAL hb_bool_t
|
||||
hb_shape_plan_execute (hb_shape_plan *shape_plan,
|
||||
void *
|
||||
hb_shape_plan_get_user_data (hb_shape_plan_t *shape_plan,
|
||||
hb_user_data_key_t *key);
|
||||
|
||||
|
||||
hb_bool_t
|
||||
hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
const hb_feature_t *features,
|
||||
unsigned int num_features);
|
||||
|
||||
#ifdef HB_NOT_IMPLEMENTED
|
||||
const char *
|
||||
hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan);
|
||||
#endif
|
||||
|
||||
|
||||
HB_END_DECLS
|
||||
|
||||
#endif /* HB_SHAPE_PLAN_H */
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
|
||||
#include "hb-private.hh"
|
||||
|
||||
#include "hb-shape-plan.h" /* TODO remove */
|
||||
|
||||
typedef hb_bool_t hb_shape_func_t (hb_shape_plan_t *shape_plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
*/
|
||||
|
||||
#include "hb-private.hh"
|
||||
|
||||
#include "hb-shaper-private.hh"
|
||||
#include "hb-atomic-private.hh"
|
||||
|
||||
|
||||
static const hb_shaper_pair_t all_shapers[] = {
|
||||
|
|
1
src/hb.h
1
src/hb.h
|
@ -34,6 +34,7 @@
|
|||
#include "hb-font.h"
|
||||
#include "hb-set.h"
|
||||
#include "hb-shape.h"
|
||||
#include "hb-shape-plan.h"
|
||||
#include "hb-unicode.h"
|
||||
#include "hb-version.h"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue