You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When opening the SVG file in a browser or an image viewer, underscores look like white spaces:
Reading the SVG source, we can see that:
the text string indeed contains _ and not white spaces
the underscores are actually clipped by the main <cliPath> (the one whose identifier ends with "clip-terminal"), giving it a little more height reveals the _
In the test example:
the viewbox height is 74.4
the terminal <cliPath> height is 23.4
the terminal group is translated to 41 on the vertical axis (as always)
Adding 23.4 to 41, we're at 64.4 on the vertical axis, about 10px above the end of the viewbox. My 2 cents is that it is too much.
Still my 2 cents:
the height of the main <rect> (the one that sets the background) equals to (y + 1) * line_height + padding_top + padding_bottom
the height of the terminal group equals to (y + 1) * line_height - 1 : I understand we don't have to take padding_top into account (we're translated bellow the padding on the vertical axis), but shouldn't we still add padding_bottom ?
This is how I generated the SVG where the underscores aren't clipped. Which does not prove that my reasoning is correct, 8 may very well be a value that falls just right, and incidentally equal to padding_bottom.
BTW, thanks for the good work, DTSh could hardly be what it (humbly) is without this library.
The text was updated successfully, but these errors were encountered:
Workaround upstream rich library issue 3576:
Underscores on the last captured line are clipped
when exporting to SVG.
The main <clipPath> height computed
by the rich library in Console.export_svg() is a bit too small,
and the bottom of the last captured output line may be truncated,
depending on the font and the printed characters (e.g. underscores,
but also the bottom of the letter 'y').
This workaround adds the bottom padding to the height computed
by the rich library.
Ref:
- #8
- Textualize/rich#3576
Underscore characters on the last captured line are clipped when exporting to SVG.
Easily reproducible (rich 13.9.4):
When opening the SVG file in a browser or an image viewer, underscores look like white spaces:
Reading the SVG source, we can see that:
_
and not white spaces<cliPath>
(the one whose identifier ends with "clip-terminal"), giving it a little more height reveals the_
In the test example:
<cliPath>
height is 23.4Adding 23.4 to 41, we're at 64.4 on the vertical axis, about 10px above the end of the viewbox. My 2 cents is that it is too much.
Still my 2 cents:
<rect>
(the one that sets the background) equals to(y + 1) * line_height + padding_top + padding_bottom
(y + 1) * line_height - 1
: I understand we don't have to takepadding_top
into account (we're translated bellow the padding on the vertical axis), but shouldn't we still addpadding_bottom
?This is how I generated the SVG where the underscores aren't clipped. Which does not prove that my reasoning is correct, 8 may very well be a value that falls just right, and incidentally equal to
padding_bottom
.BTW, thanks for the good work, DTSh could hardly be what it (humbly) is without this library.
The text was updated successfully, but these errors were encountered: