Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic etFontSize causes text to dissappear (Read 3122 times)
Al
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Sep 3rd, 2014
etFontSize causes text to dissappear
Nov 4th, 2014 at 3:23pm
Print Post  
Hi,

Why does this code cause my node labels to disappear?

Code (Javascript)
Select All
            var style = new Style();
            style.setShadowColor(null);
            style.setFontSize(10);
            diagram.setStyle(style);
 



If I remove the line for 'setFontSize' then all works fine.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: etFontSize causes text to dissappear
Reply #1 - Nov 4th, 2014 at 5:01pm
Print Post  
That's size in millimeters if using the default MeasureUnit, and text won't be rendered if there's not enough space available in nodes to fit a single line. If you want to specify font size in points, multiply the value by 25.44 / 72 to get it in millimeters.
  
Back to top
 
IP Logged
 
Al
Junior Member
**
Offline


I Love MindFusion!

Posts: 56
Joined: Sep 3rd, 2014
Re: etFontSize causes text to dissappear
Reply #2 - Nov 5th, 2014 at 7:20am
Print Post  
Thanks Stoyan, that worked just fine.

Is there any control over the text style eg. I don't want it to wrap and want to limit it's length?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: etFontSize causes text to dissappear
Reply #3 - Nov 5th, 2014 at 8:32am
Print Post  
The text always wraps at this time. You can work around it like this:

Code
Select All
var Text = MindFusion.Drawing.Text;
var originalGetLines = Text.prototype.getLines;
Text.prototype.getLines = function (context)
{
	var wrappedLines = originalGetLines.apply(this, [context]);
	if (wrappedLines.length < 2)
		return wrappedLines;

	var line = wrappedLines[0];
	line += " ...";
	this.lines = [line];
	return this.lines;
}; 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint