penpot / penpot-exporter-figma-plugin

Penpot exporter Figma plugin
https://www.figma.com/community/plugin/1219369440655168734/penpot-exporter
Mozilla Public License 2.0
265 stars 25 forks source link

`svg-path-parser` returns outline #210

Open sneko opened 2 months ago

sneko commented 2 months ago

Hi,

Here a straight line into Figma by using the VECTOR type:

image

The corresponding Figma SVG path is: M0 0.5L34.5 0.5L34.5 -0.5L0 -0.5L0 0.5Z

It will result into a rectangle into Penpot:

image

This is due to svg-path-parser that will analyze the raw Figma SVG path, not understanding the shape was initially created with a strokeWeight (no matter the value). The main issue is to modify the shape, you need to manage close points so the shape stay a line. And it's even worse with curves because you need to also have the same angle for the both curve points.

I'm not sure of all possible cases from a SVG path but:

(in both cases, strokeWeight and strokeAlign would help shifting the position of points since outlines where used initially, not the original centered line)

EDIT: I think by doing this, shape having a "close path" will have their fill property working, there will be not necessary to have 2 shapes inside a group, one for the stroke, one for the filling.

EDIT2: related https://forum.figma.com/t/rest-api-exposing-svg-real-strokes/42387 on Figma side but we no solution?

Cenadros commented 3 weeks ago

Hi there @sneko. I was not able to reproduce this by making lines in Figma. Could you please share a simple figma file with this example in which you're encountering this issue?