mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-24 17:23:05 +02:00
Cambria anyway
This commit is contained in:
@@ -47,16 +47,20 @@ var options = {
|
||||
|
||||
// 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.
|
||||
// The SVG contains values in "ex" units, but to maximise legibility we convert
|
||||
// these to "rem" instead, so that formulae are always sized the same, no matter
|
||||
// the textsize around them.
|
||||
var svg = fs.readFileSync(destination).toString();
|
||||
var pt2rem = 0.1;
|
||||
var w = parseFloat(svg.match(/width="([^"]+)"/)[1]) * pt2rem;
|
||||
var h = parseFloat(svg.match(/height="([^"]+)"/)[1]) * pt2rem;
|
||||
return `<img className="LaTeX SVG" src="${filename}" />`;
|
||||
var vb = svg.match(/viewBox="([^"]+)"/)[1].split(/\s+/);
|
||||
var w = parseFloat(vb[2]) - parseFloat(vb[0]);
|
||||
var h = parseFloat(vb[3]) - parseFloat(vb[1]);
|
||||
|
||||
// The SVG contains values in "pt" units, but to maximise legibility we convert
|
||||
// these to "rem" instead, so that formulae are always sized based on the font
|
||||
// around them, rather than being sized independently of the document text.
|
||||
var pt2rem = 1.4;
|
||||
w *= pt2rem;
|
||||
h *= pt2rem;
|
||||
|
||||
return `<img className="LaTeX SVG" src="${filename}" width="${w}rem" height="${h}rem"/>`;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = blockLoader(options);
|
||||
|
||||
|
Reference in New Issue
Block a user