PluggableButtonMorph does not respect font size :(

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

PluggableButtonMorph does not respect font size :(

stepharo
For the Pharo Mooc we need to use large font and we end up with this visual glitch :(
I tried to dive into PluggableButtonMorph and I failed to found how to make sure it computes the bound correctly.
Any help is welcome.
I really think that in Brick we should really be picky on such problems.

Stef


 
Reply | Threaded
Open this post in threaded view
|

Re: PluggableButtonMorph does not respect font size :(

Nicolai Hess-3-2


2016-01-14 11:19 GMT+01:00 stepharo <[hidden email]>:
For the Pharo Mooc we need to use large font and we end up with this visual glitch :(
I tried to dive into PluggableButtonMorph and I failed to found how to make sure it computes the bound correctly.
Any help is welcome.


I think this issue is related:
13376  Wrong TextMorph extent for ButtonMorphs
The problem:
UITheme buttonLabelFor: creates a TextMorph with an extent
computed by TextMorph>>optimalExtent (in buttonLabelForText:),
which relies on its TextStyle (from the default font).
After that, the TextMorphs font is changed to the buttons
default font:


label := self buttonLabelForText: aButton label.
    label enabled: aButton enabled.
    label font: self buttonFont.

but the "label font:" does not recomputed the extent.



 
I really think that in Brick we should really be picky on such problems.

Stef


 

Reply | Threaded
Open this post in threaded view
|

Re: PluggableButtonMorph does not respect font size :(

stepharo
Thanks nicolai
I changed the font right now. I will check because after we will do around 20 videos
showing pharo tools.


Le 14/1/16 11:33, Nicolai Hess a écrit :


2016-01-14 11:19 GMT+01:00 stepharo <[hidden email]>:
For the Pharo Mooc we need to use large font and we end up with this visual glitch :(
I tried to dive into PluggableButtonMorph and I failed to found how to make sure it computes the bound correctly.
Any help is welcome.


I think this issue is related:
13376  Wrong TextMorph extent for ButtonMorphs
The problem:
UITheme buttonLabelFor: creates a TextMorph with an extent
computed by TextMorph>>optimalExtent (in buttonLabelForText:),
which relies on its TextStyle (from the default font).
After that, the TextMorphs font is changed to the buttons
default font:


label := self buttonLabelForText: aButton label.
    label enabled: aButton enabled.
    label font: self buttonFont.

but the "label font:" does not recomputed the extent.



 
I really think that in Brick we should really be picky on such problems.

Stef


 


Reply | Threaded
Open this post in threaded view
|

Re: PluggableButtonMorph does not respect font size :(

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


> On Jan 14, 2016, at 11:19 AM, stepharo <[hidden email]> wrote:
>
> For the Pharo Mooc we need to use large font and we end up with this visual glitch :(
> I tried to dive into PluggableButtonMorph and I failed to found how to make sure it computes the bound correctly.
> Any help is welcome.
> I really think that in Brick we should really be picky on such problems.

Indeed. Actually, Alex Syrel spent 2 weeks to get this “little” thing of computing the bounds of a string right (I think it works well now hopefully) :).

Doru

> Stef
>
>
>  <djbhggee..png>

--
www.tudorgirba.com
www.feenk.com

"Problem solving should be focused on describing
the problem in a way that makes the solution obvious."






Reply | Threaded
Open this post in threaded view
|

Re: PluggableButtonMorph does not respect font size :(

stepharo

Indeed. Actually, Alex Syrel spent 2 weeks to get this “little” thing of computing the bounds of a string right (I think it works well now hopefully) :).


excellent
And we should be really picky about that. Especially since we will have
a vector graphic.
and I would like to avoid to have the font plaque that we have now.

>
> Doru
>
>> Stef
>>
>>
>>   <djbhggee..png>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "Problem solving should be focused on describing
> the problem in a way that makes the solution obvious."
>
>
>
>
>
>
>