Search code examples
mql4metatrader4

How to set bold label with ObjectSetText in MQL


Is there a way to set bold text using ObjectSetText() function in MQL4.

Should a font name be for example "Arial Bold" or can I set a path to the font .ttf-file?

If a path option is possible, is that path relative or absolute?


Solution

  • ObjectSetText() uses O/S-registered fonts & only limited controls

    as one may test on GUI panels, MQL4 operations do not have full type-setting font-manipulation controls available via code

    ( this is all about trading, isn't it? )

    Check what fonts are available from your O/S:

    Font-selector
    ( or from used Docker/WINE thin-wrapper container )

    So in MQL4 code there will thus simply be a string-typed or #define-ed literal specification of the font name and one may additionally set aFontSIZE + aFontCOLOUR attribute(s)

    #define           clrSignalLABEL       clrAqua                  // LITERAL-way
    #define           iLabelFontSIZE       24
    
    string            signalTextFONT       'Times New Roman';       // STRING-way