FONT - more detail please!

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

  • FONT - more detail please!

    Dear all
    I don't understand what is meant by first and last character in GUI_FONT_PROP_EXT.
    Could you please explain in more detail please?

    I managed to convert Arial into .c file using Font Converter. However I still don't understand how compiler knows that a given font code corresponds to a given character, i.e. I'm trying to print out an exclamation mark (0x0021) but it isn't working.

    Thanks
  • Hi,

    When creating a font with the Font Converter you will see gabs between the different character 'blocks'. Those gabs have a grayish background and characters inside the font have a white background.

    When using Arial the first block of characters starts at 0x20 (first character) and ends at 0x7E (last character). The next block will be from 0xA0 to 0x36F.

    If you want to display a string emWin searches through the different blocks until it finds the desired character.

    For an exclamation marks emWin would already stop in the first block since the exclamation mark is between 0x20 and 0x7E.

    How did you tried to display the exclamation mark?

    Try:

    C Source Code

    1. GUI_DispChar('!');

    or

    C Source Code

    1. GUI_DispString("!")


    Regards
    Sven
    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.
  • Hi there
    Thanks for the quick reply.

    So I tried displaying exclamation mark as follows and none of the options works:


    uint16_t c;
    c = 0x0021;
    c = '!';
    c = "!"; // does not even compile "char*" cannot be assigned to an entitiy of type "unit16_t"
    GUI_StoreKeyMsg(c, 1); // Pressed state.
    GUI_StoreKeyMsg(c, 0); // Released (unpressed) state.

    Similarly, quotation mark isn't working.
    Any idea?
    Thanks
  • Hi,

    I guess you are mixing something up here.

    The function GUI_StoreKeyMsg() is not for displaying any characters or strings.

    If you want to display a character try this:

    C Source Code

    1. void MainTask(void) {
    2. U16 c = '!';
    3. const char ac[] = "!";
    4. GUI_Init();
    5. GUI_DispChar(c);
    6. GUI_DispNextLine();
    7. GUI_DispChar(0x0021);
    8. GUI_DispNextLine();
    9. GUI_DispString(ac);
    10. while (1) {
    11. GUI_Delay(100);
    12. }
    13. }
    Display All


    Regards
    Sevn
    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.
  • The ! and " characters not being displayed in Edit box when using the GUI_StoreKeyMsg() function

    Hi,

    I am using the very recently released version of STemWin to prototype an application.

    I was reading through this thread and I believe the issue is related to a problem I have also been experiencing.

    I have implemented an 'onscreen soft keyboard' for my touch screen application to enable the entry of text into edit boxes throughout the application. It works perfectly for all characters except the symbols ! and ". I am delivering the messages to the Edit box first by setting focus to the appropriate Edit box and then by using the GUI_StoreKeyMsg() function.


    Here is a code snippet from my keyboard window callback:

    C Source Code

    1. case WM_NOTIFICATION_RELEASED:
    2. if(Id < ID_BUTTON_36) {
    3. hItem = WM_GetDialogItem(pMsg->hWin, Id);
    4. BUTTON_GetText(hItem, tmp, sizeof(tmp));
    5. c = tmp[0];
    6. WM_SetFocus(kb_dest);
    7. GUI_StoreKeyMsg(c, 1);
    8. GUI_StoreKeyMsg(c, 0);
    9. }
    10. break;


    I have debugged this piece of code for the characters ! and ", the variable c is being set with the appropriate character code but no character appears in the Edit box. As I mentioned before all other characters appear okay in the Edit box, this being all alpha, upper and lower case, numbers 0-9 and all other symbols.

    This suggests the GUI_StoreKeyMsg() function appears to failing for the ! and " characters for some reason?

    Please would you be kind enough to advise, it seems like a bug in the function, unless I'm missing something?

    Thank you.

    Kind Regards,

    Pete
  • Hi,

    Unfortunately, the values 0x21 and 0x22 are used for GUI_KEY_PGUP and GUI_KEY_PGDOWN.

    You can get around of this by calling EDIT_AddKey(hItem, 0x21) and EDIT_AddKey(hItem, 0x22).

    Regards
    Sven
    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.