Setting fallback font for text in svg?


  • admin

    I use drawbot to make svg illustrations. Razorsharp diagrams! For this it would be useful to be able to set a fontstack rather than just a single name.

    Drawbot:
    font('Menlo-Regular')

    SVG:
    font-family="Menlo-Regular"

    Maybe we could add an attribute to the font function that accepts a list of names. For normal non-svg output this could be ignored.

    Drawbot:
    font('Menlo-Regular', fallback=['godforbid-arial', 'sans-serif'])

    SVG:
    font-family="Menlo-Regular, godforbid-arial, sans-serif"

    I can easily open the svg file and manipulate the text to include the extra names. But maybe it is useful to have a more explicit way.


  • admin

    there is already a fallbackFont(fontName) see

    but no connection with the svg, this would be indeed nice to add, as the fonts are not embedded into the svg.

    Embedding of font in svg is not allowed.


  • admin

    further discussion here https://github.com/typemytype/drawbot/issues/274

    also read why we dont allow embedding fonts: https://github.com/typemytype/drawbot/issues/23


Log in to reply