Skip to content

Commit f3be6f2

Browse files
committed
read first block of text
1 parent 85c763d commit f3be6f2

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/headers/symbology.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
const symbology6 = require('./symbology6');
2+
13
const parse = (raf) => {
24
const blockDivider = raf.readShort();
35
const blockId = raf.readShort();
6+
// block id 6 is undocumented but appears to be text
7+
if (blockId === 6) return symbology6(raf);
48
const blockLength = raf.readInt();
59

610
// test some known values

src/headers/symbology6.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// block id 6 is undocumented but appears to be text
2+
3+
const parse = (raf) => {
4+
const pages = [];
5+
6+
// loop until a -1 is encounted
7+
let length = raf.readShort();
8+
do {
9+
while (length !== -1) {
10+
pages.push(raf.readString(length));
11+
length = raf.readShort();
12+
}
13+
length = raf.readShort();
14+
} while (length === 80);
15+
16+
// roll back the 4 bytes used to detect the end of the text area
17+
raf.skip(-4);
18+
19+
return { pages };
20+
};
21+
22+
//
23+
24+
module.exports = parse;

0 commit comments

Comments
 (0)