<spanclass="line"><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> uint24_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> magic;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // constant, equal to 0x464651 ("QFF")</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> qff_version;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // constant, equal to 0x01</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint32_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> total_file_size;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // total size of the entire file, starting at offset zero</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint32_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> neg_total_file_size;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // negated value of total_file_size, used for detecting parsing errors</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> line_height;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // glyph height in pixels</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> bool</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> has_ascii_table;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // whether the font has an ascii table of glyphs (0x20...0x7E)</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint16_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> num_unicode_glyphs;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // the number of glyphs in the unicode table -- no table specified if zero</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> format;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // frame format, see below.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> flags;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // frame flags, see below.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> compression_scheme;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // compression scheme, see below.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> transparency_index;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // palette index used for transparent pixels (not yet implemented)</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// _Static_assert(sizeof(qff_font_descriptor_v1_t) == (sizeof(qgf_block_header_v1_t) + 20), "qff_font_descriptor_v1_t must be 25 bytes in v1 of QFF");</span></span></code></pre></div><p>The values for <code>format</code>, <code>flags</code>, <code>compression_scheme</code>, and <code>transparency_index</code> match <ahref="./quantum_painter_qgf#qgf-frame-descriptor">QGF's frame descriptor block</a>, with the exception that the <code>delta</code> flag is ignored by QFF.</p><h2id="qff-ascii-table"tabindex="-1">ASCII glyph table <aclass="header-anchor"href="#qff-ascii-table"aria-label="Permalink to "ASCII glyph table {#qff-ascii-table}""></a></h2><ul><li><em>typeid</em> = 0x01</li><li><em>length</em> = 290</li></ul><p>If the font contains ascii characters, the <em>ASCII glyph block</em> must be located directly after the <em>font descriptor block</em>.</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> QFF_GLYPH_WIDTH_BITS</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 6</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// _Static_assert(sizeof(qff_ascii_glyph_table_v1_t) == (sizeof(qgf_block_header_v1_t) + 285), "qff_ascii_glyph_table_v1_t must be 290 bytes in v1 of QFF");</span></span></code></pre></div><h2id="qff-unicode-table"tabindex="-1">Unicode glyph table <aclass="header-anchor"href="#qff-unicode-table"aria-label="Permalink to "Unicode glyph table {#qff-unicode-table}""></a></h2><ul><li><em>typeid</em> = 0x02</li><li><em>length</em> = variable</li></ul><p>If this font contains unicode characters, the <em>unicode glyph block</em> must be located directly after the <em>ASCII glyph table block</em>, or the <em>font descriptor block</em> if the font does not contain ASCII characters.</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">typedef</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> struct</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> __attribute__</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">((packed)) </span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">qff_unicode_glyph_table_v1_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> struct</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> __attribute__</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">((packed)) {</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // container for a single unicode glyph</span></span>
<spanclass="line"><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> uint24_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> code_point;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // the unicode code point</span></span>
<spanclass="line"><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> uint24_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> glyph;</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // the glyph information, as per ASCII glyphs above</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } </span><spanstyle="--shiki-light:#E36209;--shiki-dark:#FFAB70;">glyph</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[N];</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // N glyphs worth of data</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">} </span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">qff_unicode_glyph_table_v1_t</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span></code></pre></div><h2id="qff-palette-descriptor"tabindex="-1">Font palette block <aclass="header-anchor"href="#qff-palette-descriptor"aria-label="Permalink to "Font palette block {#qff-palette-descriptor}""></a></h2><ul><li><em>typeid</em> = 0x03</li><li><em>length</em> = variable</li></ul><p>The <em>font palette block</em> is identical to <ahref="./quantum_painter_qgf#qgf-frame-palette-descriptor">QGF's frame palette block</a>, retaining the same <em>typeid</em> of 0x03.</p><p>It is only specified in the QFF if the font is palette-based, and follows the <em>unicode glyph block</em> if the font contains any Unicode glyphs, or the <em>ASCII glyph block</em> if the font contains only ASCII glyphs.</p><h2id="qff-data-descriptor"tabindex="-1">Font data block <aclass="header-anchor"href="#qff-data-descriptor"aria-label="Permalink to "Font data block {#qff-data-descriptor}""></a></h2><ul><li><em>typeid</em> = 0x04</li><li><em>length</em> = variable</li></ul><p>The <em>font data block</em> is the last block in the file and is identical to <ahref="./quantum_painter_qgf#qgf-frame-data-descriptor">QGF's frame data block</a>, however has a different <em>typeid</em> of 0x04 in QFF.</p></div></div></main><footerclass="VPDocFooter"data-v-39a288b8data-v-09de1c0f><!--[--><!--]--><!----><navclass="prev-next"data-v-09de1c0f><divclass="pager"data-v-09de1c0f><!----></div><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link next"href="/newbs"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Next page</span><spanclass="title"data-v-09de1c0f>Introduction</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>