A bug with pointSize?

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

A bug with pointSize?

Javier Diaz-Reinoso
Is this a bug?:

f0:=TextStyle defaultFont.
p0:=f0 pointSize.

f1:=(StrikeFont familyName: (f0 name) size: (f0 pointSize)).
p1:=f1 pointSize.
       
f0 asString, ' p0=', p0 asString, ' ', f1 asString, ' p1=', p1 asString




Reply | Threaded
Open this post in threaded view
|

Re: A bug with pointSize?

Boris.Gaertner
 "Javier Diaz-Reinoso" <[hidden email]> wrote:

> Is this a bug?:
Yes, I think it is a bug.

> f0:=TextStyle defaultFont.
> p0:=f0 pointSize.
>
> f1:=(StrikeFont familyName: (f0 name) size: (f0 pointSize)).
> p1:=f1 pointSize.
>
> f0 asString, ' p0=', p0 asString, ' ', f1 asString, ' p1=', p1 asString
>
>
 
To better the situation, you can add this method to
the class  protocol of StrikeFont:

familyName: aName pointSize: aSize
 "Answer a font (or the default font if the name is unknown)
  in the specified point size."

 ^ ((TextStyle named: aName asSymbol)
            ifNil: [TextStyle default]) fontOfPointSize: aSize

Reply | Threaded
Open this post in threaded view
|

Re: A bug with pointSize?

Jerome Peace
In reply to this post by Javier Diaz-Reinoso
Q: Is it a bug?

A: Depends. What would you classify as a bug.
The code itself is poorly documented and the method is
unfortunately named.

 StrikeFont familyName: (f0 name) size: (f0 height)
 is the correct choice.

So maybe it should be
 StrikeFont familyName: (f0 name) height: (f0 height)

Try evaluating:


(
{
(f0 :=TextStyle defaultFont) .

( fHeight := ( StrikeFont familyName: (f0 name) size:
(f0 height))).
( fPixel := ( StrikeFont familyName: (f0 name) size:
(f0 pixelSize))).
( fPoint := ( StrikeFont familyName: (f0 name) size:
(f0 pointSize ))). }

collect:

[ :font |
(font asString, ' height=', font height printString
 , ' pixelSize=', font pixelSize printString
, ' pointSize=', font pointSize printString
, ' ') ]


) explore


 "Javier Diaz-Reinoso" <javier_diaz_r at mac.com>
wrote:

> Is this a bug?:


> f0:=TextStyle defaultFont.
> p0:=f0 pointSize.
>
> f1:=(StrikeFont familyName: (f0 name) size: (f0
pointSize)).
> p1:=f1 pointSize.
>
> f0 asString, ' p0=', p0 asString, ' ', f1 asString,
' p1=', p1 asString
>
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com