|
|
|
start date: Thu, 5 Jul 2007 13:48:18 -0700,
posted on: microsoft.public.dotnet.framework.drawing
back
| Thread Index |
|
1
RobinS
|
|
2
Bob Powell [MVP]
|
|
3
RobinS
|
Font Size Maximization for the area
I am creating Text Slides for my user, i.e. taking text input and creating
jpegs out of it.
I have text and the selected font. Is there a method for calculating the
maximum font size I should use in order to fit the output to a specific
area, like 1024x768?
Or do I have to use MeasureString with the width and iterate until the
height is hit?
Thanks in advance,
RobinS.
Date:Thu, 5 Jul 2007 13:48:18 -0700
Author:
|
Re: Font Size Maximization for the area
Effectively, as you surmise, it's an iterative process. I use a binary chop
type algorithm.
The effect depends greatly on the font used.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
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.
"RobinS" wrote in message
news:-aWdnX57YOyPxBDbnZ2dnUVZ_uCinZ2d@comcast.com...
>I am creating Text Slides for my user, i.e. taking text input and creating
>jpegs out of it.
>
> I have text and the selected font. Is there a method for calculating the
> maximum font size I should use in order to fit the output to a specific
> area, like 1024x768?
>
> Or do I have to use MeasureString with the width and iterate until the
> height is hit?
>
> Thanks in advance,
> RobinS.
>
>
Date:Sat, 7 Jul 2007 11:09:57 +0200
Author:
|
Re: Font Size Maximization for the area
I figured as much, darn it. I am giving the user the ability to select his
own font, too. Thanks; just wanted to make sure there wasn't some magic
function available (wishful thinking).
Robin S.
----------------------------
"Bob Powell [MVP]" wrote in message
news:ughFYaHwHHA.4480@TK2MSFTNGP02.phx.gbl...
> Effectively, as you surmise, it's an iterative process. I use a binary
> chop type algorithm.
>
> The effect depends greatly on the font used.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Ramuseco Limited .NET consulting
> http://www.ramuseco.com
>
> 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.
>
>
>
> "RobinS" wrote in message
> news:-aWdnX57YOyPxBDbnZ2dnUVZ_uCinZ2d@comcast.com...
>>I am creating Text Slides for my user, i.e. taking text input and
>>creating jpegs out of it.
>>
>> I have text and the selected font. Is there a method for calculating the
>> maximum font size I should use in order to fit the output to a specific
>> area, like 1024x768?
>>
>> Or do I have to use MeasureString with the width and iterate until the
>> height is hit?
>>
>> Thanks in advance,
>> RobinS.
>>
>>
>
>
Date:Sun, 8 Jul 2007 23:04:02 -0700
Author:
|
|
|