|
@@ -1343,7 +1343,7 @@ export class CanvasPhotoEditor {
|
|
|
* @param {number} maxLines - 最大显示行数(超出显示省略号)
|
|
* @param {number} maxLines - 最大显示行数(超出显示省略号)
|
|
|
* @param {string} font - 字体样式(如 '16px Microsoft Yahei')
|
|
* @param {string} font - 字体样式(如 '16px Microsoft Yahei')
|
|
|
*/
|
|
*/
|
|
|
- drawCenteredTextWithEllipsis(ctx, text, x, y, maxWidth, lineHeight, maxLines, font) {
|
|
|
|
|
|
|
+ drawCenteredTextWithEllipsis(ctx, text, x, y, maxWidth, lineHeight, maxLines, font='14pt 宋体') {
|
|
|
// 1. 设置字体样式(必须先设置,否则measureText计算不准确)
|
|
// 1. 设置字体样式(必须先设置,否则measureText计算不准确)
|
|
|
ctx.font = font;
|
|
ctx.font = font;
|
|
|
ctx.textBaseline = 'top'; // 基准线设为顶部,方便计算行位置
|
|
ctx.textBaseline = 'top'; // 基准线设为顶部,方便计算行位置
|