Announcement

Collapse
No announcement yet.

12x16 font for uLCD-32PTU

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • tinvis
    started a topic 12x16 font for uLCD-32PTU

    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?

  • Vince_4D
    replied
    Hi,

    No worries.

    But if I have any problems, I will reactivate this thread.
    Sure thing, don't hesitate to ask.

    Best regards,

    Leave a comment:


  • tinvis
    replied
    Thanks a lot, Vince. I need to order a programming cable before I can test this out. But if I have any problems, I will reactivate this thread.

    Your assistance has been much appreciated!!

    Leave a comment:


  • Vince_4D
    replied
    Hi,

    Apologies for the delayed response.

    The issue you raised about the gfx_Button(...) is evident due to the format of the font file.
    The method that is proven to work in achieving your goal is by doing the following methods:
    Note: You will need Windows Machine to load the SPE once

    Load the Modified SPE (See attached file)

    The program inherits the FONT4.FNT and default Font is set to FONT4
    In line 8
    Code:
    #inherit "FONT4.FNT"
    In line 202
    Code:
      txt_FontID(FONT4) ;
    Define FONT4 in Arduino Code
    Code:
    #define FONT4 0x8007    // value of FONT4 in SPE program
    Initialise Text Font
    Code:
    Display.txt_FontID(FONT4);
    With this, you can now use the function gfx_Button(...) without issue.

    If you find any problem with this implementation, feel free to ask.

    Best regards,
    Attached Files
    Last edited by Vince_4D; 18th February 2019, 02:07 PM.

    Leave a comment:


  • tinvis
    replied
    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()?

    Leave a comment:


  • Vince_4D
    replied
    Hi,

    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:

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

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

    Leave a comment:


  • tinvis
    replied
    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?

    Leave a comment:


  • tinvis
    replied
    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!

    Leave a comment:


  • Vince_4D
    replied
    Hi,

    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, 12:11 PM. Reason: Revised

    Leave a comment:

Working...
X