diff --git a/modules/canvaskit/font.js b/modules/canvaskit/font.js index f804a33de4..d6601d088d 100644 --- a/modules/canvaskit/font.js +++ b/modules/canvaskit/font.js @@ -13,7 +13,7 @@ CanvasKit._extraInitializations.push(function() { CanvasKit._free(strPtr); }; - // Glyphs should be a Uint32Array of glyph ids, e.g. provided by Font.getGlyphIDs. + // Glyphs should be a Uint16Array of glyph ids, e.g. provided by Font.getGlyphIDs. // If using a Malloc'd array, be sure to use CanvasKit.MallocGlyphIDs() to get the right type. // The return value will be a Float32Array that is 4 times as long as the input array. For each // glyph, there will be 4 floats for left, top, right, bottom (relative to 0, 0) for that glyph. @@ -62,12 +62,12 @@ CanvasKit._extraInitializations.push(function() { CanvasKit._free(glyphPtr); return optionalOutputArray; } - var rv = Uint32Array.from(glyphs); + var rv = Uint16Array.from(glyphs); CanvasKit._free(glyphPtr); return rv; }; - // Glyphs should be a Uint32Array of glyph ids, e.g. provided by Font.getGlyphIDs. + // Glyphs should be a Uint16Array of glyph ids, e.g. provided by Font.getGlyphIDs. // If using a Malloc'd array, be sure to use CanvasKit.MallocGlyphIDs() to get the right type. // The return value will be a Float32Array that has one width per input glyph. CanvasKit.Font.prototype.getGlyphWidths = function(glyphs, paint, optionalOutputArray) { diff --git a/modules/canvaskit/npm_build/types/index.d.ts b/modules/canvaskit/npm_build/types/index.d.ts index ec75cae2d3..2806f20cf8 100644 --- a/modules/canvaskit/npm_build/types/index.d.ts +++ b/modules/canvaskit/npm_build/types/index.d.ts @@ -3526,11 +3526,8 @@ export type FlattenedPointArray = Float32Array; * be the top, left, right, bottom point for each rectangle. */ export type FlattenedRectangleArray = Float32Array; -/** - * Regardless of the format we use internally for GlyphID (16 bit unsigned atm), we expose them - * as 32 bit unsigned. - */ -export type GlyphIDArray = Uint32Array; + +export type GlyphIDArray = Uint16Array; /** * PathCommand contains a verb and then any arguments needed to fulfill that path verb. * Examples: @@ -3575,7 +3572,7 @@ export type InputColorMatrix = MallocObj | ColorMatrix | number[]; * CanvasKit APIs accept normal arrays, typed arrays, or Malloc'd memory as glyph IDs. * Length n for n glyph IDs. */ -export type InputGlyphIDArray = MallocObj | GlyphIDArray | number[]; +export type InputGlyphIDArray = MallocObj | GlyphIDArray | Uint32Array | number[]; /** * CanvasKit APIs accept normal arrays, typed arrays, or Malloc'd memory as flattened points. * Length 2 * n for n points.