Humm, undo some shuffling
In preparation for adding more advanced unicode funcs.
This commit is contained in:
parent
4b6317c4f4
commit
891c4755ba
|
@ -197,8 +197,8 @@ hb_set_unicode_props (hb_ot_shape_context_t *c)
|
|||
|
||||
unsigned int count = c->buffer->len;
|
||||
for (unsigned int i = 1; i < count; i++) {
|
||||
info[i].general_category() = unicode->get_general_category (info[i].codepoint);
|
||||
info[i].combining_class() = unicode->get_combining_class (info[i].codepoint);
|
||||
info[i].general_category() = hb_unicode_get_general_category (unicode, info[i].codepoint);
|
||||
info[i].combining_class() = hb_unicode_get_combining_class (unicode, info[i].codepoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ hb_mirror_chars (hb_ot_shape_context_t *c)
|
|||
|
||||
unsigned int count = c->buffer->len;
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
hb_codepoint_t codepoint = unicode->get_mirroring (c->buffer->info[i].codepoint);
|
||||
hb_codepoint_t codepoint = hb_unicode_get_mirroring (unicode, c->buffer->info[i].codepoint);
|
||||
if (likely (codepoint == c->buffer->info[i].codepoint))
|
||||
c->buffer->info[i].mask |= rtlm_mask; /* XXX this should be moved to before setting user-feature masks */
|
||||
else
|
||||
|
|
|
@ -63,7 +63,7 @@ hb_shape (hb_font_t *font,
|
|||
hb_unicode_funcs_t *unicode = buffer->unicode;
|
||||
unsigned int count = buffer->len;
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
hb_script_t script = unicode->get_script (buffer->info[i].codepoint);
|
||||
hb_script_t script = hb_unicode_get_script (unicode, buffer->info[i].codepoint);
|
||||
if (likely (script != HB_SCRIPT_COMMON &&
|
||||
script != HB_SCRIPT_INHERITED &&
|
||||
script != HB_SCRIPT_UNKNOWN)) {
|
||||
|
|
|
@ -44,13 +44,22 @@ HB_BEGIN_DECLS
|
|||
*/
|
||||
|
||||
#define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (unsigned int, combining_class, 0) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (unsigned int, eastasian_width, 1) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (hb_unicode_general_category_t, general_category, HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (hb_codepoint_t, mirroring, unicode) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (hb_script_t, script, HB_SCRIPT_UNKNOWN) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (combining_class) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (eastasian_width) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (general_category) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (mirroring) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (script) \
|
||||
/* ^--- Add new callbacks here */
|
||||
|
||||
/* Simple callbacks are those taking a hb_codepoint_t and returning a hb_codepoint_t */
|
||||
#define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (unsigned int, combining_class) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (unsigned int, eastasian_width) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (hb_unicode_general_category_t, general_category) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (hb_codepoint_t, mirroring) \
|
||||
HB_UNICODE_FUNC_IMPLEMENT (hb_script_t, script) \
|
||||
/* ^--- Add new simple callbacks here */
|
||||
|
||||
struct _hb_unicode_funcs_t {
|
||||
hb_object_header_t header;
|
||||
|
||||
|
@ -58,31 +67,22 @@ struct _hb_unicode_funcs_t {
|
|||
|
||||
bool immutable;
|
||||
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) \
|
||||
inline return_type \
|
||||
get_##name (hb_codepoint_t unicode) \
|
||||
{ return this->get.name (this, unicode, this->user_data.name); }
|
||||
|
||||
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
||||
|
||||
#undef HB_UNICODE_FUNC_IMPLEMENT
|
||||
|
||||
/* Don't access these directly. Call get_*() instead. */
|
||||
/* Don't access these directly. Call hb_unicode_get_*() instead. */
|
||||
|
||||
struct {
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) hb_unicode_get_##name##_func_t name;
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_get_##name##_func_t name;
|
||||
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
||||
#undef HB_UNICODE_FUNC_IMPLEMENT
|
||||
} get;
|
||||
|
||||
struct {
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) void *name;
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(name) void *name;
|
||||
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
||||
#undef HB_UNICODE_FUNC_IMPLEMENT
|
||||
} user_data;
|
||||
|
||||
struct {
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) hb_destroy_func_t name;
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_destroy_func_t name;
|
||||
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
||||
#undef HB_UNICODE_FUNC_IMPLEMENT
|
||||
} destroy;
|
||||
|
|
|
@ -39,19 +39,45 @@ HB_BEGIN_DECLS
|
|||
* hb_unicode_funcs_t
|
||||
*/
|
||||
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) \
|
||||
\
|
||||
\
|
||||
static return_type \
|
||||
hb_unicode_get_##name##_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, \
|
||||
hb_codepoint_t unicode HB_UNUSED, \
|
||||
void *user_data HB_UNUSED) \
|
||||
{ \
|
||||
return default_value; \
|
||||
static unsigned int
|
||||
hb_unicode_get_combining_class_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
|
||||
hb_codepoint_t unicode HB_UNUSED,
|
||||
void *user_data HB_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
||||
#undef HB_UNICODE_FUNC_IMPLEMENT
|
||||
static unsigned int
|
||||
hb_unicode_get_eastasian_width_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
|
||||
hb_codepoint_t unicode HB_UNUSED,
|
||||
void *user_data HB_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static hb_unicode_general_category_t
|
||||
hb_unicode_get_general_category_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
|
||||
hb_codepoint_t unicode HB_UNUSED,
|
||||
void *user_data HB_UNUSED)
|
||||
{
|
||||
return HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER;
|
||||
}
|
||||
|
||||
static hb_codepoint_t
|
||||
hb_unicode_get_mirroring_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
|
||||
hb_codepoint_t unicode HB_UNUSED,
|
||||
void *user_data HB_UNUSED)
|
||||
{
|
||||
return unicode;
|
||||
}
|
||||
|
||||
static hb_script_t
|
||||
hb_unicode_get_script_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
|
||||
hb_codepoint_t unicode HB_UNUSED,
|
||||
void *user_data HB_UNUSED)
|
||||
{
|
||||
return HB_SCRIPT_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
hb_unicode_funcs_t _hb_unicode_funcs_nil = {
|
||||
|
@ -60,7 +86,7 @@ hb_unicode_funcs_t _hb_unicode_funcs_nil = {
|
|||
NULL, /* parent */
|
||||
TRUE, /* immutable */
|
||||
{
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) hb_unicode_get_##name##_nil,
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_get_##name##_nil,
|
||||
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
||||
#undef HB_UNICODE_FUNC_IMPLEMENT
|
||||
}
|
||||
|
@ -114,7 +140,7 @@ hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs)
|
|||
{
|
||||
if (!hb_object_destroy (ufuncs)) return;
|
||||
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) \
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(name) \
|
||||
if (ufuncs->destroy.name) ufuncs->destroy.name (ufuncs->user_data.name);
|
||||
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
||||
#undef HB_UNICODE_FUNC_IMPLEMENT
|
||||
|
@ -163,7 +189,7 @@ hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs)
|
|||
}
|
||||
|
||||
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) \
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(name) \
|
||||
\
|
||||
void \
|
||||
hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \
|
||||
|
@ -186,7 +212,13 @@ hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \
|
|||
ufuncs->user_data.name = ufuncs->parent->user_data.name; \
|
||||
ufuncs->destroy.name = NULL; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
||||
#undef HB_UNICODE_FUNC_IMPLEMENT
|
||||
|
||||
|
||||
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name) \
|
||||
\
|
||||
return_type \
|
||||
hb_unicode_get_##name (hb_unicode_funcs_t *ufuncs, \
|
||||
|
@ -194,8 +226,7 @@ hb_unicode_get_##name (hb_unicode_funcs_t *ufuncs, \
|
|||
{ \
|
||||
return ufuncs->get.name (ufuncs, unicode, ufuncs->user_data.name); \
|
||||
}
|
||||
|
||||
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
||||
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
|
||||
#undef HB_UNICODE_FUNC_IMPLEMENT
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue