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

TitleEditor: Support SVG contain tspan element without style attribute #4781

Conversation

mitsu-ksgr
Copy link
Contributor

Issue

If the SVG contains a tspan element without style attribute, "Edit Title" will not work.

  • sample svg
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" version="1.1" width="720" height="486" id="svg2985">
   <defs id="defs2987" />
   <g id="layer1">
      <text x="50.03632" y="273.45352" id="text2993" xml:space="preserve" style="font-size:155.10592651px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans">
         <tspan x="50.03632" y="273.45352" id="tspan2995">My Title</tspan>
      </text>
   </g>
</svg>

This svg from https://cloud.openshot.org/doc/text.html#example-svg-contents

env

  • OS: Debian buster
  • OpenShot: latest develop branch (8f363de)
  • libopenshot: 0.2.7
  • libopenshot-audio: 0.2.2

Fix

Fixed to treat the value of the style attribute as an empty string when the tspan element does not have the style attribute.

thanks!

Use Element#getAttribute method to get style attribute.
@jonoomph
Copy link
Member

@jonoomph
Copy link
Member

LGTM!

@jonoomph jonoomph merged commit 006a2ee into OpenShot:develop Jan 10, 2023
@jonoomph
Copy link
Member

@mitsu-ksgr mitsu-ksgr deleted the title_editor_support_svg_contain_tspan_without_style_attr branch January 16, 2023 10:29
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.

2 participants