Introduce Kern space

This commit is contained in:
2024-01-05 12:24:30 -06:00
parent ff9186ea67
commit e1c0f2bcb1
4 changed files with 38 additions and 23 deletions

View File

@@ -7,8 +7,29 @@ namespace JabyEngine {
using FontPrimitive = GPU::SPRT::Linked;
struct FontInfo {
struct RenderInfo {
GPU::SizeU8 font_size;
GPU::SizeU8 kern_size;
static constexpr RenderInfo empty() {
return RenderInfo{.font_size = Make::SizeU8(), .kern_size = Make::SizeU8()};
}
};
GPU::SizeU16 texture_size;
GPU::SizeU16 font_size;
RenderInfo render_info;
static constexpr FontInfo create(GPU::SizeU16 texture_size, GPU::SizeU8 font_size, GPU::SizeU8 kern_size) {
return FontInfo{.texture_size = texture_size, .render_info = {.font_size = font_size, .kern_size = kern_size}};
}
static constexpr FontInfo create(GPU::SizeU16 texture_size, GPU::SizeU8 font_size) {
return FontInfo::create(texture_size, font_size, font_size);
}
constexpr GPU::SizeU16 get_font_size() const {
return GPU::SizeU16::from(this->render_info.font_size);
}
};
struct State {

View File

@@ -12,7 +12,7 @@ namespace JabyEngine {
va_end(list)
GPU::TexPage::Linked tex_page[2];
GPU::SizeI16 font_size;
FontInfo::RenderInfo render_info;
GPU::PageClut clut;
GPU::Link* last_primitive;
@@ -22,16 +22,16 @@ namespace JabyEngine {
instance.tex_page[0] = {0};
instance.tex_page[1] = {0};
instance.font_size = Make::SizeI16();
instance.render_info = FontInfo::RenderInfo::empty();
instance.clut = Make::PageClut();
instance.last_primitive = nullptr;
return instance;
}
void setup(const SimpleTIM& vram_dst, const GPU::SizeI16& font_size);
void setup(const SimpleTIM& vram_dst, const FontInfo::RenderInfo& font_render_info);
void setup(const SimpleTIM& vram_dst, const FontInfo& font_info) {
FontWriter::setup(vram_dst, Make::SizeI16(font_info.font_size.width, font_info.font_size.height));
FontWriter::setup(vram_dst, font_info.render_info);
}
void clear();

View File

@@ -4,20 +4,13 @@
namespace JabyEngine {
struct DefaultFont {
static constexpr auto Info = FontInfo {
.texture_size = {64, 80},
.font_size = {12, 16}
};
static constexpr auto Info = FontInfo::create(Make::SizeU16(64, 80), Make::SizeU8(12, 16));
static void load(uint32_t* work_area, SimpleTIM vram_dst);
};
struct BIOSFont {
static constexpr auto Info = FontInfo {
.texture_size = {64, 96},
.font_size = {16, 16}
};
static constexpr auto TIM = SimpleTIM(JabyEngine::GPU::BIOS_Font::TextureLoadPos.x, JabyEngine::GPU::BIOS_Font::TextureLoadPos.y, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.x, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.y);
static constexpr auto Info = FontInfo::create(Make::SizeU16(64, 96), Make::SizeU8(16, 16), Make::SizeU8(12, 16));
static constexpr auto TIM = SimpleTIM(JabyEngine::GPU::BIOS_Font::TextureLoadPos.x, JabyEngine::GPU::BIOS_Font::TextureLoadPos.y, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.x, JabyEngine::GPU::BIOS_Font::CLUTLoadPos.y);
};
}