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

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

Closed
sbinet opened this issue Jun 11, 2021 · 1 comment · Fixed by #705
Closed

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

sbinet opened this issue Jun 11, 2021 · 1 comment · Fixed by #705

Comments

@sbinet
Copy link
Member

sbinet commented Jun 11, 2021

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>
@kortschak
Copy link
Member

SGTM

sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 15, 2021
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 15, 2021
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 24, 2021
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 24, 2021
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jul 1, 2021
sbinet added a commit that referenced this issue Jul 1, 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

Successfully merging a pull request may close this issue.

2 participants