drei icon indicating copy to clipboard operation
drei copied to clipboard

3D Text - RangeError: attempting to construct out-of-bounds Uint8Array on ArrayBuffer

Open FileManagerKim opened this issue 3 years ago • 1 comments

Hi, I noticed when I'm attempting to add a font json file made through facetype that I run into an array range error. Opening up the debugger I receive the error

RangeError: attempting to construct out-of-bounds Uint8Array on ArrayBuffer

The error occurs in the following block of code when attempting to load a font file inside troikaDefine().

return function parse(buffer) {
    // Look to see if we have a WOFF file and convert it if so:
    const peek = new Uint8Array(buffer, 0, 4);
    const tag = Typr._bin.readASCII(peek, 0, 4);
    if (tag === 'wOFF') {
      buffer = woff2otf(buffer);
    } else if (tag === 'wOF2') {
      throw new Error('woff2 fonts not supported')
    }
    return wrapFontObj(Typr.parse(buffer)[0])
}

Error

Would anyone have happened to run into this error or know why? I will keep on investigating in the mean time. Thank you!

FileManagerKim avatar Jul 20 '22 05:07 FileManagerKim

Im not sure what this issue is refering to.

  • Are you using the Text3d component? If so, then that does not use Troika, it uses ThreeJS's TextGeometry
  • Are you using the Text component? if so, then it does not use the JSON fonts, it uses .ttf, .otf or .woff formats.

FarazzShaikh avatar Jul 28 '22 18:07 FarazzShaikh