2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 12:27:43 +00:00

Compile-time locale refactor

This commit is contained in:
Jack Andersen
2019-07-19 18:26:59 -10:00
parent afb1162c43
commit 70ce423d00
18 changed files with 58 additions and 154 deletions

View File

@@ -48,7 +48,7 @@ void TextView::_commitResources(size_t capacity) {
TextView::TextView(ViewResources& res, View& parentView, const FontAtlas& font, Alignment align, size_t capacity)
: View(res, parentView), m_capacity(capacity), m_fontAtlas(font), m_align(align) {
if (size_t(hecl::VertexBufferPool<RenderGlyph>::bucketCapacity()) < capacity)
Log.report(logvisor::Fatal, "bucket overflow [%" PRISize "/%" PRISize "]", capacity,
Log.report(logvisor::Fatal, fmt("bucket overflow [{}/{}]"), capacity,
hecl::VertexBufferPool<RenderGlyph>::bucketCapacity());
_commitResources(0);
@@ -105,7 +105,7 @@ void TextView::typesetGlyphs(std::string_view str, const zeus::CColor& defaultCo
for (; it.iter() < str.end(); ++it) {
utf8proc_int32_t ch = *it;
if (ch == -1) {
Log.report(logvisor::Warning, "invalid UTF-8 char");
Log.report(logvisor::Warning, fmt("invalid UTF-8 char"));
break;
}
if (ch == '\n' || ch == '\0')
@@ -237,7 +237,7 @@ void TextView::draw(boo::IGraphicsCommandQueue* gfxQ) {
std::pair<int, int> TextView::queryGlyphDimensions(size_t pos) const {
if (pos >= m_glyphInfo.size())
Log.report(logvisor::Fatal, "TextView::queryGlyphWidth(%" PRISize ") out of bounds: %" PRISize, pos,
Log.report(logvisor::Fatal, fmt("TextView::queryGlyphWidth({}) out of bounds: {}"), pos,
m_glyphInfo.size());
return m_glyphInfo[pos].m_dims;
@@ -260,7 +260,7 @@ size_t TextView::reverseSelectGlyph(int x) const {
int TextView::queryReverseAdvance(size_t idx) const {
if (idx > m_glyphInfo.size())
Log.report(logvisor::Fatal, "TextView::queryReverseGlyph(%" PRISize ") out of inclusive bounds: %" PRISize, idx,
Log.report(logvisor::Fatal, fmt("TextView::queryReverseGlyph({}) out of inclusive bounds: {}"), idx,
m_glyphInfo.size());
if (!idx)
return 0;
@@ -269,7 +269,7 @@ int TextView::queryReverseAdvance(size_t idx) const {
std::pair<size_t, size_t> TextView::queryWholeWordRange(size_t idx) const {
if (idx > m_glyphInfo.size())
Log.report(logvisor::Fatal, "TextView::queryWholeWordRange(%" PRISize ") out of inclusive bounds: %" PRISize, idx,
Log.report(logvisor::Fatal, fmt("TextView::queryWholeWordRange({}) out of inclusive bounds: {}"), idx,
m_glyphInfo.size());
if (m_glyphInfo.empty())
return {0, 0};