Font Size

1,855 views
Skip to first unread message

EthraZa

unread,
Nov 22, 2009, 9:40:32 PM11/22/09
to dompdf
Hi!
I have a problem regards to font size. What dompdf thinks is the
right size for a 16px font, for example, Firefox and IE disagree. The
fact is that all the ways to tell a font size in HTML have some
difference between the browsers and the dompdf, been it in pixels the
most noticeable, because a font at 12px in the browser is the same
size of a 16px to dompdf. And on print outs it get huge, because what
fits in one page on browser, will take only a little bit more than a
half page in PDFs generated by dompdf, making things some how
difficult to modelling my system documents and reports. It seems that
put the font size in points (pt), leads to a more accurate font size,
but I need to do more tests yet.
Besides that it looks like that the space between the lines produced
by a <br> is completely different too, about 2x or 3x greater for
dompdf.
There is some way to make sure the fonts will be always the same
size? And about the <br> space size?
Is this a dompdf bug or am I misunderstanding something about the
rederization thing?

Thanks.

BrianS

unread,
Nov 23, 2009, 4:13:19 PM11/23/09
to dompdf
Which version of DOMPDF are you using? In 0.6.0 alpha 2 the size of
the font is affected by the setting used for DOMPDF_DPI. If you have a
higher DPI then the fonts will appear smaller.

I'm not sure about the <br> space size ... it may also be related to
the DPI.

EthraZa

unread,
Nov 23, 2009, 8:57:52 PM11/23/09
to dompdf
Now that I get almost all the day testing and reading about that font
thing, the best solution wold be the possibility to tell dompdf what a
<font size=2> means in points. Firefox 3.5, Chrome 3 and IE8 all agree
that size=2 means something close to 10pt, but dompdf thinks size=2 is
more to 9pt and this is a big difference. Also determine the size of a
font=medium and so wold be great.

Some one can lead me the way where I can find that on dompdf files?

Thanks

EthraZa

unread,
Nov 23, 2009, 9:04:21 PM11/23/09
to dompdf
I have posted another question before to read this. I'm using dompdf
0.5.1 in a production environment.
I'll take a look in that variable.

Thanks

Scott Webber

unread,
Nov 24, 2009, 8:14:46 AM11/24/09
to dom...@googlegroups.com
I was having similar problems when converting between dompdf versions.
I found that putting 9pt in the css file instead of 9px allowed me to
adjust the fonts as I needed and get the output I was expecting.
> --
>
> You received this message because you are subscribed to the Google Groups "dompdf" group.
> To post to this group, send email to dom...@googlegroups.com.
> To unsubscribe from this group, send email to dompdf+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/dompdf?hl=en.
>
>
>

BrianS

unread,
Nov 24, 2009, 9:07:47 PM11/24/09
to dompdf
DOMPDF_DPI should not affect the appearance of text in 0.5.1. There is
probably something else going on here. Do you have a sample document
that exhibits the problem on your system?

EthraZa

unread,
Nov 24, 2009, 10:24:15 PM11/24/09
to dompdf
I have updated the dompdf to 0.6alpha. It looks like a little better
than 0.5.1. About the differences between browsers (Fx/IE) and dompdf,
I just give up of get a equivalent output. I have just disabled the
option to print from browser on my systems (letting it just as a
preview) and let only the "export to pdf" button enabled. Now the
documents and reports will be always the same and in all browsers.
I had to take out the ms core fonts too, because dompdf generate the
text with a big gap between the lines when using that fonts. Using
Arial, for example, makes the gap between the lines at the same size
of the font and that is too much. Using the fonts that came with
dompdf, it don't happens, so it's ok.
Another problem I'm having is that dompdf is breaking the line (like
a <br> does) when a span closes and that makes difficult to style the
document.

ex. <span style="font-weight: bold;"> Item A:</span> <span style="font-
style: italic;">That text goes to the second line.</span>

BrianS

unread,
Nov 25, 2009, 10:54:50 AM11/25/09
to dompdf
On Nov 24, 10:24 pm, EthraZa <ethr...@gmail.com> wrote:
>  I have updated the dompdf to 0.6alpha. It looks like a little better
> than 0.5.1. About the differences between browsers (Fx/IE) and dompdf,
> I just give up of get a equivalent output. I have just disabled the
> option to print from browser on my systems (letting it just as a
> preview) and let only the "export to pdf" button enabled. Now the
> documents and reports will be always the same and in all browsers.
>  I had to take out the ms core fonts too, because dompdf generate the
> text with a big gap between the lines when using that fonts. Using
> Arial, for example, makes the gap between the lines at the same size
> of the font and that is too much. Using the fonts that came with
> dompdf, it don't happens, so it's ok.

Before you started using the MS fonts with DOMPDF did you successfully
install the fonts for DOMPDF using load_font.php? We'll run some tests
on those fonts to see if there's an issue that needs to be addressed.
To help in testing can you share the OS and PHP version you are using?

>  Another problem I'm having is that dompdf is breaking the line (like
> a <br> does) when a span closes and that makes difficult to style the
> document.
>
> ex. <span style="font-weight: bold;"> Item A:</span> <span style="font-
> style: italic;">That text goes to the second line.</span>

I've seen the span problem reported before, but have yet to be able to
duplicate it. As you can see on the following sample:
http://eclecticgeek.com/dompdf/index.php?input_file=f6a0951ca1239c77.htm&paper=&orientation=&dompdf_ver=0.5.1&load_method=1&submit=submit

There does appear to be a slight misalignment of the text. Perhaps on
your system the misalignment is large enough to cause the text in
italics to be pushed down to a new line. Right now that's the only
lead we have, and we'll look into it. Unless we can duplicate the
issue, however, I'm not sure we'll be able to fully address the
problem.
Reply all
Reply to author
Forward
0 new messages