Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find and Use Better Default Font #186

Open
sprankhub opened this issue Nov 20, 2014 · 13 comments
Open

Find and Use Better Default Font #186

sprankhub opened this issue Nov 20, 2014 · 13 comments
Assignees

Comments

@sprankhub
Copy link
Member

We should find a better default font which is not as bad as Zend's Helvetica. We have to check if we are allowed to use it for this project. It should support regular/bold/italic font styles and should support a wide range of languages. We already had problems with the Slovenian as well as Chinese language.

@Schrank
Copy link
Member

Schrank commented May 30, 2015

@riconeitzel recommends http://font.ubuntu.com/ if I see this correct, we are allowed to use it http://font.ubuntu.com/licence/

@Schrank
Copy link
Member

Schrank commented Jun 11, 2015

@sprankhub will you have a look here please? :)

@sprankhub sprankhub self-assigned this Jun 11, 2015
@sprankhub
Copy link
Member Author

I just implemented this. I do not have any good news. The file size increases dramatically when using a custom font (e.g. from 5,2kB to 361kB). The problem is that by default, Zend includes the font into the PDF file, so that it can be viewed on every computer even if the font is not installed. It can be configured that it should not include the font (pass Zend_Pdf_Font::EMBED_DONT_EMBED to Zend_Pdf_Font::fontWithPath), but this means the PDF looks broken on computers where the font is not installed.

Fun fact: The Ubuntu font is even not installed on a default Ubuntu system :D

I think 360kB is too much for a simple invoice PDF. @riconeitzel is there any font which can be considered save to use, because it is installed on nearly all computers?

@riconeitzel
Copy link
Member

Arial … ?

@riconeitzel
Copy link
Member

While I'm still fine with 360k … as long as it's not explodes to 1.5MB it's good, isn't it?

@sprankhub
Copy link
Member Author

The implementation can be found here: https://github.com/firegento/firegento-pdf/tree/ubuntu-font

@Schrank what do you think, what should we do?

@Schrank
Copy link
Member

Schrank commented Jun 15, 2015

Does the Invoice looks better? :) If yes, I would go with this as standard. We can change the "upload your own font" selectbox to Use: Ubuntu, Helvetica, Arial, ... and put a comment that with ubuntu the pdf will be 360kb vs 6kb

@pquerner
Copy link
Contributor

pquerner commented Mar 3, 2016

Generating the PDF reveals that the font is embedded as ANSI. (CTRL+D in Adobe Acrobat > Fonts)
Can we simply alter the way its embedded? I did not find a way, where I can set this.

Somewhere in \Zend_Pdf_Font::fontWithPath I think its going wrong when loading the default file.

The Magento Standard file "LinLibertine" is embedded to the PDF as "IDENTIY-H", which to my knowledge reveals all chars this font has.
(CTRL+D in Adobe Acrobat > Fonts)

Looking at a rendered PDF in magento standard and firegento PDF this seems to be the only difference.

I might test the branch for the Ubuntu font to find out if that fixes the problem (altough a different font to use might cause more trouble ?)

@Schrank @sprankhub @riconeitzel

@Schrank
Copy link
Member

Schrank commented Mar 3, 2016

Unfortunately I don't have enough knowledge to follow you properly but this sounds amazing. If we can help you somehow, tell us - although our time is currently highly limited :-/

@sprankhub
Copy link
Member Author

@pquerner I just updated the ubuntu-font branch (merged development into it), so feel free to test it.

@gfobe
Copy link
Contributor

gfobe commented May 25, 2016

We use it, but when we have a customer with e.g. character š it will be displayed as 8.

@pquerner
Copy link
Contributor

http://font.ubuntu.com/
Here we can check if a character is working or not. In the default font, which is embedded into this site, the character "š" seems to be working just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants