Skip to content

tom95/sqFreeTypeFont

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FreeType Fonts in Squeak

This adds a basic new font type to Squeak that is rendered via FreeType. Subpixel AA included!

Note that the project has not been used much, so things may explode, leaving you locked out of your system as text can no longer be displayed.

Portability is given to a certain extent: fonts render and cache glyphs lazily. Only when a previously unrendered glyph is encountered, the system needs to be able to locate the font files according to the currently configured family name or fail critically. This will be improved in the future to gracefully fall back to other fonts.

Install

Installation requires squeak-trunk (the new FFI needs the new immutability functions). If you get errors with the freetype library not being found, you may need to adjust your library load path, e.g. start Squeak via env LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/" ./squeak.sh.

Metacello new
	baseline: 'FreeTypeFont';
	repository: 'github://tom95/sqFreeTypeFont:master/src';
	load

Examples

For testing, open a Morph with an external font (adjust the path to match your system):

TextMorph new
	contents: 'Hello world!';
	font: (FreeTypeFont file: '/usr/share/fonts/truetype/ubuntu/UbuntuMono-R.ttf' pointSize: 11);
	openInHand.

Or, to resolve a font by name, use:

TextMorph new
	contents: 'Hello world!';
	font: (FreeTypeFont named: 'Ubuntu Mono' pointSize: 11);
	openInHand.

Change the default font in your image:

FreeTypeFont use: 'Ubuntu' at: 11.

Construct the font family manually from individual files:

font := ((FreeTypeFont file: '/usr/share/fonts/truetype/ubuntu/UbuntuMono-R.ttf' pointSize: 11)
	addBold: '/usr/share/fonts/truetype/ubuntu/UbuntuMono-B.ttf';
	addItalic: '/usr/share/fonts/truetype/ubuntu/UbuntuMono-RI.ttf';
	yourself).
font installSystemWide.

TODO

  • Font Decorations (strike-through, underline)
  • Locate Font by name rather than path
  • Fallback Fonts
  • Stretch: Harfbuzz Integration
  • Condensed font style

About

A new font type for rendering via FreeType in Squeak

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published