anasera3 / dompdf

Automatically exported from code.google.com/p/dompdf
0 stars 0 forks source link

Support for font sub-setting #135

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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=81IWkUIAAADdRj5vzS
N1rhnapA02xwoc3oDAlRB1PV6FJinjipf3aNsCf-7kBZhGhDvD8uNw6EZV4u3aa4iAIyYQIqbG9naPgh
6o8ccLBvP6Chud5KMzIQ

Original issue reported on code.google.com by naruskev...@gmail.com on 15 Mar 2010 at 7:01

GoogleCodeExporter commented 9 years ago
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).

Original comment by eclecticgeek on 15 Mar 2010 at 4:13

GoogleCodeExporter commented 9 years ago
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.

Original comment by fabien.menager on 15 Mar 2010 at 6:12

GoogleCodeExporter commented 9 years ago
   "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.

Original comment by naruskev...@gmail.com on 16 Mar 2010 at 6:31

Attachments:

GoogleCodeExporter commented 9 years ago
hi have problem with greek font i have attchend my pdf file 
plz help me out 

Original comment by bhosale....@gmail.com on 2 Feb 2011 at 11:27

Attachments:

GoogleCodeExporter commented 9 years ago
The same problem with greek fonts! Any news?

Original comment by karageor...@gmail.com on 2 May 2011 at 2:13

GoogleCodeExporter commented 9 years ago
@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

Original comment by eclecticgeek on 10 May 2011 at 7:40

GoogleCodeExporter commented 9 years ago
Issue 330 has been merged into this issue.

Original comment by fabien.menager on 31 Jul 2011 at 1:37

GoogleCodeExporter commented 9 years ago

Original comment by fabien.menager on 15 Jan 2012 at 11:04

GoogleCodeExporter commented 9 years ago
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.

Original comment by fabien.menager on 5 Feb 2012 at 11:47

GoogleCodeExporter commented 9 years ago
Issue 330 has been merged into this issue.

Original comment by eclecticgeek on 13 Feb 2013 at 5:55

GoogleCodeExporter commented 9 years ago

Original comment by eclecticgeek on 24 May 2013 at 3:00