Skip to content

chess svg from path to text #4

@sugizo

Description

@sugizo

background
can't have pieces style

expectation
nice to have different pieces style

solution
use text instead of path when drawing chess pieces

attached the example output when using svg text to draw chess pieces

image

heres the code for king white on picture above (using unicode white king default without font family = ♔)

<style type="text/css">
    .st1{text-anchor:middle;}
    .st2{dominant-baseline:central;}
    .st3{font-size:45px;}
    .st4{font-family:"";}
</style>
    <text x="22.5" y="22.5" class="st1 st2 st3 st4">&#9812;</text>

image

heres the code for king white on picture above (using non unicode king = k for font family = chess)

<style type="text/css">
    .st1{text-anchor:middle;}
    .st2{dominant-baseline:central;}
    .st3{font-size:45px;}
    .st4{font-family:"Chess";}
</style>
    <text x="22.5" y="22.5" class="st1 st2 st3 st4">k</text>

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions