decode method
Decodes the bytes of a text string into glyphs.
Implementation
List<PdfContentGlyph> decode(Uint8List bytes) {
final glyphs = <PdfContentGlyph>[];
final step = codeByteLength;
for (var i = 0; i < bytes.length; i += step) {
var code = bytes[i];
var length = 1;
if (step == 2) {
code = (bytes[i] << 8) | (i + 1 < bytes.length ? bytes[i + 1] : 0);
length = i + 1 < bytes.length ? 2 : 1;
}
final mappedText = _textOf(code);
glyphs.add(PdfContentGlyph(
code: code,
text: mappedText ?? '�',
width: widthOf(code),
byteLength: length,
mapped: mappedText != null,
));
}
return glyphs;
}