scichart
Version:
Fast WebGL JavaScript Charting Library and Framework
45 lines (44 loc) • 2.08 kB
TypeScript
import { Thickness } from "../Core/Thickness";
import { EHorizontalAnchorPoint, EVerticalAnchorPoint } from "../types/AnchorPoint";
import { TNativeTextStyle } from "../types/TextStyle";
import { SCRTFont, TSciChart, TSRTextBounds, TSRTextLineBounds } from "../types/TSciChart";
/**
* Wrap a string by adding newline characters, splitting on spaces and wrapping to a maximum size
*/
export declare const wrapNativeText: (text: string, maxWidth: number, font: SCRTFont, textBounds: TSRTextBounds) => string;
export declare const convertToNativeLineSpacing: (maxLineHeight: number, lineSpacing: number) => number;
export declare const getNativeTextSize: (text: string, nativeFont: SCRTFont, textStyle: TNativeTextStyle, webAssemblyContext: TSciChart, rotation?: number) => {
textHeight: number;
textWidth: number;
nativeLineSpacing: number;
deltaX: number;
deltaY: number;
};
/**
* Calculates the height of the first line from top to baseline
* @param textBounds
* @returns
*/
export declare const getFirstLineHeightToBaseline: (lineBounds: TSRTextLineBounds) => number;
/**
* For single line text return height to baseline. For multiline text returns total height
*/
export declare const getTextHeightToBaseline: (textBounds: TSRTextBounds) => number;
/**
* Calculates multiline text height from the top to the last line baseline
*/
export declare const getMultilineTextHeight: (textBounds: TSRTextBounds) => number;
/**
*
* @param x Text position X coordinate
* @param y Text position Y coordinate
* @param horizontalAnchorPoint Horizontal alignment
* @param verticalAnchorPoint Vertical alignment
* @param textBounds Text bounds
* @param padding The padding
* @returns x and y position where to draw text for SCRTFont.DrawStringAdvanced() method
*/
export declare const getNativeTextPosition: (x: number, y: number, horizontalAnchorPoint: EHorizontalAnchorPoint, verticalAnchorPoint: EVerticalAnchorPoint, textBounds: TSRTextBounds, padding: Thickness) => {
x: number;
y: number;
};