@selldone/sdk-storefront
Version:
A TypeScript SDK to connect to your shop and build a fully functional storefront and website by simply developing a frontend web application. All backend operations are seamlessly managed by the serverless Selldone solution.
20 lines (19 loc) • 1.16 kB
TypeScript
export declare class FontSizeHelper {
/**
* AutoSizeText automatically calculates the optimal font size for a given text
* within a specified width and height constraint. The function takes into account
* a correction factor to fix some edge cases, particularly for specific font families.
*
* @param {string} text - The text for which the font size should be calculated.
* @param {number} width - The width constraint for the text.
* @param {number} maxHeight - The maximum height constraint for the text.
* @param {number} [correct_factor=0.7] - An optional correction factor to adjust the calculated font size.
* This helps to fix some edge cases, particularly for specific font families.
* @returns {string} - The calculated optimal font size (in pixels) for the given text and constraints.
*
* @example
* const optimalFontSize = AutoSizeText("Sample text", 300, 50);
* console.log(optimalFontSize); // Output: "20px" (example value)
*/
static AutoSizeText(text: any, width: any, maxHeight: any, correct_factor?: number): string;
}