Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to change the font and its color? (Read 1218 times)
Brarord
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 18
Joined: Dec 30th, 2019
How to change the font and its color?
Dec 31st, 2019 at 5:37am
Print Post  
Hi!
Can someone give me some example how to do it properly? Can i use google font to this? Or i need just donwload that font and link it somehow.

Here is my code:

Code (Javascript)
Select All
	diagram = Diagram.create(document.getElementById("diagram"));
	diagram.setBounds(new Rect(0, 0, 600, 205));
	diagram.setUndoEnabled(true);
	diagram.setShowGrid(true);

	// set some Diagram properties.
	diagram.setBehavior(Behavior.LinkTables);
	diagram.setAllowSelfLoops(false);
	diagram.setBackBrush('#3e4349');
	diagram.setLinkHeadShape('Triangle');
	diagram.setLinkHeadShapeSize(4);
	diagram.getSelection().allowMultipleSelection = false;
	diagram.setAllowInplaceEdit(true);

	// set the Diagram style.
	var theme = new Theme();

	var tableNodeStyle = new Style();
	tableNodeStyle.setBrush({ type: 'RadialGradientBrush', color1: 'rgb(255,255,255)', color2: 'rgb(183,236,189)', angle: 30 });
	tableNodeStyle.setTextColor({ type: 'SolidBrush', color: 'rgb(0,0,0)' });
	tableNodeStyle.setStroke('rgb(255,255,255)');

	var linkStyle = new Style();
	linkStyle.setBrush({ type: 'SolidBrush', color: 'rgb(0, 52, 102)' });
	linkStyle.setStroke('rgb(192, 192, 192)');

	theme.styles['std:TableNode'] = tableNodeStyle;
	theme.styles['std:DiagramLink'] = linkStyle;

	diagram.setTheme(theme); 



Regards
poor student Undecided
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: How to change the font and its color?
Reply #1 - Dec 31st, 2019 at 7:46am
Print Post  
Hi poor student Wink

TextColor should contain a color value rather than a brush object. So, setting font and text color through a style should look like

Code
Select All
style.setTextColor('black');
style.setFontName('sans-serif'); 



You should be able to use whatever font families are available with the browser or loaded by your page, e.g. try code from https://stackoverflow.com/questions/7961721/how-do-i-install-a-custom-font-on-an...

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Brarord
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 18
Joined: Dec 30th, 2019
Re: How to change the font and its color?
Reply #2 - Jan 1st, 2020 at 6:35am
Print Post  
Thanks Slavcho Smiley
« Last Edit: Jan 2nd, 2020 at 7:01am by Brarord »  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint