Page 1 of 2

PDF fonts for central eupean languages

Posted: Fri Feb 09, 2007 11:59 am
by H13
This is an instruction how to create PDF document with Latin 2 characters under Joomla! 1.5  (I have tried only CZECH language, but I think, other central European languages - Czech, Slovak, Croatian, Slovenian, ... - will work too)

1. Create new ufm file e.g. freemono - ttf2ufm -a -F freemono.ttf - you need ttf2ufm.exe in joomla/libraries/tcpdf/tools
2. Attention - ttf2ufm.exe creates ufm file with error: Character "Ċ" instead of "č". You need to edit this ufm file:

Change this code from:
U 266 ; WX 600 ; N Cdotaccent ; G 204 ;
U 269 ; WX 600 ; N ccaron ; G 207 ;


to:
U 266 ; WX 600 ; N Cdotaccent ; G 207 ;
U 269 ; WX 600 ; N ccaron ; G 204 ;


(Changing values: Cdotaccent -> ccaron, ccaron -> Cdotaccent - you must change G values and WX values too, if they are different)
It is only example. Some ufm files doesn't contain "Cdotaccent" but only "Cdot". If you need "Ċ", don't do this change (Thanks karol.cejka for his advice)

At the end, you create freemono.php , freemono.z, freemono.ctg.z: php -q makefontuni.php freemono.ttf freemono.ufm - you need makefontuni.php in joomla/libraries/tcpdf/tools
and you copy this files (freemono.php , freemono.z, freemono.ctg.z) to joomla/language/pdf_fonts/

Don't forget to change your language xml file (e.g cs-CZ.xml in joomla/language/cs-CZ/):

Code: Select all

<pdfFontName>freemono</pdfFontName>
And it should work.  :P

Re: PDF fonts for central eupean languages

Posted: Fri Feb 09, 2007 1:41 pm
by infograf768

Re: PDF fonts for central eupean languages

Posted: Fri Feb 09, 2007 1:52 pm
by H13
infograf768 wrote: Thanks H13,
Please have alook here
http://forge.joomla.org/sf/frs/do/viewR ... .pdf_fonts
I don't understand. There are fonts, they don't support latin 2 languages?

Re: PDF fonts for central eupean languages

Posted: Fri Feb 09, 2007 1:54 pm
by infograf768
all utf8, see the list I posted in the other thread concerning their usage.

Re: PDF fonts for central eupean languages

Posted: Fri Feb 09, 2007 2:00 pm
by karol.cejka
ttf2ufm have a bug. H13 have pretty cool hack/update for Czech / Slovak language.

Re: PDF fonts for central eupean languages

Posted: Fri Feb 09, 2007 2:11 pm
by infograf768
Could you specify which glyphs are available for that font and advantages compared to those already provided?

We may just include the new font on Forge.

Re: PDF fonts for central eupean languages

Posted: Fri Feb 09, 2007 2:33 pm
by H13
It is not so easy.

Fonts in forge.joomla.org don't support Czech/Slovak/...(Latin 2) languages (or they do but not correctly).

If we create new font with help of ttf2ufm, it supports Czech/Slovak/... languages but ttf2ufm have a bug and PDF document shows "Ċ" instead of "č". We can hack it and PDF document will show it correctly. But character "Ċ" will be missing. Czech and Slovak languages don't need this character "Ċ", so it is all right. But there can be languages (I don't know), they need both characters "Ċ" and "č" and this can be problem. This solution isn't 100% for some Latin2 languages.

Re: PDF fonts for central eupean languages

Posted: Fri Feb 09, 2007 3:27 pm
by H13
This hack can be used in the following languages (They contain character "č") : Lithuanian, Latvian, Croatian, Slovenian, Slovak, Czech, ...

Re: PDF fonts for central eupean languages

Posted: Fri Feb 09, 2007 4:15 pm
by inglia
Yes I've had the same problem with every font I compiled.
Thank you for the solution, I'll try it later and report back.

all utf8, see the list I posted in the other thread concerning their usage
Jean-Marie, I've read those threads several times and it looks to me that included Vera font should work for latin2 range of languages. Am I wrong about this?

Re: PDF fonts for central eupean languages

Posted: Sat Feb 10, 2007 6:14 am
by infograf768
UNhappily I am not the specialist on these matters.
At reading David's post, this is what we get for Vera:
Specifications for Vera font - this font is suitable for Western and Central European languages
Bitstream Vera Sans :
Basic Latin (95 out of 128 characters)
Latin-1 Supplement (96 out of 128 characters)
Latin Extended-A (20 out of 128 characters)
Latin Extended-B (1 out of 194 characters)

Spacing Modifier Letters (8 out of 80 characters)
Greek and Coptic (2 out of 124 characters)
General Punctuation (15 out of 106 characters)
Currency Symbols (1 out of 22 characters)
Letterlike Symbols (1 out of 77 characters)
Mathematical Operators (14 out of 256 characters)
Geometric Shapes (1 out of 96 characters)
Alphabetic Presentation Forms (2 out of 58 characters)
So it looks like some characters are missing indeed.

Re: PDF fonts for central eupean languages

Posted: Sat Feb 10, 2007 1:10 pm
by H13
Jean-Marie, Vera font (forge.joomla.org) doesn't support Central European languages. There (forge.joomla.org) are other fonts, they support Central European languages but they contain error. This error ("Ċ" instead of "č") affects following languages:

- Lithuanian
- Latvian
- Croatian
- Slovenian
- Slovak
- Czech.

There are three possibilities how we can solve it:

1. We do nothing. Every user will create own font.
2. Somebody repair a bug in ttf2ufm (there is a source code).
3. We will create special font for affected languages.

???

Re: PDF fonts for central eupean languages

Posted: Sat Feb 10, 2007 4:07 pm
by infograf768
H13, I would not know how to repair that ttf2ufm file.

If there are errors in the files present on Forge (which specific files please?), do you think you could correct them and let me know when available?
I will be pleased to replace the buggy ones with the corrected ones so as to let all Partners and users have access to them..

Thanks for your support.

Re: PDF fonts for central eupean languages

Posted: Sat Feb 10, 2007 4:58 pm
by H13
Vera – doesn't support: č, ď, ě, ň, ř, ť, ů, Ď, Ě, Ň, Ř, Ť, Ů (Czech characters) – this font doesn't support Latin 2 characters

DejaVuSans – supports Latin 2 characters but with one error ("Ċ" instead of "č")
CyberBase - supports Latin 2 characters but with one error ("Ċ" instead of "č")
FreeSans - supports Latin 2 characters but with one error ("Ċ" instead of "č")
Romanuni - supports Latin 2 characters but with one error ("Ċ" instead of "č")
FreeSerif - supports Latin 2 characters but with one error ("Ċ" instead of "č")
Cyberbit - supports Latin 2 characters but with one error ("Ċ" instead of "č")
CyberCJK - supports Latin 2 characters but with one error ("Ċ" instead of "č")

But I can't correct these files, I can replace "Ċ" by "č". It is solution for discussed languages. If I do it, character "Ċ" will be missing and this can cause problems in other languages  ???

Re: PDF fonts for central eupean languages

Posted: Sat Feb 10, 2007 6:33 pm
by infograf768
Understood now fully.

I'll ask if this glyph is used or not by any of our Translators.

Re: PDF fonts for central eupean languages

Posted: Sat Feb 10, 2007 6:37 pm
by H13
That is great. ;)

Re: PDF fonts for central eupean languages

Posted: Sat Feb 10, 2007 6:51 pm
by infograf768
Last question:

Have you tried the last releases of Unicode GPL fonts (december 2006):
http://download.savannah.gnu.org/releases/freefont/

I am asking because David did the job before these were released.

Re: PDF fonts for central eupean languages

Posted: Sat Feb 10, 2007 7:45 pm
by H13
Now I have tried it. The outcome is the same because there isn't problem in ttf (font) but in the ttf2ufm.exe.
ttf2ufm.exe creates ufm file with error.

Re: PDF fonts for central eupean languages

Posted: Sun Feb 11, 2007 8:10 am
by infograf768
I may have good News for you all.
tcpdf library has been updated last night and we also get a new font package.
I tested the Ċ and č and it looks like working.

Please install last SVN (6576+) and download these new fonts

http://forge.joomla.org/sf/frs/do/downl ... s8747?dl=1

Waiting for your feedback

Re: PDF fonts for central eupean languages

Posted: Sun Feb 11, 2007 1:17 pm
by H13
Jean-Marie, m'incliner devant toi.

It works great! The following code in tcpdf class is the solution:

Code: Select all

function _escape($s) 
{
     // the chr(13) substitution fixes the Bugs item #1421290.
     return strtr($s, array(')' => '\\)', '(' => '\\(', '\\' => '\\\\', chr(13) => '\r'));	
}
Thank you very much.

Re: PDF fonts for central eupean languages

Posted: Sun Feb 11, 2007 2:13 pm
by infograf768
All the merit goes to Louis Landry...
I happened to bug him about this as he was just committing the new library, explaining what was our problem.
I tested on the fly, that's all.  :D

Re: PDF fonts for central eupean languages

Posted: Sun Feb 11, 2007 4:28 pm
by H13
I don't thank you for the solution (thanks to Louis Landry), I thank you for the output.  :)

Re: PDF fonts for central eupean languages

Posted: Sun Feb 11, 2007 4:52 pm
by infograf768
inglia wrote: Jean-Marie, I've read those threads several times and it looks to me that included Vera font should work for latin2 range of languages. Am I wrong about this?
I have not tested Vera fully, Inglia, but Vera  for sure does not display the Ċ

Re: PDF fonts for central eupean languages

Posted: Sun Feb 11, 2007 5:36 pm
by inglia
It's not important any more, Vera was just confusing because it has all the glyphs (for hr) but not all of them are represented with both lowercase and uppercase variant.

Thank you, all 3 of you, for the solution  :)

Re: PDF fonts for central eupean languages

Posted: Thu Jun 21, 2007 4:07 pm
by enoreth
Hi to everyone in this forum.
I'm working with tcpdf and the pdf files that we create are about 240K, The pdf files come with Unicode support for Latin 2 characters. My question is how can we make the files smaller.

Re: PDF fonts for central eupean languages

Posted: Thu Jun 21, 2007 7:23 pm
by H13
I have the same problem. I think, PDF document saves all utf-8 characters in font, because if I create PDF with e.g. Vera fonts, it takes 70 KB but without characters I need.

Re: PDF fonts for central eupean languages

Posted: Fri Jun 22, 2007 8:39 am
by enoreth
In FPDF also the father of TCPDF it is possible too convert fonts with different encodings and only the subsets for the needed languages. the unneeded chars in map files can be deleted. The font files are therefore smaller and smaller PDF files can be created.

Does anyone have an idea if the same can be achieved with tcpdf? I tried to convert fonts with subsets, the converted font files were as big as normal converted fonts.

Re: PDF fonts for central eupean languages

Posted: Sun Aug 05, 2007 3:44 pm
by pajonkhfat
H13: Considering that your conversation about PDF fonts generating for central eu languages took place in march, i assume that fix was already implemented in RC1. I found the same problem with polish language. Instead of ¶æñ¼¿± etc. I have squares in PDF. Do you have any solution for that already or I need to wait for full polish translation project finish?

Re: PDF fonts for central eupean languages

Posted: Sun Aug 05, 2007 4:04 pm
by H13
Pajonkhfat,

Try to change font, because Vera (default PDF font for Joomla!1.5) doesn't support central European languages (Latin2). Now I use FreeSans and I have no problems with PDF creating. I think, FreeSans contains polish characters too.

Re: PDF fonts for central eupean languages

Posted: Wed Aug 08, 2007 8:38 am
by pajonkhfat
H13 wrote: Pajonkhfat,

Try to change font, because Vera (default PDF font for Joomla!1.5) doesn't support central European languages (Latin2). Now I use FreeSans and I have no problems with PDF creating. I think, FreeSans contains polish characters too.
Thanks for help. I've got freesans.php, freesans.ctg.z, freesansbold.z and freesansbold.ctg.z in my joomla/language/pdf_fonts/ directory. One more thing. How I can force joomla fpdf to use freesans instead of vera fonts? ??? I could rename it to vera and overwrite old vera files, but it does not seems to be the best way for me :)

Re: PDF fonts for central eupean languages

Posted: Wed Aug 08, 2007 9:59 am
by ot2sen
Hi pajonkhfat,

Try change the folllowing in your site language pl-PL.xml
vera
to
freesans