[go: up one dir, main page]

Page MenuHomePhabricator

librsvg does not shift from bold to normal font-weight
Closed, ResolvedPublic

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

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.

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?)

hnowlan claimed this task.

Resolved as part of T193352