WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

Bad SVG text style after v63.1

Open febdoctor opened this issue 6 months ago • 2 comments

In v63.1 and earlier the style of SVG text is rendered well. But since v64 the rendering changed. Here is a reproduction:

<!DOCTYPE html>
<html lang="fr">
<head>
	<base target="_top">
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Bug stylesheet</title>
	<style>
	html, body {
		height: 100%;
		margin: 0;
		padding: 0;
	}
	@page {
	  size: A4 landscape;
	  margin: 0mm;
	}
	</style>
</head>
<body>
<svg height="100%" width="100%" viewBox="0 0 1088 763">
<style>
	.maptitle {
	  fill: #7d7d7d;
	}
   .borders {
      stroke: black 2px;
   }
</style>

<g class="borders">
<rect x="4mm" y="4mm" width="289mm" height="202mm" fill="none" />
</g>
<g class="courselines">
<line x1="472.03439862280817" y1="182.1419693119898" x2="236.46560137719192" y2="215.85803068801022"/>
<line x1="219.6435589536194" y1="233.00369566992836" x2="192.85644104638058" y2="449.4963043300716"/>
</g>
<g class="octl">
  <text x="48.80965337559891mm" y="56.12625239605152mm">1</text>
</g>
<text class="maptitle" x="8mm" y="20mm">Repro Bug</text>

</svg>

</body>
</html>

And the resulting PDF:

repro4-main.pdf repro4-v63.pdf

This issue was initially reported in #2438 but moved into a new issue upon request.

febdoctor avatar May 30 '25 12:05 febdoctor

Thanks for opening a separate issue.

And the resulting PDF:

I can’t reproduce if I set the DejaVu font explicitly (my default font is Liberation otherwise):

text.pdf

Do you have the same result if you set font-family="DejaVu Sans" in the <text> tag?

Could you please share the DejaVu Sans font file that’s installed on your system?

liZe avatar May 30 '25 14:05 liZe

@febdoctor Did you find the time to take a look at that?

liZe avatar Jun 13 '25 12:06 liZe

Don’t hesitate to add a comment if there’s anything new on this topic.

liZe avatar Jun 20 '25 08:06 liZe