Hi,
Use RandomAccessReadBuffer and pass the array.
NonSeekableRandomAccessReadInputStream isn't for that.
Tilman
Am 09.02.2026 um 20:14 schrieb Daniel Gredler:
Hi,
I've been using FontBox 2.x for some time, and just started dipping my toes
into 3.x to see if it will work for me. However, I'm running into an issue
parsing a TTF in memory. I have a byte[], which I was wrapping in a
ByteArrayInputStream and then passing to TTFParser.parse( ).
Now it looks like I need to wrap the BAIS in
a NonSeekableRandomAccessReadInputStream and pass that to TTFParser.parse(
), but it hits EOF immediately because it looks like the length is 0 (zero)
when it is checked prior to any reads. Should I be doing something
differently?
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
TTFParser parser = new TTFParser(false);
try (NonSeekableRandomAccessReadInputStream input = new
NonSeekableRandomAccessReadInputStream(bais);
TrueTypeFont font = parser.parse(input)) {
// use font here
}
Thanks!
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]