4D SYSTEMS FORUM

Register New Posts
 
 
 


Reply
 
Author Comment
 
pgerlach

Registered: 26/05/12
Posts: 19
Reply with quote #1 
Hello,

embedding a custom font in a 4dgl program takes a lot of space (more than 10kb in my case - big font), so I cannot really afford to do so. I would like to load my font from my SD card. For the moment I have everything on a FAT16 partition, and according to this thread I can load a font from there.
However, I don't have "GCI font file" in the export options of FontTool.exe. I suspected a version problem, and in the screenshot in the thread the version is 0.2.0.3, whereas mine, which I just downloaded from the website, is 0.1.0.3. Where can I get the new version ?

Thanks


__________________
pierre
ESPsupport

Moderator
Registered: 27/01/09
Posts: 4,254
Reply with quote #2 

The new version is in this file http://www.4dsystems.com.au/downloads/Share/unicode%20font%20demo%2021022011.zip

pgerlach

Registered: 26/05/12
Posts: 19
Reply with quote #3 
Great, thank you. Is there a reason why this is not the version supplied in the downloads pages ?
__________________
pierre
ESPsupport

Moderator
Registered: 27/01/09
Posts: 4,254
Reply with quote #4 

That version was only had the new functionality tested.

 

Thus we didn't want to replace it until the original functionality had been tested, and then things fell through the cracks

pgerlach

Registered: 26/05/12
Posts: 19
Reply with quote #5 
Thank you.

If I understood well, I can't load a font directly from a FAT16 partition : I have to write it to a RAW partition, and put a DAT file in the FAT16 partition. Am I correct ?
I'm a bit confused about how the setup of my SDCard has to be. Does the FAT16 partition have to be the first or the second ? Or when I do a file_Mount() in 4dgl, does it mount the first FAT16 partition, regardless whether it is the first or not ? 

Also, how to I know the addresses where to write my GCI file and to put in the DAT file ? In the example DemoUnicodeFromFat16 (in the zip file you gave me in the link above) I see "$writePCuSD('Arial20U.GCI','I:',preserve,1955841)" (so, write the file Arial20U.GCI to SDcard at the address 1955841). After that, the DAT file is "ARIAL20" 0200 3BB0 0000 0000. Where does "0200 3BB0" come from, as it is not HEX(1955841) as I would have expected ...

Well, as you can see, I'm a bit lost ...

__________________
pierre
ESPsupport

Moderator
Registered: 27/01/09
Posts: 4,254
Reply with quote #6 

Not sure why you thought you can't load a font directly from a FAT16 partition, there is an example using FAT16 and an example for RAW.

 

Windows will only recognise the First partition on a uSD, so the FAT16 partition must be first. file_Mount() 'follows' Windows 'working'.

 

1955841 is the sector address, 0200 3BB0 is 0x3BB00200 and is the byte address, i.e. 512 * the sector address

 

pgerlach

Registered: 26/05/12
Posts: 19
Reply with quote #7 
The reason why I thought I could not load a font from the FAT16 partition is because of this comment at the beginning of DemoUnicodeFromFat16

Quote:
// Note that image control mode 1 cant be used - it will just default to internal FONT1 as
// a savety net if used. for MODE 0, the file would be opened/close for each write of a
// character which makes it unusable as it would be extremely slow.

So I thought :
" - mode 0 can't be used
 - mode 1 can't be used
so we're stuck with mode 2, thus RAW mode."

Anyway, now that I've tried it, it works Thanks

__________________
pierre
pgerlach

Registered: 26/05/12
Posts: 19
Reply with quote #8 
(well, it "works", but with the same problem as in this thread ...)
__________________
pierre
meldavia

Registered: 18/03/07
Posts: 900
Reply with quote #9 
PmmC version 2.9 will be released shortly, it will fix that problem.
This issue was a bug that emerged in 2.8
Here is part of the 2.9 release notes that pertains to your problem:-

Memory for font storage is now dynamically allocated, allowing very large user defined characters
    to be used. Previously, the allocation was only fixed 64 bytes, limting character size to a 512 pixel
    array which limited character size to approx 22 pixels square.
    The tradeoff for this is that you cannot allocate the entire amount of memory returned by mem_Heap(),
    so allow 32 bytes for the internal fonts, adjusting this amount accordingly if you have custom larger
    fonts.



__________________
Regards,
Dave
pgerlach

Registered: 26/05/12
Posts: 19
Reply with quote #10 
Great. However, I have to finish my project on monday. So, would it be possible to either get a pre-release of the PmmC version 2.9, or get a link to the PmmC version 2.7 ?

Thanks

__________________
pierre
meldavia

Registered: 18/03/07
Posts: 900
Reply with quote #11 
What display are you using ?


__________________
Regards,
Dave
pgerlach

Registered: 26/05/12
Posts: 19
Reply with quote #12 
I'm using a uLCD 24 (http://www.4dsystems.com.au/prod.php?id=147) , currently loaded with PmmC version 2.8
__________________
pierre
meldavia

Registered: 18/03/07
Posts: 900
Reply with quote #13 
Ok np, theres a couple of different 24's - one of these should work for you.

 
Attached Files:
zip uLCD-24-R29.zip (109.13 KB, 7 views)

__________________
Regards,
Dave

pgerlach

Registered: 26/05/12
Posts: 19
Reply with quote #14 
Thanks a lot ! I'm gonna try it right now. 
The version number on the back of my display is 
S I R20
220212

I'll give you feedback thanks !

__________________
pierre
pgerlach

Registered: 26/05/12
Posts: 19
Reply with quote #15 
Quick report :

1/  the DemoUnicodeFromFat16 example of http://www.4dsystems.com.au/downloads/Share/unicode%20font%20demo%2021022011.zip works again with this PmmC 2.9

2/ I still have problems with my fonts using the FontTool 0.2.0.3, and exporting this way : launching the tool, choosing my font, choosing block "Traditional", setting font height to 18, then clicking "Export", selecting "save as type GCI", then selecting "Pages: All", and exporting. In my program I include Unicode.inc, and select the font with F_Traditional_0x20_0xFF. I print "HELLO WORLD" and it displays "hello@world". 

3/ If I follow the same steps as before but select "Pages: current", the exact same GCI file is generated as when I choose "pages: All". So, same problem.

4/ If I choose the block "All" and export with "Pages: All" everything works ! (except for the euro sign, but I may investigate that later, that's little business compared to the rest). But the generated font file is 41M, and I suspect (but am totally unsure) that loading "all" takes more memory than loading only what I need.

5/ If I choose the block "All" and export with "Pages: Current", FontTool crashes.

Given all these steps, I suspect that now the problem is more related to FontTool, am I right ? Is there anything I can upload that would help you ?

Regards

__________________
pierre
ESPsupport

Moderator
Registered: 27/01/09
Posts: 4,254
Reply with quote #16 

2,3 I think if you specified F_Basic_Latin in your code it would work better.

 

4. The amount of memory used is related to the number of fonts, not the number of characters in them.

 

Use the Windows 'Character Map program' to view the font you have chosen, find the Euro symbol in that font and then make sure that that is the character you are trying to 'print'. (Windows tries to 'help you' by changing the character you have specified if it thinks it needs to, sometimes even changing the font 'for you', Picaso, simply displays what you tell it to)

skatouch

Registered: 02/05/12
Posts: 66
Reply with quote #17 
Please, do your best to solve the problems encountered.
because we need to show the touch screen during a meeting but this can be done only if we are able to add the custom font.
I had to include in my code the FONT4(3.1KB), if I exclude this from my code I will free a lot of space, and i solve a lot of problems.
Can you give me a beta version of R29 PmmC? 
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Powered by Website Toolbox - Create a Website Forum Hosting, Guestbook Hosting, or Website Chat Room for your website.