diff --git a/specter/lib/FileBrowser.cpp b/specter/lib/FileBrowser.cpp index 3ae19a947..a902cfb64 100644 --- a/specter/lib/FileBrowser.cpp +++ b/specter/lib/FileBrowser.cpp @@ -334,8 +334,7 @@ void FileBrowser::FileListingDataBind::updateListing(const hecl::DirectoryEnumer m_entries.reserve(dEnum.size()); for (const hecl::DirectoryEnumerator::Entry& d : dEnum) { - m_entries.emplace_back(); - Entry& ent = m_entries.back(); + Entry& ent = m_entries.emplace_back(); ent.m_path = d.m_path; hecl::SystemUTF8Conv nameUtf8(d.m_name); ent.m_name = nameUtf8.str(); diff --git a/specter/lib/FontCache.cpp b/specter/lib/FontCache.cpp index 1add829ac..4f3bdf88d 100644 --- a/specter/lib/FontCache.cpp +++ b/specter/lib/FontCache.cpp @@ -307,13 +307,10 @@ FontAtlas::FontAtlas(FT_Face face, uint32_t dpi, bool subpixel, FCharFilter& fil charcode = FT_Get_Next_Char(face, charcode, &gindex); continue; } + FT_Load_Glyph(face, gindex, FT_LOAD_RENDER | baseFlags); FT_UInt width, height; GridFitGlyph(face->glyph, width, height); - m_glyphLookup[charcode] = m_glyphs.size(); - m_glyphs.emplace_back(); - Glyph& g = m_glyphs.back(); - if (curLineWidth + width + 1 > TEXMAP_DIM) { totalHeight += curLineHeight + 1; curLineHeight = 0; @@ -328,6 +325,8 @@ FontAtlas::FontAtlas(FT_Face face, uint32_t dpi, bool subpixel, FCharFilter& fil curLineWidth = 1; } + m_glyphLookup.insert_or_assign(charcode, m_glyphs.size()); + Glyph& g = m_glyphs.emplace_back(); g.m_unicodePoint = charcode; g.m_glyphIdx = gindex; g.m_layerIdx = m_fullTexmapLayers; @@ -369,13 +368,10 @@ FontAtlas::FontAtlas(FT_Face face, uint32_t dpi, bool subpixel, FCharFilter& fil charcode = FT_Get_Next_Char(face, charcode, &gindex); continue; } + FT_Load_Glyph(face, gindex, FT_LOAD_RENDER | baseFlags); FT_UInt width, height; GridFitGlyph(face->glyph, width, height); - m_glyphLookup[charcode] = m_glyphs.size(); - m_glyphs.emplace_back(); - Glyph& g = m_glyphs.back(); - if (curLineWidth + width + 1 > TEXMAP_DIM) { totalHeight += curLineHeight + 1; curLineHeight = 0; @@ -390,6 +386,8 @@ FontAtlas::FontAtlas(FT_Face face, uint32_t dpi, bool subpixel, FCharFilter& fil curLineWidth = 1; } + m_glyphLookup.insert_or_assign(charcode, m_glyphs.size()); + Glyph& g = m_glyphs.emplace_back(); g.m_unicodePoint = charcode; g.m_glyphIdx = gindex; g.m_layerIdx = m_fullTexmapLayers; @@ -468,13 +466,10 @@ FontAtlas::FontAtlas(FT_Face face, uint32_t dpi, bool subpixel, FCharFilter& fil charcode = FT_Get_Next_Char(face, charcode, &gindex); continue; } + FT_Load_Glyph(face, gindex, baseFlags); FT_UInt width, height; GridFitGlyph(face->glyph, width, height); - m_glyphLookup[charcode] = m_glyphs.size(); - m_glyphs.emplace_back(); - Glyph& g = m_glyphs.back(); - if (curLineWidth + width + 1 > TEXMAP_DIM) { totalHeight += curLineHeight + 1; curLineHeight = 0; @@ -489,6 +484,8 @@ FontAtlas::FontAtlas(FT_Face face, uint32_t dpi, bool subpixel, FCharFilter& fil curLineWidth = 1; } + m_glyphLookup.insert_or_assign(charcode, m_glyphs.size()); + Glyph& g = m_glyphs.emplace_back(); g.m_unicodePoint = charcode; g.m_glyphIdx = gindex; g.m_layerIdx = m_fullTexmapLayers; @@ -530,13 +527,10 @@ FontAtlas::FontAtlas(FT_Face face, uint32_t dpi, bool subpixel, FCharFilter& fil charcode = FT_Get_Next_Char(face, charcode, &gindex); continue; } + FT_Load_Glyph(face, gindex, baseFlags); FT_UInt width, height; GridFitGlyph(face->glyph, width, height); - m_glyphLookup[charcode] = m_glyphs.size(); - m_glyphs.emplace_back(); - Glyph& g = m_glyphs.back(); - if (curLineWidth + width + 1 > TEXMAP_DIM) { totalHeight += curLineHeight + 1; curLineHeight = 0; @@ -551,6 +545,8 @@ FontAtlas::FontAtlas(FT_Face face, uint32_t dpi, bool subpixel, FCharFilter& fil curLineWidth = 1; } + m_glyphLookup.insert_or_assign(charcode, m_glyphs.size()); + Glyph& g = m_glyphs.emplace_back(); g.m_unicodePoint = charcode; g.m_glyphIdx = gindex; g.m_layerIdx = m_fullTexmapLayers; diff --git a/specter/lib/Menu.cpp b/specter/lib/Menu.cpp index 6f75abcc1..9eb319817 100644 --- a/specter/lib/Menu.cpp +++ b/specter/lib/Menu.cpp @@ -55,9 +55,7 @@ void Menu::reset(IMenuNode* rootNode) { for (size_t i = 0; i < subCount; ++i) { IMenuNode* node = rootNode->subNode(i); const std::string* nodeText = node->text(); - - m_items.emplace_back(); - ViewChild>& item = m_items.back(); + ViewChild>& item = m_items.emplace_back(); if (nodeText) { item.m_view.reset(new ItemView(res, *this, *nodeText, i, node)); diff --git a/specter/lib/Toolbar.cpp b/specter/lib/Toolbar.cpp index 10d93d5aa..c585c3b57 100644 --- a/specter/lib/Toolbar.cpp +++ b/specter/lib/Toolbar.cpp @@ -115,11 +115,13 @@ void Toolbar::setVerticalVerts(int height) { } void Toolbar::push_back(View* v, unsigned unit) { - if (unit >= m_units) + if (unit >= m_units) { Log.report(logvisor::Fatal, fmt("unit {} out of range {}"), unit, m_units); - std::vector>& u = m_children[unit]; - u.emplace_back(); - u.back().m_view = v; + } + + std::vector>& children = m_children[unit]; + auto& child = children.emplace_back(); + child.m_view = v; } void Toolbar::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) {