Giter Site home page Giter Site logo

Comments (6)

hugolpz avatar hugolpz commented on June 8, 2024 1

See

It works quite quickly, basic js and svg :
screenshot from 2016-12-08 16-07-45

I used absolute positioning and text-anchor but translation() could be nice as well.
We could do vertical text as well.

Key methods of the module are the following :

const textToSVG = TextToSVG.loadSync();                                  // load default font
const textToSVG = TextToSVG.loadSync('/fonts/Noto-Sans.otf'); // local custom font

.getD(text, options = {}) : Get the path data for d attribute of path.
.getPath(text, options = {}) : Get the path element of SVG.
.getSVG(text, options = {}) : Get the SVG.

from ruby-font-creator.

edouard-lopez avatar edouard-lopez commented on June 8, 2024

text-to-svg seems a straight-forward solution to position and add rotation:

const TextToSVG = require('text-to-svg');
const textToSVG = TextToSVG.loadSync();

const attributes = {fill: 'red', stroke: 'black'};
const options = {x: 0, y: 0, fontSize: 72, anchor: 'top', attributes: attributes};

const svg = textToSVG.getSVG('hello', options);

console.log(svg);

from ruby-font-creator.

edouard-lopez avatar edouard-lopez commented on June 8, 2024

I pushed some tests I had written.

from ruby-font-creator.

hugolpz avatar hugolpz commented on June 8, 2024

Please add a ./fonts/ directory and your base open font to the repository.
I would like to give it a try this weekend, at least to output nice svg with balanced, etlegant sinograms and phonetic.

from ruby-font-creator.

hugolpz avatar hugolpz commented on June 8, 2024

Solved.
Check out branch hugo : https://github.com/edouard-lopez/Hanzi-Pinyin-Font/tree/hugo

from ruby-font-creator.

edouard-lopez avatar edouard-lopez commented on June 8, 2024

Thanks I improved the method annotation() to use like you

from ruby-font-creator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.