Cross-browser embedded font in svg image

前端 未结 2 2025
臣服心动
臣服心动 2020-12-03 17:33

The title is ambiguous; let me clarify: I have an svg image which includes a text I want rendered with a custom font.

However, there seem to be new issues that do no

2条回答
  •  悲哀的现实
    2020-12-03 18:17

    In Firefox at least, images must be completely self-contained i.e. everything in one file for privacy reasons.

    If you want the fonts to work you'll have to base64 encode them and embed them as a data URLs in the SVG file i.e.

    @font-face {
        font-family: 'Open Sans';
        src: url("data:application/x-font-ttf;base64,[base-encoded font here]");
    }
    

提交回复
热议问题