Re: GDI+ renders some phrases without spaces
From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 02/08/05
- Next message: Becker: "Convert to 1 bit black / white"
- Previous message: Steve McLellan: "Re: telling images apart with some kind of AI / image recognition ?"
- In reply to: Robert Bouillon: "Re: GDI+ renders some phrases without spaces"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 8 Feb 2005 16:36:35 +0100
Working with small fonts is particularly hard. This article might help you.
http://windowsforms.net/articles/gdiptext.aspx
You should really be setting the TextRenderingHint property before you draw.
If you don't like the effect of the AntialiasGridFit try ClearTypeGridFit.
-- Bob Powell [MVP] Visual C#, System.Drawing Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. "Robert Bouillon" <djwhizzard@hotmail.com> wrote in message news:uHOhDkMDFHA.3924@TK2MSFTNGP15.phx.gbl... > Sure. Less the try catch and some non-relevant code... > > PrivateFontCollection fonts = new PrivateFontCollection(); > fonts.AddFontFile(ctx.Server.MapPath("/Fonts/KR-08-53.TTF")); > Kroeger0853 = new > Font(fonts.Families[0],6,FontStyle.Bold,GraphicsUnit.Point); > > SizeF size = Ruler.MeasureString(text,Kroeger0853,400); > b = new Bitmap((int)size.Width,10); > g = Graphics.FromImage(b); > g.Clear(BackColor); > g.DrawString(text,Kroeger0853,new SolidBrush(ForeColor),0,0); > transb = SetTwoColorTransparancy(b,ForeColor,BackColor); > b.Dispose(); > ctx.Response.ContentType="image/gif"; > transb.Save(ctx.Response.OutputStream, ImageFormat.Gif); > > Only thing I could think of is the fact that a 6-point font is > non-standard, > but again, it renders fine in IE and in Photoshop. The font comes out > perfect using GDI+; it's just the character spacing that's off. > > Thanks. > > --ROBERT > > > "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message > news:%23YNEoyCDFHA.1040@TK2MSFTNGP09.phx.gbl... >> Any chance of some code that demonstrates the problem? >> >> -- >> Bob Powell [MVP] >> Visual C#, System.Drawing >> >> Find great Windows Forms articles in Windows Forms Tips and Tricks >> http://www.bobpowell.net/tipstricks.htm >> >> Answer those GDI+ questions with the GDI+ FAQ >> http://www.bobpowell.net/faqmain.htm >> >> All new articles provide code in C# and VB.NET. >> Subscribe to the RSS feeds provided and never miss a new article. >> >> >> >> >> >> "Robert Bouillon" <djwhizzard@hotmail.com> wrote in message >> news:eQ$hYu9CFHA.3976@tk2msftngp13.phx.gbl... >> >I seem to have a kerning problem I can't resolve. >> > >> > I'm using a non-standard font for a website, so I created dynamic image >> > generation to render the font. In photoshop and in Internet explorer, > with >> > the font specified explicitly in css, rendering is perfect. However >> > when > I >> > generate the string in .NET, the string is often "crumpled" in places > with >> > no spaces between characters. >> > >> > I would assume IE uses the same GDI calls to render the font, so I'm >> > not >> > sure what I'm missing. >> > >> > I can post GIF's if anyone needs further clarification. >> > >> > Thanks. >> > >> > --ROBERT >> > >> > >> >> > >
- Next message: Becker: "Convert to 1 bit black / white"
- Previous message: Steve McLellan: "Re: telling images apart with some kind of AI / image recognition ?"
- In reply to: Robert Bouillon: "Re: GDI+ renders some phrases without spaces"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|