Page MenuHomePhabricator

librsvg does not shift from bold to normal font-weight
Open, Needs TriagePublic

Description

librsvg mishandles the following text element:

<text x="20" y="100" font-weight="bold">bold <tspan font-weight="normal">normal</tspan></text>

the tspan is displayed in bold rather than a normal font weight.

However, when given this almost identical text element

<text x="20" y="200" font-weight="bold">bold <tspan font-weight="400">400=normal</tspan></text>

the tspan is displayed at normal weight

For sample file, see https://commons.wikimedia.org/wiki/File:SVGTestBoldNormal.svg :

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 450" font-family="sans-serif" font-size="60">
  <title>librsvg misinterprets keyword normal</title>
  <desc>librsvg bug: librsvg text that starts bold and shifts to normal weight fails; shifting to 400 weight succeeds.</desc>
  <text x="20" y="100" font-weight="bold">bold <tspan font-weight="normal">normal</tspan></text>
  <text x="20" y="200" font-weight="bold">bold <tspan font-weight="400">400=normal</tspan></text>
  <g font-weight="bold">
    <title>normal font weight inside of group specifying bold weight - from Johannes Kalliauer</title>
    <text x="20" y="300" font-weight="normal">normal</text>
    <text x="20" y="400" font-weight="400">400=normal</text>
  </g>
</svg>

Event Timeline

Glrx created this task.Oct 19 2018, 7:00 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 19 2018, 7:00 PM
Glrx updated the task description. (Show Details)Oct 19 2018, 7:03 PM
Perhelion added a subscriber: Perhelion.EditedOct 20 2018, 10:19 PM

I could swear I saw this bug long time before, as every style property with normal is ignored. PS: I found the report, as this is mentioned for years on https://commons.wikimedia.org/wiki/Help:SVG#Font-weight_value (without report). E.g. so font-style and font-stretch is affected too.

Aklapper updated the task description. (Show Details)Oct 20 2018, 10:38 PM
Aklapper moved this task from Backlog to Patch merged upstream on the Upstream board.EditedOct 20 2018, 11:38 PM

I can confirm this locally for librsvg2-2.42.6-1.fc28.
I cannot confirm this anymore for librsvg2-2.44.7-1.fc29, however that version is missing a whitespace between the strings (worth a separate upstream task?)