diff --git a/src/Magnum/Text/AbstractGlyphCache.cpp b/src/Magnum/Text/AbstractGlyphCache.cpp index 22b82250f..6a200fb39 100644 --- a/src/Magnum/Text/AbstractGlyphCache.cpp +++ b/src/Magnum/Text/AbstractGlyphCache.cpp @@ -274,13 +274,10 @@ std::vector AbstractGlyphCache::reserve(const std::vector& s state.atlas.clearFlags(TextureTools::AtlasLandfillFlag::RotatePortrait| TextureTools::AtlasLandfillFlag::RotateLandscape); - /* Create the output array. Because the new atlas packer doesn't accept - zero sizes, change those to be (1, 1) instead. A new interface will - disallow them as well, but here we want to keep backwards - compatibility. */ + /* Create the output array */ std::vector out(sizes.size()); for(std::size_t i = 0; i != sizes.size(); ++i) - out[i].max() = Math::max(sizes[i], Vector2i{1}); + out[i].max() = sizes[i]; const bool succeeded = state.atlas.add( Containers::stridedArrayView(out).slice(&Range2Di::max), @@ -298,10 +295,9 @@ std::vector AbstractGlyphCache::reserve(const std::vector& s return {}; } - /* Update the ranges max values to match the new offsets, undo the zero - sizes being (1, 1) */ + /* Update the ranges max values to match the new offsets */ for(std::size_t i = 0; i != sizes.size(); ++i) - out[i].max() = out[i].min() + sizes[i]; + out[i].max() += out[i].min(); return out; } diff --git a/src/Magnum/Text/Test/AbstractGlyphCacheTest.cpp b/src/Magnum/Text/Test/AbstractGlyphCacheTest.cpp index c31db91c6..65e22da0e 100644 --- a/src/Magnum/Text/Test/AbstractGlyphCacheTest.cpp +++ b/src/Magnum/Text/Test/AbstractGlyphCacheTest.cpp @@ -684,8 +684,8 @@ void AbstractGlyphCacheTest::reserve() { Range2Di::fromSize({6, 12}, {5, 3}), Range2Di::fromSize({1, 2}, {12, 6}), Range2Di::fromSize({13, 12}, {10, 5}), - Range2Di::fromSize({1, 17}, {0, 1}), - Range2Di::fromSize({1, 12}, {3, 0}), + Range2Di::fromSize({4, 12}, {0, 1}), + Range2Di::fromSize({1, 17}, {3, 0}), }), TestSuite::Compare::Container); }