DavBfr / dart_pdf

Pdf creation module for dart/flutter
https://pub.dev/packages/pdf
Apache License 2.0
1.42k stars 633 forks source link

Add support for custom fonts in SVGs. #1742

Closed tdenniston closed 1 month ago

tdenniston commented 2 months ago

This adds the interface SvgCustomFonts and a corresponding parameter to the SvgImage widget. This provides a mechanism to support SVGs that have known fonts referenced in them.

Closes #1731.

Happy to make any changes!

tdenniston commented 2 months ago

My thought was that it would be easier to extend for some unforeseen need but that may be unnecessary. Happy to change to a function if you'd prefer.

On Thu, Sep 19, 2024, 05:55 David PHAM-VAN @.***> wrote:

@.**** commented on this pull request.

In pdf/lib/src/widgets/svg.dart https://github.com/DavBfr/dart_pdf/pull/1742#discussion_r1766537354:

@@ -154,3 +160,7 @@ class DecorationSvgImage extends DecorationGraphic { ); } } + +abstract class SvgCustomFonts {

Why not just a function?

— Reply to this email directly, view it on GitHub https://github.com/DavBfr/dart_pdf/pull/1742#pullrequestreview-2315029687, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHEHH3P7NUHSVGYXFYYU6LZXKNSNAVCNFSM6AAAAABOHDPZVCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGMJVGAZDSNRYG4 . You are receiving this because you authored the thread.Message ID: @.***>

DavBfr commented 2 months ago

Yes, just a function would be fine, thanks.

tdenniston commented 2 months ago

Is the CI failure related to this PR? I'm not sure what I'm looking at there.

tdenniston commented 1 month ago

I investigated the test failure, which was occuring because I haven't updated the widgets-svg.pdf golden. I improved the test, to actually exercise the custom lookup, and here's the new src png image for the test:

src-16

Would you like me to update the widget-svg.pdf golden, or is that a separate process?

DavBfr commented 1 month ago

Merged, thanks!