babylon-msdf-text
Version:
**babylon-msdf-text** is a library for rendering high-quality, scalable, and anti-aliased text in Babylon.js using the Multi-channel Signed Distance Field (MSDF) technique. It offers an efficient and straightforward solution for superior text rendering in
53 lines (52 loc) • 1.47 kB
TypeScript
import { TextLayout, Glyph } from './TextLayout';
import * as BABYLON from "@babylonjs/core";
/**
* Text mesh vertex attributes
*/
export interface TextMeshAttributes {
uvs: Float32Array;
layoutUvs: Float32Array;
positions: Float32Array;
centers: Float32Array;
}
/**
* Text mesh vertex infos
*/
export interface TextMeshInfos {
linesTotal: number;
lineIndex: Float32Array;
lineLettersTotal: Float32Array;
lineLetterIndex: Float32Array;
lineWordsTotal: Float32Array;
lineWordIndex: Float32Array;
wordsTotal: number;
wordIndex: Float32Array;
lettersTotal: number;
letterIndex: Float32Array;
}
/**
* Text mesh attributes utilities
*/
export declare namespace TextMeshAttributes {
/**
* Creates vertex attributes for text mesh
*/
function create(glyphs: Glyph[], texWidth: number, texHeight: number, flipY: boolean, layout: TextLayout): TextMeshAttributes;
/**
* Sets custom vertex attributes on mesh
*/
function setCustomAttributes(engine: BABYLON.Engine, mesh: BABYLON.Mesh, attributes: TextMeshAttributes): void;
}
/**
* Text mesh infos utilities
*/
export declare namespace TextMeshInfos {
/**
* Creates vertex infos for text mesh
*/
function create(glyphs: Glyph[]): TextMeshInfos;
/**
* Sets custom vertex infos on mesh
*/
function setCustomAttributes(engine: BABYLON.Engine, mesh: BABYLON.Mesh, infos: TextMeshInfos): void;
}