how to set FONT_BOLD

 

Hi alltogether,


I want to have a bold text for a free indicator in main window.


There is the old code:


ObjectSetText(ObName, Text_Spread,10,"MS Sans Serif",Color_Spread);



I have to add some new code for property font_bold:

ObjectSetText(ObName, Text_Spread, ““, Color_Spread);
TextSetFont(
		"MS Sans Serif", // font name or path to font file on the disk
		12,              // font size
		FONT_BOLD,       // combination of flags
			         // text slope angle
);



But I know, it is false,

help me please with correction!!!


vvm-55

 
vvm-55 :

Hi alltogether,


I want to have a bold text for a free indicator in main window.

For example, Tahoma has standard type "Tahoma" and bold type "Tahoma Bold". You should use this bold font when specifying bold.

I think that "MS Sans Serif" don't have bold type. To find out, open the font in the control panel of your computer.

 ObjectSetText (ObName, Text_Spread, 10 , "Tahoma Bold" ,Color_Spread);
 
Yes, bold is part of the font name; you can only use those fonts that have bold. In my code I have:
enum FontSelect{Arial, Times_New_Roman, Courier};
static string font2string[]={"Arial", "Times New Roman", "Courier"};
input FontSelect        selectedFont   = Times_New_Roman;
input int               textSize       = 16;
input bool              bold           = true;
:
int OnInit(){
   sFontType   = font2string[selectedFont] + (bold ? " Bold" : "");
          Indicators: Zero Lag Timer - Indices - Articles, Library comments - MQL5 programming forum
 
whroeder1:
Yes, bold is part of the font name; you can only use those fonts that have bold. In my code I have:           Indicators: Zero Lag Timer - Indices - Articles, Library comments - MQL5 programming forum

Many Thamks,

the solution number 1 works with

Noto Sans Bold,

it looks better now........

It was very easy for me!!!!!


Have a nice weekend


vvm-55