[HarfBuzz] harfbuzz-ng: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Fri Jun 8 07:10:58 PDT 2012
src/hb-private.hh | 12 +++++++++++-
src/hb-uniscribe.cc | 18 +++++++++++-------
2 files changed, 22 insertions(+), 8 deletions(-)
New commits:
commit b069c3c31bfbbf160eb897c7474be9ea90ed4fc1
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Jun 8 10:10:29 2012 -0400
Really fix override-direction in Uniscribe
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index 5013e9f..ce34f77 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -339,14 +339,18 @@ retry:
unsigned int glyphs_offset = 0;
unsigned int glyphs_len;
- for (unsigned int i = 0; i < item_count; i++)
+ bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
+ for (unsigned int j = 0; j < item_count; j++)
{
+ unsigned int i = backward ? item_count - 1 - j : j;
unsigned int chars_offset = items[i].iCharPos;
unsigned int item_chars_len = items[i + 1].iCharPos - chars_offset;
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... */
+ * between old/new tags. Not sure if this picks DFLT up correctly...
+ * This also screws things up as the item.analysis also has an opaque
+ * script member. */
if (script_tags[i] == hb_uint32_swap (buffer_script_tags[1]))
script_tag = hb_uint32_swap (buffer_script_tags[1]);
else
@@ -423,7 +427,7 @@ retry:
uint32_t *p = &vis_clusters[log_clusters[buffer->info[i].utf16_index()]];
*p = MIN (*p, buffer->info[i].cluster);
}
- if (HB_DIRECTION_IS_FORWARD (buffer->props.direction)) {
+ if (!backward) {
for (unsigned int i = 1; i < glyphs_len; i++)
if (!glyph_props[i].sva.fClusterStart)
vis_clusters[i] = vis_clusters[i - 1];
commit fcd6f5326166e993b8f5222efbaffe916da98f0a
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Jun 8 09:59:43 2012 -0400
Unbreak Uniscribe
Oops. hb_tag_t and OPENTYPE_TAG have different endianness. Perhaps
something to add API for in hb-uniscribe.h
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 0cb049e..ea8caf5 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -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.
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index 2edc178..5013e9f 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -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,
More information about the HarfBuzz
mailing list