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

Remove duplicate and invalid stop elements #184

Open
yisibl opened this issue Feb 27, 2021 · 0 comments
Open

Remove duplicate and invalid stop elements #184

yisibl opened this issue Feb 27, 2021 · 0 comments

Comments

@yisibl
Copy link
Contributor

yisibl commented Feb 27, 2021

<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
    <defs>
        <linearGradient id="lg1">
            <stop offset="-1" stop-color="yellow" />
            <stop offset="0" stop-color="yellow" />
            <stop offset="0.5" stop-color="green" />
            <stop offset="0.5" stop-color="green" />
            <stop offset="1" stop-color="yellow" />
            <stop offset="10" stop-color="yellow" />
        </linearGradient>
    </defs>
    <circle fill="url(#lg1)" cx="50" cy="50" r="45" />
</svg>

offset="-1" and 10 Is an invalid value, currently picosvg will cause an error.
offset="0.5" There are two duplicates and one needs to be deleted, otherwise there will be redundant in the generated font file.

Do we consider introducing an svg compression tool to handle more edge cases?

e.g.
svgcleaner: https://github.com/RazrFalcon/svgcleaner/blob/master/docs/svgcleaner.adoc#remove-title-element
scour: scour-project/scour#102

<ColorLine>
    <Extend value="pad" />
    <!-- StopCount=4 -->
    <ColorStop index="0">
        <StopOffset value="0.0" />
        <Color>
            <PaletteIndex value="1" />
            <Alpha value="1.0" />
        </Color>
    </ColorStop>
    <ColorStop index="1">
        <StopOffset value="0.5" />
        <Color>
            <PaletteIndex value="0" />
            <Alpha value="1.0" />
        </Color>
    </ColorStop>
    <ColorStop index="2">
        <StopOffset value="0.5" />
        <Color>
            <PaletteIndex value="0" />
            <Alpha value="1.0" />
        </Color>
    </ColorStop>
    <ColorStop index="3">
        <StopOffset value="1.0" />
        <Color>
            <PaletteIndex value="1" />
            <Alpha value="1.0" />
        </Color>
    </ColorStop>
</ColorLine>
@yisibl yisibl changed the title Remove duplicate and wrong gradients Remove duplicate and invalid stop elements Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant