25 lines
623 B
C++
25 lines
623 B
C++
#include <psemek/ui/msdf_font.hpp>
|
|
#include <psemek/gfx/pixmap.hpp>
|
|
|
|
namespace psemek::ui
|
|
{
|
|
|
|
std::unique_ptr<font> make_msdf_font(io::istream && description, io::istream && texture)
|
|
{
|
|
auto data = bmfont_data::parse(std::move(description));
|
|
|
|
auto pixmap = gfx::read_png(std::move(texture));
|
|
gfx::texture_2d atlas;
|
|
atlas.load(pixmap);
|
|
atlas.linear_mipmap_filter();
|
|
atlas.anisotropy();
|
|
atlas.generate_mipmap();
|
|
|
|
return std::make_unique<msdf_font>(std::move(data), std::move(atlas));
|
|
}
|
|
|
|
msdf_font::msdf_font(bmfont_data data, gfx::texture_2d atlas)
|
|
: kerned_font(std::move(data), std::move(atlas))
|
|
{}
|
|
|
|
}
|