@cesdk/node 1.70.0-nightly.20260220 → 1.70.0-nightly.20260221

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/index.d.ts CHANGED
@@ -6868,6 +6868,25 @@ export declare class EditorAPI {
6868
6868
  * @throws Error if the resource cannot be downloaded or MIME type determined.
6869
6869
  */
6870
6870
  getMimeType(uri: string): Promise<string>;
6871
+ /**
6872
+ * Gets the font metrics for a given font file URI.
6873
+ *
6874
+ * If the font is not yet loaded, it will be fetched asynchronously.
6875
+ * The returned metrics are in the font's design units coordinate space.
6876
+ *
6877
+ * ```javascript
6878
+ * const metrics = await engine.editor.getFontMetrics('/extensions/ly.img.cesdk.fonts/fonts/Roboto/Roboto-Regular.ttf');
6879
+ * console.log(metrics.ascender, metrics.descender, metrics.unitsPerEm);
6880
+ * console.log(metrics.lineGap);
6881
+ * console.log(metrics.capHeight, metrics.xHeight);
6882
+ * console.log(metrics.underlineOffset, metrics.underlineSize, metrics.strikeoutOffset, metrics.strikeoutSize);
6883
+ * ```
6884
+ *
6885
+ * @category Resource Management
6886
+ * @param fontFileUri - The URI of the font file to get metrics from.
6887
+ * @returns A promise resolving to the font metrics.
6888
+ */
6889
+ getFontMetrics(fontFileUri: string): Promise<FontMetrics>;
6871
6890
  /**
6872
6891
  * Get all transient resources that would be lost during export.
6873
6892
  *
@@ -7255,6 +7274,34 @@ export declare interface Font {
7255
7274
  style?: FontStyle;
7256
7275
  }
7257
7276
 
7277
+ /**
7278
+ * Font metrics extracted from a font file.
7279
+ * Values are in the font's design units coordinate space.
7280
+ * @public
7281
+ */
7282
+ export declare interface FontMetrics {
7283
+ /** The ascender value in font design units. */
7284
+ ascender: number;
7285
+ /** The descender value in font design units (typically negative). */
7286
+ descender: number;
7287
+ /** The number of units per em square (typically 1000 or 2048). */
7288
+ unitsPerEm: number;
7289
+ /** The OS/2 sTypoLineGap value in font design units. */
7290
+ lineGap: number;
7291
+ /** The OS/2 sCapHeight value in font design units. */
7292
+ capHeight: number;
7293
+ /** The OS/2 sxHeight value in font design units. */
7294
+ xHeight: number;
7295
+ /** The post.underlinePosition value in font design units (typically negative). */
7296
+ underlineOffset: number;
7297
+ /** The post.underlineThickness value in font design units. */
7298
+ underlineSize: number;
7299
+ /** The OS/2 yStrikeoutPosition value in font design units. */
7300
+ strikeoutOffset: number;
7301
+ /** The OS/2 yStrikeoutSize value in font design units. */
7302
+ strikeoutSize: number;
7303
+ }
7304
+
7258
7305
  /**
7259
7306
  * Extended design unit type that includes Point for font size operations.
7260
7307
  * Maintains consistency with SceneDesignUnit's capitalized naming convention.