|
@@ -55,9 +55,10 @@ export async function addWatermark(
|
|
|
// console.log(size);
|
|
|
const imgData = gm(image);
|
|
|
const drawText = (l: number, t: number, content: string) => {
|
|
|
- const top = t < 30 ? 30 : t > imageHeight ? imageHeight : t;
|
|
|
- const left = l > imageWidth - 30 ? imageWidth - 30 : l;
|
|
|
- imgData.drawText(left, top + 30, content);
|
|
|
+ const len = (content || "").length;
|
|
|
+ const top = t < 25 ? 50 : t + 25 > imageHeight ? imageHeight : t + 25;
|
|
|
+ const left = l > imageWidth - 25 ? imageWidth - 25 * len : l;
|
|
|
+ imgData.drawText(left, top, content);
|
|
|
};
|
|
|
//添加第一页的得分明细
|
|
|
if (index == 1) {
|
|
@@ -233,7 +234,7 @@ export async function addWatermark(
|
|
|
}
|
|
|
//显示评卷标记
|
|
|
if (student.tags != undefined && student.tags[index] != undefined) {
|
|
|
- const fontSize = 60;
|
|
|
+ const fontSize = 50;
|
|
|
const height = fontSize + 10;
|
|
|
imgData.font(fontFile, fontSize).fill(color);
|
|
|
const tags = student.tags[index];
|