StrikeFonstSet vs StrikeFont

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

StrikeFonstSet vs StrikeFont

Patrick R.
Hi everyone :)

I am currently fixing some tests in the Multilingual package. While doing this I edited the StrikeFontSet class and was wondering about its purpose. Although it is called a FontSet it is actually a subclass of AbstractFont and all instances available in a recent image do only contain one single font. Even further some methods of the class are implemented along the line of:

self fontArray first ...

Unfortunately the class does not include a class comment yet and I would like to fix this. That is why I wanted to ask whether anyone still knows the rationale behind this seeming contradiction.

Thanks! and Bests
Patrick
Reply | Threaded
Open this post in threaded view
|

Re: StrikeFonstSet vs StrikeFont

marcel.taeumel
Patrick R. wrote
Hi everyone :)

I am currently fixing some tests in the Multilingual package. While doing this I edited the StrikeFontSet class and was wondering about its purpose. Although it is called a FontSet it is actually a subclass of AbstractFont and all instances available in a recent image do only contain one single font. Even further some methods of the class are implemented along the line of:

self fontArray first ...

Unfortunately the class does not include a class comment yet and I would like to fix this. That is why I wanted to ask whether anyone still knows the rationale behind this seeming contradiction.

Thanks! and Bests
Patrick
Hi Patrick,

looking at FontSet, I don't think it does something useful. Maybe it was a helper class in the past. See FontSet class >> #installAsTextStyle.

The idea of StrikeFontSet to behave like a single font but being a set of (similar?) fonts is interesting. However, I think that there should be no need for that because we have the TextStyle abstraction to group multiple fonts to be used during layouting and rendering.

If the idea of StrikeFontSet (or any font set) actually is to describe a set of similar fonts that belong to the same font family, such a grouping will be interesting in an object-oriented sense. Better than text styles, which group arbitrary fonts.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: StrikeFonstSet vs StrikeFont

Henrik Sperre Johansen
The string draw primitive only accepts a map with 256 indices into a bitmap, so a single StrikeFont can at most be used to draw 256 different glyphs.
This is obviously not enough to display most content outside of ISO8859-1, so a StrikeFontSet includes multiple StrikeFonts; each covering a 256-glyph range of the Unicode character set (and also lets you use  different glyphs depending on the leadingChar of the WideString, arguably useful for preserving CJK)
Double dispatch then lets a WideString be drawn as consecutive calls to the primitive with the pieces that are covered by a single StrikeFont entry in the StrikeFontSet.

(At least, that's how my memory of how it should work is)