提交 fcd6f532 编写于 作者: B Behdad Esfahbod

Unbreak Uniscribe

Oops.  hb_tag_t and OPENTYPE_TAG have different endianness.  Perhaps
something to add API for in hb-uniscribe.h
上级 29eac8f5
......@@ -464,7 +464,17 @@ struct hb_lockable_set_t
static inline uint16_t hb_be_uint16 (const uint16_t v)
{
const uint8_t *V = (const uint8_t *) &v;
return (uint16_t) (V[0] << 8) + V[1];
return (V[0] << 8) | V[1];
}
static inline uint16_t hb_uint16_swap (const uint16_t v)
{
return (v >> 8) | (v << 8);
}
static inline uint32_t hb_uint32_swap (const uint32_t v)
{
return (hb_uint16_swap (v) << 16) | hb_uint16_swap (v >> 16);
}
/* Note, of the following macros, uint16_get is the one called many many times.
......
......@@ -331,7 +331,7 @@ retry:
/* TODO setup ranges */
}
OPENTYPE_TAG language_tag = hb_ot_tag_from_language (buffer->props.language);
OPENTYPE_TAG language_tag = hb_uint32_swap (hb_ot_tag_from_language (buffer->props.language));
hb_tag_t buffer_script_tags[2];
hb_ot_tags_from_script (buffer->props.script,
&buffer_script_tags[0],
......@@ -347,10 +347,10 @@ retry:
OPENTYPE_TAG script_tag;
/* We ignore what script tag Uniscribe chose, except to differentiate
* between old/new tags. Not sure if this picks DFLT up correctly... */
if (script_tags[i] == buffer_script_tags[1])
script_tag = buffer_script_tags[1];
if (script_tags[i] == hb_uint32_swap (buffer_script_tags[1]))
script_tag = hb_uint32_swap (buffer_script_tags[1]);
else
script_tag = buffer_script_tags[0];
script_tag = hb_uint32_swap (buffer_script_tags[0]);
hr = ScriptShapeOpenType (font_data->hdc,
&font_data->script_cache,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册