Change GlyphIDArray to 16bit
pre-cl to prepare for more Glyph methods e.g. https://skia-review.googlesource.com/c/skia/+/396496 Change-Id: I334f9d93ea2183a69f2d9087a783ad7d7277248b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396498 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
93cb72eefe
commit
e0f3d612b0
@ -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) {
|
||||
|
9
modules/canvaskit/npm_build/types/index.d.ts
vendored
9
modules/canvaskit/npm_build/types/index.d.ts
vendored
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user