Files
MapLibreParticleLab/src/mbgl/text/glyph.cpp
Chris Loer 40b0c8d076 [core] Use UTF-16 instead of UTF-32 for label features to avoid extra conversions and reduce in-memory size.
Continue to use uint32 as glyph ID to maintain Glyph PBF, even though we're only using 16 bits of that uint32.
Use std::codecvt instead of boost::unicode_iterator for UTF8->UTF16 conversions.
2016-11-17 14:33:03 -08:00

15 lines
326 B
C++

#include <mbgl/text/glyph.hpp>
namespace mbgl {
// Note: this only works for the BMP
GlyphRange getGlyphRange(char16_t glyph) {
unsigned start = (glyph/256) * 256;
unsigned end = (start + 255);
if (start > 65280) start = 65280;
if (end > 65535) end = 65535;
return { start, end };
}
} // namespace mbgl