Skip to content

Commit e6b5458

Browse files
committed
add cjkCharWidth option
1 parent 12da8ba commit e6b5458

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ The following are the default input options.
112112
useGlobalCache: false, // use common <defs> for all equations?
113113
linebreaks: false, // automatic linebreaking
114114
equationNumbers: "none", // automatic equation numbering ("none", "AMS" or "all")
115+
cjkCharWidth: 13, // width of CJK character
115116

116117
math: "", // the math string to typeset
117118
format: "TeX", // the input format (TeX, inline-TeX, AsciiMath, or MathML)

lib/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ var defaults = {
4848
useGlobalCache: false, // use common <defs> for all equations?
4949
linebreaks: false, // do linebreaking?
5050
equationNumbers: "none", // or "AMS" or "all"
51+
cjkCharWidth: 13, // width of CJK character
5152

5253
math: "", // the math to typeset
5354
format: "TeX", // the input format (TeX, inline-TeX, AsciiMath, or MathML)
@@ -311,7 +312,7 @@ function ConfigureMathJax() {
311312
this.SUPER(arguments).Init.call(this,def);
312313
SVG.addText(this.element,text);
313314
var textWidth = text.split('')
314-
.map(function(c) { return isFullwidthCodePoint(c.codePointAt()) ? 13 : 8.5 })
315+
.map(function(c) { return isFullwidthCodePoint(c.codePointAt()) ? data.cjkCharWidth : 8.5 })
315316
.reduce(function(a, b) { return a + b }, 0);
316317
var bbox = {width: textWidth, height: 18, y: -12};
317318
scale *= 1000/SVG.em;

0 commit comments

Comments
 (0)