use DroidSansFallback font, but PDF output in a mess

Phoca PDF - creating PDF documents in Joomla! CMS
baijianpeng
Phoca Member
Phoca Member
Posts: 27
Joined: 11 Nov 2007, 05:03

use DroidSansFallback font, but PDF output in a mess

Post by baijianpeng »

I think you know that those default fonts in Phoca PDF component can not handle Chinese language (utf-8 characters). So, I have to use a custom font.

In fact, this is not too difficult to find. Because we already have used DroidSansFallback font on Joomla 1.5 as the default pdf-font for zh-CN language. Now, I only need to pack it up as a font installer for Phoca PDF.

This is also not too difficult. I made a zip file containing my DroidSansFallback font files (DroidSansFallback.ctg.z, DroidSansFallback.php,
DroidSansFallback.z ). And I installed this font package via Phoca PDF's font installer.

Everything seems OK, right?

Then I clicked the PDF link in my article, the article has some Chinese words in it.

PDF file generated. But, when I open it, it was in a mess, there is no any readable text characters but some squeezed symbols.

I think this is a bug of Phoca PDF itself.

Why I am so sure? Becuase those 3 files of DroidSansFallback fonts, were exactly the files I had used on Joomla 1.5 for PDF generating. They can work fine on Joomla 1.5 (with TCPDF library then), but now can not work with Phoca PDF.

So I suspect that Phoca PDF has something wrong.

Please check this and fix it. Thanks.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: use DroidSansFallback font, but PDF output in a mess

Post by Jan »

Hi, please send me:
- the font you have made
- some of chinese text

per email so I can test it (unfortunatelly I don't speak chinese so really no idea if I can do there something) My language uses diacritics and only some fonts work in TCPDF with my language. So mostly people need to install the specific font like you have done but then it works Ok ... The problem is Phoca PDF does not render anything. Phoca PDF only prepares all the functions so TCPDF can render the PDF in Joomla!

- so the fonts included in Phoca PDF fonts packages are TCPDF fonts (no specific changes are done, there is no reason for doing some customization there)
- the rendering is 100% made by TCPDF (I have done only changes in paths to images, etc. etc.)

So, my work is not handling fonts or making rendering, this all is done by TCPDF (I have no logical reason to do something there). My work is to prepare easy way to set parameters, to load the fonts in Joomla! and manage them easily, to prepare all the content to be printed in TCPDF and a lot of different features which do not have any dependency to the rendering - so phoca sends the output to TCPDF and it renders it. Tested by many europan languages whith diacritics and mostly if there were problems, they were solved by changing the font.

Jan
If you find Phoca extensions useful, please support the project
baijianpeng
Phoca Member
Phoca Member
Posts: 27
Joined: 11 Nov 2007, 05:03

Re: use DroidSansFallback font, but PDF output in a mess

Post by baijianpeng »

Thank you for help me. But, which email address do you use? I checked the XML file of your component, there is no email information.

I think DroidSansFallback is a good choice because:

1. It is completely free, you can use it anywhere.
2. It was designed by Google, we all trust Google.
3. It can support English , Chinese, Japanese, and Korean characters at the same time!
4. It's TTF file is only 3.04MB, far more smaller than normal Chinese language fonts (usurally more than 6MB ).

Why supporting for Chinese language is so important? Because China has the most biggest population of Internet users, and I am sure a great large portion of the internet information will be in Chinese language soon.

I will send you the TTF file and the font package made by me. But first please tell me your email address, if you don't want to make it public, please send a short message to me : [removed becasue of security reasons] , thanks.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: use DroidSansFallback font, but PDF output in a mess

Post by Jan »

Why supporting for Chinese language is so important? Because China has the most biggest population of Internet users, and I am sure a great large portion of the internet information will be in Chinese language soon.
Hi, this is why I am asking about the sending the files to email, to test it, I don't live outside Earth to not know importance of Chinese language :-) :-) But as written for me it is hard to test it as I don't understand Chinese :-( so any help of someone who speak Chinese will be appreciated.

Send the email.

Thank you, Jan
If you find Phoca extensions useful, please support the project
baijianpeng
Phoca Member
Phoca Member
Posts: 27
Joined: 11 Nov 2007, 05:03

Re: use DroidSansFallback font, but PDF output in a mess

Post by baijianpeng »

hi, Thanks for your understanding and support.

I had sent you the DroidSansFallback font file and its corresponding font install package made by me.

You can copy some Chinese text from my website ( http://www.joomlagate.com ) to test with, this is very easy for you to compare the PDF output with the original page.

Hope you will solve this problem.

If you succeed, maybe you can include this DroidSansFallback font in your component package, because it supports English and other Latin characters very well, as well as Chinese and Korean and Japanese, wow, is there any other single font file that can support so many languages and is less than 3MB in size?

I wait for your good news.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: use DroidSansFallback font, but PDF output in a mess

Post by Jan »

Hi, I will do more tests but for now it seems that there were problems with the font files, this produces:


Code: Select all

    freemono.z (Array, 5 elements)
        length1 (Integer) 259616
        fontdir (Boolean) FALSE
        subset (Boolean) TRUE
        fontkeys (Array, 1 element)
            0 (String, 8 characters ) freemono
        n (Integer) 13
    freemonob.z (Array, 5 elements)
        length1 (Integer) 139624
        fontdir (Boolean) FALSE
        subset (Boolean) TRUE
        fontkeys (Array, 1 element)
            0 (String, 9 characters ) freemonoB
        n (Integer) 14
freemono font
and this:


Code: Select all

    DroidSansFallback.z (Array, 4 elements)
        length1 (Integer) 3189464
        fontdir (Boolean) FALSE
        subset (Boolean) TRUE
        fontkeys (Array, 2 elements)
            0 (String, 17 characters ) droidsansfallback
            1 (String, 18 characters ) droidsansfallbackB
    droidsansfallback.z (Array, 1 element)
        n (Integer) 13
droidsansfallback

where the first is missing n value. I will do more tests (and seems I will make a new release with Phoca PDF which will include newest version of TCPDF)

I will try to recreate the font.

Jan
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: use DroidSansFallback font, but PDF output in a mess

Post by Jan »

Ok, found it, the font was not correctly created, so I have recreated it, now it works Ok, see image:

Image

Please let me know which license the font is, so I can create new package and add it for free download (in case the font license will be Ok)

Thank you, Jan
If you find Phoca extensions useful, please support the project
baijianpeng
Phoca Member
Phoca Member
Posts: 27
Joined: 11 Nov 2007, 05:03

Re: use DroidSansFallback font, but PDF output in a mess

Post by baijianpeng »

I saw the your test result, that is correct Chinese characters!

Maybe I choose wrong method to produce those ctg/z files (sorry I am not a font pro so I don't know how to call them). I used a tool named "TTF2UFM" and run it on Windows 7 OS, then use php.exe inside my XAMPP for Windows to produce the php file for font.

Well, glad to see you got correct result. Maybe you can teach me how to convert a TTF font correctly to those ctg/z/php files?

I tried to find official announcement about the license of Droid Sans Fallback font, but I can find one. I was told that this font was created by Google and released under Apache 2.0 license, but now I can not find the official statement.

During the searching , I found another font built by a Chinese non-profit organization, based on Droid Sans Fallback font, and added more Chinese characters (untill then I did not know that in fact Droid Sans Fallback has not include ALL those Chinese characters).

That is great. This means, this new font is better than Droid Sans Fallback for Chinese language. Of course this new font can show Latin characters as good as Droid Sans Fallback does.

Since this new font was named in Chinese language "文泉驿微米黑", so I can not tell you its name in English.

This "微米黑" ( "文泉驿" is the name of organization, so we can just call the font "微米黑") font can be downloaded here:

[url]http://sourceforge.net/projects/wqy/files/wqy-microhei/[/url]

It was released under Apache license ( you can find the full license text file inside the downloaded package).

Alternatively, if you still love Droid Sans Fallback font, you need to find the latest version. During my search , I realized that the one I sent to you may not be the latest one. For example, I found a Khmer Version of Droid Sans Fallback here:

http://code.google.com/p/galaxy-nexus-k ... llback.ttf

This file is bigger than the one I sent to you, so it may contains more Characters.

Anyway, hope you will make a new font package which can render proper PDF doc for Chinese webpages in Joomla.

Thanks.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: use DroidSansFallback font, but PDF output in a mess

Post by Jan »

Hi,
Maybe I choose wrong method to produce those ctg/z files (sorry I am not a font pro so I don't know how to call them). I used a tool named "TTF2UFM" and run it on Windows 7 OS, then use php.exe inside my XAMPP for Windows to produce the php file for font.

Well, glad to see you got correct result. Maybe you can teach me how to convert a TTF font correctly to those ctg/z/php files?
Hmm, seems I cannot, because I have used the same guide and the same file. But as outcome I got different file sizes (ctg/z/php) ... Really no idea why?

Ok, I will download the fonts and will release it with the new Phoca PDF version (I hope in some days). Please check: https://www.phoca.cz/news and then let me know if everything is working OK there.

Thank you, Jan
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: use DroidSansFallback font, but PDF output in a mess

Post by Jan »

Hi,
this package:
http://sourceforge.net/projects/wqy/files/wqy-microhei/

includes ttc font (not ttf). Not sure if this is the problem but I get errors while creating the font files by this font :-( ... So this package I am not able to create :-( If you find some other with similar licence (apache, gpl, mit), just let me know.

The Droid Sans Fallback with Khmer and Chinese I have created and it works, so I will release it.

Jan
If you find Phoca extensions useful, please support the project
Post Reply