Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a phase that eliminates mixed contour+component glyphs; legal in source but not binary #123

Merged
merged 8 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
7 changes: 4 additions & 3 deletions fontbe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ env_logger = "0.9.0"

parking_lot = "0.12.1"

read-fonts = "0.0.5"
write-fonts = "0.0.5"
fea-rs = "0.2.0"
read-fonts = "0.1.0"
write-fonts = "0.1.0"

fea-rs = "0.3.0"
smol_str = "0.1.18"

[dev-dependencies]
Expand Down
35 changes: 26 additions & 9 deletions fontbe/src/orchestration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::{collections::HashSet, fs, path::Path, sync::Arc};

use fontdrasil::{
orchestration::{AccessControlList, Work, MISSING_DATA},
orchestration::{access_one, AccessControlList, Work, MISSING_DATA},
types::GlyphName,
};
use fontir::orchestration::{Context as FeContext, WorkId as FeWorkIdentifier};
Expand Down Expand Up @@ -74,6 +74,9 @@ pub struct Context {
// If set additional debug files will be emitted to disk
pub emit_debug: bool,

// If set seek to match fontmake (python) behavior even at cost of abandoning optimizations
match_legacy: bool,

paths: Arc<Paths>,

// The final, fully populated, read-only FE context
Expand All @@ -87,15 +90,29 @@ pub struct Context {
}

impl Context {
fn copy(&self, acl: AccessControlList<AnyWorkId>) -> Context {
Context {
emit_ir: self.emit_ir,
emit_debug: self.emit_debug,
match_legacy: self.match_legacy,
paths: self.paths.clone(),
ir: self.ir.clone(),
acl,
features: self.features.clone(),
}
}

pub fn new_root(
emit_ir: bool,
emit_debug: bool,
match_legacy: bool,
paths: Paths,
rsheeter marked this conversation as resolved.
Show resolved Hide resolved
ir: &fontir::orchestration::Context,
) -> Context {
Context {
emit_ir,
emit_debug,
match_legacy,
paths: Arc::from(paths),
ir: Arc::from(ir.read_only()),
acl: AccessControlList::read_only(),
Expand All @@ -108,14 +125,14 @@ impl Context {
work_id: WorkId,
dependencies: Option<HashSet<AnyWorkId>>,
) -> Context {
Context {
emit_ir: self.emit_ir,
emit_debug: self.emit_debug,
paths: self.paths.clone(),
ir: self.ir.clone(),
acl: AccessControlList::read_write(dependencies.unwrap_or_default(), work_id.into()),
features: self.features.clone(),
}
self.copy(AccessControlList::read_write(
dependencies.unwrap_or_default(),
access_one(work_id.into()),
))
}

pub fn read_only(&self) -> Context {
rsheeter marked this conversation as resolved.
Show resolved Hide resolved
self.copy(AccessControlList::read_only())
}
}

Expand Down
Loading