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

Support for font sub-setting #141

Closed
PhenX opened this issue Dec 6, 2012 · 7 comments
Closed

Support for font sub-setting #141

PhenX opened this issue Dec 6, 2012 · 7 comments

Comments

@PhenX
Copy link
Member

PhenX commented Dec 6, 2012

Original author: naruskev...@gmail.com (March 15, 2010 07:01:05)

Size of output PDF files are really huge if you try to use unicode support

  • all used font files (simple, bold, italic, bold italic) are fully
    embedded into PDF.

It would be great to have the possibility to include only selected symbols
from the unicode font. Lets say I want to include only ąčęėįšžĄČĘĖĮŠŽ from
Times Roman UNICODE and all other symbols should be taken from default font
Times Roman. This should significantly decrease the size of PDF.

PDF example:
http://dompdf.googlegroups.com/web/utf8_working.pdf?hl=en&gda=81IWkUIAAADdRj5vzSN1rhnapA02xwoc3oDAlRB1PV6FJinjipf3aNsCf-7kBZhGhDvD8uNw6EZV4u3aa4iAIyYQIqbG9naPgh6o8ccLBvP6Chud5KMzIQ

Original issue: http://code.google.com/p/dompdf/issues/detail?id=135

@PhenX
Copy link
Member Author

PhenX commented Dec 6, 2012

From eclecticgeek on March 15, 2010 16:13:25
Having DOMPDF decide where to pull the character bitmaps from wouldn't really be a
good idea. That being said, enabling font sub-setting across all characters would
significantly reduce the size of embedded fonts. Then if you wanted to further shrink
a document's file size you could just apply a font family using a span around the
specific characters.

Once we figure out how to support Unicode encoding with the core fonts I don't
believe you would need to embed a font for the characters cited. Note, however, that
some characters may not be supported at all in the core fonts (such as Chinese
characters).

@PhenX
Copy link
Member Author

PhenX commented Dec 6, 2012

From fabien.menager on March 15, 2010 18:12:02
I think this would be a really good idea to have an option of the DOMPDF instance as
an array of the standardized subsets
(http://en.wikipedia.org/wiki/Unicode#Standardized_subsets) like this :

protected $unicode_subsets = array(
  "Basic Latin" => true,
  "Latin-1 Supplement" => true,
  "Latin Extended-A" => true,
  ...
  "Latin Extended Additional" => false,
);

With default booleans choosen to have the best compromise, with an accessor to
modify them, like any other protecter property of dompdf. And the output of the PDF
would filter the characters of the embedded fonts with the help of an internal array
of ranges corresponding to the subset names chosen.

@PhenX
Copy link
Member Author

PhenX commented Dec 6, 2012

From naruskev...@gmail.com on March 16, 2010 06:31:11
"Once we figure out how to support Unicode encoding with the core fonts I don't
believe you would need to embed a font for the characters cited."

Don't know if it would be helpful but here is the PDF, containing the same text,
generated with OpenOffice (43,7Kb only)

Maybe some ideas could be taken from OpenOffice.

@PhenX
Copy link
Member Author

PhenX commented Dec 6, 2012

From bhosale....@gmail.com on February 02, 2011 11:27:04
hi have problem with greek font i have attchend my pdf file
plz help me out

@PhenX
Copy link
Member Author

PhenX commented Dec 6, 2012

From karageor...@gmail.com on May 02, 2011 02:13:58
The same problem with greek fonts! Any news?

@PhenX
Copy link
Member Author

PhenX commented Dec 6, 2012

From eclecticgeek on May 10, 2011 19:40:42
@naruskevic.jan Thanks for the PDF. It looks like OpenOffice is embedding a font to handle those characters.

@bhosale.mahesh21 It looks like your text wasn't properly encoded before being placed in the document. Make sure you have Unicode enabled in your configuration file and that the MBString() PHP extension is enabled.

The latest code includes the DejaVu fonts, which should allow for a large number of characters. Get it here: http://eclecticgeek.com/dompdf/

If you're having problems enabling expanded character set support please post a question to the support forum: https://groups.google.com/forum/#!forum/dompdf

@PhenX
Copy link
Member Author

PhenX commented Dec 6, 2012

From fabien.menager on February 05, 2012 11:47:22
I commited the first version supporting font subsetting in r468. You need to enable it by setting DOMPDF_ENABLE_FONTSUBSETTING to true. Not all fonts work yet, php-font-lib (http://code.google.com/p/php-font-lib/) needs to be fixed for this.

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

1 participant