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>
This commit is contained in:
1768
fonts/CrimsonPro.h
Normal file
1768
fonts/CrimsonPro.h
Normal file
File diff suppressed because it is too large
Load Diff
1203
fonts/ETBook.h
Normal file
1203
fonts/ETBook.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,8 @@
|
||||
#include "BerkeleyMono.h"
|
||||
#include "BrassMono.h"
|
||||
#include "BrassMonoCode.h"
|
||||
#include "CrimsonPro.h"
|
||||
#include "ETBook.h"
|
||||
#include "FiraCode.h"
|
||||
#include "Go.h"
|
||||
#include "IBMPlexMono.h"
|
||||
@@ -13,6 +15,7 @@
|
||||
#include "IosevkaExtended.h"
|
||||
#include "ShareTech.h"
|
||||
#include "SpaceMono.h"
|
||||
#include "Spectral.h"
|
||||
#include "Syne.h"
|
||||
#include "Triplicate.h"
|
||||
#include "Unispace.h"
|
||||
|
||||
@@ -45,6 +45,16 @@ InstallDefaultFonts()
|
||||
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,
|
||||
@@ -95,6 +105,11 @@ InstallDefaultFonts()
|
||||
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,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "Font.h"
|
||||
|
||||
@@ -87,6 +89,19 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Return all registered font names (sorted)
|
||||
std::vector<std::string> FontNames() const
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
std::vector<std::string> names;
|
||||
names.reserve(fonts_.size());
|
||||
for (const auto &[name, _] : fonts_)
|
||||
names.push_back(name);
|
||||
std::sort(names.begin(), names.end());
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
// Current font name/size as last successfully loaded via LoadFont()
|
||||
std::string CurrentFontName() const
|
||||
{
|
||||
|
||||
3227
fonts/Spectral.h
Normal file
3227
fonts/Spectral.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user