Skip to content

Commit a47f344

Browse files
committed
More small tweaks
1 parent f7e4f71 commit a47f344

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

src/cff2.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ pub fn subset(ctx: &mut Context) -> crate::Result<()> {
99

1010
let result = glyf::subset_with(ctx, |old_gid, ctx| {
1111
let data = match &ctx.interjector {
12-
Interjector::Dummy => return Err(Unimplemented),
12+
// We reject CFF2 fonts earlier if `variable_fonts` feature is not enabled.
13+
Interjector::Dummy => unreachable!(),
1314
#[cfg(feature = "variable_fonts")]
1415
Interjector::Skrifa(s) => {
1516
Cow::Owned(s.glyph_data(&mut maxp_data, old_gid).ok_or(MalformedFont)?)

src/interjector.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ pub(crate) mod skrifa {
136136
);
137137

138138
for (_, _, quad) in cubic.to_quads(1e-2) {
139+
// Note that `quad.p2` is the same as `quad.p0` of the next point in the iterator.
139140
self.quad_to(
140141
quad.p1.x as f32,
141142
quad.p1.y as f32,

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn prepare_context<'a>(
142142
let _ = variation_coordinates;
143143

144144
#[cfg(not(feature = "variable_fonts"))]
145-
let interjector = Box::new(DummyInterjector);
145+
let interjector = DummyInterjector;
146146
// For CFF, we _always_ want to do normal subsetting, since CFF cannot have variations.
147147
// For TrueType, we prefer normal subsetting in case no variation was requested. If we do have
148148
// variations, we use `skrifa` to instance.

tests/data/fonttools.tests

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ NotoSansCJKsc-Bold-subset1.otf;1
1313
NotoSans-Regular_var.ttf;10,40,58,201-205;wght=400
1414
NotoSans-Regular_var.ttf;10,40,58,201-205;wght=900
1515
NotoSans-Regular_var.ttf;10,40,58,201-205;wght=800,wdth=70.0
16+
// Note that the lsb values currently doesn't match fonttools
1617
Cantarell-VF.otf;1,15,30-35,40,103-105;wght=400
1718
Cantarell-VF.otf;1,15,30-35,40,103-105;wght=800
1819

0 commit comments

Comments
 (0)