Giter Site home page Giter Site logo

wc-duck / ttf2mesh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fetisov/ttf2mesh

0.0 0.0 0.0 243 KB

Standalone library for TrueType font tessellation. Allows to load ttf-file and convert its glyphs to 2D or 3D mesh objects without rasterization.

License: MIT License

C++ 53.73% Python 0.52% C 45.53% QMake 0.22%

ttf2mesh's Introduction

image

The ttf2mesh crossplatform library allows to convert a glyphs of truetype font (ttf) to a mesh objects in 2d and 3d space. The library does not require any graphical context and does not use system dependent functions.

The library consists of two files written in the C language of the c99 standard: ttf2mesh.c and ttf2mesh.h. The ttf2mesh.c code implements a parsing of ttf-files and a tessellation algorithm that provides the formats conversion. The tessellation algorithm uses the Delaunay test to form an optimal set of triangles. Tessellation (triangulation) process is described in "this post" and is shown in the animation below.

image

The library has a simple doxygen-documented API for loading TTF files and converting glyphs into mesh objects. Examples of using the library are presented in examples/src directory. There are three main examples:

FILE Description
examples/src/simple.c The simplest code that shows how a user can load a font from the system directory and convert its glyph to a 2d mesh object. The converted glyph is rendering to an opengl window as a filled mesh, wireframe or the glyph contours.
image
examples/src/glyph3d.c Same as simple.c example, except that the font glyphs are converted to a 3D mesh object, which is displayed in the opengl window with animation.
image
examples/src/ttf2obj.c Console application for converting TTF font input file to a Wavefront object file (.obj). Each object in the output file includes the plane geometry of the corresponding glyph and its parameters: Unicode ID, advance and bearing.
image

To compile examples on Linux system you can use the GNU make utility: make -C examples/build-linux-make all. In the Windows operating system, you can use for compilation the Microsoft Visual Studio C++ project files that are located in the examples/build-win-msvc directory. Additionally, the examples\build-any-qmake directory contains pro files for building examples using the qtcreator IDE.

You can read information on how the library works at this link.

PayPal me or: MasterCard 5469 3800 5517 1176 wmz Z518568605100 wmr R885157851601

ttf2mesh's People

Contributors

fetisov avatar jabuwu avatar stevenctl avatar wc-duck avatar

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.