OpenShot / openshot-qt

OpenShot Video Editor is an award-winning free and open-source video editor for Linux, Mac, and Windows, and is dedicated to delivering high quality video editing and animation solutions to the world.
http://www.openshot.org
Other
4.24k stars 528 forks source link

Font-family from title template always reverts to sans-serif #5572

Open babudro opened 2 months ago

babudro commented 2 months ago

Describe the bug: The font-family set in the SVG file of a title template is ignored and always set to sans-serif (DejaVu Sans in my case) when initially created. It can be edited, but initially is always set to the default sans-serif font.

I have tested the issue using DejaVu Serif, C059, EB Garamond, and Liberation Serif fonts. They all revert to DejaVu Sans the same way.

Issue #5115 also mentions the font being changed, but has more issues relating to font rendering (colour, stroke, etc.) and the comments went on tangents that do not apply in this case. So I am filing this issue to focus on the font-family not being preserved in several cases outlined below.

Steps to reproduce the behaviour: The steps below demonstrate that when you create a new title or edit it, the font always reverts to the default sans-serif except when you explicitly choose an alternate font. In other words, an alternate font must be specified every time the title is created or edited.

  1. In Inkscape create a title template using something other than the default sans-serif font. Save it as ~/.openshot_qt/title_templates/font-test.svg.
  2. In OpenShot create new project and create a title using the font-test template. Just click on your template and click Save, leaving all values as they are.
  3. Place it on a track and observe that the font is shown as the default sans-serif rather than what was saved in the template.
  4. grep -oE "font-family:['a-zA-Z0-9 ]+" ~/.openshot_qt/title/TitleFileName*.svg
  5. You will see whatever your system's default sans-serif font is, in my case I see, font-family:'DejaVu Sans'; twice.
  6. grep -oE "font-family:['a-zA-Z0-9 ]+" ~/.openshot_qt/title_templates/font-test.svg and you will see font-family is defined as what you set it to in Inkscape. In my case I see font-family:C059 twice.
  7. Right-click on the title in Project Files -> Edit title -> Change Font -> set the font back to what was saved in Inkscape -> click Save.
  8. Confirm that the Video Preview shows the chosen font.
  9. grep -oE "font-family:['a-zA-Z0-9 ]+" ~/.openshot_qt/title/TitleFileName*.svg
  10. Confirm that you see the expected font name (not the default sans-serif).
  11. Right-click on the title in Project Files -> Edit title -> Change Font.
  12. Notice sans-serif is shown rather than the expected font.
  13. Click save and confirm that the title now displays in the default sans-serif in Video Preview.
  14. Right-click on the title in Project Files -> Edit title -> Change Font -> set the font back to what was saved in Inkscape -> click Save.
  15. Notice Video Preview again displays the expected font.
  16. Right-click on the title in Project Files -> Edit title -> Text Colour. Change text colour and save.
  17. Notice sans-serif is again shown rather than the expected font.

Expected behaviour: The font saved in the title template, as well as the font chosen, should remain set instead of reverting back to sans-serif.

System Details:

Log Files: If you are experiencing a crash, please collect and attach logs of the problem. (it does not crash, but log is attached anyway)

openshot-qt.log

Exception / Stacktrace: A message that might point to the issue that I saw when running the AppImage from the terminal was this:

Warning (in usvg::parser::svgtree:288): Failed to parse font-style value: 'Roman'.

Everything else was just INFO messages.

Thank you for your efforts.

JamesRichards22 commented 1 month ago

This is a regression as it does not happen in the 3.1.1 Release, but it does happen with the 3.2.0 and 3.2.1 releases.