Skip to content

Commit

Permalink
Revert "Remove unneeded buffer clear_output / remove_output calls"
Browse files Browse the repository at this point in the history
This reverts commit 2d1ed74.

harfbuzz/harfbuzz@93e6a9b
  • Loading branch information
bluebear94 committed Oct 5, 2023
1 parent db557de commit cb7a948
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,14 @@ impl Buffer {
self.idx = 0;
}

pub fn remove_output(&mut self) {
self.have_output = false;
self.have_positions = false;

self.out_len = 0;
self.have_separate_output = false;
}

pub fn clear_output(&mut self) {
self.have_output = true;
self.have_positions = false;
Expand Down
8 changes: 6 additions & 2 deletions src/ot/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ pub fn apply_layout_table<T: LayoutTable>(
}

if let Some(func) = stage.pause_func {
ctx.buffer.clear_output();
func(plan, face, ctx.buffer);
}
}
Expand All @@ -223,10 +224,9 @@ fn apply_string<T: LayoutTable>(ctx: &mut ApplyContext, lookup: &T::Lookup) {

if !lookup.is_reverse() {
// in/out forward substitution/positioning
if !T::IN_PLACE {
if T::INDEX == TableIndex::GSUB {
ctx.buffer.clear_output();
}

ctx.buffer.idx = 0;

if apply_forward(ctx, lookup) {
Expand All @@ -238,6 +238,10 @@ fn apply_string<T: LayoutTable>(ctx: &mut ApplyContext, lookup: &T::Lookup) {
}
} else {
// in-place backward substitution/positioning
if T::INDEX == TableIndex::GSUB {
ctx.buffer.remove_output();
}

ctx.buffer.idx = ctx.buffer.len - 1;
apply_backward(ctx, lookup);
}
Expand Down
2 changes: 2 additions & 0 deletions src/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ fn shape_internal(ctx: &mut ShapeContext) {
}
}

ctx.buffer.clear_output();

initialize_masks(ctx);
set_unicode_props(ctx.buffer);
insert_dotted_circle(ctx.buffer, ctx.face);
Expand Down

0 comments on commit cb7a948

Please sign in to comment.