Yes. I mean on an image. The link tells about a method that measures size(on image) of a specified string with specified font. What I need is a method to tell me(measure) font size for a specified box(Size in GDI+) and a specified string that must be drawn
into it. It's not difficult to measure font size provided the relation between font size and drawn string is linear. At this point arises another question: Is relation of font size and drawn string linear?
Member
130 Points
229 Posts
Get font size of a box
Jan 28, 2014 05:20 AM|IranianCuriousBoy|LINK
Hi
I have a box with specified width and height and a specified string that must be fitted in this box. Is there an easy to get font size?
Regards
font
All-Star
35159 Points
9075 Posts
Re: Get font size of a box
Jan 28, 2014 09:41 AM|smirnov|LINK
If you mean you want to change size of the texbox according to the length of text, then you can try
I would do that however using js/jquery
Another idea, you can change font size as it is shown at http://web-design-weekly.com/blog/snippets/change-font-size-within-input-field-based-on-length/
Hope this helps.
font
Member
130 Points
229 Posts
Re: Get font size of a box
Jan 28, 2014 12:02 PM|IranianCuriousBoy|LINK
Hi
I asked in GDI+ forum so the question is about GDI+.
font
All-Star
35159 Points
9075 Posts
Re: Get font size of a box
Jan 28, 2014 12:48 PM|smirnov|LINK
You mean you have a box drawn on a picture? If true, read http://msdn.microsoft.com/en-us/library/6xe5hazb.aspx
font
Member
130 Points
229 Posts
Re: Get font size of a box
Jan 29, 2014 05:30 AM|IranianCuriousBoy|LINK
Hi Smirnov
Yes. I mean on an image. The link tells about a method that measures size(on image) of a specified string with specified font. What I need is a method to tell me(measure) font size for a specified box(Size in GDI+) and a specified string that must be drawn into it. It's not difficult to measure font size provided the relation between font size and drawn string is linear. At this point arises another question: Is relation of font size and drawn string linear?
Thanks
font
All-Star
35159 Points
9075 Posts
Re: Get font size of a box
Jan 29, 2014 06:52 AM|smirnov|LINK
If box is a picture, what font size do you mean? The picture has no font. You can draw a text but you define the font by yourself.
font