Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Fontsize (Read 1868 times)
ampersand
Junior Member
**
Offline



Posts: 55
Joined: Sep 21st, 2006
Fontsize
Oct 25th, 2006 at 6:06am
Print Post  
I am struggling a bit with the fontsize  in flowchart.

In my form the user can select a new font size for the active object by selecting a value from a toolstripxombobox. The value is given in Points, e.g. 10 as the default value. The measureunit of flowchart is Millimeter. To assign the fontsize to the currently selected object I do the following:

Code
Select All
defaultFontSize = size * PointToMM; //PointToMM = 0.35
if (btChart.ActiveObject.GetType() == typeof(Box))
{

Font font = new Font(defaultFontfamily, defaultFontSize, GraphicsUnit.World);

(btChart.ActiveObject as Box).Font = font;

font.Dispose();
}
 



First I convert the selected fontsize by 0.35 to convert it from Points to Millimeter. Then I create a new font and assign it the object.
Is this the correct way to do it?

I am asking because if I compare the length of a given text in Arial 10 from flowchart to the same text in Powerpoint or Word, the text in flowchart is always some pixels shorter. Not much, but my understanding is, that all applications should show the same text with same font and size with the same length?!

Dirk
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Fontsize
Reply #1 - Oct 25th, 2006 at 9:32am
Print Post  
Set PointToMM = 25.4 / 72. That's almost 0.353 Wink The text anti-aliasing mode might make a difference too. Try how the text will look with the other possible FlowChart.TextRendering values.

Stoyan
  
Back to top
 
IP Logged
 
ampersand
Junior Member
**
Offline



Posts: 55
Joined: Sep 21st, 2006
Re: Fontsize
Reply #2 - Oct 25th, 2006 at 10:36am
Print Post  
Thanks, I will give it a try.

But one more question:
In boxes etc I use GraphicsUnit.World when creating fonts.

If I do the same with a RichTextBox that is included in a Controlhost this will not work. The Text comes out tiny.

Code
Select All
(e.ControlHost.Control as RichTextBoxPrintCtrl).Font = new Font(GetDefaultFontFamily(), GetDefaultFontSize(), FontStyle.Regular, GraphicsUnit.World);
 



Only if I create the font with GraphicsUnit.Millimeter  the text has the same size as a box.

Is this a 'normal' behaviour of a RichTextBox or a Controlhost?

Dirk
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Fontsize
Reply #3 - Oct 25th, 2006 at 12:07pm
Print Post  
Hosted controls do not use the flowchart's MeasureUnit in any way - you must set their font size in the controls' default unit, which is probably Point for RichTextBox.

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