Skip to content

vg/vgsvg: consider adding the ability to embed fonts in SVG #703

@sbinet

Description

@sbinet

as evocated in #702, we could perhaps add an option to vg/vgsvg.Canvas (like we did for vg/vgpdf.Canvas) to embed fonts inside the SVG document.

the default should probably be to not embed fonts.

ex:

<svg xmlns="http://www.w3.org/2000/svg" width="450" height="150" font-size="24" text-anchor="middle">
    <defs>
        <style>
            @font-face{
                font-family:"Roboto Condensed";
                src:url(data:font/ttf;charset=utf-8;base64,your_base64_encoded_long_string) format("ttf"); 
                font-weight:normal;font-style:normal;
            }
            @font-face{
                font-family:"Open Sans";
                src:url(data:font/ttf;charset=utf-8;base64,your_base64_encoded_long_string) format("ttf"); 
                font-weight:normal;font-style:normal;
            }
            @font-face{
                font-family:"Anonymous Pro";
                src:url(data:font/ttf;charset=utf-8;base64,your_base64_encoded_long_string) format("ttf"); 
                font-weight:normal;font-style:normal;
            }
        </style>
    </defs>
        <text font-family="Roboto Condensed" x="190" y="32.92">
        This is a Roboto Condensed font
    </text>
    <text font-family="Open Sans" x="190" y="82.92">
        This is a Open Sans font
    </text>
    <text font-family="Anonymous Pro" x="190" y="132.92">
        This is a Anonymous Pro font
    </text>
</svg>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions