Colored TTF rendering
Andreas Raab
andreas.raab at gmx.de
Wed Nov 15 09:17:06 UTC 2006
Oh, and I should add that by streamlining a few methods and optimizing
the inner loop for displaying TTFs the display of purely black text has
improved by some 50% in comparison to the previous versions. Not too
shabby either ;-)
Cheers,
- Andreas
Andreas Raab wrote:
> Diego Gomez Deck wrote:
>> Do you have any code snippet to test (an compare) the TTF rendering
>> speed?
>
> Sure. Try this:
>
> text :=
> ('Hello World\' withCRs asText addAttribute: TextColor red),
> ('Hello World\' withCRs asText addAttribute: TextColor green),
> ('Hello World\' withCRs asText addAttribute: TextColor blue).
> text addAttribute: (TextFontReference toFont:
> ((TextStyle named: 'BitstreamVeraSans') fontOfSize: 24)).
> morph := TextMorph new contentsAsIs: text.
> form := Form extent: morph fullBounds extent depth: 32.
> Transcript cr; show: (
> [1 to: 1000 do:[:i| morph fullDrawOn: form getCanvas]] timeToRun
> ).
>
> On my machine this results in:
> Before: 8700 msecs
> After: 750 msecs
> And the speed difference is actually quite noticeable in interactions.
>
> Cheers,
> - Andreas
>
>
More information about the Squeak-dev
mailing list
|