Skip to content

Commit

Permalink
Delete change detector, just build the whole font always. Shuffle thi…
Browse files Browse the repository at this point in the history
…ngs as a result.
  • Loading branch information
rsheeter committed Jan 3, 2025
1 parent aeb5116 commit 742a2d1
Show file tree
Hide file tree
Showing 21 changed files with 663 additions and 2,834 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Where in we pursue oxidizing [fontmake](https://github.com/googlefonts/fontmake)
For context around where fontmake came from see
[Mr B goes to Vartown](https://github.com/googlefonts/oxidize/blob/main/text/2023-10-18-mrb-goes-to-vartown.md).

Converts source to IR, and then IR to font binary. Aims to be safe, incremental, and fast.
Converts source to IR, and then IR to font binary. Aims to be safe and fast.

References

Expand Down Expand Up @@ -47,14 +47,13 @@ Install the latest version of Rust, https://www.rust-lang.org/tools/install.
$ cargo run -p fontc -- resources/testdata/wght_var.designspace
```

### Emit IR to enable incremental builds
### Emit IR

If you pass the `--incremental` (or `-i`) option, the IR will be written to disk inside
the build working directory, so that the next time you run fontc with the same source file
only what changed will be rebuilt.
If you pass the `--emit-ir` option, the IR will be written to disk inside
the build working directory. This can be helpful when troubleshooting.

```shell
$ cargo run -p fontc -- --incremental resources/testdata/wght_var.designspace
$ cargo run -p fontc -- --emit-ir resources/testdata/wght_var.designspace
$ ls build/
```

Expand Down
12 changes: 7 additions & 5 deletions fontc/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ pub struct Args {
#[arg(short, long)]
source: Option<PathBuf>,

/// Whether to write IR to disk. Must be true if you want incremental compilation.
/// Whether to write IR to disk.
#[arg(short, long, default_value = "false")]
pub incremental: bool,
pub emit_ir: bool,

/// Output file name (default: build/font.ttf)
#[arg(short, long)]
Expand Down Expand Up @@ -109,7 +109,7 @@ impl Args {
pub fn flags(&self) -> Flags {
let mut flags = Flags::default();

flags.set(Flags::EMIT_IR, self.incremental);
flags.set(Flags::EMIT_IR, self.emit_ir);
flags.set(Flags::EMIT_DEBUG, self.emit_debug);
flags.set(Flags::PREFER_SIMPLE_GLYPHS, self.prefer_simple_glyphs);
flags.set(Flags::FLATTEN_COMPONENTS, self.flatten_components);
Expand All @@ -129,7 +129,7 @@ impl Args {
glyph_name_filter: None,
input_source: Some(input_source),
source: None,
incremental: true,
emit_ir: false,
output_file: None,
emit_debug: false, // they get destroyed by test cleanup
emit_timing: false,
Expand All @@ -152,7 +152,9 @@ impl Args {
use crate::testdata_dir;

let input_source = testdata_dir().join(source).canonicalize().unwrap();
Self::new(build_dir, input_source)
let mut result = Self::new(build_dir, input_source);
result.emit_ir = true;
result
}

/// The input source to compile.
Expand Down
Loading

0 comments on commit 742a2d1

Please sign in to comment.