Skip to content

Commit 9ce2c29

Browse files
authored
Merge pull request #276 from mathjax/patch-cm
Add missing pxPerInch value. #275
2 parents a356f66 + 3eaf200 commit 9ce2c29

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ function ConfigureMathJax() {
245245
// Set up the default ex-size and width
246246
//
247247
InitializeSVG: function () {
248+
this.pxPerInch = 96;
248249
this.defaultEx = 6;
249250
this.defaultWidth = 100;
250251
},

test/issue276.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var tape = require('tape');
2+
var mjAPI = require("../lib/main.js");
3+
var jsdom = require('jsdom').jsdom;
4+
5+
tape('SVG output: physical units', function(t) {
6+
t.plan(1);
7+
mjAPI.start();
8+
var mml = '<math><mspace width="1cm"></mspace></math>';
9+
10+
mjAPI.typeset({
11+
math: mml,
12+
format: "MathML",
13+
svg: true
14+
}, function(data) {
15+
var document = jsdom(data.svg);
16+
var doc = document.defaultView.document;
17+
var width = doc.querySelector('svg').getAttribute('width');
18+
t.notEqual(width, '0', '');
19+
});
20+
});

0 commit comments

Comments
 (0)