style;证书预览
Showing
1 changed file
with
30 additions
and
8 deletions
... | @@ -189,16 +189,34 @@ | ... | @@ -189,16 +189,34 @@ |
189 | }) | 189 | }) |
190 | }) | 190 | }) |
191 | } | 191 | } |
192 | |||
193 | // context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 129, 429); | 192 | // context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 129, 429); |
194 | // qlqtzk | 193 | // 权利其他状态 |
195 | const maxWidth = 330; // 最大宽度限制 | 194 | const maxWidth = 332; // 最大宽度限制 |
196 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; | 195 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; |
197 | lines.forEach((line, index) => { | 196 | // lines.forEach((line, index) => { |
198 | const y = 463 + (index * 40); // 每行文本的垂直位置 | 197 | // const y = 463 + (index * 33); // 每行文本的垂直位置 |
198 | // let currentLine = ''; | ||
199 | // let arr = []; | ||
200 | // for (let word of line) { | ||
201 | // const testLine = currentLine + word; | ||
202 | // const lineWidth = context.measureText(testLine).width; | ||
203 | // if (lineWidth <= maxWidth) { | ||
204 | // currentLine = testLine; | ||
205 | // } else { | ||
206 | // arr.push(currentLine); | ||
207 | // currentLine = word; | ||
208 | // } | ||
209 | // } | ||
210 | // arr.push(currentLine); | ||
211 | // arr.forEach((line, index) => { | ||
212 | // context.fillText(line, 129, y + (index * 17)); // 调整行高 | ||
213 | // }) | ||
214 | // }) | ||
215 | for (let i = 0; i < lines.length; i++) { | ||
216 | if (getByteLen(lines[i]) > 41) { | ||
199 | let currentLine = ''; | 217 | let currentLine = ''; |
200 | let arr = []; | 218 | let arr = []; |
201 | for (let word of line) { | 219 | for (let word of lines[i]) { |
202 | const testLine = currentLine + word; | 220 | const testLine = currentLine + word; |
203 | const lineWidth = context.measureText(testLine).width; | 221 | const lineWidth = context.measureText(testLine).width; |
204 | if (lineWidth <= maxWidth) { | 222 | if (lineWidth <= maxWidth) { |
... | @@ -210,9 +228,13 @@ | ... | @@ -210,9 +228,13 @@ |
210 | } | 228 | } |
211 | arr.push(currentLine); | 229 | arr.push(currentLine); |
212 | arr.forEach((line, index) => { | 230 | arr.forEach((line, index) => { |
213 | context.fillText(line, 129, y + (index * 20)); // 调整行高 | 231 | context.fillText(line, 129, 490 + (28 * (i - 1)) + (index * 14)); // 调整行高 |
214 | }) | ||
215 | }) | 232 | }) |
233 | } else { | ||
234 | context.fillText(lines[i] ? lines[i] : '', 129, 495 + (30 * (i - 1))); | ||
235 | } | ||
236 | } | ||
237 | |||
216 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : []; | 238 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : []; |
217 | lines1.forEach((line, index) => { | 239 | lines1.forEach((line, index) => { |
218 | const y = 100 + (index * 30); // 每行文本的垂直位置 | 240 | const y = 100 + (index * 30); // 每行文本的垂直位置 | ... | ... |
-
Please register or sign in to post a comment