1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-23 08:43:18 +02:00

Latin-Modern conversions, for Unicode compat.

This commit is contained in:
Pomax
2016-01-02 08:37:02 -08:00
parent 118bc0e9bf
commit 4f3227793a
62 changed files with 6528 additions and 6675 deletions

View File

@@ -1,7 +1,5 @@
var sha1 = require("sha1");
var fs = require("fs");
var imagesize = require('image-size');
var execSync = require("child_process").execSync;
var op = "\\[";
@@ -45,10 +43,15 @@ function escapeBlockLaTeX(source) {
execSync(cmd);
}
// make sure we hardcode the size of this LaTeX SVG image, because we absolutely
// Make sure we hardcode the size of this LaTeX SVG image, because we absolutely
// do not want the page to resize in any possible noticable way if we can help it.
var img = imagesize(filename);
var rewrite = `<img className="LaTeX SVG" src="${filename}" style={{width:"${img.width}ex", height:"${img.height}ex"}} />`;
// The SVG contains values in "ex" units, but to maximise rendering compatibility
// with things like older Android tables etc. we convert these to "em" instead.
var svg = fs.readFileSync(filename).toString();
var exem = 0.45;
var w = parseFloat(svg.match(/width="([^"]+)"/)[1]) * exem;
var h = parseFloat(svg.match(/height="([^"]+)"/)[1]) * exem;
var rewrite = `<img className="LaTeX SVG" src="${filename}" style={{width:"${w}em", height:"${h}em"}} />`;
newsource += rewrite;
}