toptensoftware / RichTextKit

Rich text rendering for SkiaSharp
Other
366 stars 73 forks source link

RichString.MeasuredWidth fails if margins are set #56

Closed manutiedra closed 2 years ago

manutiedra commented 2 years ago

The property MeasuredWith returns the proper with of a RichString if left and right margin are 0.

If I set the left and right margin to 10, it fails (it returns the same width as when it was without margin).

Here I have attached two scenarios, where I render the second parragraph following the first one. The top example is whithout margin. The second one is with a margin of 10 in every direction. I drew the bounding box of the RichString in red. You can clearly see the problem. The bitmap size was calculated adding the MeassuredWidth of both RichText.

I hope you fix it.

PS: congrats for the great library. I had to start using Skia and I couldn't be happier after I found RichTextKit

margin_error

toptensoftware commented 2 years ago

Thanks for reporting. Fixed by https://github.com/toptensoftware/RichTextKit/commit/be6dc264c604d775ffc961595985b843e85db5aa