Extra background color length

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

    • Extra background color length

      Hi,

      I am using functions given below to display a string with background color. I want background color length corresponding to string length but in the end of string some extra length ( 1 character) of background color is coming. Please suggest solution to this problem.

      GUI_SetBkColor(GUI_RED);
      GUI_SetColor(GUI_BLACK);
      GUI_RECT pHRect={85,430,380,465}; //10/7/2019{95,435,383,465};
      GUI_DispStringInRectEx(dispHighPriW,&pHRect,GUI_TA_VCENTER|GUI_TA_HCENTER, strlen(dispHighPriW), GUI_ROTATE_0);

      Regards
      Gaurav Aggarwal
    • Hi,

      I can't reproduce the behavior. With the code below I can display the string with a red background ending pretty much directly with the last character. I had to adapt the GUI_RECT because it didn't fit on my screen.

      C Source Code

      1. /*********************************************************************
      2. *
      3. * MainTask
      4. */
      5. void MainTask(void) {
      6. char dispHighPriW[] = "Hello World";
      7. GUI_RECT pHRect={85,20,380,45}; //10/7/2019{95,435,383,465};
      8. GUI_Init();
      9. GUI_SetBkColor(GUI_RED);
      10. GUI_SetColor(GUI_BLACK);
      11. GUI_DispStringInRectEx(dispHighPriW, &pHRect, GUI_TA_VCENTER|GUI_TA_HCENTER, strlen(dispHighPriW), GUI_ROTATE_0);;
      12. while (1) {
      13. GUI_Delay(100);
      14. }
      15. }
      Display All
      Are you using a stock font of emWin or a font created with the Font Converter?

      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,

      I can't say if this is related to the font.
      I don't have the font.

      Is it possible to send me the font?
      If this is a free font, where can I download it?

      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.
    • I am attaching font converter. Please check.

      When you run .exe file it will open. One pop up window will come whatever default settings are there use same settings.

      Font Verdana
      Font Size 35

      Save this file as a .c file.

      Regards
      Gaurav
    • Hi,

      I gave it a try and it is working fine.

      Which version of emWin are you using?

      It might be that there was bug in an older version and is fixed now.
      Try to get access to a more recent version.

      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.