|
|
|
|
@ -194,7 +194,7 @@ export function createTextPosition({ setData }) {
@@ -194,7 +194,7 @@ export function createTextPosition({ setData }) {
|
|
|
|
|
charWidth = fontSize * 0.6; |
|
|
|
|
} else if (/[a-zA-Z]/.test(char)) { |
|
|
|
|
// 英文字母:宽度约为 fontSize * 0.6(大写)或 0.5(小写)
|
|
|
|
|
charWidth = /[A-Z]/.test(char) ? fontSize * 0.65 : fontSize * 0.5; |
|
|
|
|
charWidth = /[A-Z]/.test(char) ? fontSize * 0.6 : fontSize * 0.45; |
|
|
|
|
} else if (/[\u3000-\u303f\uff00-\uffef]/.test(char)) { |
|
|
|
|
// 全角符号:宽度约为 fontSize
|
|
|
|
|
charWidth = fontSize; |
|
|
|
|
@ -213,7 +213,7 @@ export function createTextPosition({ setData }) {
@@ -213,7 +213,7 @@ export function createTextPosition({ setData }) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 为文字之间添加2px间距(除了最后一个字符)
|
|
|
|
|
const spacing = 2; |
|
|
|
|
const spacing = 0; |
|
|
|
|
const totalSpacing = (text.length > 1) ? (text.length - 1) * spacing : 0; |
|
|
|
|
const totalWidthWithSpacing = totalWidth + totalSpacing; |
|
|
|
|
|
|
|
|
|
|