PC Review


Reply
Thread Tools Rate Thread

**********DrawString is not drawing the text at Point(0,0)**********

 
 
Ponnurangam
Guest
Posts: n/a
 
      21st Oct 2004
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


 
Reply With Quote
 
 
 
 
Bob Powell [MVP]
Guest
Posts: n/a
 
      21st Oct 2004
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.

--
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






"Ponnurangam" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Ponnurangam
Guest
Posts: n/a
 
      21st Oct 2004
Hi Bob,

Can you tell me about the font table analysis to extract information from a
TTF file.

Thanks

Ponnurangam

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:(E-Mail Removed)...
> 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.
>
> --
> 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
>
>
>
>
>
>
> "Ponnurangam" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>
>>

>
>



 
Reply With Quote
 
Bob Powell [MVP]
Guest
Posts: n/a
 
      21st Oct 2004
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.

--
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






"Ponnurangam" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Bob,
>
> Can you tell me about the font table analysis to extract information from

a
> TTF file.
>
> Thanks
>
> Ponnurangam
>
> "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
> news:(E-Mail Removed)...
> > 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.
> >
> > --
> > 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
> >
> >
> >
> >
> >
> >
> > "Ponnurangam" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> 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
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Graphics.DrawString inconsistent drawing behavior on Dell Axim x50v (640x480) holmerj@cintas.com Microsoft Dot NET Compact Framework 2 28th Dec 2006 07:11 PM
DrawString - Drawing MenuItem Text with Underline Mnemonic? Lex Microsoft C# .NET 1 11th Jun 2004 06:37 PM
DrawString - Drawing MenuItem Text with Underline Mnemonic? Lex Microsoft Dot NET 1 11th Jun 2004 06:37 PM
System.Drawing.Graphics.DrawString problem in Compact Framework =?Utf-8?B?SGFycnk=?= Microsoft Dot NET Compact Framework 1 7th Apr 2004 07:58 AM
System.Drawing.Graphics.DrawString problem in Compact Framework Harry Microsoft Dot NET Framework 0 5th Apr 2004 06:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:21 AM.