dreamcast/font/font.hpp
Zack Buhman 8f0afc2868 font_outline: remove all 1024/256/128 magic numbers
This fully threads both the real minimum size of the texture and the
dimensions of the texture through to the TA parameters.

This also removes spurious zero-area drawing commands (space
characters).
2023-12-22 23:54:39 +08:00

41 lines
937 B
C++

// this file is designed to be platform-agnostic
#pragma once
#include <cstdint>
// metrics are 26.6 fixed point
struct glyph_metrics {
int32_t horiBearingX;
int32_t horiBearingY;
int32_t horiAdvance;
} __attribute__ ((packed));
static_assert((sizeof (glyph_metrics)) == ((sizeof (int32_t)) * 3));
struct glyph_bitmap {
uint16_t x;
uint16_t y;
uint16_t width;
uint16_t height;
} __attribute__ ((packed));
static_assert((sizeof (glyph_bitmap)) == ((sizeof (uint16_t)) * 4));
struct glyph {
glyph_bitmap bitmap;
glyph_metrics metrics;
} __attribute__ ((packed));
static_assert((sizeof (glyph)) == ((sizeof (glyph_bitmap)) + (sizeof (glyph_metrics))));
struct font {
uint32_t first_char_code;
uint16_t glyph_count;
uint16_t glyph_height;
uint16_t texture_width;
uint16_t texture_height;
uint32_t max_z_curve_ix;
} __attribute__ ((packed));
static_assert((sizeof (font)) == ((sizeof (uint32_t)) * 4));