We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d1cea4a + 90f8f44 commit 6b709efCopy full SHA for 6b709ef
src/fonts.js
@@ -6897,6 +6897,14 @@ var CFFCompiler = (function CFFCompilerClosure() {
6897
},
6898
encodeFloat: function CFFCompiler_encodeFloat(num) {
6899
var value = num.toString();
6900
+
6901
+ // rounding inaccurate doubles
6902
+ var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
6903
+ if (m) {
6904
+ var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
6905
+ value = (Math.round(num * epsilon) / epsilon).toString();
6906
+ }
6907
6908
var nibbles = '';
6909
for (var i = 0, ii = value.length; i < ii; ++i) {
6910
var a = value[i];
0 commit comments