[squeak-dev] How best to import a new truetype font (.ttf file)? (was Re: Dead primitive 103 makes scrolling truetype fonts very, very slow. Let's get rid of it)

Tony Garnock-Jones tonyg at leastfixedpoint.com
Thu Feb 17 11:08:22 UTC 2022


Hi Marcel,

On 2/17/22 12:00, Marcel Taeumel wrote:
> Also: The use of linked fonts (i.e. the TTCFont with a 
> TTFontDescription) is currently rather slow regarding #hasGlyphOf:. I am 
> working on it.

This reminds me: I'm currently loading my font by some adhoc method I 
discovered by trying things until they seemed to work. This seems likely 
to be suboptimal.

What's the recommended way to load a .ttf into the image (so that 
everything is self contained in the image and fast to use)?

Cheers,
   Tony

PS. this is how I'm loading the font:

| description |
description := TTFontDescription addFromTTFile: 
'fonts/from-github/Roboto-Regular.ttf'.
TTCFont newTextStyleFromTT: description first.
TTCFont registerAll.

"Note in particular that I had to use 'description first' - is that a 
bug? Previously, using 'description' was the right thing to do, and 
TTCFont class >> newTextStyleFromTTFile:, which I was using previously, 
still expects to be able to use 'description'..."


More information about the Squeak-dev mailing list