Skip to content

Commit

Permalink
Update to_svg documentation about Complex Text Layout
Browse files Browse the repository at this point in the history
  • Loading branch information
jojolebarjos committed Jan 7, 2020
1 parent 674e0fa commit 289fef5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions wordcloud/wordcloud.py
Expand Up @@ -738,12 +738,22 @@ def to_svg(self, embed_font=False, optimize_embedded_font=True, embed_image=Fals
Font is assumed to be available to the SVG reader. Otherwise, text
coordinates may produce artifacts when rendered with replacement font.
It is also possible to include a subset of the original font in WOFF
format using `embed_font` (requires `fontTools`).
format using ``embed_font`` (requires `fontTools`).
Note that some renderers do not handle glyphs the same way, and may
differ from `to_image` result. In particular, handwriting-like fonts
(e.g. Segoe Script) ligatures might not be properly rendered, which
could introduce discrepancies in tight layouts.
differ from ``to_image`` result. In particular, Complex Text Layout may
not be supported. In this typesetting, the shape or positioning of a
grapheme depends on its relation to other graphemes.
Pillow, since version 4.2.0, supports CTL using ``libraqm``. However,
due to dependencies, this feature is not always enabled. Hence, the
same rendering differences may appear in ``to_image``. As this
rasterized output is used to compute the layout, this also affects the
layout generation. Use ``PIL.features.check`` to test availability of
``raqm``.
Consistant rendering is therefore expected if both Pillow and the SVG
renderer have the same support of CTL.
Contour drawing is not supported.
Expand All @@ -754,7 +764,7 @@ def to_svg(self, embed_font=False, optimize_embedded_font=True, embed_image=Fals
optimize_embedded_font : bool, default=True
Whether to be aggressive when embedding a font, to reduce size. In
particular, hinting tables are dropped, which may introduces slight
particular, hinting tables are dropped, which may introduce slight
changes to character shapes (w.r.t. `to_image` baseline).
embed_image : bool, default=False
Expand Down

1 comment on commit 289fef5

@bqwu
Copy link

@bqwu bqwu commented on 289fef5 Feb 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the updating,
but I still found a problem. It says there is no 'to_svg' method when I tried to use it. My version of word cloud is 1.6.0 (on Mac).
I don't know why this happens.

Please sign in to comment.