mirror of
https://bjh21.me.uk/bedstead/.git
synced 2026-07-09 21:43:06 -04:00
webstead: make a named function to update the rendered glyph
This commit is contained in:
parent
111484a4f1
commit
6cf53005fe
@ -4,24 +4,25 @@
|
||||
<link rel="stylesheet" href="bedstead.css" type="text/css" />
|
||||
<title>Bedstead editor test</title>
|
||||
<script type="module"><![CDATA[
|
||||
import Bedstead from './bedstead.js';
|
||||
document.getElementById("run").onclick = function(){
|
||||
Bedstead({
|
||||
arguments: document.getElementById("input").value.split(" "),
|
||||
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/, ""));
|
||||
}
|
||||
});
|
||||
};
|
||||
]]>
|
||||
import Bedstead from './bedstead.js';
|
||||
function update_glyph() {
|
||||
Bedstead({
|
||||
arguments: document.getElementById("input").value.split(" "),
|
||||
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/, ""));
|
||||
}
|
||||
});
|
||||
}
|
||||
document.getElementById("run").onclick = update_glyph;
|
||||
]]>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user