All Projects → ycw → three-font-outliner

ycw / three-font-outliner

Licence: MIT license
Constructing shapes from glyphs at runtime for three.js.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to three-font-outliner

aframe-bmfont-text-component
A-Frame component for rendering bitmap fonts.
Stars: ✭ 62 (+6.9%)
Mutual labels:  threejs
three-maze
♟️ Creation of random 3D mazes with three.js and tween.js.
Stars: ✭ 44 (-24.14%)
Mutual labels:  threejs
tk-fangsong-font
剔骨仿宋: Experimental Fang Song style Chinese font
Stars: ✭ 93 (+60.34%)
Mutual labels:  font
stb-truetype-example
Example of how to use stb_truetype library for rendering TrueType fonts.
Stars: ✭ 51 (-12.07%)
Mutual labels:  font
Acy-Font
自制手写字体。A hand-writing font set.
Stars: ✭ 20 (-65.52%)
Mutual labels:  font
cellular-automata-explorer
(WIP) An interactive web app for exploring cellular automata.
Stars: ✭ 18 (-68.97%)
Mutual labels:  threejs
FontManager-Module
Font Manager is the premier font and emoji management and changing solution for android.
Stars: ✭ 60 (+3.45%)
Mutual labels:  font
car-assembly
基于Vue3.0+WebGL+Nestjs搭建的汽车组装演示系统
Stars: ✭ 44 (-24.14%)
Mutual labels:  threejs
obj-simplify
Object File (.obj) simplifier
Stars: ✭ 117 (+101.72%)
Mutual labels:  threejs
brass mono
Retro monospaced font inspired by 70's design.
Stars: ✭ 58 (+0%)
Mutual labels:  font
element
Fast and simple custom elements.
Stars: ✭ 65 (+12.07%)
Mutual labels:  threejs
tplh.net-2019
I explored what my identity was and tried to express it as much as possible using whatever technology I have now.
Stars: ✭ 35 (-39.66%)
Mutual labels:  threejs
Filament
Interactive Music Visualizer
Stars: ✭ 22 (-62.07%)
Mutual labels:  threejs
sysfont
Golang identification and matching of system fonts
Stars: ✭ 29 (-50%)
Mutual labels:  font
spacesvr
A standardized reality for the future of the 3D Web.
Stars: ✭ 135 (+132.76%)
Mutual labels:  threejs
wormhole
A wormhole simulation.
Stars: ✭ 32 (-44.83%)
Mutual labels:  threejs
ng2-3d-editor
3D Viewer and Editor Javascript
Stars: ✭ 15 (-74.14%)
Mutual labels:  threejs
virtex
A three.js object viewer written in TypeScript
Stars: ✭ 14 (-75.86%)
Mutual labels:  threejs
three-typescript-starter
Three.js + Typescript + Webpack Boilerplate
Stars: ✭ 105 (+81.03%)
Mutual labels:  threejs
farro
Farro is an artsy, four-weighted, display typeface that has a peculiar personality flowing through its European humanist silhouette.
Stars: ✭ 26 (-55.17%)
Mutual labels:  font

About

Constructing shapes from glyphs at runtime for three.js.

Examples

Installation

Via npm: ( npm i ycw/three-font-outliner#v2.0.0 )

import { FontOutliner } from "three-font-outliner"

Via cdn:

import { FontOutliner } from "https://cdn.jsdelivr.net/gh/ycw/[email protected]/dist/lib.esm.js"

Usage

// Ex. Show text "Shapes" using font "aqua.ttf".
const outliner = await FontOutliner.fromUrl(THREE, "./aqua.ttf");
const { shapes } = outliner.outline("Shapes");
scene.add(new THREE.Mesh(
    new THREE.ShapeBufferGeometry(shapes, 16).center(),
    new THREE.MeshBasicMaterial({ color: "blue", side: THREE.DoubleSide })
));

Live result: Shapes

Docs

Make a font outliner:

// Method 1: Load from `Arraybuffer` holding the font file.
const outliner = new FontOutliner(THREE, arrayBuffer);

// Method 2: Load from url. (async)
const outliner = await FontOutliner.fromUrl(THREE, fontUrl);

Then, outline glyph:

const result = outliner.outline("hello");

result.shapes; // Array of `THREE.Shape`
result.h; // Line height
result.w; // Advance width
result.yMin; // Bottom (usually a negative value)
result.yMax; // Top

.outline() accepts optional options:

const result = outliner.outline("hello", {
  size: 100, // Font size. Default 100,
  isLTR: true, // Is left-to-right writing mode? Default true.
  isCCW: false, // Is solid shape using CCW winding? Default false.
});

Check if certain glyph exists by unicode code point:

const codePoint = 65;
outliner.hasGlyph(codePoint); // return true / false

Credits

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].