Files
KaTeX/test/screenshotter/test.html
ylemkimon 96ad6e0f4f Add unicode-fonts as submodule (#1182)
* Add unicode-fonts as submodule

Removed checkout process from screenshotter.sh.

* Rename test-fonts submodule and update repo URL
2018-03-05 23:29:19 -05:00

72 lines
2.2 KiB
HTML

<!doctype html>
<html>
<head>
<title>Screenshotter test</title>
<script src="../../katex.js" type="text/javascript"></script>
<style type="text/css">
#math, #pre, #post {
font-size: 4em;
}
body {
font-family: "DejaVu Serif",serif;
}
@font-face {
font-family: "Mincho";
src: url("/submodules/katex-test-fonts/mincho/font_1_honokamin.ttf") format("truetype");
}
@font-face {
font-family: "Batang";
src: url("/submodules/katex-test-fonts/batang/batang.ttf") format("truetype");
}
.katex .cjk_fallback {
font-family: "Mincho",serif;
}
.katex .hangul_fallback {
font-family: "Batang",serif;
}
</style>
</head>
<body>
<span id="pre"></span>
<span id="math"></span>
<span id="post"></span>
<script type="text/javascript">
function handle_search_string(search, callback) {
var query = {};
var re = /(?:^\?|&)([^&=]+)(?:=([^&]+))?/g;
var match;
while (match = re.exec(search)) {
query[match[1]] = decodeURIComponent(match[2]);
}
var mathNode = document.getElementById("math");
var settings = {
displayMode: !!query["display"],
throwOnError: !query["noThrow"]
};
if (query["errorColor"]) {
settings.errorColor = query["errorColor"];
}
var macros = {};
var macroRegex = /(?:^\?|&)(?:\\|%5[Cc])([A-Za-z]+)=([^&]*)/g;
while ((match = macroRegex.exec(search)) !== null) {
settings.macros = macros;
macros["\\" + match[1]] = decodeURIComponent(match[2]);
}
mathNode.setAttribute("style", query["styles"] || "");
katex.render(query["tex"], mathNode, settings);
document.getElementById("pre").innerHTML = query["pre"] || "";
document.getElementById("post").innerHTML = query["post"] || "";
if (callback && document.fonts && document.fonts.ready) {
document.fonts.ready.then(callback);
} else if (callback) {
callback();
}
}
handle_search_string(window.location.search);
</script>
</body>
</html>