Skip to content
Open
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
12 changes: 7 additions & 5 deletions fea-rs/src/compile/compile_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ impl<'a, F: FeatureProvider, V: VariationInfo> CompilationCtx<'a, F, V> {
self.script = None;
}

fn start_lookup_block(&mut self, name: &Token) {
fn start_lookup_block(&mut self, name: &Token, use_extension: bool) {
if let Some((id, _name)) = self.lookups.finish_current() {
assert!(_name.is_none(), "lookup blocks cannot be nested");
self.add_lookup_to_current_feature_if_present(id);
Expand All @@ -441,7 +441,8 @@ impl<'a, F: FeatureProvider, V: VariationInfo> CompilationCtx<'a, F, V> {
}

self.vertical_feature.begin_lookup_block();
self.lookups.start_named(name.text.clone(), name.range());
self.lookups
.start_named(name.text.clone(), name.range(), use_extension);
}

fn end_lookup_block(&mut self) {
Expand Down Expand Up @@ -1468,6 +1469,8 @@ impl<'a, F: FeatureProvider, V: VariationInfo> CompilationCtx<'a, F, V> {

fn resolve_aalt_feature(&mut self, feature: &typed::Feature) {
let mut aalt = AaltFeature::default();
aalt.use_extension = feature.use_extension().is_some();

for item in feature.statements() {
if let Some(node) = typed::Gsub1::cast(item) {
let Some((target, replacement)) = self.resolve_single_sub_glyphs(&node) else {
Expand Down Expand Up @@ -1981,9 +1984,8 @@ impl<'a, F: FeatureProvider, V: VariationInfo> CompilationCtx<'a, F, V> {
}

fn resolve_lookup_block(&mut self, lookup: typed::LookupBlock) {
self.start_lookup_block(lookup.label());

//let use_extension = lookup.use_extension().is_some();
let use_extension = lookup.use_extension().is_some();
self.start_lookup_block(lookup.label(), use_extension);
for item in lookup.statements() {
self.resolve_statement(item);
}
Expand Down
8 changes: 6 additions & 2 deletions fea-rs/src/compile/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub(crate) struct AaltFeature {
pub(crate) all_alts: HashMap<GlyphId16, Vec<GlyphId16>>,
// to avoid duplicates
all_pairs: HashSet<(GlyphId16, GlyphId16)>,
pub(crate) use_extension: bool,
}

/// Helper for compiling the `size` feature
Expand Down Expand Up @@ -203,8 +204,11 @@ impl AllFeatures {

// now we have all of our referenced lookups, and so we want to use that
// to construct the aalt lookups:
let aalt_lookup_indices =
all_lookups.insert_aalt_lookups(insert_point, std::mem::take(&mut aalt.all_alts));
let aalt_lookup_indices = all_lookups.insert_aalt_lookups(
insert_point,
std::mem::take(&mut aalt.all_alts),
aalt.use_extension,
);

// now adjust our previously set lookupids, which are now invalid,
// since we're going to insert the aalt lookups in front of the lookup
Expand Down
Loading
Loading