Skip to content

How to properly add an SVG file to a glyph for creating OTF-SVG fonts? #3229

Closed Answered by 00sapo
00sapo asked this question in Q&A
Discussion options

You must be logged in to vote

So basically the problem was the rescaling of the SVG. I don't have a clear rule to follow, but I found a rule of thumb that works in my case. Here is the code I used, based on an Inkscape extension for baking transformations (scaling and transposing) to the SVG objects:

import re, io

import inkex
from .applytransform import ApplyTransform # extension from here:https://github.com/Klowner/inkscape-applytransforms/blob/master/applytransform.py

number = r"[-+]?[0-9]*\.?[0-9]+"
SVG_VIEWPORT = re.compile(
    # rf"<svg[^>]*viewBox=['\"]({number} +{number} +{number} +{number})['\"][^>]*>"
    rf"<svg[^>]*(viewBox\s*=\s*['\"]{number} +{number} +{number} +{number}['\"])[^>]*>"
)
SVG_VIEWPORT_SIZE 

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by 00sapo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants