Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/hb/aat/layout_kerx_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub(crate) fn apply(c: &mut AatApplyContext) -> Option<()> {

let mut subtable_idx = 0;

let mut buffer_is_reversed = false;
let mut seen_cross_stream = false;
for subtable in kerx.subtables().iter() {
let Ok(subtable) = subtable else {
Expand Down Expand Up @@ -84,8 +85,9 @@ pub(crate) fn apply(c: &mut AatApplyContext) -> Option<()> {
continue;
};

if reverse {
if reverse != buffer_is_reversed {
c.buffer.reverse();
buffer_is_reversed = reverse;
}

match &kind {
Expand Down Expand Up @@ -136,10 +138,9 @@ pub(crate) fn apply(c: &mut AatApplyContext) -> Option<()> {
apply_simple_kerning(c, &subtable, format6);
}
}

if reverse {
c.buffer.reverse();
}
}
if buffer_is_reversed {
c.buffer.reverse();
}

Some(())
Expand Down
11 changes: 6 additions & 5 deletions src/hb/aat/layout_morx_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub fn apply<'a>(c: &mut AatApplyContext<'a>, map: &'a AatMap) -> Option<()> {

let mut subtable_idx = 0;

let mut buffer_is_reversed = false;
for (chain, chain_flags) in chains.iter().zip(map.chain_flags.iter()) {
let Ok(chain) = chain else {
continue;
Expand Down Expand Up @@ -156,17 +157,17 @@ pub fn apply<'a>(c: &mut AatApplyContext<'a>, map: &'a AatMap) -> Option<()> {
subtable.is_backwards() != c.buffer.direction.is_backward()
};

if reverse {
if reverse != buffer_is_reversed {
c.buffer.reverse();
buffer_is_reversed = reverse;
}

if let Ok(kind) = subtable.kind() {
apply_subtable(kind, c);
}

if reverse {
c.buffer.reverse();
}
}
if buffer_is_reversed {
c.buffer.reverse();
}
}

Expand Down
11 changes: 6 additions & 5 deletions src/hb/kerning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub fn hb_ot_layout_kern(

let mut subtable_idx = 0;

let mut buffer_is_reversed = false;
let mut seen_cross_stream = false;
for subtable in kern.subtables() {
let Ok(subtable) = subtable else { continue };
Expand Down Expand Up @@ -89,8 +90,9 @@ pub fn hb_ot_layout_kern(
continue;
};

if reverse {
if reverse != buffer_is_reversed {
c.buffer.reverse();
buffer_is_reversed = reverse;
}

match kind {
Expand All @@ -108,10 +110,9 @@ pub fn hb_ot_layout_kern(
}
_ => {}
}

if reverse {
c.buffer.reverse();
}
}
if buffer_is_reversed {
c.buffer.reverse();
}
Some(())
}
Expand Down