No announcement yet.

Picaso Change Fonte Size

  • Filter
  • Time
  • Show
Clear All
new posts

  • Picaso Change Fonte Size

    I'm trying to change the font size on a Picaso µLCD-P43. I have already read and used the Application Notes. I created a "Strings-Widget", set my font there (ARIAL 40) and want to use the "hfont1" variable for the print () function.
    My problem is that in my project, a standard font is also used in the example projects such as "Add Fonts” and "Fonts Only". The .g01 and .d01 and the .txf files can be found on the SD card.
    Is there a difference to grogram on RAM, Flash or µSD?
    Da I need to put the fontfile on the SD-Card by my own?

    Here the Code:

    #platform "uLCD-43P"

    // Program Skeleton 1.4 generated 06.11.2020 10:03:41

    // #MODE RUNFLASH uncomment and set Destination to Flash to run from Flash, refer 4D-AN-00055

    #inherit "4DGL_16bitColours.fnc"
    #inherit ""

    #inherit ""

    #inherit ""

    var CounterActual[2];
    var PrintPointer;
    func main()
    var hstrings ; // Handle to access uSD strings, uncomment if required
    var hFont1 ; // Handle to access uSD fonts, uncomment if required and change n to font number
    // Uncomment the following if uSD images, fonts or strings used.
    var i;

    if (!(file_Mount()))
    putstr("Drive not mounted...");
    // gfx_TransparentColour(0x0020); // uncomment if transparency required
    // gfx_Transparency(ON); // uncomment if transparency required

    hFont1 := file_LoadImageControl("NF_UMB~1.da1", "NF_UMB~1.gc1", 1); // Open handle to access uSD fonts, uncomment if required and change n to font number dropping a and c if > 9
    hstrings := file_Open("NF_UMB~1.txf", 'r') ; // Open handle to access uSD strings, uncomment if required
    hndl := file_LoadImageControl("NF_UMB~1.dat", "NF_UMB~1.gci", 1);


    // Strings1 1.1 generated 06.11.2020 10:05:46
    txt_FontID(hFont1) ; // Font index correct at time of code generation
    txt_FGcolour(WHITE) ;
    txt_BGcolour(BLACK) ;

    gfx_MoveTo(232 , 32) ;
    //i := 1;
    //PrintDisk(hstrings, Strings1StartH, Strings1StartL, Strings1Size, i) ; // where i is Message 0 - Strings1Count-1

    CounterActual[0] := 1993;
    CounterActual[1] := 1993;
    PrintPointer := str_Ptr(CounterActual);
    str_Printf(&PrintPointer, "%ld");

    Thanks for your help
    Attached Files

  • #2
    Hi Flx,

    When using two different fonts in one project, you may use the function txt_FontID(id), where id is the font style or font handle (if font is located in the uSD).

    For example:

    txt_FontID(hFont1);  //use font located in the uSD
    print("Hello 4D!");
    txt_FontID(FONT1) ; // use system font 
    print("Hello 4D Systems!");

    The fontfiles .dan and .gcn are automatically generated and saved to uSD when you select the option uSD during code "Build".

    For more information about this, you may read this application note: 5Bdifficulty%5D=&AppNoteSearch%5Btopic%5D=

    The difference between programming to RAM and FLASH is that after power cycle, RUN from RAM programs will be cleared while RUN from FLASH programs will be retained. To know more about RAM, FLASH and uSD, you may read these forum posts and application note: Bdifficulty%5D=&AppNoteSearch%5Btopic%5D=

    I have attached a sample code for you to try. This is derived from your attached code. It only shows how to print two texts in different font styles. Also included is the PrintDisk() function that is used for printing strings.

    Hope this helps and Best Regards,
    Attached Files