diff --git a/demo/client/css/pathfinder.css b/demo/client/css/pathfinder.css
index fd096541..2de2eb64 100644
--- a/demo/client/css/pathfinder.css
+++ b/demo/client/css/pathfinder.css
@@ -27,7 +27,7 @@
.pf-toolbar-button {
pointer-events: auto;
}
-.pf-toolbar-button:not(:hover) {
+.pf-toolbar-button.btn-outline-secondary:not(:hover) {
background: rgba(255, 255, 255, 0.75);
}
#pf-file-select {
diff --git a/demo/client/html/benchmark.html.hbs b/demo/client/html/benchmark.html.hbs
new file mode 100644
index 00000000..d792ed7a
--- /dev/null
+++ b/demo/client/html/benchmark.html.hbs
@@ -0,0 +1,21 @@
+
+
+
+ Benchmark — Pathfinder
+
+ {{>partials/header.html}}
+
+
+
+ {{>partials/navbar.html isTool=true}}
+
+
+
+
+
+
+
+
diff --git a/demo/client/html/partials/navbar.html.hbs b/demo/client/html/partials/navbar.html.hbs
index b55300cf..2e541678 100644
--- a/demo/client/html/partials/navbar.html.hbs
+++ b/demo/client/html/partials/navbar.html.hbs
@@ -18,6 +18,7 @@
diff --git a/demo/client/src/benchmark.ts b/demo/client/src/benchmark.ts
new file mode 100644
index 00000000..ab263fb8
--- /dev/null
+++ b/demo/client/src/benchmark.ts
@@ -0,0 +1,59 @@
+// pathfinder/client/src/benchmark.ts
+//
+// Copyright © 2017 The Pathfinder Project Developers.
+//
+// Licensed under the Apache License, Version 2.0 or the MIT license
+// , at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+import * as opentype from "opentype.js";
+
+import {AppController} from "./app-controller";
+import {PathfinderMeshData} from "./meshes";
+import {BUILTIN_FONT_URI, GlyphStorage, PathfinderGlyph, TextFrame, TextRun} from "./text";
+import {assert, unwrapNull} from "./utils";
+
+const STRING: string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+const FONT: string = 'nimbus-sans';
+
+class BenchmarkAppController extends AppController {
+ start() {
+ super.start();
+
+ const runBenchmarkButton = unwrapNull(document.getElementById('pf-run-benchmark-button'));
+ runBenchmarkButton.addEventListener('click', () => this.runBenchmark(), false);
+
+ this.loadInitialFile();
+ }
+
+ protected fileLoaded(): void {
+ const font = opentype.parse(this.fileData);
+ assert(font.isSupported(), "The font type is unsupported!");
+
+ const createGlyph = (glyph: opentype.Glyph) => new BenchmarkGlyph(glyph);
+ const textRun = new TextRun(STRING, [0, 0], font, createGlyph);
+ const textFrame = new TextFrame([textRun]);
+ this.glyphStorage = new GlyphStorage(this.fileData, [textFrame], createGlyph, font);
+
+ this.glyphStorage.partition().then(meshes => {
+ this.meshes = meshes;
+ // TODO(pcwalton)
+ // this.renderer.attachMeshes();
+ })
+ }
+
+ private runBenchmark(): void {
+ // TODO(pcwalton)
+ }
+
+ protected readonly defaultFile: string = FONT;
+ protected readonly builtinFileURI: string = BUILTIN_FONT_URI;
+
+ private glyphStorage: GlyphStorage;
+ private meshes: PathfinderMeshData;
+}
+
+class BenchmarkGlyph extends PathfinderGlyph {}
diff --git a/demo/client/webpack.config.js b/demo/client/webpack.config.js
index f5e591d9..c131cf29 100644
--- a/demo/client/webpack.config.js
+++ b/demo/client/webpack.config.js
@@ -8,6 +8,7 @@ module.exports = {
'3d-demo': "./src/3d-demo.ts",
'svg-demo': "./src/svg-demo.ts",
'text-demo': "./src/text-demo.ts",
+ 'benchmark': "./src/benchmark.ts",
'mesh-debugger': "./src/mesh-debugger.ts",
},
module: {
diff --git a/demo/server/src/main.rs b/demo/server/src/main.rs
index e125ddaa..aa5271c3 100644
--- a/demo/server/src/main.rs
+++ b/demo/server/src/main.rs
@@ -43,6 +43,7 @@ static STATIC_INDEX_PATH: &'static str = "../client/index.html";
static STATIC_TEXT_DEMO_PATH: &'static str = "../client/text-demo.html";
static STATIC_SVG_DEMO_PATH: &'static str = "../client/svg-demo.html";
static STATIC_3D_DEMO_PATH: &'static str = "../client/3d-demo.html";
+static STATIC_TOOLS_BENCHMARK_PATH: &'static str = "../client/benchmark.html";
static STATIC_TOOLS_MESH_DEBUGGER_PATH: &'static str = "../client/mesh-debugger.html";
static STATIC_DOC_API_PATH: &'static str = "../../font-renderer/target/doc";
static STATIC_CSS_BOOTSTRAP_PATH: &'static str = "../client/node_modules/bootstrap/dist/css";
@@ -539,6 +540,10 @@ fn static_demo_svg() -> io::Result {
fn static_demo_3d() -> io::Result {
NamedFile::open(STATIC_3D_DEMO_PATH)
}
+#[get("/tools/benchmark")]
+fn static_tools_benchmark() -> io::Result {
+ NamedFile::open(STATIC_TOOLS_BENCHMARK_PATH)
+}
#[get("/tools/mesh-debugger")]
fn static_tools_mesh_debugger() -> io::Result {
NamedFile::open(STATIC_TOOLS_MESH_DEBUGGER_PATH)
@@ -634,6 +639,7 @@ fn main() {
static_demo_text,
static_demo_svg,
static_demo_3d,
+ static_tools_benchmark,
static_tools_mesh_debugger,
static_doc_api_index,
static_doc_api,