1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 08:27:22 +03:00

Merge branch 'master' into font-face

This commit is contained in:
Guillaume Ayoub 2016-10-27 17:43:49 +02:00
commit 308aaab526
4 changed files with 27 additions and 3 deletions

View File

@ -22,7 +22,6 @@ WeasyPrint |version| depends on:
.. _CFFI: https://cffi.readthedocs.org/
.. _html5lib: http://html5lib.readthedocs.org/
.. _cairocffi: http://pythonhosted.org/cairocffi/
.. _GTK+: http://www.gtk.org/
.. _lxml: http://lxml.de/
.. _tinycss: http://packages.python.org/tinycss/
.. _cssselect: http://packages.python.org/cssselect/
@ -124,7 +123,7 @@ with pip after installing the following packages:
.. code-block:: sh
sudo yum install redhat-rpm-config python-devel python-pip python-lxml python-cffi cairo pango gdk-pixbuf2
sudo yum install redhat-rpm-config python-devel python-pip python-lxml python-cffi libffi-devel cairo pango gdk-pixbuf2
Archlinux
~~~~~~~~~
@ -184,5 +183,11 @@ Windows
- reboot,
- install `Visual C++ compiler for Python 2.7 <http://aka.ms/vcpython27>`_,
- download `lxml <http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml>`_:
- "lxml-x.x.x-cp27-cp27m-win32.whl" on Windows 32 bit,
- "lxml-x.x.x-cp27-cp27m-win_amd64.whl" on Windows 64 bit,
- install lxml with ``python -m pip install path/to/lxml-xxx.whl``
- install WeasyPrint with ``python -m pip install weasyprint``,
- test with ``python -m weasyprint http://weasyprint.org weasyprint.pdf``.

View File

@ -136,7 +136,7 @@ def app(environ, start_response):
return make_response(
body, content_type='application/pdf',
headers=[('Content-Disposition',
'attachement; filename=%s.pdf' % filename)])
'attachment; filename=%s.pdf' % filename)])
elif path.startswith('/view/'):
url = normalize_url(path[6:], environ.get('QUERY_STRING'))

View File

@ -1061,6 +1061,21 @@ def test_auto_layout_table():
</table>
''')
# Test regression: https://github.com/Kozea/WeasyPrint/issues/368
# Check that white-space is used for the shrink-to-fit algorithm
page, = parse('''
<table style="width: 0">
<td style="font-family: ahem;
white-space: nowrap">a a</td>
</table>
''')
html, = page.children
body, = html.children
div, = body.children
table_wrapper, = div.children
table, = table_wrapper.children
assert table.width == 16 * 3
# Cell width as percentage in auto-width table
page, = parse('''
<div style="width: 100px">

View File

@ -820,6 +820,10 @@ def create_layout(text, style, context, max_width):
or ``None`` for unlimited width.
"""
text_wrap = style.white_space in ('pre', 'nowrap')
if text_wrap:
max_width = None
layout = Layout(context, style.font_size, style)
layout.set_text(text)