MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / writeSectionFileHeader

Method writeSectionFileHeader

lib/Epub/Epub/Section.cpp:44–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void Section::writeSectionFileHeader(const int fontId, const float lineCompression, const bool extraParagraphSpacing,
45 const uint8_t paragraphAlignment, const uint16_t viewportWidth,
46 const uint16_t viewportHeight, const bool hyphenationEnabled,
47 const bool embeddedStyle, const uint8_t imageRendering,
48 const bool focusReadingEnabled) {
49 if (!file) {
50 LOG_DBG("SCT", "File not open for writing header");
51 return;
52 }
53 static_assert(HEADER_SIZE == sizeof(SECTION_FILE_VERSION) + sizeof(fontId) + sizeof(lineCompression) +
54 sizeof(extraParagraphSpacing) + sizeof(paragraphAlignment) + sizeof(viewportWidth) +
55 sizeof(viewportHeight) + sizeof(pageCount) + sizeof(hyphenationEnabled) +
56 sizeof(embeddedStyle) + sizeof(imageRendering) + sizeof(focusReadingEnabled) +
57 sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t),
58 "Header size mismatch");
59 serialization::writePod(file, SECTION_FILE_VERSION);
60 serialization::writePod(file, fontId);
61 serialization::writePod(file, lineCompression);
62 serialization::writePod(file, extraParagraphSpacing);
63 serialization::writePod(file, paragraphAlignment);
64 serialization::writePod(file, viewportWidth);
65 serialization::writePod(file, viewportHeight);
66 serialization::writePod(file, hyphenationEnabled);
67 serialization::writePod(file, embeddedStyle);
68 serialization::writePod(file, imageRendering);
69 serialization::writePod(file, focusReadingEnabled);
70 serialization::writePod(file, pageCount); // Placeholder for page count (will be initially 0, patched later)
71 serialization::writePod(file, static_cast<uint32_t>(0)); // Placeholder for LUT offset (patched later)
72 serialization::writePod(file, static_cast<uint32_t>(0)); // Placeholder for anchor map offset (patched later)
73 serialization::writePod(file, static_cast<uint32_t>(0)); // Placeholder for paragraph LUT offset (patched later)
74 serialization::writePod(file, static_cast<uint32_t>(0)); // Placeholder for li LUT offset (patched later)
75}
76
77bool Section::loadSectionFile(const int fontId, const float lineCompression, const bool extraParagraphSpacing,
78 const uint8_t paragraphAlignment, const uint16_t viewportWidth,

Callers

nothing calls this directly

Calls 1

writePodFunction · 0.85

Tested by

no test coverage detected