How do I make the output on a chart in monospaced font?

 

Comment() - displays information in proportional font on the chart, but has difficulties with formatting tables, for example.

How can I display the information on the chart in monospaced font using Comment()?

 
Yury Kirillov:

Comment() - displays information in proportional font on the chart, but has difficulties with formatting tables, for example.

How can I display the information on the chart in monospaced font using Comment()?

OnlyOBJ_LABEL

 
Vitaly Muzichenko:

OnlyOBJ_LABEL


It's a graphic, it's all clear.

 
Yury Kirillov:

It's a graphic, it's all clear.

There's nothing you can do aboutComment, it has a slightly different purpose

 
Vitaly Muzichenko:

Nothing you can do aboutComment, it has a slightly different purpose


How is the font defined in Comment?

 
Yury Kirillov:

What determines the font in Comment?

Not really understood, but it seems to take the system settings of the OS

 
Vitaly Muzichenko:

Didn't really understand it, but it seems to take the system settings of the OS


It seems to be a Terminal font and apparently it's really unrealistic to tamper with.

 

that's what you were told, output it yourself, and in any place and in any font, find a monospace font in the winds

cut it out of the software live, I think you can figure it out.

bool CreateLabel(string name,int x,int y=10)
  {
   if(!ObjectCreate(0,name,OBJ_LABEL,0,0,0))
      return false;;
   ObjectSetInteger(0,name,OBJPROP_ANCHOR,ANCHOR_LEFT_LOWER);
   ObjectSetInteger(0,name,OBJPROP_CORNER,CORNER_LEFT_LOWER);
   ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);
   ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);
   ObjectSetInteger(0,name,OBJPROP_FONTSIZE,FontSize);
   ObjectSetInteger(0,name,OBJPROP_COLOR,FontColor);
   ObjectSetInteger(0,name,OBJPROP_SELECTABLE,true);
   ObjectSetString(0,name,OBJPROP_FONT,FontName);
   ChartRedraw();
   return true;
  }

// где-то выводим строку с именем
ObjectSetString(0,"SIP_"+lNames[2],OBJPROP_TEXT,lNames[2]+DoubleToString(sprd,_Digits)+",  RealSpread="+DoubleToString(Ask-Bid,_Digits));

**

 
Alexey Volchanskiy:

that's what you were told, output it yourself, and in any place and in any font, find a monospace font in the winds

cut it out of the software live, I think you can figure it out.

**


Thanks, Alexey! I don't have a problem with outputting graphical fonts. Thought I could fix the system fonts somehow.

 
Yury Kirillov:

Thanks, Alexey! I have no problems with the output of graphical fonts. Thought there might be a way to tweak the system fonts.


Ah, well, I'll pass.

 
Yury Kirillov:

Comment() - displays information in proportional font on the chart, but has difficulties with formatting tables, for example.

How can I display the information on the chart in monospaced font with Comment()?


You can measure the width of each character in piskels (there will be several groups with the same width). Write a function that will append any string with spaces until it reaches a given width. Then assemble comment from these substrings.

If you make such function, post it in kodobase, many will thank you. And me too. I'm too lazy to bother myself.

In this case, symbol \x200A would be useful - minimum width of the space, for an exact fit. And replace regular spaces with symbol /1 - wide space (after all, the length of the comment is limited). Maybe other spaces are useful, but I don't know them.

Reason: