20 lines
608 B
TypeScript
20 lines
608 B
TypeScript
/**
|
||
* Text Wrap - width-measurement 错误定义
|
||
*
|
||
* 约束:fontSpec 缺字段必须直接报错(简体中文),禁止隐式默认值。
|
||
*/
|
||
|
||
export class MissingFontSpecError extends Error {
|
||
readonly name = 'MissingFontSpecError';
|
||
|
||
constructor(message: string) {
|
||
super(message);
|
||
}
|
||
}
|
||
|
||
export function buildMissingFontSpecMessage(missingFields: string[]): string {
|
||
const fields = missingFields.join(', ');
|
||
return `fontSpec 缺少必填字段:${fields}。请在调用 wrapText() 时补齐 fontSpec(fontFamily/fontWeight/fontSize),禁止在测量层使用隐式默认值。`;
|
||
}
|
||
|