Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: third_party/harfbuzz-ng/src/hb-ot-map.cc

Issue 10915172: harfbuzz-ng roll (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/harfbuzz-ng/src/hb-ot-map.cc
diff --git a/third_party/harfbuzz-ng/src/hb-ot-map.cc b/third_party/harfbuzz-ng/src/hb-ot-map.cc
index bebf3ed74ed61b08d8cecbd68ef8ed56a4b74e8e..f290c98a8798a30c30d952e5c40087886ca01c54 100644
--- a/third_party/harfbuzz-ng/src/hb-ot-map.cc
+++ b/third_party/harfbuzz-ng/src/hb-ot-map.cc
@@ -28,9 +28,6 @@
#include "hb-ot-map-private.hh"
-#include "hb-ot-shape-private.hh"
-
-
void
hb_ot_map_t::add_lookups (hb_face_t *face,
@@ -63,7 +60,7 @@ hb_ot_map_t::add_lookups (hb_face_t *face,
}
-void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value, bool global)
+void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value, bool global, bool has_fallback)
{
feature_info_t *info = feature_infos.push();
if (unlikely (!info)) return;
@@ -71,55 +68,65 @@ void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value, bool gl
info->seq = feature_infos.len;
info->max_value = value;
info->global = global;
+ info->has_fallback = has_fallback;
info->default_value = global ? value : 0;
info->stage[0] = current_stage[0];
info->stage[1] = current_stage[1];
}
-void hb_ot_map_t::apply (unsigned int table_index,
- hb_ot_map_t::apply_lookup_func_t apply_lookup_func,
- void *face_or_font,
- hb_buffer_t *buffer) const
+/* Keep the next two functions in sync. */
+
+void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const
{
+ const unsigned int table_index = 0;
unsigned int i = 0;
for (unsigned int pause_index = 0; pause_index < pauses[table_index].len; pause_index++) {
const pause_map_t *pause = &pauses[table_index][pause_index];
for (; i < pause->num_lookups; i++)
- apply_lookup_func (face_or_font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask);
+ hb_ot_layout_substitute_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask);
+
+ buffer->clear_output ();
- pause->callback.func (this, face_or_font, buffer, pause->callback.user_data);
+ if (pause->callback)
+ pause->callback (plan, font, buffer);
}
for (; i < lookups[table_index].len; i++)
- apply_lookup_func (face_or_font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask);
+ hb_ot_layout_substitute_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask);
}
-void hb_ot_map_t::substitute_closure (hb_face_t *face,
- hb_set_t *glyphs) const
+void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const
{
- unsigned int table_index = 0;
+ const unsigned int table_index = 1;
unsigned int i = 0;
for (unsigned int pause_index = 0; pause_index < pauses[table_index].len; pause_index++) {
const pause_map_t *pause = &pauses[table_index][pause_index];
for (; i < pause->num_lookups; i++)
- hb_ot_layout_substitute_closure_lookup (face, glyphs, lookups[table_index][i].index);
+ hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask);
+
+ if (pause->callback)
+ pause->callback (plan, font, buffer);
}
for (; i < lookups[table_index].len; i++)
- hb_ot_layout_substitute_closure_lookup (face, glyphs, lookups[table_index][i].index);
+ hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask);
}
-void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func, void *user_data)
+void hb_ot_map_t::substitute_closure (const hb_ot_shape_plan_t *plan, hb_face_t *face, hb_set_t *glyphs) const
{
- if (pause_func) {
- pause_info_t *p = pauses[table_index].push ();
- if (likely (p)) {
- p->stage = current_stage[table_index];
- p->callback.func = pause_func;
- p->callback.user_data = user_data;
- }
+ unsigned int table_index = 0;
+ for (unsigned int i = 0; i < lookups[table_index].len; i++)
+ hb_ot_layout_substitute_closure_lookup (face, lookups[table_index][i].index, glyphs);
+}
+
+void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func)
+{
+ pause_info_t *p = pauses[table_index].push ();
+ if (likely (p)) {
+ p->stage = current_stage[table_index];
+ p->callback = pause_func;
}
current_stage[table_index]++;
@@ -169,6 +176,7 @@ hb_ot_map_builder_t::compile (hb_face_t *face,
feature_infos[j].global = false;
feature_infos[j].max_value = MAX (feature_infos[j].max_value, feature_infos[i].max_value);
}
+ feature_infos[j].has_fallback = feature_infos[j].has_fallback || feature_infos[i].has_fallback;
feature_infos[j].stage[0] = MIN (feature_infos[j].stage[0], feature_infos[i].stage[0]);
feature_infos[j].stage[1] = MIN (feature_infos[j].stage[1], feature_infos[i].stage[1]);
/* Inherit default_value from j */
@@ -203,7 +211,7 @@ hb_ot_map_builder_t::compile (hb_face_t *face,
language_index[table_index],
info->tag,
&feature_index[table_index]);
- if (!found)
+ if (!found && !info->has_fallback)
continue;
@@ -228,13 +236,14 @@ hb_ot_map_builder_t::compile (hb_face_t *face,
m.global_mask |= (info->default_value << map->shift) & map->mask;
}
map->_1_mask = (1 << map->shift) & map->mask;
+ map->needs_fallback = !found;
}
feature_infos.shrink (0); /* Done with these */
- add_gsub_pause (NULL, NULL);
- add_gpos_pause (NULL, NULL);
+ add_gsub_pause (NULL);
+ add_gpos_pause (NULL);
for (unsigned int table_index = 0; table_index < 2; table_index++) {
hb_tag_t table_tag = table_tags[table_index];
@@ -285,5 +294,3 @@ hb_ot_map_builder_t::compile (hb_face_t *face,
}
}
}
-
-
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-layout-private.hh ('k') | third_party/harfbuzz-ng/src/hb-ot-map-private.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698