[Q][RFI] Where ends a line of ASCII text ?

Ned Konz ned at squeakland.org
Fri Mar 18 03:13:21 UTC 2005


On Thursday 17 March 2005 6:55 pm, Ron Jeffries wrote:
> I'm wanting to render a specific TrueType font to GIF for my web
> site. Thought at first that Squeak would be just the thing, but it
> appears that there's nothing out there. If I'm wrong -- and there is
> something out there -- please let me know.
>
> Otherwise I'll have to write a C# program to do it. Gack.

Squeak can do this easily.


canvas := FormCanvas extent: 600 at 200 depth: 8.
canvas fillColor: Color white.
font := (TextStyle named: 'BitstreamVeraSans') fontOfPointSize: 36.
canvas drawString: 'This Is BitstreamVeraSans' at: 10 at 50 font: font color: 
Color red.
canvas drawString: 'This Is BitstreamVeraSans Bold' at: 10 at 100 font: (font 
emphasized: 1) color: Color blue.
GIFReadWriter putForm: canvas form onFileNamed: 'fontTest.gif'.


But GIF files are a bad choice to use for rendering TrueType fonts, because 
their limited color depth will result in bad looking anti-aliased edges.

Instead, consider using a PNG or JPEG:


canvas := FormCanvas extent: 600 at 200 depth: 16.
canvas fillColor: Color white.
font := (TextStyle named: 'BitstreamVeraSans') fontOfPointSize: 36.
canvas drawString: 'This Is BitstreamVeraSans' at: 10 at 50 font: font color: 
Color red.
canvas drawString: 'This Is BitstreamVeraSans Bold' at: 10 at 100 font: (font 
emphasized: 1) color: Color blue.
PNGReadWriter putForm: canvas form onFileNamed: 'fontTest.png'.

or


canvas := FormCanvas extent: 600 at 200 depth: 16.
canvas fillColor: Color white.
font := (TextStyle named: 'BitstreamVeraSans') fontOfPointSize: 36.
canvas drawString: 'This Is BitstreamVeraSans' at: 10 at 50 font: font color: 
Color red.
canvas drawString: 'This Is BitstreamVeraSans Bold' at: 10 at 100 font: (font 
emphasized: 1) color: Color blue.
JPEGReadWriter2 putForm: canvas form onFileNamed: 'fontTest.jpg'.


-- 
Ned Konz
http://bike-nomad.com/squeak/



More information about the Squeak-dev mailing list