Search code examples
fontssmalltalksqueakmonospace

How to have more font sizes in Squeak?


I installed the font DejavuSansMono which is ttf in Squeak. I want to use it in the Transcript and CommandShell.

Note: just download the ttf file then load it through the Squeak FileList app.

Now, if I select some text in Transcript then RightClick -> SetFont. I can change the font to DejavuSansMono but only to size : {9, 12, 15, 24, 36 }.

I would like to have other intermediate sizes. Is it possible? My knowledge of fonts is minimal, but I suppose it is, since in this page I see the sizes: {10,14,18}.


Solution

  • You have to add the size you want to have.

    If I would like to have a font size 10, I would do it the following way:

    (TextStyle named: #DejaVuSansMono) addNewFontSize: 10

    I presume what you get when you install a new font are the most common sizes. You can check what sizes you have via:

    TextStyle fontArrayForStyle: #DejaVuSansMono

    you should get (after adding font size 10):

    {TTCFont(DejaVuSansMono 9 Book) . TTCFont(DejaVuSansMono 10 Book) . TTCFont(DejaVuSansMono 12 Book) . TTCFont(DejaVuSansMono 15 Book) . TTCFont(DejaVuSansMono 24 Book) . TTCFont(DejaVuSansMono 36 Book)}
    

    Edit: How did I find it? (I'm not using Squeak on regular basis)

    In the TTCFontSet>>#familyName:pointSize: you will find a (global) Dictionary TextConstants.

    If you inspect the TextConstants, find a TextStyle DejaVuSansMono instance. When you inspect it you will see the details. From there I thought to check a TextStyle class. There I found TextStyle>>#addNewFontSize: which you can use to introduce a new size.

    When you add the #DejaVuSansMono to Squeak you will get a This font does not have a kerning table message, which means that you will not get optimized specing between characters. I recommnend reading some good source what is kerning to know more.