Merge remote-tracking branch 'origin/master' into claude/issue-60

# Conflicts:
#	project.cpp
This commit is contained in:
catbot 2026-06-16 17:07:32 +00:00
commit bdbe3bf568
5 changed files with 204 additions and 6 deletions

View file

@ -72,5 +72,17 @@ namespace Crafter {
float LineHeight(float size);
float AscentPx(float size);
float ScaleForSize(float size);
// Horizontal advance for `cp` in unscaled font units, cached per Font.
// Stored in font units (not pixels) so it can be rescaled for any
// `size`; Glyph::advance in the FontAtlas is baked at kBaseSize and is
// wrong at other sizes, so it cannot be reused here. ASCII lands in a
// flat array (the common path for caret hit-testing, which rescans the
// whole field per character), everything else in the map.
std::int32_t AdvanceUnits(std::uint32_t cp);
private:
std::array<std::int32_t, 128> asciiAdvance_; // -1 = uncached
std::unordered_map<std::uint32_t, std::int32_t> advanceUnits_;
};
}