Browse Source

Text: no need to pollute header with internal functions.

pull/88/head
Vladimír Vondruš 11 years ago
parent
commit
127970eda1
  1. 44
      src/Magnum/Text/AbstractFontConverter.cpp
  2. 7
      src/Magnum/Text/AbstractFontConverter.h

44
src/Magnum/Text/AbstractFontConverter.cpp

@ -35,6 +35,30 @@
namespace Magnum { namespace Text {
namespace {
#ifndef __MINGW32__
std::u32string uniqueUnicode(const std::string& characters)
#else
std::vector<char32_t> uniqueUnicode(const std::string& characters)
#endif
{
/* Convert UTF-8 to UTF-32 */
#ifndef __MINGW32__
std::u32string result = Utility::Unicode::utf32(characters);
#else
std::vector<char32_t> result = Utility::Unicode::utf32(characters);
#endif
/* Remove duplicate glyphs */
std::sort(result.begin(), result.end());
result.erase(std::unique(result.begin(), result.end()), result.end());
return std::move(result);
}
}
AbstractFontConverter::AbstractFontConverter() = default;
AbstractFontConverter::AbstractFontConverter(PluginManager::AbstractManager& manager, std::string plugin): PluginManager::AbstractPlugin(manager, std::move(plugin)) {}
@ -208,24 +232,4 @@ std::unique_ptr<GlyphCache> AbstractFontConverter::doImportGlyphCacheFromFile(co
return doImportGlyphCacheFromSingleData(Utility::Directory::read(filename));
}
#ifndef __MINGW32__
std::u32string AbstractFontConverter::uniqueUnicode(const std::string& characters)
#else
std::vector<char32_t> AbstractFontConverter::uniqueUnicode(const std::string& characters)
#endif
{
/* Convert UTF-8 to UTF-32 */
#ifndef __MINGW32__
std::u32string result = Utility::Unicode::utf32(characters);
#else
std::vector<char32_t> result = Utility::Unicode::utf32(characters);
#endif
/* Remove duplicate glyphs */
std::sort(result.begin(), result.end());
result.erase(std::unique(result.begin(), result.end()), result.end());
return std::move(result);
}
}}

7
src/Magnum/Text/AbstractFontConverter.h

@ -350,13 +350,6 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl
* and calls @ref doImportGlyphCacheFromSingleData() with its contents.
*/
virtual std::unique_ptr<GlyphCache> doImportGlyphCacheFromFile(const std::string& filename) const;
private:
#ifndef __MINGW32__
MAGNUM_TEXT_LOCAL static std::u32string uniqueUnicode(const std::string& characters);
#else
MAGNUM_TEXT_LOCAL static std::vector<char32_t> uniqueUnicode(const std::string& characters);
#endif
};
CORRADE_ENUMSET_OPERATORS(AbstractFontConverter::Features)

Loading…
Cancel
Save