Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions source/bcfnt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ bool BCFNT::serialize (const std::string &path)
const std::uint32_t sheetOffset = (fileSize + MASK) & ~MASK;
fileSize = sheetOffset + sheetImages.size () * SHEET_SIZE;

const std::uint32_t totalTglpSize = fileSize - tglpOffset;

// CWDH headers + data
const std::uint32_t cwdhOffset = fileSize;
fileSize += 0x10; // CWDH header
Expand Down Expand Up @@ -676,7 +678,7 @@ bool BCFNT::serialize (const std::string &path)
// TGLP header
assert (std::distance (std::begin (output), it) == tglpOffset);
it << "TGLP" // magic
<< static_cast<std::uint32_t> (0x20) // section size
<< static_cast<std::uint32_t> (totalTglpSize) // section size
<< static_cast<std::uint8_t> (cellWidth) // cell width
<< static_cast<std::uint8_t> (cellHeight) // cell height
<< static_cast<std::uint8_t> (ascent) // cell baseline
Expand Down Expand Up @@ -715,7 +717,7 @@ bool BCFNT::serialize (const std::string &path)
it << "CWDH" // magic
<< static_cast<std::uint32_t> (0x10 + ((3 * glyphs.size () + 3) & ~3)) // section size
<< static_cast<std::uint16_t> (0) // start index
<< static_cast<std::uint16_t> (glyphs.size ()) // end index
<< static_cast<std::uint16_t> (glyphs.size () - 1) // end index
<< static_cast<std::uint32_t> (0); // next CWDH offset

for (const auto &info : glyphs)
Expand Down