Coder Social home page Coder Social logo

codetiger / font23d Goto Github PK

View Code? Open in Web Editor NEW
129.0 8.0 26.0 9.82 MB

Convert any text to a 3d mesh using any font style

License: The Unlicense

C++ 30.41% Shell 0.57% C 0.45% CSS 0.23% HTML 1.17% JavaScript 67.17%
cpp mesh-generation font 3d-mesh text freetype glut ttf-fonts

font23d's Introduction

Font23D

Font23D is a C++ library for creating a 3d mesh of any Text in the given True type font.

Demo: Font23D running on browser using webassembly

Compile the code

Install the dependancies

sudo apt install libfreetype6-dev

Now just run the bash script to get the OBJ file output.

sh compile.sh

Sample Outputs

Below outputs are generated using different fonts Screenshot Font23D with Coolveticarg Font Screenshot Font23D with HP Font Screenshot Font23D with Hursheys Font

Unicode Support Screenshot Font23D with Tamil Font

Instruction to use:

  • The Library uses FreeType Library to decode the fonts and converts the Text into Vector.
  • Then the vector data is converted into triangles using Ploy2Tri library.
  • This gives us the triangles of the complete text in a plane.
  • The plane is then extruded into 3d object and then creates a closed mesh.
  • The Mesh is then saved as OBJ file.

Plans for Future:

  • Support WebAssembly and create sample web page to convert input text using uploaded font to 3D mesh.

Contributions:

  • Thanks to J.Scheurich from White Dune Project for suggesting fixes for Face culling.
  • Thanks to DaegyuMin for fixing a bug in missing triangle.

font23d's People

Contributors

10110111 avatar codetiger avatar harishankarnarayanan avatar kimbatt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

font23d's Issues

Generated Mesh has missing face.

Describe the bug

at 2021-02-06, in master branch

below Font2OBJ.cpp file has a bug that generated mesh has missing face.

for(size_t p = 0; p < contour->PointCount() - 1; ++p) {
const double* d1 = contour->GetPoint(p);
const double* d2 = contour->GetPoint(p + 1);

this code can be changed to fix bug.

for(size_t p = 0; p < contour->PointCount(); ++p) {
const double* d1 = contour->GetPoint(p);
const double* d2 = contour->GetPoint(
(p == contour->PointCount() - 1)?(0):(p + 1)
);

Way to have only front face of text

The only way to get something similar to this is to set extrude, bevelRadius, and bevelSteps to zero but there are still the side faces and back face.

I think that a good way to implement this would be to add a new function that would do this.

Also, you should put how to use the functions provided in the respiratory in the readme.

Cannot get the code to compile - compiler error on ubuntu gcc

Describe the bug
Cannot compile the code using sh compile.sh

To Reproduce

  1. I'm using gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
  2. I've installed libfreetype6-dev
  3. error showing on compiling - mesh.h: In member function ‘int Mesh::addVertex(Vertex)’:
    mesh.h:41:90: error: no matching function for call to ‘find(std::vector::iterator, std::vector::iterator, Vertex&)’
    41 | std::vector::iterator itr = std::find(vertices.begin(), vertices.end(), v);
    | ^

Desktop (please complete the following information):

  • OS: Windows 10 / running ubuntu as WSL

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.