public int CountGlyphs(IntPtr str, int strLen, SKTextEncoding encoding) { if (str == IntPtr.Zero && strLen != 0) { throw new ArgumentNullException(nameof(str)); } return(SkiaApi.sk_typeface_chars_to_glyphs(Handle, (byte *)str, encoding.ToEncoding(), null, strLen)); }
public ushort[] GetGlyphs(IntPtr text, int length, SKTextEncoding encoding) { if (text == IntPtr.Zero && length != 0) { throw new ArgumentNullException(nameof(text)); } var n = SkiaApi.sk_typeface_chars_to_glyphs(Handle, (void *)text, encoding.ToEncoding(), null, length); if (n <= 0) { return(new ushort[0]); } var glyphs = new ushort[n]; fixed(ushort *gp = glyphs) { SkiaApi.sk_typeface_chars_to_glyphs(Handle, (void *)text, encoding.ToEncoding(), gp, n); } return(glyphs); }