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

Invisible font on adobe acrobat reader #596

Closed
vikeen opened this Issue Mar 20, 2018 · 12 comments

Comments

Projects
None yet
3 participants
@vikeen

vikeen commented Mar 20, 2018

WeasyPrint version: 0.42.2

Python version: 3.6.2

Problem: I'm using a custom font-face (otf). The font renders fine in Chrome, but when using Adobe Acrobat Reader there is no text. What is strange to me is that the line height and content space seems to be preserved. This is akin to the css 'visiblity: hidden' style.

Steps to reproduce:

  1. Render the font-face (BookSanity)
  2. Open in Adobe Acrobat

Example (pdf and css): example.zip

What can I do to help ensure my font / weasyprint are correct?
PDF rendering is crucial to my business. What material/technology should read up on?

@liZe

This comment has been minimized.

Member

liZe commented Mar 21, 2018

Thank you for this bug report.

The fonts seems to be OK for me when the document is open using Evince or Google Chrome, and when converted into other formats using GhostScript and ImageMagick. (I don't have access to Adobe Reader right now.)

Is that what you expect, or is there some extra text missing?

capture d ecran de 2018-03-21 13-34-03

@vikeen

This comment has been minimized.

vikeen commented Mar 21, 2018

@liZe, that looks as expected.

@liZe

This comment has been minimized.

Member

liZe commented Mar 21, 2018

@liZe, that looks as expected.

Then, there's probably something wrong with Adobe Reader. Can you tests other PDF readers and/or other versions of Adobe Reader?

What can I do to help ensure my font / weasyprint are correct?
PDF rendering is crucial to my business. What material/technology should read up on?

There are so many PDF readers now (including the ones included in browsers), it's hard to get something working everywhere. The PDF spec is huge, and largely used implementations create implicit rules. Regularly testing various implementations is the only reliable solution I know.

@vikeen

This comment has been minimized.

vikeen commented Mar 21, 2018

Then, there's probably something wrong with Adobe Reader. Can you tests other PDF readers and/or other versions of Adobe Reader?

@liZe, I wouldn't expect this from Adobe given that they are the frontrunner of PDF. I'll test some other versions, but should I be logging issues with them or debugging for Adobe Reader specifically?

@liZe

This comment has been minimized.

Member

liZe commented Mar 22, 2018

I wouldn't expect this from Adobe given that they are the frontrunner of PDF. I'll test some other versions, but should I be logging issues with them or debugging for Adobe Reader specifically?

Adobe devs are probably the only ones who can tell if it's a bug in Reader or if it's a bug in WeasyPrint's stack that's silently ignored by other PDF viewers. I don't know if Adobe provides support for Reader. If they don't, you'll have to find a PDF guru (who I'm not at all).

@drukepple

This comment has been minimized.

drukepple commented Mar 23, 2018

@vikeen I suspect the issue is the font file itself. I'm not very literate at all on font files and what goes into them (or PDF files for that matter), but suffice it to say that I'm seeing a similar issue with my fonts, except the text does show up in Adobe Reader, just in Helvetica and not in my chosen font. When I downloaded a free font from fontsquirrel.com, it worked just fine...so I have to suspect the file.

However, I uploaded the font into glypherstudio.com and simply exported it back out, and now it works. I also tried it with your BookSanity, too, and it seems to work. I wonder if there was some incorrect metadata or something in the file that you downloaded that Glyphr will correct/add when exporting. I attached the one font I created for you (just did the Regular typeface...if it works you should do the rest of them)
BookSanity-Glyphr.otf.zip

@drukepple

This comment has been minimized.

drukepple commented Mar 23, 2018

Quick update: I got my font to work after exporting and trying in the example files I downloaded from @vikeen ... but when I added them to my real project they didn't work. After a bit of experimentation, I realized that I was running weasyprint with -s ./my-print-styles.css, and the fonts were being ignored even though the rest of the styles were honored. When I put a <link rel="stylesheet" href="my-print-styles.css" type="text/css" media="print"> line in the source HTML document, then suddenly my fonts worked. Apparently reexporting them was not necessary in my case...although it did seem to help BookSanity.

@liZe: why should I have to add a <link> tag to get fonts to load, when I'm specifying the exact same CSS via the -s option?

@liZe

This comment has been minimized.

Member

liZe commented Mar 23, 2018

why should I have to add a tag to get fonts to load, when I'm specifying the exact same CSS via the -s option?

There's a bug! @font-face rules in stylesheets added with the -s option don't work, probably because there's a problem with the font_config parameter.

@liZe liZe added the bug label Mar 23, 2018

@liZe liZe added this to the 43 milestone Mar 23, 2018

liZe added a commit that referenced this issue Mar 23, 2018

@liZe

This comment has been minimized.

Member

liZe commented Mar 23, 2018

why should I have to add a tag to get fonts to load, when I'm specifying the exact same CSS via the -s option?

It's fixed by 34e2992. @vikeen Does your problem comes from this bug too?

@vikeen

This comment has been minimized.

vikeen commented Mar 24, 2018

@liZe, nah. I use a css link in the html

html = render_to_string(theme_template, context)
            doc = weasyprint.HTML(string=html, base_url=self.request.build_absolute_uri())
            doc.render()
            pdf = doc.write_pdf()
@liZe

This comment has been minimized.

Member

liZe commented Mar 24, 2018

@vikeen Is it possible for you to test Cairo 1.15.4 (or higher)?

@liZe

This comment has been minimized.

Member

liZe commented Aug 2, 2018

@vikeen is there anything new about that?

liZe added a commit that referenced this issue Aug 6, 2018

Don't use pdfrw anymore
pdfrw is a great piece of software, but we don't know PDF enough to debug the
problems we've met. It's safer to use the new cairo API and get back to manual
edition for attachments and bleed boxes.

We only have two regressions for now:
- some internal links are broken,
- PDF producer is not overwritten.

A mail has been sent to cairo's mailing-list about that:
https://lists.cairographics.org/archives/cairo/2018-August/028694.html

Fix #639, #615, fix #596, fix #565.

@liZe liZe closed this in #665 Aug 17, 2018

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Nov 14, 2018

py-weasyprint: Update to 43.
Version 43
----------

Released on 2018-11-09.

Bug fixes:

* `#726 <https://github.com/Kozea/WeasyPrint/issues/726>`_:
  Make empty strings clear previous values of named strings
* `#729 <https://github.com/Kozea/WeasyPrint/issues/729>`_:
  Include tools in packaging

This version also includes the changes from unstable rc1 and rc2 versions
listed below.

Version 43rc2
-------------

Released on 2018-11-02.

**This version is experimental, don't use it in production. If you find bugs,
please report them!**

Bug fixes:

* `#706 <https://github.com/Kozea/WeasyPrint/issues/706>`_:
  Fix text-indent at the beginning of a page
* `#687 <https://github.com/Kozea/WeasyPrint/issues/687>`_:
  Allow query strings in file:// URIs
* `#720 <https://github.com/Kozea/WeasyPrint/issues/720>`_:
  Optimize minimum size calculation of long inline elements
* `#717 <https://github.com/Kozea/WeasyPrint/issues/717>`_:
  Display <details> tags as blocks
* `#691 <https://github.com/Kozea/WeasyPrint/issues/691>`_:
  Don't recalculate max content widths when distributing extra space for tables
* `#722 <https://github.com/Kozea/WeasyPrint/issues/722>`_:
  Fix bookmarks and strings set on images
* `#723 <https://github.com/Kozea/WeasyPrint/issues/723>`_:
  Warn users when string() is not used in page margin


Version 43rc1
-------------

Released on 2018-10-15.

**This version is experimental, don't use it in production. If you find bugs,
please report them!**

Dependencies:

* Python 3.4+ is now needed, Python 2.x is not supported anymore
* Cairo 1.15.4+ is now needed, but 1.10+ should work with missing features
  (such as links, outlines and metadata)
* Pdfrw is not needed anymore

New features:

* `Beautiful website <https://weasyprint.org>`_
* `#579 <https://github.com/Kozea/WeasyPrint/issues/579>`_:
  Initial support of flexbox
* `#592 <https://github.com/Kozea/WeasyPrint/pull/592>`_:
  Support @font-face on Windows
* `#306 <https://github.com/Kozea/WeasyPrint/issues/306>`_:
  Add a timeout parameter to the URL fetcher functions
* `#594 <https://github.com/Kozea/WeasyPrint/pull/594>`_:
  Split tests using modern pytest features
* `#599 <https://github.com/Kozea/WeasyPrint/pull/599>`_:
  Make tests pass on Windows
* `#604 <https://github.com/Kozea/WeasyPrint/pull/604>`_:
  Handle target counters and target texts
* `#631 <https://github.com/Kozea/WeasyPrint/pull/631>`_:
  Enable counter-increment and counter-reset in page context
* `#622 <https://github.com/Kozea/WeasyPrint/issues/622>`_:
  Allow pathlib.Path objects for HTML, CSS and Attachment classes
* `#674 <https://github.com/Kozea/WeasyPrint/issues/674>`_:
  Add extensive installation instructions for Windows

Bug fixes:

* `#558 <https://github.com/Kozea/WeasyPrint/issues/558>`_:
  Fix attachments
* `#565 <https://github.com/Kozea/WeasyPrint/issues/565>`_,
  `#596 <https://github.com/Kozea/WeasyPrint/issues/596>`_,
  `#539 <https://github.com/Kozea/WeasyPrint/issues/539>`_:
  Fix many PDF rendering, printing and compatibility problems
* `#614 <https://github.com/Kozea/WeasyPrint/issues/614>`_:
  Avoid crashes and endless loops caused by a Pango bug
* `#662 <https://github.com/Kozea/WeasyPrint/pull/662>`_:
  Fix warnings and errors when generating documentation
* `#666 <https://github.com/Kozea/WeasyPrint/issues/666>`_,
  `#685 <https://github.com/Kozea/WeasyPrint/issues/685>`_:
  Fix many table layout rendering problems
* `#680 <https://github.com/Kozea/WeasyPrint/pull/680>`_:
  Don't crash when there's no font available
* `#662 <https://github.com/Kozea/WeasyPrint/pull/662>`_:
  Fix support of some align values in tables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment