Giter Club home page Giter Club logo

Comments (6)

florianfesti avatar florianfesti commented on May 26, 2024

Right now I am not using any font libraries. Boxes.py generates text. So it leaves the rendering of the fonts to the client on all supported formats. This has pros and cons.

The things is if you are only interested in generating texts in different fonts you, too, can leave that to the client side. SVG has much more powerful mechanisms to alter the text that I am using in Boxes.py (which tries to only use simple graphic primitives that can be turned in to different formats).

So unless you want to do something very specific it might not e worth it to reinvent the wheel and create your own ttf library. Especially as there are probably already a few out there. May be you can find one that can be used for the ttf part so you only need to turn the paths into an SVG format, whihc should be relatively simple.

from boxes.

KittyDreadful avatar KittyDreadful commented on May 26, 2024

I’d like to know more about converting TTF to SVG fonts. This probably isn’t the right place. Can I contact you separately?

from boxes.

florianfesti avatar florianfesti commented on May 26, 2024

I’d like to know more about converting TTF to SVG fonts. This probably isn’t the right place. Can I contact you separately?

Nah, this is pretty much on topic here.

The issue is more that I do not know much about that topic. In the past Boxes.py was using libcairo as a backend. libcairo puts text in as a graphics as some of its output formats don't have text but are true graphics.

Here is an example on the produced SVG: view-source:https://raw.githubusercontent.com/florianfesti/boxes/6ab0cef413c110947d20b5fd3d414d170c7a2a13/examples/drillbox.svg

So each letter is declared as some

<symbol overflow="visible" id="glyph0-0">

containing a path that draws the letter.

And then used later with a

<use xlink:href="#glyph0-4" x="105.101562" y="333.414062"/>

If that is good enough for you you can use the SVG backend of libcairo. That way you do not need to bother with the details of the fonts at all. You just set the font and place some text sopmewhere and the library handles turning the ttf glyph into a SVG symbol. For Boxes.py we ofc don't want to go back to using libcairo.

from boxes.

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.