Code Monkey home page Code Monkey logo

gputext's Introduction

GPU Text

Engine agnostic GPU text rendering

Demo

Building /dist

npm install
npm run build

GPU Text Font Generator

Usage
['--charset'] <path>              : Path of file containing character set
['--charlist'] <characters>       : List of characters
['--output-dir', '-o'] <path>     : Sets the path of the output font file. External resources will be saved in the same directory
['--technique'] <name>            : Font rendering technique, one of: msdf, sdf, bitmap
['--msdfgen'] <path>              : Path of msdfgen executable
['--size'] <glyphSize>            : Maximum dimension of a glyph in pixels
['--pxrange'] <range>             : Specifies the width of the range around the shape between the minimum and maximum representable signed distance in pixels
['--max-texture-size'] <size>     : Sets the maximum dimension of the texture atlas
['--bounds'] <enabled>            : Enables storing glyph bounding boxes in the font (default false)
['--binary'] <enabled>            : Saves the font in the binary format (experimental; default false)
['--external-textures'] <enabled> : Store textures externally when saving in the binary format
['--help']                        : Shows this help
_ <path>                          : Path of TrueType font file (.ttf)
Example Font Generation

Checkout this repo

> ./cli.js source-fonts/OpenSans/OpenSans-Regular.ttf --binary true
Building

The atlas tool depends on msdfgen, a command-line tool to generate MSDF distance fields for TrueType glyphs. Checkout the msdfgen submodule and build it (after installing msdfgen dependencies)

git submodule init
cd msdfgen
cmake .
make

Then with haxe 4.0.0:

haxelib install build.hxml
haxe build.hxml

Release Todos

  • prebuilt msdfgen for windows
  • Complex layout demo
    • Text of different fonts within a single layout
  • Document public methods
  • Manually generate signed distance atlas mipmaps (this improves quality at low font sizes)
    • Store mipmap level in alpha and use to offset uvs to precise pixel coords
  • Support 3D anti-aliasing
  • Create examples for other libraries
    • three.js

gputext's People

Contributors

haxiomic avatar saliksyed 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

Watchers

 avatar  avatar  avatar  avatar

gputext's Issues

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.