Colored TTF rendering

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

Colored TTF rendering

Andreas.Raab
Hi -

For those of you who use colored Truetype fonts excessively (like
Shout+TTF default fonts) it may be interesting to note that I just
committed a fix for the color-caching problem to the Croquet repository.
This fix speeds up colored text rendering with TTFs by up to an order of
magnitude and might be worthwhile to port it back to 3.9 if anyone is
interested.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Colored TTF rendering

Diego Gomez Deck
Hi Andreas,

> Hi -
>
> For those of you who use colored Truetype fonts excessively (like
> Shout+TTF default fonts) it may be interesting to note that I just
> committed a fix for the color-caching problem to the Croquet repository.

Can you point where it is exactly?

> This fix speeds up colored text rendering with TTFs by up to an order of
> magnitude and might be worthwhile to port it back to 3.9 if anyone is
> interested.

I'll give it a try.

> Cheers,
>    - Andreas

-- Diego



Reply | Threaded
Open this post in threaded view
|

Re: Colored TTF rendering

Joshua Gargus-2
In the Multilingual package in the following repository:

MCHttpRepository
        location: 'http://hedgehog.software.umn.edu:8888/Homebase'
        user: ''
        password: ''

Josh


On Nov 15, 2006, at 12:10 AM, Diego Gomez Deck wrote:

> Hi Andreas,
>
>> Hi -
>>
>> For those of you who use colored Truetype fonts excessively (like
>> Shout+TTF default fonts) it may be interesting to note that I just
>> committed a fix for the color-caching problem to the Croquet  
>> repository.
>
> Can you point where it is exactly?
>
>> This fix speeds up colored text rendering with TTFs by up to an  
>> order of
>> magnitude and might be worthwhile to port it back to 3.9 if anyone is
>> interested.
>
> I'll give it a try.
>
>> Cheers,
>>    - Andreas
>
> -- Diego
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Colored TTF rendering

Andreas.Raab
In reply to this post by Diego Gomez Deck
Diego Gomez Deck wrote:
>> For those of you who use colored Truetype fonts excessively (like
>> Shout+TTF default fonts) it may be interesting to note that I just
>> committed a fix for the color-caching problem to the Croquet repository.
>
> Can you point where it is exactly?

http://hedgehog.software.umn.edu:8888/Homebase/Multilingual-ar.17.mcz

>> This fix speeds up colored text rendering with TTFs by up to an order of
>> magnitude and might be worthwhile to port it back to 3.9 if anyone is
>> interested.
>
> I'll give it a try.

Good luck. The changes itself shouldn't be too hard to integrate (just
look at a diff to the prior version) but I'm not sure what has changed
in 3.9 itself. And of course getting the load-order to work is a pain.
This may actually require backporting a few changes from Monticello
(same repository).

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Colored TTF rendering

Diego Gomez Deck
Hi Andreas,

> >> might be worthwhile to port it back to 3.9 if anyone is
> >> interested.
> >
> > I'll give it a try.
>
> Good luck. The changes itself shouldn't be too hard to integrate (just
> look at a diff to the prior version) but I'm not sure what has changed
> in 3.9 itself. And of course getting the load-order to work is a pain.

Do you have any code snippet to test (an compare) the TTF rendering
speed?

-- Diego



Reply | Threaded
Open this post in threaded view
|

Re: Colored TTF rendering

Andreas.Raab
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

Reply | Threaded
Open this post in threaded view
|

Re: Colored TTF rendering

Andreas.Raab
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
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Colored TTF rendering

Diego Gomez Deck
In reply to this post by Andreas.Raab
Hi,

A just made a quick try[*] and it seems to work.

I tried the CS in 3.9-7067 and I got this numbers:

   Before: 5782
   After: 539

I also tried in a 3.8 with a lot of packages (the image I'm currently
using for development) and the number are more impressive:

   Before: 12405
   After: 541

Attached is the CS.

Cheers,

-- Diego

[*] I only filed out the changeset created my Monticello in the
installation of Multilingual-ar.17.mcz. This changeset seems to be in
good order.

> 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



TTFSpeedUp-dgd.1.cs.gz (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Colored TTF rendering

Klaus D. Witzel
Got the ~same~ ratio in the Squeak-dev .image,

before: 15607
after: 1174

Thank you both!

/Klaus

On Wed, 15 Nov 2006 10:21:22 +0100, Diego Gomez Deck  
<[hidden email]> wrote:

> Hi,
>
> A just made a quick try[*] and it seems to work.
>
> I tried the CS in 3.9-7067 and I got this numbers:
>
>    Before: 5782
>    After: 539
>
> I also tried in a 3.8 with a lot of packages (the image I'm currently
> using for development) and the number are more impressive:
>
>    Before: 12405
>    After: 541
>
> Attached is the CS.
>
> Cheers,
>
> -- Diego
>
> [*] I only filed out the changeset created my Monticello in the
> installation of Multilingual-ar.17.mcz. This changeset seems to be in
> good order.
>
>> 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
>



Reply | Threaded
Open this post in threaded view
|

Re: Colored TTF rendering

J J-6
In reply to this post by Diego Gomez Deck
Is this going into 3.9?


>From: Diego Gomez Deck <[hidden email]>
>Reply-To: The general-purpose Squeak developers
>list<[hidden email]>
>To: The general-purpose Squeak developers
>list<[hidden email]>
>CC: "José L. Redrejo Rodríguez"<[hidden email]>
>Subject: Re: Colored TTF rendering
>Date: Wed, 15 Nov 2006 10:21:22 +0100
>
>Hi,
>
>A just made a quick try[*] and it seems to work.
>
>I tried the CS in 3.9-7067 and I got this numbers:
>
>    Before: 5782
>    After: 539
>
>I also tried in a 3.8 with a lot of packages (the image I'm currently
>using for development) and the number are more impressive:
>
>    Before: 12405
>    After: 541
>
>Attached is the CS.
>
>Cheers,
>
>-- Diego
>
>[*] I only filed out the changeset created my Monticello in the
>installation of Multilingual-ar.17.mcz. This changeset seems to be in
>good order.
>
> > 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
>


><< TTFSpeedUp-dgd.1.cs.gz >>


>

_________________________________________________________________
Share your latest news with your friends with the Windows Live Spaces
friends module.
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mk