Files
kte/fonts/FontRegistry.cc
Kyle Isom 23f04e4357 Add proportional fonts, edit modes, and TOML config
- Add three proportional serif fonts: Crimson Pro, ET Book, Spectral
- Fix text rendering for variable-width fonts: selection, cursor,
  mouse click mapping, search highlights, and syntax-colored text
  now use pixel-accurate measurement via ImGui::CalcTextSize()
- Add per-buffer edit mode (code/writing) with auto-detection from
  file extension (.txt, .md, .rst, .org, .tex default to writing)
- Add C-k m keybinding and :mode command to toggle edit modes
- Switch config format from INI to TOML (kge.toml), with legacy
  INI fallback; vendor toml++ v3.4.0
- New config keys: font.code and font.writing for per-mode defaults
- Add font tab completion for ImGui builds
- Add tab completion for :mode command
- Update help text, themes.md, and add CONFIG.md
- Bump version to 1.10.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 23:05:56 -07:00

130 lines
4.1 KiB
C++

#include "FontRegistry.h"
#include "FontList.h"
namespace kte::Fonts {
void
InstallDefaultFonts()
{
FontRegistry::Instance().Register(std::make_unique<Font>(
"default",
BerkeleyMono::DefaultFontBoldCompressedData,
BerkeleyMono::DefaultFontBoldCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"b612",
B612Mono::DefaultFontRegularCompressedData,
B612Mono::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"berkeley",
BerkeleyMono::DefaultFontRegularCompressedData,
BerkeleyMono::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"berkeley-bold",
BerkeleyMono::DefaultFontBoldCompressedData,
BerkeleyMono::DefaultFontBoldCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"brassmono",
BrassMono::DefaultFontRegularCompressedData,
BrassMono::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"brassmono-bold",
BrassMono::DefaultFontBoldCompressedData,
BrassMono::DefaultFontBoldCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"brassmonocode",
BrassMonoCode::DefaultFontRegularCompressedData,
BrassMonoCode::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"brassmonocode-bold",
BrassMonoCode::DefaultFontBoldCompressedData,
BrassMonoCode::DefaultFontBoldCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"crimsonpro",
CrimsonPro::DefaultFontRegularCompressedData,
CrimsonPro::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"etbook",
ETBook::DefaultFontRegularCompressedData,
ETBook::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"fira",
FiraCode::DefaultFontRegularCompressedData,
FiraCode::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"go",
Go::DefaultFontRegularCompressedData,
Go::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"ibm",
IBMPlexMono::DefaultFontRegularCompressedData,
IBMPlexMono::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"idealist",
Idealist::DefaultFontRegularCompressedData,
Idealist::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"inconsolata",
Inconsolata::DefaultFontRegularCompressedData,
Inconsolata::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"inconsolataex",
InconsolataExpanded::DefaultFontRegularCompressedData,
InconsolataExpanded::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"iosevka",
Iosoveka::DefaultFontRegularCompressedData,
Iosoveka::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"iosevkaex",
IosevkaExtended::DefaultFontRegularCompressedData,
IosevkaExtended::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"sharetech",
ShareTech::DefaultFontRegularCompressedData,
ShareTech::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"space",
SpaceMono::DefaultFontRegularCompressedData,
SpaceMono::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"spectral",
Spectral::DefaultFontRegularCompressedData,
Spectral::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"syne",
Syne::DefaultFontRegularCompressedData,
Syne::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"triplicate",
Triplicate::DefaultFontRegularCompressedData,
Triplicate::DefaultFontRegularCompressedSize
));
FontRegistry::Instance().Register(std::make_unique<Font>(
"unispace",
Unispace::DefaultFontRegularCompressedData,
Unispace::DefaultFontRegularCompressedSize
));
}
}