Skip to content

Instantly share code, notes, and snippets.

@pjanik
Created February 12, 2016 20:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjanik/49c03c02c66341a26904 to your computer and use it in GitHub Desktop.
Save pjanik/49c03c02c66341a26904 to your computer and use it in GitHub Desktop.
// Load font file to string.
import fontDef from 'raw!three/examples/fonts/helvetiker_regular.typeface.js';
// Load font in a sync way, using webpack raw-loader. Based on async THREE JS loader:
// https://github.com/mrdoob/three.js/blob/ddab1fda4fd1e21babf65aa454fc0fe15bfabc33/src/loaders/FontLoader.js#L20
let font = new THREE.Font(JSON.parse(fontDef.substring(65, fontDef.length - 2)));
let geometry = new THREE.TextGeometry(txt, {
size: 50000000 * c.SF,
height: 1000000 * c.SF,
font: font
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment