Commit 4bb1a4af by doszhang

dos

parent ca9ed454
...@@ -347,6 +347,7 @@ function showPage1() { ...@@ -347,6 +347,7 @@ function showPage1() {
function calculationWrap() { function calculationWrap() {
let redLineWidth = pxToRem(367 * 2); let redLineWidth = pxToRem(367 * 2);
let content = '啊啊啊啊啊啊啊啊'; let content = '啊啊啊啊啊啊啊啊';
posterCtx.font = 1.4 * fontSize * 2 + 'px normal';
for (let i = 8; i < 20; i++) { for (let i = 8; i < 20; i++) {
let textWidth = posterCtx.measureText(content).width; let textWidth = posterCtx.measureText(content).width;
if (textWidth > redLineWidth) { if (textWidth > redLineWidth) {
...@@ -962,8 +963,7 @@ function flagNoDraw(ctx, content, fontsize, color, x, y) { ...@@ -962,8 +963,7 @@ function flagNoDraw(ctx, content, fontsize, color, x, y) {
function flagTextDraw(ctx, content, fontsize, color, x, y, font = "normal") { function flagTextDraw(ctx, content, fontsize, color, x, y, font = "normal") {
let length = calculateStringLength(content); let length = calculateStringLength(content);
alert(ctx.measureText(content).width);
alert(pxToRem(367 * 2));
let lineTop = 0; let lineTop = 0;
if (length <= 24) { if (length <= 24) {
ctx.font = fontsize + 'px ' + font; ctx.font = fontsize + 'px ' + font;
...@@ -979,6 +979,7 @@ function flagTextDraw(ctx, content, fontsize, color, x, y, font = "normal") { ...@@ -979,6 +979,7 @@ function flagTextDraw(ctx, content, fontsize, color, x, y, font = "normal") {
for (let i = 0; i < lineArr.length; i++) { for (let i = 0; i < lineArr.length; i++) {
ctx.font = fontsize + 'px normal'; ctx.font = fontsize + 'px normal';
ctx.fillStyle = color; ctx.fillStyle = color;
alert(ctx.measureText(content).width);
ctx.fillText(lineArr[i], x, y + (lineNo * (fontsize + 10))); ctx.fillText(lineArr[i], x, y + (lineNo * (fontsize + 10)));
if (i == lineArr.length - 1) { if (i == lineArr.length - 1) {
lineTop = y + (lineNo * (fontsize + 10)) - 8; lineTop = y + (lineNo * (fontsize + 10)) - 8;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment