fonts - Delphi 6 : How can I display large size high quality Text via the TextOut() method? -


i have timage component print text string using tcanvas.textout(). set height , width of timage large size 50 pixels x (textwidth) pixels, , set canvas font height little smaller 48 pixels. bitblt() timage's bitmap on main canvas. see on screen big skinny letters terribly jagged. want instead thick jumbo letters appear smooth. reason using timage/bitblt combo because need resizing , alpha blending of text on fly.

what easiest way me big smooth letters printed timage bitmap?

are never displaying timage? should use off-screen bitmap instead. common technique achieve double buffering (flicker-free rendering).

for example,

var   bm: tbitmap;  procedure initoffscreenbitmap; begin   bm := tbitmap.create;   bm.setsize(bmwidth, bmheight); end;  procedure drawbitmap; begin   // draw on bm end;  procedure swap; begin   bitblt(canvas.handle, x, y, bmwidth, bmheight, bm.canvas.handle, 0, 0, srccopy) end; 

if using modern version of windows (e.g. vista+), or windows xp cleartype enabled (for odd reason, disabled default), text should smooth. make sure use modern font. of them do, old fonts such ms sans serif cannot smoothed using cleartype.

also, naturally, imperative bm has same background colour form, because alpha-blending occur when text drawn on bm. if form clred (for perverse reason), need do

bm.canvas.brush.color := clred; bm.canvas.brush.style := bssolid; bm.fillrect(rect(0, 0, bmwidth, bmheight)); 

prior to

bm.textout(...) 

just talking same thing: isn't smooth enough?

procedure tform3.formpaint(sender: tobject); begin   canvas.font.name := 'segoe ui';   canvas.font.height := 64;   canvas.textout(10, 10, 'this example.'); end; 

sample text output http://privat.rejbrand.se/sampletext.png
(high-res)


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -