Hi all I'm getting successfully grabbing svg path data using opentype.js but having trouble using that data with svg.js to render the path:
Below is my code which currently creates an svg with an empty group <g></g>
where I was expecting the group to wrap my path data.
I read on another post that I should be using SVG.adopt() (as I have tried below) to no avail. Thanks in advance
const svg = new SVG().addTo('body').attr({
viewBox: '0 0 100 100'
})
const createShape = (font,content) => {
const fontPaths = font.getPaths(content,20,20,100)
const paths = fontPaths.map(fontPath => {
console.log(fontPath.toSVG())
const path = SVG.adopt(fontPath.toSVG())
// const svgPath = SVG(path)
// // svgPath.fill('black')
console.log(path)
return path
})
const group = svg.group()
group.add(paths).attr({
fill: 'black'
})
return group
}
const draw = (font) => {
createShape(font,'hello')
}
opentype.load('https://assets.codepen.io/1070/basiersquare-bold-webfont.woff',(err,font) => draw(font))