Fwd: Some question and request for Athens

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

Fwd: Some question and request for Athens

Stéphane Ducasse


Begin forwarded message:

From: Igor Stasenko <[hidden email]>
Subject: Re: Some question and request for Athens
Date: March 25, 2013 2:57:33 PM GMT+01:00
To: Tristan Bourgois <[hidden email]>
Cc: Stéphane Ducasse <[hidden email]>, LE PORS Eric <[hidden email]>

On 25 March 2013 11:45, Tristan Bourgois <[hidden email]> wrote:
Hi Igor!

I have some questions and request for Athens :)

1 Do exist a possibility in Athens to draw a Surface on a Surface?
For example :
aSurf drawSurface: anOtherSurface at: aPosition
(I need it for draw image on a surface)

yes. You can use Forms or surfaces as paints so they act like 2D textures:

canvas setPaint: someSurface.
canvas drawShape: myRect.


2 About my first question, I try to draw a png image on a Surface and
I get some strange behavior. When nothing is applied on my first
surface and draw the image in a rectangle path I crash the VM!
This an example I tried and crash my VM:

|surf pharoLogo ref path patternPaint|
surf := AthensCairoSurface extent: 600@600.

ref := 'pharo.png' asFileReference.
pharoLogo := AthensCairoSurface createFromFile: ref fullName ifFailed:[nil].

surf drawDuring: [:can|
       surf clear.
       patternPaint := can setPaint: pharoLogo.
       patternPaint setExtend: #None.
       can drawShape: (0@0 extent: pharoLogo extent).
].
Display getCanvas drawImage: surf asForm at: 0@0.

If you need more information about the crash and my environment ask it :)

weird... it should be working fine.

3. Do exist something in Athens to create some text and get the extent
of the text? I tried to draw text but I only succeed to draw a text
without font (only width) and I don't found how to get the extent of
this text :( This is really important for the next of the porting
because I'm blocking on that and the textModel is not necessary for
the next of my work because they already have a layoutManager for the
text.

You can use freetype to measure text extent. Please look how i doing it with
AthensTextScanner.
Because the default methods of freetype using rounding for font size(s),
which is not really nice.
I added more precise methods, which do not do any rounding and using
them for measuring
text extent.

Try this:

text := 'asdsdgs' asText.
lines := (AthensTextComposer scan: text for: AthensTextScanner new) lines.

lines first width.

will give you the width.

(but for that to work, your default font should be TTF font)

Thanks Igor :)

Tristan

PS: The porting advance as well :) I have animation and that's really amazing :)



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Some question and request for Athens

Tristan Bourgois-2
2013/3/25 Stéphane Ducasse <[hidden email]>:

>
>
> Begin forwarded message:
>
> From: Igor Stasenko <[hidden email]>
> Subject: Re: Some question and request for Athens
> Date: March 25, 2013 2:57:33 PM GMT+01:00
> To: Tristan Bourgois <[hidden email]>
> Cc: Stéphane Ducasse <[hidden email]>, LE PORS Eric
> <[hidden email]>
>
> On 25 March 2013 11:45, Tristan Bourgois <[hidden email]> wrote:
>
> Hi Igor!
>
> I have some questions and request for Athens :)
>
> 1 Do exist a possibility in Athens to draw a Surface on a Surface?
> For example :
> aSurf drawSurface: anOtherSurface at: aPosition
> (I need it for draw image on a surface)
>
>
> yes. You can use Forms or surfaces as paints so they act like 2D textures:
>
> canvas setPaint: someSurface.
> canvas drawShape: myRect.

Thanks that's works fine :)

>
> 2 About my first question, I try to draw a png image on a Surface and
> I get some strange behavior. When nothing is applied on my first
> surface and draw the image in a rectangle path I crash the VM!
> This an example I tried and crash my VM:
>
> |surf pharoLogo ref path patternPaint|
> surf := AthensCairoSurface extent: 600@600.
>
> ref := 'pharo.png' asFileReference.
> pharoLogo := AthensCairoSurface createFromFile: ref fullName ifFailed:[nil].
>
> surf drawDuring: [:can|
>        surf clear.
>        patternPaint := can setPaint: pharoLogo.
>        patternPaint setExtend: #None.
>        can drawShape: (0@0 extent: pharoLogo extent).
> ].
> Display getCanvas drawImage: surf asForm at: 0@0.
>
> If you need more information about the crash and my environment ask it :)
>
> weird... it should be working fine.

I try it on a new clean image and again get a VM crash.

> 3. Do exist something in Athens to create some text and get the extent
> of the text? I tried to draw text but I only succeed to draw a text
> without font (only width) and I don't found how to get the extent of
> this text :( This is really important for the next of the porting
> because I'm blocking on that and the textModel is not necessary for
> the next of my work because they already have a layoutManager for the
> text.
>
> You can use freetype to measure text extent. Please look how i doing it with
> AthensTextScanner.
> Because the default methods of freetype using rounding for font size(s),
> which is not really nice.
> I added more precise methods, which do not do any rounding and using
> them for measuring
> text extent.
>
> Try this:
>
> text := 'asdsdgs' asText.
> lines := (AthensTextComposer scan: text for: AthensTextScanner new) lines.
>
> lines first width.
>
> will give you the width.
>
> (but for that to work, your default font should be TTF font)

Sorry for the newbie question but how I can change the default font to TTF font?

> Thanks Igor :)
>
> Tristan
>
> PS: The porting advance as well :) I have animation and that's really
> amazing :)
>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Some question and request for Athens

Tudor Girba-2
Indeed, I second the newbie question: how do we set TrueType fonts :)?

Doru


On Tue, Mar 26, 2013 at 11:29 AM, Tristan Bourgois <[hidden email]> wrote:
2013/3/25 Stéphane Ducasse <[hidden email]>:
>
>
> Begin forwarded message:
>
> From: Igor Stasenko <[hidden email]>
> Subject: Re: Some question and request for Athens
> Date: March 25, 2013 2:57:33 PM GMT+01:00
> To: Tristan Bourgois <[hidden email]>
> Cc: Stéphane Ducasse <[hidden email]>, LE PORS Eric
> <[hidden email]>
>
> On 25 March 2013 11:45, Tristan Bourgois <[hidden email]> wrote:
>
> Hi Igor!
>
> I have some questions and request for Athens :)
>
> 1 Do exist a possibility in Athens to draw a Surface on a Surface?
> For example :
> aSurf drawSurface: anOtherSurface at: aPosition
> (I need it for draw image on a surface)
>
>
> yes. You can use Forms or surfaces as paints so they act like 2D textures:
>
> canvas setPaint: someSurface.
> canvas drawShape: myRect.

Thanks that's works fine :)

>
> 2 About my first question, I try to draw a png image on a Surface and
> I get some strange behavior. When nothing is applied on my first
> surface and draw the image in a rectangle path I crash the VM!
> This an example I tried and crash my VM:
>
> |surf pharoLogo ref path patternPaint|
> surf := AthensCairoSurface extent: 600@600.
>
> ref := 'pharo.png' asFileReference.
> pharoLogo := AthensCairoSurface createFromFile: ref fullName ifFailed:[nil].
>
> surf drawDuring: [:can|
>        surf clear.
>        patternPaint := can setPaint: pharoLogo.
>        patternPaint setExtend: #None.
>        can drawShape: (0@0 extent: pharoLogo extent).
> ].
> Display getCanvas drawImage: surf asForm at: 0@0.
>
> If you need more information about the crash and my environment ask it :)
>
> weird... it should be working fine.

I try it on a new clean image and again get a VM crash.

> 3. Do exist something in Athens to create some text and get the extent
> of the text? I tried to draw text but I only succeed to draw a text
> without font (only width) and I don't found how to get the extent of
> this text :( This is really important for the next of the porting
> because I'm blocking on that and the textModel is not necessary for
> the next of my work because they already have a layoutManager for the
> text.
>
> You can use freetype to measure text extent. Please look how i doing it with
> AthensTextScanner.
> Because the default methods of freetype using rounding for font size(s),
> which is not really nice.
> I added more precise methods, which do not do any rounding and using
> them for measuring
> text extent.
>
> Try this:
>
> text := 'asdsdgs' asText.
> lines := (AthensTextComposer scan: text for: AthensTextScanner new) lines.
>
> lines first width.
>
> will give you the width.
>
> (but for that to work, your default font should be TTF font)

Sorry for the newbie question but how I can change the default font to TTF font?

> Thanks Igor :)
>
> Tristan
>
> PS: The porting advance as well :) I have animation and that's really
> amazing :)
>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>
>




--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Some question and request for Athens

Igor Stasenko
On 26 March 2013 11:32, Tudor Girba <[hidden email]> wrote:
> Indeed, I second the newbie question: how do we set TrueType fonts :)?
>
system settings -> appearance
turn on "use freetype"
then go to "standard fonts" and choose any truetype font you like as default.

> Doru
>
>
> On Tue, Mar 26, 2013 at 11:29 AM, Tristan Bourgois
> <[hidden email]> wrote:
>>
>> 2013/3/25 Stéphane Ducasse <[hidden email]>:
>> >
>> >
>> > Begin forwarded message:
>> >
>> > From: Igor Stasenko <[hidden email]>
>> > Subject: Re: Some question and request for Athens
>> > Date: March 25, 2013 2:57:33 PM GMT+01:00
>> > To: Tristan Bourgois <[hidden email]>
>> > Cc: Stéphane Ducasse <[hidden email]>, LE PORS Eric
>> > <[hidden email]>
>> >
>> > On 25 March 2013 11:45, Tristan Bourgois <[hidden email]>
>> > wrote:
>> >
>> > Hi Igor!
>> >
>> > I have some questions and request for Athens :)
>> >
>> > 1 Do exist a possibility in Athens to draw a Surface on a Surface?
>> > For example :
>> > aSurf drawSurface: anOtherSurface at: aPosition
>> > (I need it for draw image on a surface)
>> >
>> >
>> > yes. You can use Forms or surfaces as paints so they act like 2D
>> > textures:
>> >
>> > canvas setPaint: someSurface.
>> > canvas drawShape: myRect.
>>
>> Thanks that's works fine :)
>>
>> >
>> > 2 About my first question, I try to draw a png image on a Surface and
>> > I get some strange behavior. When nothing is applied on my first
>> > surface and draw the image in a rectangle path I crash the VM!
>> > This an example I tried and crash my VM:
>> >
>> > |surf pharoLogo ref path patternPaint|
>> > surf := AthensCairoSurface extent: 600@600.
>> >
>> > ref := 'pharo.png' asFileReference.
>> > pharoLogo := AthensCairoSurface createFromFile: ref fullName
>> > ifFailed:[nil].
>> >
>> > surf drawDuring: [:can|
>> >        surf clear.
>> >        patternPaint := can setPaint: pharoLogo.
>> >        patternPaint setExtend: #None.
>> >        can drawShape: (0@0 extent: pharoLogo extent).
>> > ].
>> > Display getCanvas drawImage: surf asForm at: 0@0.
>> >
>> > If you need more information about the crash and my environment ask it
>> > :)
>> >
>> > weird... it should be working fine.
>>
>> I try it on a new clean image and again get a VM crash.
>>
>> > 3. Do exist something in Athens to create some text and get the extent
>> > of the text? I tried to draw text but I only succeed to draw a text
>> > without font (only width) and I don't found how to get the extent of
>> > this text :( This is really important for the next of the porting
>> > because I'm blocking on that and the textModel is not necessary for
>> > the next of my work because they already have a layoutManager for the
>> > text.
>> >
>> > You can use freetype to measure text extent. Please look how i doing it
>> > with
>> > AthensTextScanner.
>> > Because the default methods of freetype using rounding for font size(s),
>> > which is not really nice.
>> > I added more precise methods, which do not do any rounding and using
>> > them for measuring
>> > text extent.
>> >
>> > Try this:
>> >
>> > text := 'asdsdgs' asText.
>> > lines := (AthensTextComposer scan: text for: AthensTextScanner new)
>> > lines.
>> >
>> > lines first width.
>> >
>> > will give you the width.
>> >
>> > (but for that to work, your default font should be TTF font)
>>
>> Sorry for the newbie question but how I can change the default font to TTF
>> font?
>>
>> > Thanks Igor :)
>> >
>> > Tristan
>> >
>> > PS: The porting advance as well :) I have animation and that's really
>> > amazing :)
>> >
>> >
>> >
>> >
>> > --
>> > Best regards,
>> > Igor Stasenko.
>> >
>> >
>>
>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Some question and request for Athens

Igor Stasenko
In reply to this post by Tristan Bourgois-2
On 26 March 2013 11:29, Tristan Bourgois <[hidden email]> wrote:

> 2013/3/25 Stéphane Ducasse <[hidden email]>:
>>
>>
>> Begin forwarded message:
>>
>> From: Igor Stasenko <[hidden email]>
>> Subject: Re: Some question and request for Athens
>> Date: March 25, 2013 2:57:33 PM GMT+01:00
>> To: Tristan Bourgois <[hidden email]>
>> Cc: Stéphane Ducasse <[hidden email]>, LE PORS Eric
>> <[hidden email]>
>>
>> On 25 March 2013 11:45, Tristan Bourgois <[hidden email]> wrote:
>>
>> Hi Igor!
>>
>> I have some questions and request for Athens :)
>>
>> 1 Do exist a possibility in Athens to draw a Surface on a Surface?
>> For example :
>> aSurf drawSurface: anOtherSurface at: aPosition
>> (I need it for draw image on a surface)
>>
>>
>> yes. You can use Forms or surfaces as paints so they act like 2D textures:
>>
>> canvas setPaint: someSurface.
>> canvas drawShape: myRect.
>
> Thanks that's works fine :)
>
>>
>> 2 About my first question, I try to draw a png image on a Surface and
>> I get some strange behavior. When nothing is applied on my first
>> surface and draw the image in a rectangle path I crash the VM!
>> This an example I tried and crash my VM:
>>
>> |surf pharoLogo ref path patternPaint|
>> surf := AthensCairoSurface extent: 600@600.
>>
>> ref := 'pharo.png' asFileReference.
>> pharoLogo := AthensCairoSurface createFromFile: ref fullName ifFailed:[nil].
>>
>> surf drawDuring: [:can|
>>        surf clear.
>>        patternPaint := can setPaint: pharoLogo.
>>        patternPaint setExtend: #None.
>>        can drawShape: (0@0 extent: pharoLogo extent).
>> ].
>> Display getCanvas drawImage: surf asForm at: 0@0.
>>
>> If you need more information about the crash and my environment ask it :)
>>
>> weird... it should be working fine.
>
> I try it on a new clean image and again get a VM crash.

okay, then i need more information :)

--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Some question and request for Athens

Tudor Girba-2
In reply to this post by Igor Stasenko
Hi Igor,

Thanks. I managed that also in 1.4, but my question was about how to set a TT font programmatically.

Cheers,
Doru



On Tue, Mar 26, 2013 at 2:20 PM, Igor Stasenko <[hidden email]> wrote:
On 26 March 2013 11:32, Tudor Girba <[hidden email]> wrote:
> Indeed, I second the newbie question: how do we set TrueType fonts :)?
>
system settings -> appearance
turn on "use freetype"
then go to "standard fonts" and choose any truetype font you like as default.

> Doru
>
>
> On Tue, Mar 26, 2013 at 11:29 AM, Tristan Bourgois
> <[hidden email]> wrote:
>>
>> 2013/3/25 Stéphane Ducasse <[hidden email]>:
>> >
>> >
>> > Begin forwarded message:
>> >
>> > From: Igor Stasenko <[hidden email]>
>> > Subject: Re: Some question and request for Athens
>> > Date: March 25, 2013 2:57:33 PM GMT+01:00
>> > To: Tristan Bourgois <[hidden email]>
>> > Cc: Stéphane Ducasse <[hidden email]>, LE PORS Eric
>> > <[hidden email]>
>> >
>> > On 25 March 2013 11:45, Tristan Bourgois <[hidden email]>
>> > wrote:
>> >
>> > Hi Igor!
>> >
>> > I have some questions and request for Athens :)
>> >
>> > 1 Do exist a possibility in Athens to draw a Surface on a Surface?
>> > For example :
>> > aSurf drawSurface: anOtherSurface at: aPosition
>> > (I need it for draw image on a surface)
>> >
>> >
>> > yes. You can use Forms or surfaces as paints so they act like 2D
>> > textures:
>> >
>> > canvas setPaint: someSurface.
>> > canvas drawShape: myRect.
>>
>> Thanks that's works fine :)
>>
>> >
>> > 2 About my first question, I try to draw a png image on a Surface and
>> > I get some strange behavior. When nothing is applied on my first
>> > surface and draw the image in a rectangle path I crash the VM!
>> > This an example I tried and crash my VM:
>> >
>> > |surf pharoLogo ref path patternPaint|
>> > surf := AthensCairoSurface extent: 600@600.
>> >
>> > ref := 'pharo.png' asFileReference.
>> > pharoLogo := AthensCairoSurface createFromFile: ref fullName
>> > ifFailed:[nil].
>> >
>> > surf drawDuring: [:can|
>> >        surf clear.
>> >        patternPaint := can setPaint: pharoLogo.
>> >        patternPaint setExtend: #None.
>> >        can drawShape: (0@0 extent: pharoLogo extent).
>> > ].
>> > Display getCanvas drawImage: surf asForm at: 0@0.
>> >
>> > If you need more information about the crash and my environment ask it
>> > :)
>> >
>> > weird... it should be working fine.
>>
>> I try it on a new clean image and again get a VM crash.
>>
>> > 3. Do exist something in Athens to create some text and get the extent
>> > of the text? I tried to draw text but I only succeed to draw a text
>> > without font (only width) and I don't found how to get the extent of
>> > this text :( This is really important for the next of the porting
>> > because I'm blocking on that and the textModel is not necessary for
>> > the next of my work because they already have a layoutManager for the
>> > text.
>> >
>> > You can use freetype to measure text extent. Please look how i doing it
>> > with
>> > AthensTextScanner.
>> > Because the default methods of freetype using rounding for font size(s),
>> > which is not really nice.
>> > I added more precise methods, which do not do any rounding and using
>> > them for measuring
>> > text extent.
>> >
>> > Try this:
>> >
>> > text := 'asdsdgs' asText.
>> > lines := (AthensTextComposer scan: text for: AthensTextScanner new)
>> > lines.
>> >
>> > lines first width.
>> >
>> > will give you the width.
>> >
>> > (but for that to work, your default font should be TTF font)
>>
>> Sorry for the newbie question but how I can change the default font to TTF
>> font?
>>
>> > Thanks Igor :)
>> >
>> > Tristan
>> >
>> > PS: The porting advance as well :) I have animation and that's really
>> > amazing :)
>> >
>> >
>> >
>> >
>> > --
>> > Best regards,
>> > Igor Stasenko.
>> >
>> >
>>
>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"



--
Best regards,
Igor Stasenko.




--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Some question and request for Athens

Igor Stasenko
On 26 March 2013 15:32, Tudor Girba <[hidden email]> wrote:
> Hi Igor,
>
> Thanks. I managed that also in 1.4, but my question was about how to set a
> TT font programmatically.
>

where?

you know, if you right-click on setting in settings browser and then
click "browse",
you will find a place where this setting is defined and then a little
of investigation will lead you to some class var/etc which you can
change programmatically in
a way you want.

> Cheers,
> Doru
>
>
>
> On Tue, Mar 26, 2013 at 2:20 PM, Igor Stasenko <[hidden email]> wrote:
>>
>> On 26 March 2013 11:32, Tudor Girba <[hidden email]> wrote:
>> > Indeed, I second the newbie question: how do we set TrueType fonts :)?
>> >
>> system settings -> appearance
>> turn on "use freetype"
>> then go to "standard fonts" and choose any truetype font you like as
>> default.
>>
>> > Doru
>> >
>> >
>> > On Tue, Mar 26, 2013 at 11:29 AM, Tristan Bourgois
>> > <[hidden email]> wrote:
>> >>
>> >> 2013/3/25 Stéphane Ducasse <[hidden email]>:
>> >> >
>> >> >
>> >> > Begin forwarded message:
>> >> >
>> >> > From: Igor Stasenko <[hidden email]>
>> >> > Subject: Re: Some question and request for Athens
>> >> > Date: March 25, 2013 2:57:33 PM GMT+01:00
>> >> > To: Tristan Bourgois <[hidden email]>
>> >> > Cc: Stéphane Ducasse <[hidden email]>, LE PORS Eric
>> >> > <[hidden email]>
>> >> >
>> >> > On 25 March 2013 11:45, Tristan Bourgois <[hidden email]>
>> >> > wrote:
>> >> >
>> >> > Hi Igor!
>> >> >
>> >> > I have some questions and request for Athens :)
>> >> >
>> >> > 1 Do exist a possibility in Athens to draw a Surface on a Surface?
>> >> > For example :
>> >> > aSurf drawSurface: anOtherSurface at: aPosition
>> >> > (I need it for draw image on a surface)
>> >> >
>> >> >
>> >> > yes. You can use Forms or surfaces as paints so they act like 2D
>> >> > textures:
>> >> >
>> >> > canvas setPaint: someSurface.
>> >> > canvas drawShape: myRect.
>> >>
>> >> Thanks that's works fine :)
>> >>
>> >> >
>> >> > 2 About my first question, I try to draw a png image on a Surface and
>> >> > I get some strange behavior. When nothing is applied on my first
>> >> > surface and draw the image in a rectangle path I crash the VM!
>> >> > This an example I tried and crash my VM:
>> >> >
>> >> > |surf pharoLogo ref path patternPaint|
>> >> > surf := AthensCairoSurface extent: 600@600.
>> >> >
>> >> > ref := 'pharo.png' asFileReference.
>> >> > pharoLogo := AthensCairoSurface createFromFile: ref fullName
>> >> > ifFailed:[nil].
>> >> >
>> >> > surf drawDuring: [:can|
>> >> >        surf clear.
>> >> >        patternPaint := can setPaint: pharoLogo.
>> >> >        patternPaint setExtend: #None.
>> >> >        can drawShape: (0@0 extent: pharoLogo extent).
>> >> > ].
>> >> > Display getCanvas drawImage: surf asForm at: 0@0.
>> >> >
>> >> > If you need more information about the crash and my environment ask
>> >> > it
>> >> > :)
>> >> >
>> >> > weird... it should be working fine.
>> >>
>> >> I try it on a new clean image and again get a VM crash.
>> >>
>> >> > 3. Do exist something in Athens to create some text and get the
>> >> > extent
>> >> > of the text? I tried to draw text but I only succeed to draw a text
>> >> > without font (only width) and I don't found how to get the extent of
>> >> > this text :( This is really important for the next of the porting
>> >> > because I'm blocking on that and the textModel is not necessary for
>> >> > the next of my work because they already have a layoutManager for the
>> >> > text.
>> >> >
>> >> > You can use freetype to measure text extent. Please look how i doing
>> >> > it
>> >> > with
>> >> > AthensTextScanner.
>> >> > Because the default methods of freetype using rounding for font
>> >> > size(s),
>> >> > which is not really nice.
>> >> > I added more precise methods, which do not do any rounding and using
>> >> > them for measuring
>> >> > text extent.
>> >> >
>> >> > Try this:
>> >> >
>> >> > text := 'asdsdgs' asText.
>> >> > lines := (AthensTextComposer scan: text for: AthensTextScanner new)
>> >> > lines.
>> >> >
>> >> > lines first width.
>> >> >
>> >> > will give you the width.
>> >> >
>> >> > (but for that to work, your default font should be TTF font)
>> >>
>> >> Sorry for the newbie question but how I can change the default font to
>> >> TTF
>> >> font?
>> >>
>> >> > Thanks Igor :)
>> >> >
>> >> > Tristan
>> >> >
>> >> > PS: The porting advance as well :) I have animation and that's really
>> >> > amazing :)
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Best regards,
>> >> > Igor Stasenko.
>> >> >
>> >> >
>> >>
>> >
>> >
>> >
>> > --
>> > www.tudorgirba.com
>> >
>> > "Every thing has its own flow"
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko.
>>
>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Some question and request for Athens

Benjamin Van Ryseghem (Pharo)
And if you want to be lazier, you can export the setting in your preference file, and have a look then :)

Ben

On Mar 26, 2013, at 4:23 PM, Igor Stasenko <[hidden email]> wrote:

On 26 March 2013 15:32, Tudor Girba <[hidden email]> wrote:
Hi Igor,

Thanks. I managed that also in 1.4, but my question was about how to set a
TT font programmatically.


where?

you know, if you right-click on setting in settings browser and then
click "browse",
you will find a place where this setting is defined and then a little
of investigation will lead you to some class var/etc which you can
change programmatically in
a way you want.

Cheers,
Doru



On Tue, Mar 26, 2013 at 2:20 PM, Igor Stasenko <[hidden email]> wrote:

On 26 March 2013 11:32, Tudor Girba <[hidden email]> wrote:
Indeed, I second the newbie question: how do we set TrueType fonts :)?

system settings -> appearance
turn on "use freetype"
then go to "standard fonts" and choose any truetype font you like as
default.

Doru


On Tue, Mar 26, 2013 at 11:29 AM, Tristan Bourgois
<[hidden email]> wrote:

2013/3/25 Stéphane Ducasse <[hidden email]>:


Begin forwarded message:

From: Igor Stasenko <[hidden email]>
Subject: Re: Some question and request for Athens
Date: March 25, 2013 2:57:33 PM GMT+01:00
To: Tristan Bourgois <[hidden email]>
Cc: Stéphane Ducasse <[hidden email]>, LE PORS Eric
<[hidden email]>

On 25 March 2013 11:45, Tristan Bourgois <[hidden email]>
wrote:

Hi Igor!

I have some questions and request for Athens :)

1 Do exist a possibility in Athens to draw a Surface on a Surface?
For example :
aSurf drawSurface: anOtherSurface at: aPosition
(I need it for draw image on a surface)


yes. You can use Forms or surfaces as paints so they act like 2D
textures:

canvas setPaint: someSurface.
canvas drawShape: myRect.

Thanks that's works fine :)


2 About my first question, I try to draw a png image on a Surface and
I get some strange behavior. When nothing is applied on my first
surface and draw the image in a rectangle path I crash the VM!
This an example I tried and crash my VM:

|surf pharoLogo ref path patternPaint|
surf := AthensCairoSurface extent: 600@600.

ref := 'pharo.png' asFileReference.
pharoLogo := AthensCairoSurface createFromFile: ref fullName
ifFailed:[nil].

surf drawDuring: [:can|
      surf clear.
      patternPaint := can setPaint: pharoLogo.
      patternPaint setExtend: #None.
      can drawShape: (0@0 extent: pharoLogo extent).
].
Display getCanvas drawImage: surf asForm at: 0@0.

If you need more information about the crash and my environment ask
it
:)

weird... it should be working fine.

I try it on a new clean image and again get a VM crash.

3. Do exist something in Athens to create some text and get the
extent
of the text? I tried to draw text but I only succeed to draw a text
without font (only width) and I don't found how to get the extent of
this text :( This is really important for the next of the porting
because I'm blocking on that and the textModel is not necessary for
the next of my work because they already have a layoutManager for the
text.

You can use freetype to measure text extent. Please look how i doing
it
with
AthensTextScanner.
Because the default methods of freetype using rounding for font
size(s),
which is not really nice.
I added more precise methods, which do not do any rounding and using
them for measuring
text extent.

Try this:

text := 'asdsdgs' asText.
lines := (AthensTextComposer scan: text for: AthensTextScanner new)
lines.

lines first width.

will give you the width.

(but for that to work, your default font should be TTF font)

Sorry for the newbie question but how I can change the default font to
TTF
font?

Thanks Igor :)

Tristan

PS: The porting advance as well :) I have animation and that's really
amazing :)




--
Best regards,
Igor Stasenko.






--
www.tudorgirba.com

"Every thing has its own flow"



--
Best regards,
Igor Stasenko.




--
www.tudorgirba.com

"Every thing has its own flow"



--
Best regards,
Igor Stasenko.


Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Some question and request for Athens

Tristan Bourgois-2
In reply to this post by Igor Stasenko
2013/3/26 Igor Stasenko <[hidden email]>:

> On 26 March 2013 11:29, Tristan Bourgois <[hidden email]> wrote:
>> 2013/3/25 Stéphane Ducasse <[hidden email]>:
>>>
>>>
>>> Begin forwarded message:
>>>
>>> From: Igor Stasenko <[hidden email]>
>>> Subject: Re: Some question and request for Athens
>>> Date: March 25, 2013 2:57:33 PM GMT+01:00
>>> To: Tristan Bourgois <[hidden email]>
>>> Cc: Stéphane Ducasse <[hidden email]>, LE PORS Eric
>>> <[hidden email]>
>>>
>>> On 25 March 2013 11:45, Tristan Bourgois <[hidden email]> wrote:
>>>
>>> Hi Igor!
>>>
>>> I have some questions and request for Athens :)
>>>
>>> 1 Do exist a possibility in Athens to draw a Surface on a Surface?
>>> For example :
>>> aSurf drawSurface: anOtherSurface at: aPosition
>>> (I need it for draw image on a surface)
>>>
>>>
>>> yes. You can use Forms or surfaces as paints so they act like 2D textures:
>>>
>>> canvas setPaint: someSurface.
>>> canvas drawShape: myRect.
>>
>> Thanks that's works fine :)
>>
>>>
>>> 2 About my first question, I try to draw a png image on a Surface and
>>> I get some strange behavior. When nothing is applied on my first
>>> surface and draw the image in a rectangle path I crash the VM!
>>> This an example I tried and crash my VM:
>>>
>>> |surf pharoLogo ref path patternPaint|
>>> surf := AthensCairoSurface extent: 600@600.
>>>
>>> ref := 'pharo.png' asFileReference.
>>> pharoLogo := AthensCairoSurface createFromFile: ref fullName ifFailed:[nil].
>>>
>>> surf drawDuring: [:can|
>>>        surf clear.
>>>        patternPaint := can setPaint: pharoLogo.
>>>        patternPaint setExtend: #None.
>>>        can drawShape: (0@0 extent: pharoLogo extent).
>>> ].
>>> Display getCanvas drawImage: surf asForm at: 0@0.
Did this code work fine on your image or other machine? (I'm working
on a Windows XP pro)

>>> If you need more information about the crash and my environment ask it :)
>>>
>>> weird... it should be working fine.
>>
>> I try it on a new clean image and again get a VM crash.
>
> okay, then i need more information :)

I send the report of the crash in the mail.

Tristan

> --
> Best regards,
> Igor Stasenko.
>

crash.dmp (19K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Some question and request for Athens

Igor Stasenko
On 27 March 2013 14:44, Tristan Bourgois <[hidden email]> wrote:

> 2013/3/26 Igor Stasenko <[hidden email]>:
>> On 26 March 2013 11:29, Tristan Bourgois <[hidden email]> wrote:
>>> 2013/3/25 Stéphane Ducasse <[hidden email]>:
>>>>
>>>>
>>>> Begin forwarded message:
>>>>
>>>> From: Igor Stasenko <[hidden email]>
>>>> Subject: Re: Some question and request for Athens
>>>> Date: March 25, 2013 2:57:33 PM GMT+01:00
>>>> To: Tristan Bourgois <[hidden email]>
>>>> Cc: Stéphane Ducasse <[hidden email]>, LE PORS Eric
>>>> <[hidden email]>
>>>>
>>>> On 25 March 2013 11:45, Tristan Bourgois <[hidden email]> wrote:
>>>>
>>>> Hi Igor!
>>>>
>>>> I have some questions and request for Athens :)
>>>>
>>>> 1 Do exist a possibility in Athens to draw a Surface on a Surface?
>>>> For example :
>>>> aSurf drawSurface: anOtherSurface at: aPosition
>>>> (I need it for draw image on a surface)
>>>>
>>>>
>>>> yes. You can use Forms or surfaces as paints so they act like 2D textures:
>>>>
>>>> canvas setPaint: someSurface.
>>>> canvas drawShape: myRect.
>>>
>>> Thanks that's works fine :)
>>>
>>>>
>>>> 2 About my first question, I try to draw a png image on a Surface and
>>>> I get some strange behavior. When nothing is applied on my first
>>>> surface and draw the image in a rectangle path I crash the VM!
>>>> This an example I tried and crash my VM:
>>>>
>>>> |surf pharoLogo ref path patternPaint|
>>>> surf := AthensCairoSurface extent: 600@600.
>>>>
>>>> ref := 'pharo.png' asFileReference.
>>>> pharoLogo := AthensCairoSurface createFromFile: ref fullName ifFailed:[nil].
>>>>
>>>> surf drawDuring: [:can|
>>>>        surf clear.
>>>>        patternPaint := can setPaint: pharoLogo.
>>>>        patternPaint setExtend: #None.
>>>>        can drawShape: (0@0 extent: pharoLogo extent).
>>>> ].
>>>> Display getCanvas drawImage: surf asForm at: 0@0.
>
> Did this code work fine on your image or other machine? (I'm working
> on a Windows XP pro)
>
could be a problem. we should check.
To workaround this, you can try to load .png into a form:
Form fromBynaryStream: (ref ... readStream)

>>>> If you need more information about the crash and my environment ask it :)
>>>>
>>>> weird... it should be working fine.
>>>
>>> I try it on a new clean image and again get a VM crash.
>>
>> okay, then i need more information :)
>
> I send the report of the crash in the mail.
>

yes, i see there's some problem.. but cannot tell anything why it happens.

> Tristan
>
>> --
>> Best regards,
>> Igor Stasenko.
>>



--
Best regards,
Igor Stasenko.