xverse-components-utils
Version:
xverse components utils
33 lines (32 loc) • 846 B
TypeScript
export interface IHorizonCanvasParams {
content: string;
canvasHeight: number;
canvasWidth: number;
fontOption: IFontOption;
maxWidth: number;
}
export interface IFontOption {
fontSize: number;
fontWeight?: string;
fontFamily?: string;
}
interface IFinalArr {
text: string;
left: number;
top: number;
}
/**
* 使用方式
* const textList = horizonCanvas({
* content,
* canvasWidth,
* canvasHeight,
* maxWidth,
* fontOption,
* })
* @param horizonCanvasParams
*/
export declare const horizonCanvas: (horizonCanvasParams: IHorizonCanvasParams) => IFinalArr[];
export declare const pxWidth: (content: string, font: string) => any;
export declare const stringSplitLineByWidth: (str: string, maxWidth: number, font: string, fontSize: number) => any[];
export {};