googlefonts / googlefonts/fontations
GT Corporate rendered incorrectly without hinting
- Dominant language
- Rust
- Stars
- 826
- Forks
- 75
- Avg merge
- 22h 33m
- Merged PRs (30d)
- 75
Description
Linked issue: https://issues.chromium.org/issues/444048015
Since Chrome 140 and https://github.com/googlefonts/fontations/commit/d6b4719403925e210d82edee9e1002324f9e5754 , [GT Corporate](https://www.grillitype.com/about) is not getting rendered properly;
## Expected render
## Actual render
It looks correct though when `text-rendering: geometricPrecision;` is added
# svg renders
## Render code
```rust
// converted with ./woff2_decompress
let path = Path::new("GT-Corporate-Web.otf");
let font_bytes = std::fs::read(path).unwrap();
let font = FontRef::new(&font_bytes).expect("failed to read font data");
// First, grab the set of outline glyphs from the font.
let outlines = font.outline_glyphs();
// Find the glyph identifier for our character.
let glyph_id = font.charmap().map('r').unwrap();
// Grab the outline glyph.
let glyph = outlines.get(glyph_id).unwrap();
// Now, construct an instance of our pen.
let mut svg_path = SvgPath::default();
glyph
.draw(
DrawSettings::unhinted(Size::new(16.0), LocationRef::default()),
&mut svg_path,
)
.unwrap();
std::fs::write(
"out.svg",
format!(
r##""##,
svg_path.0
),
)
.unwrap();
```
## before https://github.com/googlefonts/fontations/commit/d6b4719403925e210d82edee9e1002324f9e5754

## after https://github.com/googlefonts/fontations/commit/d6b4719403925e210d82edee9e1002324f9e5754

# Probable cause of the regression
```rust
let font_bytes = std::fs::read(Path::new("GT-Corporate-Web.otf")).unwrap();
let font = FontRef::new(&font_bytes).expect("failed to read font data");
let cff = font.cff().expect("missing cff table");
let private_offset = entries(cff.top_dicts().get(0).unwrap(), None)
.find_map(|x| match x {
Ok(Entry::PrivateDictRange(r)) => Some(r),
_ => None,
})
.unwrap();
let private_dict = cff.offset_data().slice(private_offset).unwrap();
let blue = entries(private_dict.as_bytes(), None)
.find_map(|x| match x {
Ok(Entry::BlueScale(r)) => Some(r),
_ => None,
})
.unwrap();
// before d6b47194: BLUE SCALE: 0.029998779296875
// after d6b47194: BLUE SCALE: 0
println!("BLUE SCALE: {blue}");
```
[OTF font file](https://issues.chromium.org/action/issues/444048015/attachments/69199966?download=true)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the linked Chromium issue and the fontations commit d6b4719403925e210d82edee9e1002324f9e5754, then reproduce the SVG rendering with the Rust snippet and GT-Corporate-Web.otf. Trace how the CFF Blue Scale value changes before and after the commit; done means the font renders consistently without requiring the reported CSS hint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100