How to draw the Euro sign

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • How to draw the Euro sign

    I'm using standard fonts to write some texts on the display, but I think it's impossible to draw Euro sign, because the emWin fonts lack that character. Right?

    Is it possible to embed the Euro sign in a standard font? Do I need to create a custom font?
  • Hi,

    The code of the euro-sign is 0x20AC. Unfortunately that code is not part of the ASCII- or ISO8859-1 range. Here is a sample with a custom font showing the euro character:

    C Source Code

    1. #include "GUI.h"
    2. GUI_CONST_STORAGE unsigned char acGUI_Font16_20AC[ 10] = { /* code 20AC, EURO SIGN */
    3. ___XXXX_,
    4. __X_____,
    5. _X______,
    6. XXXXXXX_,
    7. _X______,
    8. XXXXXXX_,
    9. _X______,
    10. _X______,
    11. __X_____,
    12. ___XXXX_};
    13. GUI_CONST_STORAGE GUI_CHARINFO_EXT GUI_Font16_CharInfo[1] = {
    14. { 7, 10, 0, 3, 7, acGUI_Font16_20AC } /* code 20AC, EURO SIGN */
    15. };
    16. GUI_CONST_STORAGE GUI_FONT_PROP_EXT GUI_Font16_Prop1 = {
    17. 0x20AC /* first character */
    18. ,0x20AC /* last character */
    19. ,&GUI_Font16_CharInfo[ 0] /* address of first character */
    20. ,(GUI_CONST_STORAGE GUI_FONT_PROP_EXT *)0 /* pointer to next GUI_FONT_PROP_EXT */
    21. };
    22. GUI_CONST_STORAGE GUI_FONT GUI_Font16 = {
    23. GUI_FONTTYPE_PROP_EXT /* type of font */
    24. ,16 /* height of font */
    25. ,16 /* space of font y */
    26. ,1 /* magnification x */
    27. ,1 /* magnification y */
    28. ,{&GUI_Font16_Prop1}
    29. ,13 /* Baseline */
    30. ,7 /* Height of lowercase characters */
    31. ,10 /* Height of capital characters */
    32. };
    33. void MainTask(void) {
    34. GUI_Init();
    35. GUI_UC_SetEncodeUTF8();
    36. GUI_SetFont(&GUI_Font16);
    37. GUI_DispString("\xe2\x82\xac");
    38. while (1) {
    39. GUI_Delay(100);
    40. }
    41. }
    Display All


    Regards, Jörg
    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: segger.com/ticket/

    Or you can contact us via e-mail.