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

Svg text with tspan incorrect rendering #1793

Open
1 of 6 tasks
Nevenit opened this issue Dec 16, 2024 · 0 comments
Open
1 of 6 tasks

Svg text with tspan incorrect rendering #1793

Nevenit opened this issue Dec 16, 2024 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@Nevenit
Copy link

Nevenit commented Dec 16, 2024

Describe the bug
The separate tspan elements within a text field don't get rendered properly.

To Reproduce
Code snippet to reproduce the behavior:

String testImg = '''<svg height="40" width="250" xmlns="http://www.w3.org/2000/svg">
  <text x="5" y="30" fill="red" font-size="35">I Love
    <tspan fill="none" stroke="green">SVG</tspan>!
  </text>
</svg>''';

    pdf.addPage(
      pw.Page(
        build: (pw.Context context) {
          return pw.Center(
            child: pw.SvgImage(svg: testImg)
          );
        },
      ),
    );

Expected behavior
Its a rendering issue visible in the images. The green "SVG" is supposed to be between the red "I Love" and "!" but its after.
Then using tech-anchor="center" should make the whole text element rendered from the center but it seems like all tspan elements act separately? Only tested on MacOS, I would assume the svg renderer would be the same on all platforms?

Screenshots
image
image
image
image

Flutter Doctor

[✓] Flutter (Channel stable, 3.24.4, on macOS 14.5 23F79 darwin-arm64, locale
    en-US)
    • Flutter version 3.24.4 on channel stable at
      /Users/michaelryan/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 603104015d (7 weeks ago), 2024-10-24 08:01:25 -0700
    • Engine revision db49896cf2
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/michaelryan/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/michaelryan/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version unknown)
    • Android Studio at /Applications/Android Studio Preview.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio 2.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.91.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.92.0

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 131.0.6778.109

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Desktop (please complete the following information):

  • iOS
  • Android
  • Browser
  • Windows
  • Linux
  • MacOS
@Nevenit Nevenit added bug Something isn't working needs triage labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant