Hi,
I am trying to draw text on a bitmap at (0,0)
But Graphics.DrawString("the brown fox",drawFont,drawBrush,drawPoint) is not
writing exactly at (0,0)
drawFont: Font("Arial", 9, Style, GraphicsUnit.Point)
drawPoint: (0,0)
There is space at left and at the Top.
For some fonts the space at the Top is more.
The spacing at the Top is not even for all the fonts.
I don't want the space at the top. If there is space at the top, it should
be even for all the fonts
Any help would be appreciated
Thanks
Ponnurangam
Bob Powell [MVP] - 21 Oct 2004 12:46 GMT
The positioning of the font is made according to the height of the EM square
defined by the font. Some fonts have glyphs that sit on different base-lines
and extend upwards to different heights within the EM square. In order to
position letters so that the top of the letter exactly touches a specific
picel would require individual analysis of the font tables and adjustment of
the output position on a character by character basis. This isn't possible
with the standard methods available to GDI+ and certainly not available to
DrawString.
I have written the code that does the font table analysis to extract such
information from a TTF file but it's a whole lot of work and I'm sorry but I
don't give that away for free.

Signature
Bob Powell [MVP]
Visual C#, System.Drawing
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm
The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
> Hi,
>
[quoted text clipped - 21 lines]
>
> Ponnurangam
Ponnurangam - 21 Oct 2004 13:36 GMT
Hi Bob,
Can you tell me about the font table analysis to extract information from a
TTF file.
Thanks
Ponnurangam
> The positioning of the font is made according to the height of the EM
> square
[quoted text clipped - 40 lines]
>>
>> Ponnurangam
Bob Powell [MVP] - 21 Oct 2004 22:12 GMT
Here's where I got my information from... Good luck!
http://fonts.apple.com/TTRefMan/index.html
Chapter 6, Font Files, explains the tables you need to decode.

Signature
Bob Powell [MVP]
Visual C#, System.Drawing
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm
The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
> Hi Bob,
>
[quoted text clipped - 49 lines]
> >>
> >> Ponnurangam