mirror of
https://bjh21.me.uk/bedstead/.git
synced 2026-07-09 13:33:06 -04:00
117 lines
3.9 KiB
HTML
117 lines
3.9 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-GB" xml:lang="en-GB">
|
|
<head>
|
|
<!-- SPDX-License-Identifier: CC0-1.0 -->
|
|
<link rel="stylesheet" href="bedstead.css" type="text/css" />
|
|
<title>Bedstead editor test</title>
|
|
<script type="module"><![CDATA[
|
|
import Bedstead from './bedstead.js';
|
|
function update_glyph() {
|
|
var args = [];
|
|
for (var row of document.getElementById("pixels").rows) {
|
|
var arg = 0;
|
|
for (var pixel of row.getElementsByTagName('input')) {
|
|
arg *= 2;
|
|
if (pixel.checked) {
|
|
arg += 1
|
|
}
|
|
}
|
|
args.push(arg.toString())
|
|
}
|
|
Bedstead({
|
|
arguments: args,
|
|
print: function(charstring) {
|
|
document.getElementById("output").textContent = charstring;
|
|
document.getElementById("rendered")
|
|
.setAttribute("d", charstring
|
|
.replaceAll(/<!--(?:[^-]|-[^-])*-->/g, "")
|
|
.replace(/^.* [hv]stem /, "")
|
|
.replace(/^/, "m ")
|
|
.replaceAll(/ rmoveto/g, "")
|
|
.replaceAll(/ rlineto/g, "m")
|
|
.replace(/ endchar/, ""));
|
|
}
|
|
});
|
|
}
|
|
for (var e of document.getElementsByTagName('input')) {
|
|
e.onchange = update_glyph;
|
|
}
|
|
]]>
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<form>
|
|
<table id="pixels">
|
|
<tr>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
<td><input type="checkbox"/></td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
<p><code id="output"></code></p>
|
|
<div>
|
|
<svg width="600" height="1000" xmlns="http://www.w3.org/2000/svg">
|
|
<path id="rendered" fill="currentColor"/>
|
|
</svg>
|
|
</div>
|
|
</body>
|
|
</html>
|