On 12 October 2013 09:28, Denis Kudriashov <[email protected]> wrote:

>
> 2013/10/12 Nicolas Cellier <[email protected]>
>
>> So here is the display mini bench:
>>
>>     | text canvas m1 m2 |
>>     canvas := FormCanvas extent:  569@399 depth: 32.
>>
>>     text := Compiler evaluate: (FileSystem workingDirectory parent parent
>> parent / 'text.st' ) readStream contentsOfEntireFile .
>>     m1 := TextMorph new.
>>     m1 text: text textStyle: TextStyle default.
>>     m1 wrapFlag: true.
>>     m1 extent: 569@9999999.
>>     MessageTally spyOn: [ 100 timesRepeat: [
>>         m1 drawOn: canvas]].
>>     m2 := TxTextMorph new.
>>     m2 layoutStrategy: TxWrapTextStrategy new.
>>     m2 extent: 569@9999999.
>>     m2 newTextContents: text.
>>     MessageTally spyOn: [ 100 timesRepeat: [
>>         m2 drawOn: canvas]].
>>
>> Squeak revised BitBltDisplayScanner 1077ms / Pharo MultiDisplayScanner
>> 1229ms / Pharo TxText 1584ms
>
>
> Interesting how Athens drawing will change picture
>

i hoping for the better.
i did many changes comparing to your original code,
and need to do some cleanup.

In athens to calculate layout i introduced a special role called "font
metrics provider" , which is responsible for
calculating dimensions of separate glyphs and advance.
Right now it is hardcoded to use CairoFontMetricsProvider, but later it
going to be refurbished
and merged with CairoFreetypeFontRenderer.
So you will be able to obtain one using:

fontRenderer := canvas setFont: aFont.

or:

fontRenderer := aFont glyphRendererOn: surface.

and once you got it, you can ask certain things from it:

fontRenderer getGlyphWidth: aCharacter
fontRenderer fontAscent
fontRenderer fontHeight

etc
but it is not fully organically merged yet, and need more thought what is
public API of it to cover the needs of rendering text and/or measuring it.


-- 
Best regards,
Igor Stasenko.

Reply via email to