three-text 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE_THIRD_PARTY +15 -0
- package/README.md +80 -50
- package/dist/index.cjs +66 -20
- package/dist/index.d.ts +8 -0
- package/dist/index.js +66 -20
- package/dist/index.min.cjs +310 -307
- package/dist/index.min.js +265 -262
- package/dist/index.umd.js +68 -21
- package/dist/index.umd.min.js +268 -265
- package/dist/three/index.cjs +2 -1
- package/dist/three/index.d.ts +1 -0
- package/dist/three/index.js +2 -1
- package/dist/three/react.cjs +35 -17
- package/dist/three/react.d.ts +8 -0
- package/dist/three/react.js +35 -17
- package/dist/types/core/Text.d.ts +6 -0
- package/dist/types/core/types.d.ts +2 -33
- package/dist/types/three/index.d.ts +1 -0
- package/dist/types/vector/core/index.d.ts +28 -0
- package/dist/types/vector/index.d.ts +17 -12
- package/dist/types/vector/react.d.ts +3 -4
- package/dist/types/vector/slug/SlugPacker.d.ts +2 -0
- package/dist/types/vector/slug/curveUtils.d.ts +6 -0
- package/dist/types/vector/slug/index.d.ts +8 -0
- package/dist/types/vector/slug/shaderStrings.d.ts +4 -0
- package/dist/types/vector/slug/slugGLSL.d.ts +21 -0
- package/dist/types/vector/slug/slugTSL.d.ts +13 -0
- package/dist/types/vector/slug/types.d.ts +30 -0
- package/dist/types/vector/slug/unpackVertices.d.ts +11 -0
- package/dist/types/vector/webgl/index.d.ts +7 -3
- package/dist/types/vector/webgpu/index.d.ts +4 -4
- package/dist/vector/all.cjs +21 -0
- package/dist/vector/all.d.ts +134 -0
- package/dist/vector/all.js +2 -0
- package/dist/vector/core/index.cjs +856 -0
- package/dist/vector/core/index.d.ts +63 -0
- package/dist/vector/core/index.js +854 -0
- package/dist/vector/core.cjs +5489 -0
- package/dist/vector/core.d.ts +402 -0
- package/dist/vector/core.js +5486 -0
- package/dist/vector/index.cjs +5 -1305
- package/dist/vector/index.d.ts +41 -67
- package/dist/vector/index.js +3 -1306
- package/dist/vector/index2.cjs +287 -0
- package/dist/vector/index2.js +264 -0
- package/dist/vector/loopBlinnTSL.d.ts +69 -0
- package/dist/vector/react.cjs +54 -40
- package/dist/vector/react.d.ts +11 -2
- package/dist/vector/react.js +55 -41
- package/dist/vector/slugTSL.cjs +252 -0
- package/dist/vector/slugTSL.js +231 -0
- package/dist/vector/webgl/index.cjs +131 -201
- package/dist/vector/webgl/index.d.ts +19 -44
- package/dist/vector/webgl/index.js +131 -201
- package/dist/vector/webgpu/index.cjs +100 -283
- package/dist/vector/webgpu/index.d.ts +16 -45
- package/dist/vector/webgpu/index.js +100 -283
- package/package.json +6 -1
- package/dist/types/vector/GlyphVectorGeometryBuilder.d.ts +0 -26
- package/dist/types/vector/LoopBlinnGeometry.d.ts +0 -68
- package/dist/types/vector/loopBlinnTSL.d.ts +0 -11
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Text as Text$1 } from '../core/Text';
|
|
2
|
+
import { VectorGlyphInfo, TextQueryOptions, TextRange, LoadedFont, TextOptions } from '../core/types';
|
|
3
|
+
export { LoadedFont, TextOptions, VectorGlyphInfo } from '../core/types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
|
|
6
|
+
interface BoundingBox {
|
|
7
|
+
min: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
z: number;
|
|
11
|
+
};
|
|
12
|
+
max: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
z: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface QuadraticSegment {
|
|
20
|
+
p0x: number;
|
|
21
|
+
p0y: number;
|
|
22
|
+
p1x: number;
|
|
23
|
+
p1y: number;
|
|
24
|
+
p2x: number;
|
|
25
|
+
p2y: number;
|
|
26
|
+
}
|
|
27
|
+
interface ContourVertex {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
}
|
|
31
|
+
interface VectorContour {
|
|
32
|
+
vertices: ContourVertex[];
|
|
33
|
+
segments: QuadraticSegment[];
|
|
34
|
+
}
|
|
35
|
+
interface VectorGlyphAttributes {
|
|
36
|
+
glyphCenter: Float32Array;
|
|
37
|
+
glyphIndex: Float32Array;
|
|
38
|
+
glyphProgress: Float32Array;
|
|
39
|
+
glyphLineIndex: Float32Array;
|
|
40
|
+
glyphBaselineY: Float32Array;
|
|
41
|
+
}
|
|
42
|
+
interface GlyphRange {
|
|
43
|
+
interiorIndexStart: number;
|
|
44
|
+
interiorIndexCount: number;
|
|
45
|
+
curveVertexStart: number;
|
|
46
|
+
curveVertexCount: number;
|
|
47
|
+
}
|
|
48
|
+
interface VectorGeometryData {
|
|
49
|
+
interiorPositions: Float32Array;
|
|
50
|
+
interiorIndices: Uint32Array;
|
|
51
|
+
curvePositions: Float32Array;
|
|
52
|
+
fillPositions: Float32Array;
|
|
53
|
+
fillIndices: Uint32Array;
|
|
54
|
+
glyphRanges: GlyphRange[];
|
|
55
|
+
interiorGlyphAttrs?: VectorGlyphAttributes;
|
|
56
|
+
curveGlyphAttrs?: VectorGlyphAttributes;
|
|
57
|
+
fillGlyphAttrs?: VectorGlyphAttributes;
|
|
58
|
+
planeBounds: BoundingBox;
|
|
59
|
+
stats: {
|
|
60
|
+
glyphCount: number;
|
|
61
|
+
contourCount: number;
|
|
62
|
+
interiorTriangleCount: number;
|
|
63
|
+
curveTriangleCount: number;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
interface LoopBlinnGlyphInput {
|
|
67
|
+
offsetX: number;
|
|
68
|
+
offsetY: number;
|
|
69
|
+
segments: QuadraticSegment[];
|
|
70
|
+
bounds: {
|
|
71
|
+
minX: number;
|
|
72
|
+
minY: number;
|
|
73
|
+
maxX: number;
|
|
74
|
+
maxY: number;
|
|
75
|
+
};
|
|
76
|
+
lineIndex: number;
|
|
77
|
+
baselineY: number;
|
|
78
|
+
}
|
|
79
|
+
interface LoopBlinnInput {
|
|
80
|
+
glyphs: LoopBlinnGlyphInput[];
|
|
81
|
+
planeBounds: BoundingBox;
|
|
82
|
+
}
|
|
83
|
+
declare function extractContours(segments: QuadraticSegment[]): VectorContour[];
|
|
84
|
+
declare function buildVectorGeometry(input: LoopBlinnInput): VectorGeometryData;
|
|
85
|
+
|
|
86
|
+
interface HyphenationTrieNode {
|
|
87
|
+
patterns: number[] | null;
|
|
88
|
+
children: {
|
|
89
|
+
[char: string]: HyphenationTrieNode;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface VectorTextResult {
|
|
94
|
+
glyphs: VectorGlyphInfo[];
|
|
95
|
+
geometryData: VectorGeometryData;
|
|
96
|
+
query(options: TextQueryOptions): TextRange[];
|
|
97
|
+
getLoadedFont(): LoadedFont | undefined;
|
|
98
|
+
measureTextWidth(text: string, letterSpacing?: number): number;
|
|
99
|
+
update(options: Partial<TextOptions>): Promise<VectorTextResult>;
|
|
100
|
+
dispose(): void;
|
|
101
|
+
}
|
|
102
|
+
declare class Text {
|
|
103
|
+
static setHarfBuzzPath: typeof Text$1.setHarfBuzzPath;
|
|
104
|
+
static setHarfBuzzBuffer: typeof Text$1.setHarfBuzzBuffer;
|
|
105
|
+
static init: typeof Text$1.init;
|
|
106
|
+
static registerPattern: typeof Text$1.registerPattern;
|
|
107
|
+
static preloadPatterns: typeof Text$1.preloadPatterns;
|
|
108
|
+
static setMaxFontCacheMemoryMB: typeof Text$1.setMaxFontCacheMemoryMB;
|
|
109
|
+
static enableWoff2: typeof Text$1.enableWoff2;
|
|
110
|
+
static create(options: TextOptions): Promise<VectorTextResult>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface VectorMeshOptions {
|
|
114
|
+
color?: THREE.ColorRepresentation;
|
|
115
|
+
positionNode?: any;
|
|
116
|
+
colorNode?: any;
|
|
117
|
+
center?: boolean;
|
|
118
|
+
}
|
|
119
|
+
interface VectorMeshes {
|
|
120
|
+
group: THREE.Group;
|
|
121
|
+
interiorMesh: THREE.Object3D;
|
|
122
|
+
curveMesh: THREE.Object3D;
|
|
123
|
+
fillMesh: THREE.Mesh;
|
|
124
|
+
interiorGeometry: THREE.BufferGeometry;
|
|
125
|
+
curveGeometry: THREE.BufferGeometry;
|
|
126
|
+
fillGeometry: THREE.BufferGeometry;
|
|
127
|
+
setOffset(x: number, y: number, z?: number): void;
|
|
128
|
+
updateMaterials(options?: VectorMeshOptions): void;
|
|
129
|
+
dispose(): void;
|
|
130
|
+
}
|
|
131
|
+
declare const loopBlinnFragment: any;
|
|
132
|
+
declare function createVectorMeshes(data: VectorGeometryData, options?: VectorMeshOptions | THREE.ColorRepresentation): VectorMeshes;
|
|
133
|
+
|
|
134
|
+
export { GlyphRange, HyphenationTrieNode, LoopBlinnGlyphInput, LoopBlinnInput, QuadraticSegment, Text, VectorTextResult as TextGeometryInfo, VectorContour, VectorGeometryData, VectorGlyphAttributes, VectorMeshOptions, VectorMeshes, VectorTextResult, buildVectorGeometry, createVectorMeshes, extractContours, loopBlinnFragment };
|