Skip to content

Choicelin/meshwriter-font

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MeshWriter-Font

Generate fonts for BABYLON MeshWriter.  (https://github.com/briantbutton/meshwriter)

Dependencies

Converting new font with MeshWriter-Font requires nodejs.  Making a new minified build of MeshWriter with custom font collections also requires npm and webpack.  (Note to reader: If you notice undocumented dependencies, let me know.) 

Recipe

Here is how the author builds a new font. 

Set up directories

Download the MeshWriter repo and MeshWriter-Font repo side by side onto your dev machine.

Follow this directory structure and naming
(Note that both directories use lowercase letters.  Naming matters.)

ParentDir
   |
   + - - meshwriter
   |   + - fonts                        // MeshWriter font files will be written here
   |   + - earcut
   |
   + - - meshwriter-font
       + - fonts                        // You will be placing .ttf/.otf files here
       + - opentype
       + - js

All done with setup.

Place new font files

Place a font file, hypothetically called 'FooBar-Book.ttf', into /meshwriter/fonts. 

Select glyph coverage

Open config.js.  Do you like the default-coverage list?  If so, you are done.  Otherwise, put coverage for your font into config.js.  Like this:

"foobar-book"   : [	
  "a","b","c","A","B","C","1","2","3"
],

Start node, load meshwriter-font and run it

From the directory, /meshwriter-font, invoke node:

> require("./index")
{}
> convertFontFile({suffix:"ttf",name:"FooBar-Book",compress:true})
[ 
  'a', 'b', 'c',
  'A', 'B', 'C',
  '1', '2', '3'
]
undefined
Wrote MeshWriter font file to '../meshwriter/fonts/foobar-book.js'

That's it!

Packaging MeshWriter with your new fonts

At this point, the action returns to the /meshwriter directory.  The instructions for making a new build are found here: https://github.com/briantbutton/meshwriter/tree/master/fonts

About

Create font files for meshwriter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.2%
  • HTML 2.9%
  • CSS 0.9%