Closed GoogleCodeExporter closed 8 years ago
It appears the problem is that the DOMPDF_DEFAULT_FONT setting is ignored in
favor of the default set in the Style class. You can work around the problem by
adding a body styling to your CSS, e.g.:
body { font-family: DejaVu Sans, sans-serif; }
If you want a quick fix for the issue you can modify
dompdf/include/style.cls.php@238 to read as follows:
$d["font_family"] = DOMPDF_DEFAULT_FONT;
(ref.
http://code.google.com/p/dompdf/source/browse/tags/dompdf_0-6-0_beta3/dompdf/inc
lude/style.cls.php#238)
Also, please note that "dejavu" is not a valid font. The DejaVu font pack is a
set of fonts that include the following: DejaVu Sans, DejaVu Sans Light, DejaVu
Sans Condensed, DejaVu Sans Mono, DejaVu Serif, DejaVu Serif Condensed.
Original comment by eclecticgeek
on 22 Mar 2012 at 10:34
Using r481 as a reference for discussion.
A default font of "serif" is set in the Style class here:
http://code.google.com/p/dompdf/source/browse/trunk/dompdf/include/style.cls.php
?r=481#240
dompdf currently takes into account the DOMPDF_DEFAULT_FONT setting here:
http://code.google.com/p/dompdf/source/browse/trunk/dompdf/include/font_metrics.
cls.php?r=481#169
Since the default font set in CSS is a valid font the value of
DOMPDF_DEFAULT_FONT will always be ignored unless the user specifies a bad
font. We might consider switching where DOMPDF_DEFAULT_FONT is referenced so
that the CSS default is set as follows:
$d["font_family"] = (isset(DOMPDF_DEFAULT_FONT)?DOMPDF_DEFAULT_FONT:"serif");
And the FontMetrics class initializes to "serif" (a known, valid font) on line
240.
Original comment by eclecticgeek
on 22 Mar 2012 at 10:46
I thought about the same thing for the default font, but I don't think the
"isset" test is needed.
$d["font_family"] = DOMPDF_DEFAULT_FONT;
should be enought IMO.
Original comment by fabien.menager
on 25 Mar 2012 at 4:18
You're right. No need to complicate the code.
Original comment by eclecticgeek
on 26 Mar 2012 at 1:30
This issue was closed by revision r484.
Original comment by eclecticgeek
on 28 Mar 2012 at 2:53
Original comment by eclecticgeek
on 30 May 2013 at 5:16
Original issue reported on code.google.com by
soul...@gmail.com
on 22 Mar 2012 at 11:08Attachments: