No announcement yet.

12x16 font for uLCD-32PTU

  • Filter
  • Time
  • Show
Clear All
new posts

  • 12x16 font for uLCD-32PTU

    I am using the uLCD-32PTU module in a product I originally designed around the uLCD-32PT (now discontinued). I was using the large 12x16 font in my UI - but the uLCD-32PTU doesn't seem to have this font anymore. It only has 3 built-in fonts and the largest is 8x12. Scaling the smaller fonts over the serial interface can only be done by integer multiples, so it can't make a 12x16 out of an 8x12 (and it looks ugly anyhow). I know it is possible to generate custom fonts, and store them on the SD card, but I don't have a Windows machine to do this. Is there anywhere that a decent looking 12x16 font (or even the original 12x16 from the earlier modules) in a format that allows it to be stored on the SD card and loaded by the uLCD-32PTU via the serial interface can be downloaded? Or does anyone have another workaround for the now-missing large font size when controlling a uLCD-32PTU from e.g. an Arduino over serial?

  • #2

    If I may suggest, try using a Virtual Machine on your PC with Windows OS for you to utilize the Workshop4.
    Btw, may I ask what environment your project is being implemented?
    Font4 was part of the system font of the old SGC, so I'm guessing your implementation is now in an SPE.
    Fortunately, you can still use FONT4. You'll just have to inherit FONT4.fnt on your project file and use txt_FontID(FONT4) to utlize the font.
    FONT4.fnt is located on this directory - C:\Program Files (x86)\4D Labs\4D Workshop 4 IDE\INCLUDE\FONT4.FNT

    Hope this helps.
    Best regards,
    Last edited by Vince_4D; 15th February 2019, 01:11 PM. Reason: Revised


    • #3
      Hi Vince, thanks for the reply.

      The environment I am using is the Arduino serial libraries on stock unmodified uLCD-32PTU modules.

      The function command to change font in this library is txt_FontID(). It only accepts parameters of 0, 1 or 2. Parameters greater than 2 just select FONT1 (i.e. are treated as parameter value 0).

      I don't have a Windows VM either, is it possible to make the FONT4.fnt available for download or email it to me?

      Once I have the font file, how do I inherit it into my project if I am using the Arduino library? Does that need to be done using a Windows PC also?

      Thank you for your assistance!


      • #4
        Someone kindly sent me FONT4.FNT.

        Can you please walk me through the steps of installing this font so I can reference it from Arduino using txt_FontID()?

        Do I copy FONT4.FNT to the SD card? What serial command is used to load the font?


        • #5

          The FONT4.FNT file that was previously mentioned is not applicable on your end since you can't modify of WS4 project file.

          The method you can implement is by utilizing the function Display.file_LoadImageControl(...). Using this function needs two font files - font.dat and font.gci loaded in SD card.
          Unfortunately, I don't have the gci file for FONT4 but for the meantime, you can use Arial16 font file. See attached file.

          You can implement it as follows:

          word FONT4
          Main program
           FONT4= Display.file_LoadImageControl("Arial16.dat", "Arial16.gci", 1);
          If you find any issue, feel free to ask.

          Best regards,
          Attached Files
          Last edited by Vince_4D; 16th February 2019, 03:16 PM.


          • #6
            Thanks a lot, Vince.

            Unfortunately, this Arial font is very narrow. I really need a 12x16 font to make the user interface consistent with the existing product.

            In addition, I also have buttons in my UI using the larger font. However, when I pass the handle generated by file_LoadImageControl() to gfx_Button(), gfx_Button() returns an error and the button is not drawn properly. Can fonts from the SD card be used with gfx_Button()?