Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/font2c.c #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

tools/font2c.c #25

wants to merge 1 commit into from

Conversation

derSicking
Copy link

I added a simple font2c tool, very much in the style of png2c and obj2c. It uses freetype2 to create bitmaps of the entire ASCII set of glyphs out of a given font file (e.g. a .ttf file).

I also added a test case using the "LibreBaskerville-Regular.ttf" font that was already in the repo.

custom_font_expected

Some thoughts:

  • The addition to nobuild.c (line 11) needs work, as the include and link flags are system dependent. I was not sure on how to implement a smarter solution (probably using "pkg-config --cflags freetype2" ?)
  • LibreBaskerville looks a bit odd when rendered this way, because the olive.c text rendering mechanism only supports monospaced glyphs. I opted to align all glyphs to the left edge of their space, and some narrow letters look a little lost. There may be a way to be smarter about aligning the glyphs (centered?), or to add non-monospaced font support.
  • The tool uses 16pt font size for a 72dpi display (tools/font2c.c line 113), and there is no way for the user to configure this yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant