mapbox / mapbox/node-fontnik

Try different SDF granularities

Open
#38 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

jira-sync-complete question
Dominant language
C++
Stars
248
Forks
67
PR merge metrics
No merged PRs in 30d

Description

We can get better compression ratios by reducing the granularity of the SDFs -- the following commit rounds each value to the nearest multiple of 8:

https://github.com/mapbox/fontserver/commit/c213c12cf1ff45b5de9f17f8818352e344e33285

Visually it's hard to see much difference once rendered and here is the space saving for a 0-255 range:

```
master 43124 bytes
compress-more 23208 bytes
```

This is a nice boost we can get now roughly for free since it doesn't affect the format/integrating projects -- later we may try other encodings for the bitmap (PNG, etc.) but those will be format-breaking.
### Next actions
- [x] Try this and other settings (4 and 2? 16 is where I started to see artifacts...) with a variety of different fonts
- [ ] This could be variable/env based so if you want a very high quality SDF you can set your settings that way

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the referenced compression commit with the current SDF generation path, then try granularities of 4, 8, and 2 across several fonts. Define an environment or variable-based quality setting without changing the format, and verify the resulting compression savings and visual artifacts.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, performance
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.