*/
var Fonts = (function Fonts() {
- var kScalePrecision = 40;
+ var kScalePrecision = 50;
var fonts = [];
if (!isWorker) {
// Repair the TrueType file if it is can be damaged in the point of
// view of the sanitizer
data = this.checkAndRepair(name, file, properties);
+ writeToFile(data, "/tmp/file." + this.name + ".ttf");
break;
default:
}
var CanvasGraphics = (function() {
+ var kScalePrecision = 50;
+ var kRasterizerMin = 14;
+
function constructor(canvasCtx, imageCanvas) {
this.ctx = canvasCtx;
this.current = new CanvasExtraState();
if (this.ctx.$setFont) {
this.ctx.$setFont(fontName, size);
} else {
- this.ctx.font = size + 'px "' + fontName + '"';
Fonts.setActive(fontName, fontObj, size);
+
+ size = (size <= kRasterizerMin) ? size * kScalePrecision : size;
+ this.ctx.font = size + 'px "' + fontName + '"';
}
},
setTextRenderingMode: function(mode) {
ctx.translate(current.x, -1 * current.y);
var font = this.current.font;
if (font) {
+ if (this.current.fontSize < kRasterizerMin)
+ ctx.transform(1 / kScalePrecision, 0, 0, 1 / kScalePrecision, 0, 0);
ctx.transform.apply(ctx, font.textMatrix);
text = font.charsToUnicode(text);
}