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

Supporting <text> tags from SVG files #1029

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Supporting <text> tags from SVG files #1029

wants to merge 1 commit into from

Conversation

Lucas-C
Copy link
Member

@Lucas-C Lucas-C commented Nov 20, 2023

This is a contribution towards #537

@Lucas-C
Copy link
Member Author

Lucas-C commented Nov 20, 2023

Currently this PR only contains a base unit test / SVG test sample file, and some minimal "glue" code.

@gmischler: I think we should wait for your work on TextRegions to be complete before tackling this.

Quoting a comment I made there: https://github.com/py-pdf/fpdf2/blob/svg-text/fpdf/svg.py#L1003:

We should reuse code from the line_break and/or text_region modules to implement this.
We could either:

  1. handle text regions in this module (svg), with a dedicated SVGText class.
  2. handle text regions in the drawing module, maybe by defining a PaintedPath.text() method.

This second option may be the best approach, as we would benefit from the global transformation performed in SVGObject.transform_to_rect_viewport().

But then, we will have to find a way to have PaintedPath objects from the drawing module to benefit from the text rendering logic implemented in other modules, including the font selection mechanism.

How difficult do you expect this to be?

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

Successfully merging this pull request may close these issues.

None yet

1 participant