PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
MigraDoc: AddSpace does not reset underline https://forum.pdfsharp.net/viewtopic.php?f=3&t=2232 |
Page 1 of 1 |
Author: | RichardD [ Tue Nov 20, 2012 4:26 pm ] |
Post subject: | MigraDoc: AddSpace does not reset underline |
MigraDoc / PDFSharp 1.32 Calling AddSpace at the start of a FormattedText block results in the white-space inheriting the underline from the previous block. Attachment:
File comment: Screen-shot of the bug in action pdfsharp-underline-bug.png [ 39.64 KiB | Viewed 7724 times ] To reproduce: Code: var para = section.AddParagraph(); var block = para.AddFormattedText(); block.Font.Underline = Underline.Single; block.Add(new Text("This should be underlined")); block = para.AddFormattedText(); block.Font.Underline = Underline.None; block.AddSpace(10); block.Add(new Text("<-- These spaces should not")); The problem appears to be in the RenderSpace method of the ParagraphRenderer class. I was able to fix the bug by changing this method to: Code: void RenderSpace(Character character)
{ XUnit width = GetSpaceWidth(character); RenderUnderline(width, false); RealizeHyperlink(width); this.currentXPosition += width; } |
Author: | RichardD [ Wed Nov 21, 2012 3:28 pm ] | ||
Post subject: | Re: MigraDoc: AddSpace does not reset underline | ||
I've attached a simple project to reproduce the problem, using the latest NuGet version of PDFSharp and MigraDoc.
|
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |