Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.
Rust androiddocument-scannerdocximage-editorjetpack-composekotlinliquid-glassofflineopen-sourcepdfpdf-compressorpdf-editorpdf-mergerpdf-readerpdf-splitterpdf-toolspdf-viewerpptxspreadsheet-editorxlsx
/*
ToUnicode CMaps are special CMaps and thus can be parsed simpler. Assumptions:
- /CMapType is always 2
- only bfchar and bfrange sections allowed
- no glyph names as target allowed, only hex strings
- target encoded in UTF16-BE
*/
pub(crate) type ArrayOfTargetStrings = Vec<Vec<u16>>;
// According to pdf documentation source codes can be of various byte length but they
// should be smaller than integer
pub(crate) type SourceCode = u32;
pub(crate) type CodeLen = u8;
pub(crate) type SourceRangeMapping = ((SourceCode, SourceCode, CodeLen), ArrayOfTargetStrings);
pub(crate) type SourceCharMapping = ((SourceCode, CodeLen), Vec<u16>);
#[derive(Debug, PartialEq)]
pub enum CMapSection {
CsRange(Vec<(SourceCode, SourceCode, CodeLen)>),
BfChar(Vec<SourceCharMapping>),
BfRange(Vec<SourceRangeMapping>),
}
#[derive(Debug)]
pub enum CMapParseError {
Incomplete,
Error,
}