Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Font Size And Scaling (Read 2673 times)
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
Font Size And Scaling
Nov 9th, 2007 at 10:47am
Print Post  
Hello, I've looked all over the place, but found nothing that could solve my problem.

I'm using FlowChart.NET 4.3.1 and can not upgrade to 5 at this moment.

I have an application that has a FlowChart object inside a Ruler object. The ruler and flowchart their MeasureUnit is usually set to Millimeter, but sometimes to inch. I had to create an indication of the page size on the FlowChart. I do this by drawing a line on the flowchart at the correct height and width of the flowchart (for example a vertical line at 210 mm for an A4 page).

This works well, and all elements are on the screen at exactly the same place as they are on the paper.

But now I must allow users to select a font size. I also want the fonts to scale when the user hits "Fit To Page" in the print preview.

I am aware all fonts should have the GraphicsUnit set as World to allow scaling. So my thought was to set everything to World, and then allow the user to choose the font size, for example in Mm. However... when I convert the size from Millimeter to World things go wrong. I set for example 10 mm, but the font on the screen is about 30 mm, which is what I can see on the ruler.

So setting the font size to 10 mm won't give me a text that is 10 mm, but a lot bigger.

I also tried to take the default font size I have for the FlowChart, convert this to World and set the diagramm font size to World, with the converted size value. I expected the size to not change, but it did.

If I look at the SizeInPoints property before and after this last action, it remains the same. So the font-size did not change, but it is represented bigger on the screen... any ideas?

I think I don't really understand the "World" GraphicsUnit.

Thanks in advance
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Font Size And Scaling
Reply #1 - Nov 9th, 2007 at 10:56am
Print Post  
Try the convert() method from this topic:
http://mindfusion.org/cgi/Forum/YaBB.pl?board=fcnet_disc;action=display;num=1168...

Use it to convert the Point size returned by the font dialog to the units specified in FlowChart.MeasureUnit. Finally, construct a new Font from the font name specified by the user, but using the converted size and Unit=World.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
Re: Font Size And Scaling
Reply #2 - Nov 9th, 2007 at 12:40pm
Print Post  
Thanks for the quick reply. I should have mentioned I was using the method from the post you linked to.

I think I was using it the wrong way. But just to be sure, I'll tell you what I understand from it now:

The Convert method is needed to convert from some GraphicsUnit, to the FlowChart.MeasureUnit. Using the call:

Code
Select All
value = Convert(someSize, GraphicsUnit.Millimeter, MyFlowChart.MeasureUnit)
 



Assuming someSize is the wanted size in millimeter.

Then we use the value to create a font size with value as size and World as GraphicsUnit.

We can do the same for any kind of size, be it point, inch, ...

This certainly gives me a more realistic font size.

See what I was doing first was this:

Code
Select All
value = Convert(someSize, GraphicsUnit.Millimeter, GraphicsUnit.World)
// Make the font with value as size and World as Unit...
 



I allready thought this made no sense because World was not in the switch case... but I didn't understand "world" anyway. Now I think I do.

Thanks anyway, I get a bit slow on fridays Wink

(Great software and support btw)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Font Size And Scaling
Reply #3 - Nov 9th, 2007 at 12:58pm
Print Post  
8) Yes, you should convert to MyFlowChart.MeasureUnit - this is the unit the fonts will be measured in when their own Unit is World. The GDI.NET renderer uses two transformation stages - world-to-page and page-to-device. My guess is that when applied to fonts, World specifies that the font size is relative to the 'World' coordinate system. Otherwise, it is relative to the page coordinate system and is not affected by the scale transformations, which are applied at the world-to-page stage.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint