[squeak-dev] Heads up for FreeType maintainers

tim Rowledge tim at rowledge.org
Tue Oct 8 22:22:31 UTC 2013


Just in the hope of helping whoever is caring for the FreeType (and any similar packages) these days, a few words about the just-pushed CharacterScanner/encode/font refactoring.

To quote from http://bugs.squeak.org/view.php?id=7789
> Instead of splitting out byte and wide strings, and kernable and non-kernable fonts within the scanner scanCharactersFrom:to:… method we now
> a) send #scanCharactersFrom:to:with:rightX: font: to the string.
> b) a ByteString assumes no clever encodings and forwards #scanByteCharactersFrom:to:in:with: rightX: to the font
> b-1) a non-pair-kerning font (i.e. all the strike font related classes currently in the image) passes #scanByteCharactersFrom:to:in:rightX: back to the characterscanner, which now knows exactly what to do
> b-2) a pair-kerning font (FreeType? Cairo?) can send #scanKernableByteCharactersFrom:to:in:rightX: instead
> c) a WideString finds the relevant EncodedCharSet to use and sends #scanMultibyteCharactersFrom:to:in:with:rightX:font: to it
> c-1) the encoding thingy then sends #scanXXXXCharactersFrom:to:in:with:rightX: to the font - where XXXX is relevant for the encoding. Currently the only special version is #scanMultibyteJapaneseCharactersFrom:to:in:with:rightX:
> c-2) similarly to b-2, the font forwards to the character scanner.
> 
> The minor inconvenience here is that anyone adding a new encoding has to implement a couple of methods
> a) over-ride {encoding}>scanMultibyteCharactersFrom:to:in:with:rightX:font:
> b) add AbstractFont>#scanXXXXCharactersFrom:to:in:with:rightX:
> c) maybe also for not-in-the-image font classes
> d) add CharacterScanner>#scanXXXXCharactersFrom:to:in:with:rightX:
> 
> Of course, at any step along the way, the functionality can be usurped and refocussed. A new scanner could be built and used, the font might use sophisticated plugin instead of a class in-image even the encoding used might have other ideas.

I strongly suspect that the FreeType class(es) will want to implement some version of the AbstractFont>#scanXXXXCharactersFrom:to:in:with:rightX: methods. If FreeType can do it's own scanning then this would be a really good place to hookup to it, rather than passing the message on to the CharacterScanners.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Useful random insult:- Always responds to "Make Money Fast" postings on the Net.




More information about the Squeak-dev mailing list