Announcement

Collapse
No announcement yet.

Picaso Change Fonte Size

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

  • Picaso Change Fonte Size

    Hello,
    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 "PrintDisk.inc"

    #inherit "VisualConst.inc"

    #inherit "NF_Umbau_NeuConst.inc"


    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;

    putstr("Mounting...\n");
    if (!(file_Mount()))
    while(!(file_Mount()))
    putstr("Drive not mounted...");
    pause(200);
    gfx_Cls();
    pause(200);
    wend
    endif
    // 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);


    gfx_Set(SCREEN_MODE,LANDSCAPE) ;

    // 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) ;
    //txt_Width(4);
    //txt_Height(4);

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

    repeat
    CounterActual[0] := 1993;
    CounterActual[1] := 1993;
    PrintPointer := str_Ptr(CounterActual);
    txt_MoveCursor(5,5);
    str_Printf(&PrintPointer, "%ld");
    forever
    endfunc


    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:


    Code:
    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: https://docs.4dsystems.com.au/app-no...AppNoteSearch% 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:
    https://forum.4dsystems.com.au/node/...5664#post65664
    https://forum.4dsystems.com.au/node/...8096#post68096
    https://docs.4dsystems.com.au/app-no...ppNoteSearch%5 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
    Eran

    Comment

    Working...
    X