This text contains some rambling about needed/done refactorings/improvements to the StrikeFont and FontSet classes.
The StrikeFont class has three access methods (in version 2.6)
familyName:size: familyName:size:emphasized: familyNames
to access certain fonts. The first two are for requesting a specific font in a specific size (or anything closeby). Currently, the size argument is the height of the font in pixels. I'd recommend to change the behavior into requesting the point size. This allows one to switch fonts more easily because the point size is always 8 or 10 while the pixel size is - depending on the font - 13, 15 or even more pixel.
The change needs to be done in TextStyle>>fontIndexOfSize:.
This method is also used by TextMorph>>string:fontName:size: and BookMorph>>insertPageShowingString:fontName:fontSize:, but fortunately, these methods aren't used at all, so a change in behavior should be possible.
I'd also recommend to alphabetically sort the answer of familyNames. This makes the Cmd+K fonts menu of paragraph editors much more useful. The method is only used here.
The method StrikeFont>>familySizeFace should probably also answer point sizes instead of heights, but fortunately, this method seems to be unused and could probably also be deleted. The only usage is in TextStyle>>printOn: and can easily replaced by calling name directly.
Please explain the different between StrikeFont>>lineGrid and StrikeFont>>height to me. IMHO one method can be removed.
What's the meaning of raster in StrikeFont? It seems completely unused.
I dislike that StrikeFont>>readFromStrike2Stream: closes it file stream. This is against the rule that you should be touch the resources of other persons. It also requires the FontSet class to use a ReadWriteStream to read strike fonts because that's the only non-file stream that understands close. I recommend to move the close command to readFromStrike2named:
With the exception of the height -> pointSize convertion, I did the proposed changes in an 2.6 squeak. As the changeset became a little too big, I will not attach it. But I'll be happy to send it to anybody who's interested.
Especially when working with new fonts like Tahoma, the synthetic fonts Squeak automatically generates for bold type faces look very ugly compared to the real font. Therefore I extended the system to allow more fonts in a fontArray. I hacked StrikeFont>>reset which will now add the other variants directly to the derivativeFonts array instead of nilling out everything.
To allow these fonts to be saved, I had also change the FontSet class to use a new method "sizeNNN" where NNN is not only the point size but the complete name. It's still called size because FontSet is scanning for selectors starting with size.
This change allows also to unify ComicPlain and ComicBold to a single Comic family. I created a new font called ComicSans which does this and also contains the squeak specific ^ and _ glyphs. I noticed that the Squeak font is also based on Microsoft's Comic Sans MS and it seems that the Squeak central thought that including that font isn't against the licence. Is this right?
bye -- Stefan Matthias Aust // Bevor wir fallen, fallen wir lieber auf.
squeak-dev@lists.squeakfoundation.org