mixn / carbon-now-cli

🎨 Beautiful images of your code — from right inside your terminal.
MIT License
5.75k stars 117 forks source link

Weird line break issues with SVG #175

Open graipher opened 8 months ago

graipher commented 8 months ago

Describe the bug When saving as SVG, some lines are weirdly broken. widthAdjustment is true. The PNG version is fine. Only happens with chromium driver, not firefox.

To Reproduce Steps to reproduce the behavior:

  1. Run carbon-now with… config.json
    {
    "latest-preset": {
    "theme": "material",
    "backgroundColor": "#00000000",
    "windowTheme": "none",
    "windowControls": false,
    "fontFamily": "Fira Code",
    "fontSize": "18px",
    "lineNumbers": false,
    "firstLineNumber": 1,
    "dropShadow": false,
    "dropShadowOffsetY": "20px",
    "dropShadowBlurRadius": "68px",
    "selectedLines": "*",
    "widthAdjustment": true,
    "lineHeight": "133%",
    "paddingVertical": "2px",
    "paddingHorizontal": "2px",
    "squaredImage": false,
    "watermark": false,
    "exportSize": "1x",
    "type": "svg",
    "language": "python"
    }
    }

    and generics.py

    
    from typing import Generic, TypeVar

T = TypeVar("T")

def f(a: T) -> T: return a

class A(Generic[T]): a: T



`carbon-now generics.py --engine chromium`

3. Wait for image to download…
4. See error

**Expected behavior**
SVG and PNG output should be the same. There should be no weird linebreaks that are not present in the file.

**Screenshots**
SVG:
![Generics_1](https://github.com/mixn/carbon-now-cli/assets/984262/79293f6e-bd5a-4844-bbc4-289c075f0a4e)
PNG:
![Generics_1](https://github.com/mixn/carbon-now-cli/assets/984262/daf92fb8-d957-4c78-a191-3035baf86e7a)

**Info (please complete the following information):**

- OS [e.g. macOS, Linux, Windows, iOS]: Linux
- `--engine` used [e.g. `chromium`, `firefox`, `webkit`]: `chromium`
- Carbon URL (run with `--open-in-browser` to see) [e.g. carbon.now.sh?bg=pink]: browser does not open
mixn commented 8 months ago

@graipher Thank you for opening; sorry I missed this earlier last month. I’ll investigate further this weekend, but I think this is an error on Carbon’s part (not the CLI), since I remember having different outputs when implementing --engine as part of v2 and I even had to use --engine firefox for some of the screenshots of the docs.

I will report back, though; thanks for your patience! 🙂

mixn commented 3 months ago

Been quite swamped since the beginning of the year, but I will tackle a new release of the CLI soon and, amongst other things, address this (somehow.) 🙂 Thanks for your patience, appreciated! @graipher