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

@font-face issue #506

Closed
leesus opened this issue Sep 15, 2017 · 3 comments
Closed

@font-face issue #506

leesus opened this issue Sep 15, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@leesus
Copy link

@leesus leesus commented Sep 15, 2017

Using the Python API, my custom font isn't showing in the PDF. When I try using the command line arguments on Mac, the PDF is output fine, with the font. Minimal example below, hopefully I'm just missing something simple.

CSS

@font-face {
  font-family: MyCustomFont;
  font-style: normal;
  src: url(http://path.to/MyCustomFont.ttf) format('truetype');
}

body {
  font-family: MyCustomFont;
}

Python

font_config = FontConfiguration()
stylesheet = CSS(path_to_my_stylesheet, font_config=font_config)
pdf = HTML(string=my_html_template_string).write_pdf(stylesheets=[stylesheet])

The CSS is output correctly, just the fonts aren't showing up.

@liZe liZe added the bug label Oct 1, 2017
@liZe liZe closed this in 0c27e94 Oct 1, 2017
@liZe
Copy link
Member

@liZe liZe commented Oct 1, 2017

Thanks for taking the time to report this issue.

That was actually a problem in the API, you couldn't use the font_config attribute with render and write_* methods. That's now fixed if you give font_config to write_pdf. I've also updated the tutorial.

Loading

@liZe liZe added this to the v0.41 milestone Oct 1, 2017
@liZe liZe self-assigned this Oct 1, 2017
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 9, 2017
Version 0.41
------------

Released on 2017-10-05.

WeasyPrint now depends on pdfrw >= 0.4.

New features:

* `#471 <https://github.com/Kozea/WeasyPrint/issues/471>`_:
  Support page marks and bleed.

Bug fixes:

* `#513 <https://github.com/Kozea/WeasyPrint/issues/513>`_:
  Don't crash on unsupported image-resolution values.
* `#506 <https://github.com/Kozea/WeasyPrint/issues/506>`_:
  Fix @font-face use with write_* methods.
* `#500 <https://github.com/Kozea/WeasyPrint/pull/500>`_:
  Improve readability of _select_source function.
* `#498 <https://github.com/Kozea/WeasyPrint/issues/498>`_:
  Use CSS prefixes as recommanded by the CSSWG.
* `#441 <https://github.com/Kozea/WeasyPrint/issues/441>`_:
  Fix rendering problems and crashes when using @font-face.
* `bb3a4db <https://github.com/Kozea/WeasyPrint/commit/bb3a4db>`_:
  Try to break pages after a block before trying to break inside it.
* `1d1654c <https://github.com/Kozea/WeasyPrint/commit/1d1654c>`_:
  Fix and test corner cases about named pages.

Documentation:

* `#508 <https://github.com/Kozea/WeasyPrint/pull/508>`_:
  Add missing libpangocairo dependency for Debian and Ubuntu.
* `a7b17fb <https://github.com/Kozea/WeasyPrint/commit/a7b17fb>`_:
  Add documentation on logged rendering steps.
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 22, 2017
Version 0.41
------------

Released on 2017-10-05.

WeasyPrint now depends on pdfrw >= 0.4.

New features:

* `#471 <https://github.com/Kozea/WeasyPrint/issues/471>`_:
  Support page marks and bleed.

Bug fixes:

* `#513 <https://github.com/Kozea/WeasyPrint/issues/513>`_:
  Don't crash on unsupported image-resolution values.
* `#506 <https://github.com/Kozea/WeasyPrint/issues/506>`_:
  Fix @font-face use with write_* methods.
* `#500 <https://github.com/Kozea/WeasyPrint/pull/500>`_:
  Improve readability of _select_source function.
* `#498 <https://github.com/Kozea/WeasyPrint/issues/498>`_:
  Use CSS prefixes as recommanded by the CSSWG.
* `#441 <https://github.com/Kozea/WeasyPrint/issues/441>`_:
  Fix rendering problems and crashes when using @font-face.
* `bb3a4db <https://github.com/Kozea/WeasyPrint/commit/bb3a4db>`_:
  Try to break pages after a block before trying to break inside it.
* `1d1654c <https://github.com/Kozea/WeasyPrint/commit/1d1654c>`_:
  Fix and test corner cases about named pages.

Documentation:

* `#508 <https://github.com/Kozea/WeasyPrint/pull/508>`_:
  Add missing libpangocairo dependency for Debian and Ubuntu.
* `a7b17fb <https://github.com/Kozea/WeasyPrint/commit/a7b17fb>`_:
  Add documentation on logged rendering steps.
@sunanda-sarbadhikary-navsoft

It cannot support Thai character when creating pdf
Example: ซอยกรุงเทพกรีฑา
Output: Not supporting the character.
But from my local linux machine it works fine.
Only server its not working. I use docker for build to server.
Please reply as soon as possible.

Loading

@liZe
Copy link
Member

@liZe liZe commented Apr 15, 2019

Only server its not working. I use docker for build to server.

You probably don't have fonts with Thai characters installed on your server. Install such fonts or use @font-face rules with Thai fonts to solve the issue.

Please reply as soon as possible.

People here already reply as soon as possible. You don't have to ask them, it just makes them angry 😠 😉.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants