Michael
Try specifing your test values relative to the bounds of a
single character. Example;
mSize := 'm' asText asParagraph bounds.
Then use the ratio of your text sizes to mSize as your test
reference values.
I should add that I have not tried this, but I would hope
that there would be some consistency for a type face like
Courier.
Terry
===========================================================
Terry Raymond Smalltalk Professional Debug Package
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI 02878
(401) 624-4517
[hidden email]
<
http://www.craftedsmalltalk.com>
===========================================================
> -----Original Message-----
> From: Michael Meyer [mailto:
[hidden email]]
> Sent: Monday, May 01, 2006 5:31 AM
> To:
[hidden email]
> Subject: Platform independent font for sunit test?
>
> Hi,
> I have a couple of sunit tests that check width and height of a
> ComposedText object.
>
> My problem is, that I get different values for the width on windows and
> OsX.
>
> Is there a font (it doesn't have to look good) that is platform
> independent?
>
> I hoped that the solution below would work (pixelSize and fixedWidth) but
> "text width" returns 25 on windows and 45 on OsX.
>
> Cheers,
> michael
>
>
> | fd ca ta text |
> fd := FontDescription new
> family: #( 'courier' '*' );
> serif: false;
> fixedWidth: true;
> pixelSize: 14.
> ca := CharacterAttributes newWithDefaultAttributes.
> ca setDefaultQuery: fd.
> ta := TextAttributes characterAttributes: ca.
>
> text := ComposedText withText: 'Label' asText style: ta.
> text width
>
> --
> Echte DSL-Flatrate dauerhaft f|r 0,- Euro*!
> "Feel free" mit GMX DSL!
http://www.gmx.net/de/go/dsl