mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 20:11:50 +00:00
fix text width and caret positioning in text boxes
This commit is contained in:
parent
ac3d4a5148
commit
7211e99bc8
3 changed files with 63 additions and 31 deletions
|
|
@ -57,6 +57,10 @@ public:
|
|||
/// @return pixel width of the substring
|
||||
int calcWidth(std::wstring_view text, size_t offset, size_t length) const;
|
||||
|
||||
/// @brief Get the horizontal advance of a character in pixels
|
||||
/// @param codepoint character unicode codepoint
|
||||
int getAdvance(uint codepoint) const;
|
||||
|
||||
/// @brief Check if character is visible (non-whitespace)
|
||||
/// @param codepoint character unicode codepoint
|
||||
bool isPrintableChar(uint codepoint) const;
|
||||
|
|
@ -87,7 +91,7 @@ public:
|
|||
return {std::nullopt, lineHeight, yoffset, glyphInterval};
|
||||
}
|
||||
|
||||
const Glyph* getGlyph(int codepoint);
|
||||
const Glyph* getGlyph(int codepoint) const;
|
||||
|
||||
static std::unique_ptr<Font> createBitmapFont(
|
||||
std::vector<std::unique_ptr<ImageData>> pages
|
||||
|
|
@ -97,7 +101,7 @@ private:
|
|||
int yoffset;
|
||||
int glyphInterval;
|
||||
bool monospace = true;
|
||||
std::vector<std::unique_ptr<Texture>> pages;
|
||||
std::vector<Glyph> glyphs;
|
||||
mutable std::vector<std::unique_ptr<Texture>> pages;
|
||||
mutable std::vector<Glyph> glyphs;
|
||||
std::optional<std::weak_ptr<vector_fonts::FontFile>> fontFile;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue