Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] svg Tables seem bugged when trying to generate an png from them #3034

Closed
2 tasks done
MrMatch246 opened this issue Jul 13, 2023 · 7 comments
Closed
2 tasks done

Comments

@MrMatch246
Copy link

MrMatch246 commented Jul 13, 2023

Describe the bug

When exporting a table to svg and afterwards trying to generate a png from them (cairosvg and some online converters)
I get broken pictures. Maybe related or not Jetbrains cant display them which makes me think that something might be broken there too

i tried to manually fix it as shown in the attachments resulting in the expected pngs but breaking the view in the chrome browser.

Platform

Click to expand

What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
multiple, server/wsl

╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface. │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ color_system = '256' │
│ encoding = 'utf-8' │
│ file = <_io.TextIOWrapper name='' mode='w' encoding='utf-8'> │
│ height = 41 │
│ is_alt_screen = False │
│ is_dumb_terminal = False │
│ is_interactive = True │
│ is_jupyter = False │
│ is_terminal = True │
│ legacy_windows = False │
│ no_color = False │
│ options = ConsoleOptions( │
│ size=ConsoleDimensions(width=228, height=41), │
│ legacy_windows=False, │
│ min_width=1, │
│ max_width=228, │
│ is_terminal=True, │
│ encoding='utf-8', │
│ max_height=41, │
│ justify=None, │
│ overflow=None, │
│ no_wrap=False, │
│ highlight=None, │
│ markup=None, │
│ height=None │
│ ) │
│ quiet = False │
│ record = False │
│ safe_box = True │
│ size = ConsoleDimensions(width=228, height=41) │
│ soft_wrap = False │
│ stderr = False │
│ style = None │
│ tab_size = 8 │
│ width = 228 │
╰──────────────────────────────────────────────────────────────────────────────────╯
╭─── <class 'rich._windows.WindowsConsoleFeatures'> ────╮
│ Windows features available. │
│ │
│ ╭───────────────────────────────────────────────────╮ │
│ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
│ ╰───────────────────────────────────────────────────╯ │
│ │
│ truecolor = False │
│ vt = False │
╰───────────────────────────────────────────────────────╯
╭────── Environment Variables ───────╮
│ { │
│ 'TERM': 'xterm-256color', │
│ 'COLORTERM': None, │
│ 'CLICOLOR': None, │
│ 'NO_COLOR': None, │
│ 'TERM_PROGRAM': None, │
│ 'COLUMNS': None, │
│ 'LINES': None, │
│ 'JUPYTER_COLUMNS': None, │
│ 'JUPYTER_LINES': None, │
│ 'JPY_PARENT_PID': None, │
│ 'VSCODE_VERBOSE_LOGGING': None │
│ } │
╰────────────────────────────────────╯
platform="Linux"

Actual:
test

"Expected" (this ends up in a not broken png)
test_fixed
test

@github-actions
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

Its font related. Your PNG renderer isn't picking up the appropriate font. Not a Rich issue per-se.

@MrMatch246
Copy link
Author

MrMatch246 commented Jul 13, 2023

how can i fix this? i think its rather hard to do that on the renderer side, so how can i do this on the rich side?
Is there some kind of safe default font option that shouldn't cause problems

@willmcgugan
Copy link
Collaborator

The issue lies with the software you are using to render the file. You could modify the template used to generate the SVG, but as it was carefully chosen to produce the best results, you may break it in other ways.

@MrMatch246
Copy link
Author

Id be willing to give it a try anyway, could you give me some direction how i could change the font in the template? i would assume this is a matter of string replace if i would like to take the dirty way?

@willmcgugan
Copy link
Collaborator

See the code_format attribute here https://github.com/Textualize/rich/blob/master/rich/console.py#L2278

@github-actions
Copy link

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants