[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)

Marcel Taeumel marcel.taeumel at hpi.de
Thu Feb 17 11:20:18 UTC 2022


Hi Tony --

Please give me 1 more day. I am almost finished refactoring TTFontReader. :-)

Currently, use the FontImporterTool. Or use this interface to try out a font without installing it into Squeak:

fontFile := '/Users/ecgade/Downloads/Santakku/SantakkuM.ttf'. fontReader := TTFontReader parseFileNamed: fontFile. myCoolFont := TTCFont new ttcDescription: fontReader first; pointSize: 36.0; yourself. myCoolFont browseAllGlyphs.

Best,
Marcel
Am 17.02.2022 12:08:23 schrieb Tony Garnock-Jones <tonyg at leastfixedpoint.com>:
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'..."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220217/7432a450/attachment.html>


More information about the Squeak-dev mailing list