@unmade/text-renderer 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -88,6 +88,9 @@ export declare interface GetFontSizeFromPhysicalSizeOptions {
88
88
 
89
89
  /**
90
90
  * Async text renderer. Loads font from URL, then delegates to renderText.
91
+ *
92
+ * If the calculated font size causes a TOO_WIDE error and fontSizeFallback is
93
+ * provided, retries once using the fallback as an explicit fontSize override.
91
94
  */
92
95
  export declare const getRenderedText: (options: GetRenderedTextOptions) => Promise<string>;
93
96
 
@@ -96,6 +99,12 @@ export declare interface GetRenderedTextOptions {
96
99
  text: string;
97
100
  fontUrl: string;
98
101
  physicalSize: PhysicalSize;
102
+ /**
103
+ * Fallback font size (in pixels) to use if the calculated size causes a
104
+ * TOO_WIDE error. Useful when the caller has an authoritative size (e.g.
105
+ * from the CE) that avoids floating-point rounding issues.
106
+ */
107
+ fontSizeFallback?: number;
99
108
  boxDimensions: BoxDimensions;
100
109
  spacing?: TextSpacing;
101
110
  verticalAlignment?: VerticalTextAlignmentValues;
@@ -165,6 +174,8 @@ export declare interface RenderTextOptions {
165
174
  text: string;
166
175
  font: LoadedFont;
167
176
  physicalSize: PhysicalSize;
177
+ /** When provided, bypasses the physicalSize → font size calculation. */
178
+ fontSize?: number;
168
179
  boxDimensions: BoxDimensions;
169
180
  spacing?: TextSpacing;
170
181
  verticalAlignment?: VerticalTextAlignmentValues;