mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-10 13:38:39 +00:00
Summary: This diff provides support for Latin-1, Cyrillic, and CJK characters inside \text{} groups. For Latin-1 and Cyrillic characters we use glyph metrics from a glyph from Basic Latin that has roughly the same bounding box. We use the metrics for a capital 'M' to approximate the full-width CJK characters. Half-width characters are not supported yet. Test Plan: - make test - make screenshots Reviewers: emily
57 lines
1.6 KiB
HTML
57 lines
1.6 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>Screenshotter test</title>
|
|
<script src="/katex.js" type="text/javascript"></script>
|
|
<link href="/katex.css" rel="stylesheet" type="text/css">
|
|
<style type="text/css">
|
|
#math, #pre, #post {
|
|
font-size: 4em;
|
|
}
|
|
body {
|
|
font-family: "DejaVu Serif",serif;
|
|
}
|
|
@font-face {
|
|
font-family: "Mincho";
|
|
src: url("unicode-fonts/mincho/font_1_honokamin.ttf") format("truetype");
|
|
}
|
|
@font-face {
|
|
font-family: "Batang";
|
|
src: url("unicode-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">
|
|
var query = {};
|
|
var re = /(?:^\?|&)([^&=]+)(?:=([^&]+))?/g;
|
|
var match;
|
|
while (match = re.exec(window.location.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"];
|
|
}
|
|
|
|
katex.render(query["tex"], mathNode, settings);
|
|
document.getElementById("pre").innerHTML = query["pre"] || "";
|
|
document.getElementById("post").innerHTML = query["post"] || "";
|
|
</script>
|
|
</body>
|
|
</html>
|