Fonts Fonts Font... !

skipsy

Member
Licensed User
Longtime User
Hi folks,

I used to have a problem with french characters (accents, euro etc...) when creating a CSV file.
I have solved this using "Windows-1252" as encoding option in TXT_WRITE.Initialize2

Now I have the same problem creating a PDF (with the PDF writer lib).
I don't understand how to do this.
In
B4X:
MYPDF.setFont(FONT.SUBTYPE, FONT.COURIER_BOLD)
I can't find information about the first parameter "FONT.SUBTYPE".Is it the one to set ??
So Iam wondering... Is there any way to use other alphabet with this library...

Any idea ??
Thks,
William.
 

skipsy

Member
Licensed User
Longtime User
Oups...
Forgot to mention that I have also tried different encoding parameters with :
B4X:
MYPDF.outputToFile(SDCARD_PATH, "TEST.PDF", PDFContent, "ISO-8859-1")

ISO-8859-1 does not work
ISO-8859-15 does not work
Windows-1252 does not work
UTF-8 does not work (adobe reader says : file corrupted)

:BangHead:

WW
 
Upvote 0

Locutus

Member
Licensed User
Longtime User
I am having the same problem with Turkish fonts and most probably will also with other languages. So far I have found that you need to use setFont2 and specify the encoding as WIN_ANSI_ENCODING then specify the encoding in outputToFile (ie. ISO-8859-XX). Testing with different encodings produces different results including UTF-8 (using adobe reader on android does not say file corrupted).

I have come to the conclusion that the PDFStandardFonts do not support any other character set besides ANSI. Which can be tested by looking at the properties of the generated PDF file.

The closest I have come is using the ISO encoding for the Turkish character set (ISO-8859-9) however some of the special characters do not display correctly in a manner that shows the font used in the PDF creation does not have the correct glyphs (same problem with console fonts in *nix operating systems).

This can be fixed by using a different typeface which has the correct glyphs in PDF creation but I have so far been unable to figure out how to use custom fonts in the PDFWriter library.

If anyone can tell us how to use custom fonts in the PDFWriter library they win the internet in my book :) Please, tell us how to use custom fonts in creating a PDF.
 
Upvote 0

GudEvil

Member
Licensed User
Longtime User
This can be fixed by using a different typeface which has the correct glyphs in PDF creation but I have so far been unable to figure out how to use custom fonts in the PDFWriter library.


also looking for same..

did u find a solution??
 
Upvote 0
Top