No announcement yet.

Custom Fonts

  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Fonts

    I need to show text with a big font, so I follow 4D-AN-P3001/Displaying Third Party Fonts, and works... sometimes...
    If I use FONT3, works fine, but with custom font, sometimes no image is displayed.
    When I use custom font, is it readed from uSD ?
    (I need to redraw it 1 or 2 times per second)

  • #2

    Custom fonts reside on uSD, each character is read off uSD as required.

    Have you tried a different uSD?

    How are you powering the display? If power is marginal the uSD will be the first to 'malfunction'.


    • #3

      My uSD is a Samsung 4Gb class 4. May be class 6 better ?
      Is there any way to load it into ram?


      • #4

        If the font is small enough, then it can be included with your program.

        The Class of the uSD card is almost irrelevant when the uSD card is accessed in SPI mode, which is how it is accessed by the display.


        • #5

          If the font is small enough, then it can be included with your program.


          • #6

            There are a few examples in the Goldelox Designer 'General Examples' folder, 'Goldelox_propfonttest' is one.

            You create those fonts using FontTool


            • #7

              Works great !!!


              • #8

                I have a question, I saved some custom fonts to the usd card fat partition, when I try to load a sub-program that uses these fonts the system crashes, no error code, the program just restarts. I suspect a memory issue so I used mem_free to see how much memory was left in the stack for my called programs. It showed that there was over 6K and the program is just 5K. Is there a lot of overhead associated with using the fonts stored in the fat partition? I have also tried the method of storing a font in the non-fat partition, but I don't get the correct letter displayed because of offset issues. The program works fine if it is a stand alone program, its just when I try to call it from another that these issues pop up.

                my code in the called program looks like this:

                hFont1 := file_LoadImageControl("AddFonts.da1", "AddFonts.gc1", 1);
                hFont2 := file_LoadImageControl("AddFonts.da2", "AddFonts.gc2", 1);
                hFont3 := file_LoadImageControl("AddFonts.da3", "AddFonts.gc3", 1);
                hFont4 := file_LoadImageControl("AddFonts.da4", "AddFonts.gc4", 1);
                hFont5 := file_LoadImageControl("AddFonts.da5", "AddFonts.gc5", 1);
                hFont6 := file_LoadImageControl("AddFonts.da6", "AddFonts.gc6", 1);
                hstrings := file_Open("AddFonts.txf", 'r') ;

                Thank you for your help,



                • #9

                  The overhead is just slightly (28) bytes more than what it takes to open a fat file (576? bytes).

                  If it was raw, you'd save the 576 off bytes for each, but not the 28, I think.

                  How did you try to copy the .gcx files to the RAW partition?


                  • #10

                    When I try to copy to the non-fat partition I create a gci file using the font tool, and a dat file using the workshop, then I write it using a script. Then from the command prompt : scriptc writeusdfonts.4dscript. The script looks like this:


                    then from the program:

                    Ihndl := file_LoadImageControl("FontA.DAT", "", 2);
                    unicode_page(0x0000, 0x00FF, 0x20);


                    • #11

                      I think so, if yo don't use Unicode_page in your FAT code, then you don't need it in your RAW code.

                      What you need to do is use a different .dat file for the RAW code.

                      It's the .dat file that says where the font is located.


                      "anyname" 0200 3B50 00 00 // address of start of font

                      The 0200 3B50 is the address where the font is located.

                      In this case the font starts at sector 1943553, we need to convert that into a byte address and hex.

                      1943553 * 512 = 995099136 = 0x3B500200
                      Split that into 2 halves (0x3B50 0x0200) and swap


                      • #12

                        So what you are saying is that if I get rid of the unicode statement and use that address statement then it should work as intended. Even for multiple fonts? Since I am having problems loading the fonts from my called programs with the gci method then this might be the way to go.

                        Thank you


                        • #13

                          Yep, I'm pretty sure it will then work


                          • #14

                            I'm having a similar issue and I don't understand how to make or were to get the additional .daX and .gcX files not given in with the 4D-AN-P3001 application note. I've been trying to use Arial Rounded MT Bold, size 100, ANSI and I just can't get it to work. I think if I make or add a AddFonts.da3 and AddFonts.gc3 will fix my issue. Can someone tutor me how?


                            • #15

                              Workshop generates and builds the additional .daX and .gcX files (fonts) for you when you specify them in a strings object and build your application.

                              I'm not sure what bit you are missing out on?

                              Does the app note work for you at all?

                              Perhaps zip up your resulting project and attach it here