aloisdeniel / aloisdeniel/path_icon

SVG Rendering issues

未关闭
#1 2 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
question
主要语言
Dart
星标
49
派生
4
PR 合并指标
30 天内没有已合并 PR

描述

If you have a rendering issue with an icon, please share its data content here.

Remember that the parsing pass is basic, on purpose. So make sure your vector data is really simple, composed only of filled shapes.

The only supported operations and properties are :

* **circle** : `cx`, `cy`, `r`
* **ellipse** : `cx`, `cy`, `rx`, `ry`
* **rect** : `x`, `y`, `width`, `height`
* **path** : `d`, `fill-rule`
* **g** : `transform`

All paths from operations are merged as a single path, filled with a unique color.

## Preparing an icon in Figma

### Outlining strokes

Let's take an example :

![image](https://user-images.githubusercontent.com/7687231/99909354-554bd500-2ce8-11eb-90b3-f85e78757ed2.png)

By default, Figma exports it to :

```svg

```
This won't work, since the circle is drawn with a stroke.

Right click on the circle, and choose `Outline strokes` from the menu.

![image](https://user-images.githubusercontent.com/7687231/99909402-993eda00-2ce8-11eb-8d3e-35432a540422.png)

![image](https://user-images.githubusercontent.com/7687231/99909427-c25f6a80-2ce8-11eb-9bbe-6545d8343f33.png)

The SVG now looks fine :

```svg

```

### Flattening

If you use complexe operations in your designing software (like unions/intersects), flattening the shapes may improve the final export.

For example :

![image](https://user-images.githubusercontent.com/7687231/99910078-5bdc4b80-2cec-11eb-8def-7edb5eadd6ef.png)

The export may sometimes work, but it is generally better to have raw flatten path. To flatten your shapes, right-click on the shape, and select `Flatten`.

![image](https://user-images.githubusercontent.com/7687231/99910119-980fac00-2cec-11eb-8623-b3716f6088fa.png)

That's it ! You now have a unique path.

![image](https://user-images.githubusercontent.com/7687231/99910133-ad84d600-2cec-11eb-9891-5f2a478cab5e.png)

### Optimizing data before release

If you want to optimize a bit the parsing before your production release, you can remove all the unnecessary properties.

```svg

```

If you want an even more optimized parsing pass, you can join multiple path together, get a unique data content and use the `PathIconData.fromData` instead.

```
M57.3785 .. 120.434Z M118.947 ...109.579Z
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。