Emwin TEXT_SetFont(hItem, acHRBCezanne_140_Normal_EXT_AA4) not working

  • Hi guys,

    I created some custom font in App wizard like acHRBCezanne_140_Normal_EXT_AA4 and acHRBCezanne_190_Normal_EXT_AA4. Initially I set 190 fonts by default in App wizard text properties. But run time I try to change to 140 fonts using following comment in emwin code.


    TEXT_SetFont(hItem, acHRBCezanne_140_Normal_EXT_AA4)

    But i am getting error.

    If i miss something somebody pls help to fix this issue.

    Thanks advance.

    Ravi.S

  • Hi Ravi,

    There currently is no "SETFONT" job implemented that would set the font of an object. But you can set the font of the object in user code.

    The byte arrays generated by AppWizard are essentially just the content of XBF font files. The reason why what you were trying to do does not work is that TEXT_SetFont() expects a pointer to a GUI_FONT struct.

    The easiest way to change the font would be if you'd retrieve the GUI_FONT* from a TEXT widget that has the 190 font set with TEXT_GetFont(). Then you could set it to the other TEXT widget that should retrieve the font with TEXT_SetFont().

    If this is not an option, the XBF font needs to be parsed into a GUI_FONT struct during runtime and then it can be set to the widget.
    There is an example in our wiki. However, you can strip away everything file related from the example. The _GetData() function just needs to copy the XBF data to the buffer:


    Best regards,
    Florian

    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!