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

weazyprint 0.37 fails with google font stylesheets #477

Closed
johndagostino opened this issue Jun 16, 2017 · 1 comment
Closed

weazyprint 0.37 fails with google font stylesheets #477

johndagostino opened this issue Jun 16, 2017 · 1 comment
Labels
bug Existing features not working as expected crash Problems preventing documents from being rendered
Milestone

Comments

@johndagostino
Copy link

Example below works as expected on 0.36 but fails with the recently released 0.37

Backtrace from WeazyPrint

Traceback (most recent call last):
  File "/usr/local/bin/weasyprint", line 11, in <module>
    load_entry_point('WeasyPrint==0.37', 'console_scripts', 'weasyprint')()
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/__main__.py", line 172, in main
    getattr(html, 'write_' + format_)(output, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py", line 181, in write_pdf
    presentational_hints=presentational_hints).write_pdf(
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py", line 146, in render
    self, stylesheets, enable_hinting, presentational_hints)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/document.py", line 317, in _render
    font_config=font_config)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/__init__.py", line 770, in get_all_computed_styles
    element_tree, device_media_type, url_fetcher, font_config))
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/__init__.py", line 160, in find_stylesheets
    font_config=font_config)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py", line 268, in __init__
    self.fonts, font_config)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/__init__.py", line 722, in preprocess_stylesheet
    base_url, content))
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/descriptors.py", line 165, in preprocess_descriptors
    result = list(validate(base_url, descriptor.name, tokens))
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/descriptors.py", line 143, in validate
    value = function(tokens, base_url)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/validation.py", line 172, in wrapper
    result = function(remove_whitespace(part), *args)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/css/descriptors.py", line 76, in src
    return 'local', font_family(token.content, allow_spaces=True)
AttributeError: 'FunctionBlock' object has no attribute 'content'

Example test html file

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Test</title>
  <link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">
</head>
<body>
  <div class="book">
  </div>
</body>
</html>
@liZe liZe closed this as completed in ccf58d7 Jun 16, 2017
@liZe
Copy link
Member

liZe commented Jun 16, 2017

Thanks for reporting this issue, sorry for this problem…

@liZe liZe added bug Existing features not working as expected crash Problems preventing documents from being rendered labels Jun 16, 2017
@liZe liZe added this to the v0.38 milestone Jun 16, 2017
netbsd-srcmastr referenced this issue in NetBSD/pkgsrc Aug 1, 2017
Version 0.39
------------

Released on 2017-06-24.

Bug fixes:

* Fix the use of WeasyPrint's URL fetcher with CairoSVG.


Version 0.38
------------

Released on 2017-06-16.

Bug fixes:

* `#477 <https://github.com/Kozea/WeasyPrint/issues/477>`_:
  Don't crash on font-face's src attributes with local functions.


Version 0.37
------------

Released on 2017-06-15.

WeasyPrint now depends on tinycss2 instead of tinycss.

New features:

* `#437 <https://github.com/Kozea/WeasyPrint/issues/437>`_:
  Support local links in generated PDFs.

Bug fixes:

* `#412 <https://github.com/Kozea/WeasyPrint/issues/412>`_:
  Use a NullHandler log handler when WeasyPrint is used as a library.
* `#417 <https://github.com/Kozea/WeasyPrint/issues/417>`_,
  `#472 <https://github.com/Kozea/WeasyPrint/issues/472>`_:
  Don't crash on some line breaks.
* `#327 <https://github.com/Kozea/WeasyPrint/issues/327>`_:
  Don't crash with replaced elements with height set in percentages.
* `#467 <https://github.com/Kozea/WeasyPrint/issues/467>`_:
  Remove incorrect line breaks.
* `#446 <https://github.com/Kozea/WeasyPrint/pull/446>`_:
  Let the logging module do the string interpolation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected crash Problems preventing documents from being rendered
Projects
None yet
Development

No branches or pull requests

2 participants