|
@@ -147,11 +147,10 @@ function export_pdf_file (pageData, paperSize, fName, callback) {
|
|
|
let fontFile = __dirname + '/pdf_base_files/simkai.ttf';
|
|
|
if (font) {
|
|
|
dftFontHeight = 1 * font[JV.FONT_PROPS[1]];
|
|
|
- let dftFontBold = font[JV.FONT_PROPS[3]];
|
|
|
- let dftFontItalic = font[JV.FONT_PROPS[4]];
|
|
|
- fontFile = __dirname + '/pdf_base_files/' + fontUtil.getActualFont(font[JV.FONT_PROPS[0]], (dftFontBold === 'T'), (dftFontItalic === 'T')) + '.ttf';
|
|
|
+ fontFile = __dirname + '/pdf_base_files/' + fontUtil.getActualFont(font[JV.FONT_PROPS[0]], (font[JV.FONT_PROPS[3]] === 'T'), (font[JV.FONT_PROPS[4]] === 'T')) + '.ttf';
|
|
|
doc.fontSize(dftFontHeight);
|
|
|
}
|
|
|
+ doc.font(fontFile);
|
|
|
let options={};
|
|
|
if (control) {
|
|
|
private_setupAreaH(area, control.Horizon, font.FontAngle, dftFontHeight, output,options);
|
|
@@ -164,23 +163,22 @@ function export_pdf_file (pageData, paperSize, fName, callback) {
|
|
|
if (parseInt(font.FontAngle) !== 0) {
|
|
|
w = area[JV.IDX_BOTTOM] - JV.OUTPUT_OFFSET[JV.OFFSET_IDX_BOTTOM] - area[JV.IDX_TOP] - JV.OUTPUT_OFFSET[JV.OFFSET_IDX_TOP];
|
|
|
}
|
|
|
- doc.save();
|
|
|
+ // doc.save();
|
|
|
//doc.translate(output[0], output[1]);
|
|
|
if (w >= doc.widthOfString(val)) {
|
|
|
- options.width=w;
|
|
|
- options.height=dftFontHeight;
|
|
|
+ options.width = w;
|
|
|
+ options.height = dftFontHeight;
|
|
|
} else {
|
|
|
while (true) {
|
|
|
dftFontHeight--;
|
|
|
doc.fontSize(dftFontHeight);
|
|
|
if (w >= doc.widthOfString(val) || dftFontHeight < 6) {
|
|
|
- options.width=w;
|
|
|
- options.height=dftFontHeight;
|
|
|
+ options.width = w;
|
|
|
+ options.height = dftFontHeight;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
function private_drawUnderline() {
|
|
|
//A. 暂不支持角度; B. PDF输出时,坐标没有translate
|
|
|
let ctx = doc;
|
|
@@ -232,9 +230,9 @@ function export_pdf_file (pageData, paperSize, fName, callback) {
|
|
|
}
|
|
|
doc.rotate(font.FontAngle,rotateOptions);
|
|
|
}
|
|
|
- // doc.text(val,output[0], output[1],options);
|
|
|
- doc.font(fontFile).text(val,output[0], output[1],options);
|
|
|
- doc.restore();
|
|
|
+ doc.text(val,output[0], output[1], options);
|
|
|
+ doc.font(__dirname + '/pdf_base_files/Smart.ttf');
|
|
|
+ // doc.restore();
|
|
|
}
|
|
|
|
|
|
function private_setupAreaH(area, type, fontAngle, dftFontHeight, outputPoint,options) {
|