[HarfBuzz] harfbuzz-ng: Branch 'master' - 5 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Fri Aug 13 11:10:42 PDT 2010
src/hb-buffer-private.hh | 9 ++++--
src/hb-buffer.cc | 12 ++++----
src/hb-ot-layout-gpos-private.hh | 4 +-
src/hb-ot-layout.cc | 2 -
src/hb-ot-shape.cc | 53 ++++++++++++++++-----------------------
5 files changed, 37 insertions(+), 43 deletions(-)
New commits:
commit 258305c2a5dd47bd2d83f12eaf9caa5b19ae5efb
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Aug 13 14:10:02 2010 -0400
[GPOS] Fix div-by-zero
Patch by Jonathan Kew. Mozilla bug #465728.
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 3b40bdc..a5f65b4 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -345,7 +345,7 @@ struct AnchorMatrix
inline bool sanitize (hb_sanitize_context_t *c, unsigned int cols) {
TRACE_SANITIZE ();
if (!c->check_struct (this)) return false;
- if (unlikely (cols >= ((unsigned int) -1) / rows)) return false;
+ if (unlikely (rows > 0 && cols >= ((unsigned int) -1) / rows)) return false;
unsigned int count = rows * cols;
if (!c->check_array (matrix, matrix[0].static_size, count)) return false;
for (unsigned int i = 0; i < count; i++)
commit 2422c4b96d32037a5cdaef4c427ed1d25db5f647
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Aug 13 14:00:34 2010 -0400
Add TODO
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index c9caff6..34ac89b 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -92,7 +92,7 @@ cmp_lookups (const void *p1, const void *p2)
}
-#define MAX_FEATURES 100
+#define MAX_FEATURES 100 /* FIXME */
struct hb_mask_allocator_t {
commit 27f0b092a13344e8791c496c77a3c1e5de4f887c
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Jul 23 17:35:54 2010 -0400
Logically separate feature allocation from application
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index af15661..c9caff6 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -251,10 +251,6 @@ setup_lookups (hb_face_t *face,
hb_ot_tag_from_language (buffer->props.language),
&language_index);
- if (hb_ot_layout_language_get_required_feature_index (face, table_tag, script_index, language_index,
- &feature_index))
- add_feature (face, table_tag, feature_index, 1, lookups, num_lookups, room_lookups);
-
hb_mask_allocator_t allocator;
@@ -290,6 +286,10 @@ setup_lookups (hb_face_t *face,
/* Gather lookup indices for features and set buffer masks at the same time */
+ if (hb_ot_layout_language_get_required_feature_index (face, table_tag, script_index, language_index,
+ &feature_index))
+ add_feature (face, table_tag, feature_index, 1, lookups, num_lookups, room_lookups);
+
const hb_mask_allocator_t::feature_map_t *map;
hb_mask_t global_mask = allocator.get_global_mask ();
commit 6cf63132dc771e1bcd5627720daf4bd2ea0800a5
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Jul 23 17:32:26 2010 -0400
Minor
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 3c224e3..af15661 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -197,7 +197,7 @@ struct hb_mask_allocator_t {
map->tag = info->tag;
map->index = feature_index;
if (info->global && info->value == 1) {
- /* Uses the global bit */
+ /* Use the global bit */
map->shift = 0;
map->mask = 1;
} else {
commit 4e4ef24e46f273ad2bdda2f718223e05b37dd50f
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Jul 23 17:22:11 2010 -0400
Towards separating bit allocation from shaping
diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index b48ef1d..ce7a3b5 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -111,9 +111,12 @@ struct _hb_buffer_t {
/* Information about how the text in the buffer should be treated */
hb_unicode_funcs_t *unicode;
- hb_direction_t direction;
- hb_script_t script;
- hb_language_t language;
+
+ struct properties_t {
+ hb_direction_t direction;
+ hb_script_t script;
+ hb_language_t language;
+ } props;
/* Buffer contents */
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index ff39330..ccc075a 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -182,39 +182,39 @@ hb_buffer_set_direction (hb_buffer_t *buffer,
hb_direction_t direction)
{
- buffer->direction = direction;
+ buffer->props.direction = direction;
}
hb_direction_t
hb_buffer_get_direction (hb_buffer_t *buffer)
{
- return buffer->direction;
+ return buffer->props.direction;
}
void
hb_buffer_set_script (hb_buffer_t *buffer,
hb_script_t script)
{
- buffer->script = script;
+ buffer->props.script = script;
}
hb_script_t
hb_buffer_get_script (hb_buffer_t *buffer)
{
- return buffer->script;
+ return buffer->props.script;
}
void
hb_buffer_set_language (hb_buffer_t *buffer,
hb_language_t language)
{
- buffer->language = language;
+ buffer->props.language = language;
}
hb_language_t
hb_buffer_get_language (hb_buffer_t *buffer)
{
- return buffer->language;
+ return buffer->props.language;
}
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 00fa7ef..3b40bdc 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -967,7 +967,7 @@ struct CursivePosFormat1
/* TODO vertical */
- if (c->buffer->direction == HB_DIRECTION_RTL)
+ if (c->buffer->props.direction == HB_DIRECTION_RTL)
{
/* advance is absolute, not relative */
c->buffer->pos[c->buffer->i].x_advance = entry_x - gpi->anchor_x;
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index c39b63e..31451fc 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -634,7 +634,7 @@ hb_ot_layout_position_finish (hb_font_t *font HB_UNUSED,
pos[i].x_offset += pos[back].x_offset;
pos[i].y_offset += pos[back].y_offset;
- if (buffer->direction == HB_DIRECTION_RTL)
+ if (buffer->props.direction == HB_DIRECTION_RTL)
for (j = back + 1; j < i + 1; j++) {
pos[i].x_offset += pos[j].x_advance;
pos[i].y_offset += pos[j].y_advance;
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 3c21953..3c224e3 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -50,12 +50,6 @@ hb_tag_t default_features[] = {
HB_TAG('r','l','i','g')
};
-enum {
- MASK_ALWAYS_ON = 1 << 0,
- MASK_RTLM = 1 << 1
-};
-#define MASK_BITS_USED 2
-
struct lookup_map {
unsigned int index;
hb_mask_t mask;
@@ -156,7 +150,7 @@ struct hb_mask_allocator_t {
unsigned int language_index)
{
global_mask = 0;
- next_bit = MASK_BITS_USED;
+ unsigned int next_bit = 1;
if (!count)
return;
@@ -230,10 +224,9 @@ struct hb_mask_allocator_t {
unsigned int count;
feature_info_t infos[MAX_FEATURES];
- feature_map_t maps[MAX_FEATURES];
+ feature_map_t maps[MAX_FEATURES];
hb_mask_t global_mask;
- unsigned int next_bit;
};
static void
@@ -252,10 +245,10 @@ setup_lookups (hb_face_t *face,
*num_lookups = 0;
hb_ot_layout_table_choose_script (face, table_tag,
- hb_ot_tags_from_script (buffer->script),
+ hb_ot_tags_from_script (buffer->props.script),
&script_index);
hb_ot_layout_script_find_language (face, table_tag, script_index,
- hb_ot_tag_from_language (buffer->language),
+ hb_ot_tag_from_language (buffer->props.language),
&language_index);
if (hb_ot_layout_language_get_required_feature_index (face, table_tag, script_index, language_index,
@@ -272,8 +265,7 @@ setup_lookups (hb_face_t *face,
break;
case HB_DIRECTION_RTL:
allocator.add_feature (HB_TAG ('r','t','l','a'), 1, true);
- //allocator.add_feature (HB_TAG ('r','t','l','m'), false);
- allocator.add_feature (HB_TAG ('r','t','l','m'), 1, true);
+ allocator.add_feature (HB_TAG ('r','t','l','m'), 1, false);
break;
case HB_DIRECTION_TTB:
case HB_DIRECTION_BTT:
@@ -314,8 +306,8 @@ setup_lookups (hb_face_t *face,
case HB_DIRECTION_RTL:
map = allocator.find_feature (HB_TAG ('r','t','l','a'));
add_feature (face, table_tag, map->index, map->mask, lookups, num_lookups, room_lookups);
- //map = allocator.find_feature (HB_TAG ('r','t','l','m'));
- add_feature (face, table_tag, map->index, MASK_RTLM, lookups, num_lookups, room_lookups);
+ map = allocator.find_feature (HB_TAG ('r','t','l','m'));
+ add_feature (face, table_tag, map->index, map->mask, lookups, num_lookups, room_lookups);
break;
case HB_DIRECTION_TTB:
case HB_DIRECTION_BTT:
@@ -435,14 +427,14 @@ hb_form_clusters (hb_buffer_t *buffer)
static hb_direction_t
hb_ensure_native_direction (hb_buffer_t *buffer)
{
- hb_direction_t original_direction = buffer->direction;
+ hb_direction_t original_direction = buffer->props.direction;
/* TODO vertical */
if (HB_DIRECTION_IS_HORIZONTAL (original_direction) &&
- original_direction != _hb_script_get_horizontal_direction (buffer->script))
+ original_direction != _hb_script_get_horizontal_direction (buffer->props.script))
{
hb_buffer_reverse_clusters (buffer);
- buffer->direction = HB_DIRECTION_REVERSE (buffer->direction);
+ buffer->props.direction = HB_DIRECTION_REVERSE (buffer->props.direction);
}
return original_direction;
@@ -456,14 +448,16 @@ hb_mirror_chars (hb_buffer_t *buffer)
{
hb_unicode_get_mirroring_func_t get_mirroring = buffer->unicode->v.get_mirroring;
- if (HB_DIRECTION_IS_FORWARD (buffer->direction))
+ if (HB_DIRECTION_IS_FORWARD (buffer->props.direction))
return;
+// map = allocator.find_feature (HB_TAG ('r','t','l','m'));
+
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++) {
hb_codepoint_t codepoint = get_mirroring (buffer->info[i].codepoint);
if (likely (codepoint == buffer->info[i].codepoint))
- buffer->info[i].mask |= MASK_RTLM;
+;// buffer->info[i].mask |= map->mask;
else
buffer->info[i].codepoint = codepoint;
}
@@ -590,7 +584,6 @@ hb_ot_shape (hb_font_t *font,
/* SUBSTITUTE */
{
-
buffer->clear_masks ();
/* Mirroring needs to see the original direction */
@@ -604,12 +597,10 @@ hb_ot_shape (hb_font_t *font,
if (substitute_fallback)
hb_substitute_complex_fallback (font, face, buffer, features, num_features);
-
}
/* POSITION */
{
-
buffer->clear_masks ();
hb_position_default (font, face, buffer, features, num_features);
@@ -619,14 +610,14 @@ hb_ot_shape (hb_font_t *font,
if (position_fallback)
hb_position_complex_fallback (font, face, buffer, features, num_features);
- if (HB_DIRECTION_IS_BACKWARD (buffer->direction))
+ if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction))
hb_buffer_reverse (buffer);
if (position_fallback)
hb_position_complex_fallback_visual (font, face, buffer, features, num_features);
}
- buffer->direction = original_direction;
+ buffer->props.direction = original_direction;
}
More information about the HarfBuzz
mailing list