Don't call `Font.toArrayBuffer()` in the mesh debugger, as that's really slow
This commit is contained in:
parent
2197896c4f
commit
3efca89235
|
@ -113,6 +113,7 @@ class MeshDebuggerAppController extends AppController {
|
||||||
private fontLoaded(fileData: ArrayBuffer): void {
|
private fontLoaded(fileData: ArrayBuffer): void {
|
||||||
this.file = opentype.parse(fileData);
|
this.file = opentype.parse(fileData);
|
||||||
assert(this.file.isSupported(), "The font type is unsupported!");
|
assert(this.file.isSupported(), "The font type is unsupported!");
|
||||||
|
this.fileData = fileData;
|
||||||
|
|
||||||
const glyphCount = this.file.numGlyphs;
|
const glyphCount = this.file.numGlyphs;
|
||||||
for (let glyphIndex = 1; glyphIndex < glyphCount; glyphIndex++) {
|
for (let glyphIndex = 1; glyphIndex < glyphCount; glyphIndex++) {
|
||||||
|
@ -147,14 +148,14 @@ class MeshDebuggerAppController extends AppController {
|
||||||
|
|
||||||
let promise: Promise<PathfinderMeshData>;
|
let promise: Promise<PathfinderMeshData>;
|
||||||
|
|
||||||
if (this.file instanceof opentype.Font) {
|
if (this.file instanceof opentype.Font && this.fileData != null) {
|
||||||
if (opentypeGlyph == null) {
|
if (opentypeGlyph == null) {
|
||||||
const glyphIndex = parseInt(this.fontPathSelect.selectedOptions[0].value);
|
const glyphIndex = parseInt(this.fontPathSelect.selectedOptions[0].value);
|
||||||
opentypeGlyph = this.file.glyphs.get(glyphIndex);
|
opentypeGlyph = this.file.glyphs.get(glyphIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
const glyph = new MeshDebuggerGlyph(opentypeGlyph);
|
const glyph = new MeshDebuggerGlyph(opentypeGlyph);
|
||||||
const glyphStorage = new GlyphStorage(this.file.toArrayBuffer(), [glyph], this.file);
|
const glyphStorage = new GlyphStorage(this.fileData, [glyph], this.file);
|
||||||
promise = glyphStorage.partition();
|
promise = glyphStorage.partition();
|
||||||
} else if (this.file instanceof SVGLoader) {
|
} else if (this.file instanceof SVGLoader) {
|
||||||
promise = this.file.partition(this.fontPathSelect.selectedIndex);
|
promise = this.file.partition(this.fontPathSelect.selectedIndex);
|
||||||
|
@ -172,6 +173,7 @@ class MeshDebuggerAppController extends AppController {
|
||||||
|
|
||||||
private file: Font | SVGLoader | null;
|
private file: Font | SVGLoader | null;
|
||||||
private fileType: FileType;
|
private fileType: FileType;
|
||||||
|
private fileData: ArrayBuffer | null;
|
||||||
|
|
||||||
meshes: PathfinderMeshData | null;
|
meshes: PathfinderMeshData | null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue