Move fonts code to a separate library
This commit is contained in:
parent
b21332b9a4
commit
53bfbb0cd0
12 changed files with 26 additions and 18 deletions
8
libs/fonts/CMakeLists.txt
Normal file
8
libs/fonts/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
file(GLOB_RECURSE PSEMEK_FONTS_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "include/*.hpp")
|
||||||
|
file(GLOB_RECURSE PSEMEK_FONTS_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "source/*.cpp")
|
||||||
|
|
||||||
|
psemek_add_library(psemek-fonts ${PSEMEK_FONTS_HEADERS} ${PSEMEK_FONTS_SOURCES})
|
||||||
|
target_include_directories(psemek-fonts PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||||
|
target_link_libraries(psemek-fonts PUBLIC psemek-util psemek-geom psemek-gfx rapidjson)
|
||||||
|
|
||||||
|
psemek_glob_resources(psemek-fonts resources psemek/fonts/resources)
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace psemek::ui
|
namespace psemek::fonts
|
||||||
{
|
{
|
||||||
|
|
||||||
struct bmfont_data
|
struct bmfont_data
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace psemek::ui
|
namespace psemek::fonts
|
||||||
{
|
{
|
||||||
|
|
||||||
enum class font_type
|
enum class font_type
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <psemek/ui/font.hpp>
|
#include <psemek/fonts/font.hpp>
|
||||||
#include <psemek/ui/bmfont.hpp>
|
#include <psemek/fonts/bmfont.hpp>
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace psemek::ui
|
namespace psemek::fonts
|
||||||
{
|
{
|
||||||
|
|
||||||
struct kerned_font
|
struct kerned_font
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <psemek/ui/font.hpp>
|
#include <psemek/fonts/font.hpp>
|
||||||
|
|
||||||
namespace psemek::ui
|
namespace psemek::fonts
|
||||||
{
|
{
|
||||||
|
|
||||||
struct monospace_font
|
struct monospace_font
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <psemek/ui/font.hpp>
|
#include <psemek/fonts/font.hpp>
|
||||||
#include <psemek/ui/kerned_font.hpp>
|
#include <psemek/fonts/kerned_font.hpp>
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace psemek::ui
|
namespace psemek::fonts
|
||||||
{
|
{
|
||||||
|
|
||||||
struct msdf_font
|
struct msdf_font
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include <psemek/ui/bmfont.hpp>
|
#include <psemek/fonts/bmfont.hpp>
|
||||||
#include <psemek/util/to_string.hpp>
|
#include <psemek/util/to_string.hpp>
|
||||||
|
|
||||||
#include <boost/preprocessor/stringize.hpp>
|
#include <boost/preprocessor/stringize.hpp>
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include <rapidjson/document.h>
|
#include <rapidjson/document.h>
|
||||||
#include <rapidjson/istreamwrapper.h>
|
#include <rapidjson/istreamwrapper.h>
|
||||||
|
|
||||||
namespace psemek::ui
|
namespace psemek::fonts
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#include <psemek/ui/kerned_font.hpp>
|
#include <psemek/fonts/kerned_font.hpp>
|
||||||
|
|
||||||
#include <psemek/util/unicode.hpp>
|
#include <psemek/util/unicode.hpp>
|
||||||
|
|
||||||
namespace psemek::ui
|
namespace psemek::fonts
|
||||||
{
|
{
|
||||||
|
|
||||||
kerned_font::kerned_font(bmfont_data data, gfx::texture_2d atlas)
|
kerned_font::kerned_font(bmfont_data data, gfx::texture_2d atlas)
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#include <psemek/ui/monospace_font.hpp>
|
#include <psemek/fonts/monospace_font.hpp>
|
||||||
|
|
||||||
#include <psemek/util/unicode.hpp>
|
#include <psemek/util/unicode.hpp>
|
||||||
|
|
||||||
namespace psemek::ui
|
namespace psemek::fonts
|
||||||
{
|
{
|
||||||
|
|
||||||
monospace_font::monospace_font(character_range range, std::string_view name, geom::vector<int, 2> size, gfx::texture_2d atlas, std::vector<geom::box<float, 2>> texcoords)
|
monospace_font::monospace_font(character_range range, std::string_view name, geom::vector<int, 2> size, gfx::texture_2d atlas, std::vector<geom::box<float, 2>> texcoords)
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <psemek/ui/msdf_font.hpp>
|
#include <psemek/fonts/msdf_font.hpp>
|
||||||
#include <psemek/gfx/pixmap.hpp>
|
#include <psemek/gfx/pixmap.hpp>
|
||||||
|
|
||||||
namespace psemek::ui
|
namespace psemek::fonts
|
||||||
{
|
{
|
||||||
|
|
||||||
std::unique_ptr<font> make_msdf_font(io::istream && description, io::istream && texture)
|
std::unique_ptr<font> make_msdf_font(io::istream && description, io::istream && texture)
|
||||||
Loading…
Add table
Reference in a new issue