Skip to content

Commit

Permalink
Pass outer coordinates to inner coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Mar 27, 2023
1 parent ec67ff4 commit cbdaed9
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 6 deletions.
Binary file modified base-fonts/Recursive-subset.ttf
Binary file not shown.
Binary file modified inception/Inception-VF.ttf
Binary file not shown.
32 changes: 28 additions & 4 deletions inception/Inception.glyphs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ tag = ROND;
{
name = "Optical Size";
tag = opsz;
},
{
name = Weight;
tag = wght;
},
{
name = Slant;
tag = slnt;
},
{
name = Cursive;
tag = CURS;
}
);
date = "2023-03-26 14:34:12 +0000";
Expand All @@ -21,7 +33,10 @@ fontMaster = (
{
axesValues = (
100,
200
200,
0,
0,
0
);
id = m01;
metricValues = (
Expand Down Expand Up @@ -52,7 +67,10 @@ name = "Small Round";
{
axesValues = (
100,
9
9,
0,
0,
0
);
id = "91F0254D-AE70-4F0E-839A-589122BCBEE9";
metricValues = (
Expand Down Expand Up @@ -83,7 +101,10 @@ name = "Large Round";
{
axesValues = (
0,
200
200,
0,
0,
0
);
id = "E2AC362B-EF5F-4483-802D-EA6D735A27A3";
metricValues = (
Expand Down Expand Up @@ -114,7 +135,10 @@ name = "Small Square";
{
axesValues = (
0,
9
9,
0,
0,
0
);
id = "53B69B1A-7EC8-4DB3-B9E3-541D2D7A0A5E";
metricValues = (
Expand Down
3 changes: 2 additions & 1 deletion inception/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ TARGET_SOURCE=Inception.glyphs
WASM=inception_bg.wasm

# This one is a little different.
$(TARGET_FONT): pkg/$(WASM) $(SLIM_BASE_FONT) $(TARGET_SOURCE) colr.ttx
$(TARGET_FONT): pkg/$(WASM) $(SLIM_BASE_FONT) $(TARGET_SOURCE) colr.ttx fvar.ttx
fontmake -o variable -g $(TARGET_SOURCE)
../bin/otfsurgeon -i variable_ttf/Inception-VF.ttf add -o $(TARGET_FONT) Font < $(SLIM_BASE_FONT)
../bin/otfsurgeon -i $(TARGET_FONT) add -o $(TARGET_FONT) Wasm < pkg/$(WASM)
ttx -o $(TARGET_FONT) -m $(TARGET_FONT) colr.ttx
ttx -o $(TARGET_FONT) -m $(TARGET_FONT) fvar.ttx

$(SLIM_BASE_FONT): $(BASE_FONT)
../bin/otfsurgeon -i $(BASE_FONT) strip -o $(SLIM_BASE_FONT) 'name' 'OS/2' 'MVAR' 'prep' 'HVAR' 'STAT' 'gasp'
Expand Down
59 changes: 59 additions & 0 deletions inception/fvar.ttx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.38">

<fvar>

<!-- Pixel Shape -->
<Axis>
<AxisTag>ROND</AxisTag>
<Flags>0x0</Flags>
<MinValue>0.0</MinValue>
<DefaultValue>100.0</DefaultValue>
<MaxValue>100.0</MaxValue>
<AxisNameID>256</AxisNameID>
</Axis>

<!-- Optical Size -->
<Axis>
<AxisTag>opsz</AxisTag>
<Flags>0x0</Flags>
<MinValue>9.0</MinValue>
<DefaultValue>200.0</DefaultValue>
<MaxValue>200.0</MaxValue>
<AxisNameID>257</AxisNameID>
</Axis>

<!-- Weight -->
<Axis>
<AxisTag>wght</AxisTag>
<Flags>0x0</Flags>
<MinValue>400.0</MinValue>
<DefaultValue>400.0</DefaultValue>
<MaxValue>800.0</MaxValue>
<AxisTag>wght</AxisTag>
<AxisNameID>258</AxisNameID>
</Axis>

<!-- Slant -->
<Axis>
<AxisTag>slnt</AxisTag>
<Flags>0x0</Flags>
<MinValue>-15.0</MinValue>
<DefaultValue>0.0</DefaultValue>
<MaxValue>0.0</MaxValue>
<AxisNameID>259</AxisNameID>
</Axis>

<!-- Cursive -->
<Axis>
<AxisTag>CRSV</AxisTag>
<Flags>0x0</Flags>
<MinValue>0.0</MinValue>
<DefaultValue>0.5</DefaultValue>
<MaxValue>1.0</MaxValue>
<AxisNameID>260</AxisNameID>
</Axis>

</fvar>

</ttFont>
10 changes: 9 additions & 1 deletion inception/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,15 @@ pub fn shape(
// let (x_scale, _y_scale) = font.get_scale();
let pixel_size = -font.get_glyph_extents(2).height as f32;
// debug(&format!("Test pixel size: {}", pixel_size));
// debug(&format!("Test X scale: {}", x_scale));
let coords = font.get_var_coords();
// debug(&format!("Test Outer Coords: {:?}", coords));
if coords.len() > 1 {
inner_font.set_var_coords(&coords[2..]);
// debug(&format!(
// "Test Inner Coords: {:?}",
// inner_font.get_var_coords()
// ));
}
let mut new_glyphs: Vec<Glyph> = vec![];

// Ordinary shaping
Expand Down

0 comments on commit cbdaed9

Please sign in to comment.