Add editing of text volume

This commit is contained in:
Filip Sykala 2021-09-15 15:14:04 +02:00
parent 8226f74413
commit 8add695de9
7 changed files with 440 additions and 131 deletions

View file

@ -7,6 +7,7 @@
#include <memory>
#include <admesh/stl.h> // indexed_triangle_set
#include "Polygon.hpp"
#include "TextConfiguration.hpp"
namespace Slic3r {
@ -19,28 +20,10 @@ class Emboss
public:
Emboss() = delete;
struct FontItem
{
std::string name;
std::string path;
enum class Type;
Type type;
FontItem(const std::string &name, const std::string &path);
FontItem(const std::string &name, const std::string &path, Type type);
FontItem(const std::wstring &name, const std::wstring &path);
// way of load font described in path string
enum class Type {
file_path, // path is file loacation on computer - no move between computers
wx_font_descr // path is font descriptor generated by wxWidgets - limits for os/language move
};
};
using FontList = std::vector<FontItem>;
/// <summary>
/// Collect fonts registred inside OS
/// </summary>
/// <returns>OS resistred TTF font files(full path) with names</returns>
/// <returns>OS registred TTF font files(full path) with names</returns>
static FontList get_font_list();
#ifdef _WIN32
static FontList get_font_list_by_register();
@ -55,24 +38,6 @@ public:
/// <returns>File path to font when found</returns>
static std::optional<std::wstring> get_font_path(const std::wstring &font_face_name);
// user defined font property
struct FontProp
{
// define extra space between letters, negative mean closer letter
int char_gap = 0;
// define extra space between lines, negative mean closer lines
int line_gap = 0;
// Precision of lettter outline curve in conversion to lines
float flatness = 2.0;
// Height of letter [in mm]
float size_in_mm = 10;
// Z depth of text [in mm]
float emboss = 5;
// TODO: add enum class Align: center/left/right
FontProp() = default;
};
// description of one letter
struct Glyph
{
@ -185,7 +150,7 @@ public:
return std::make_pair(res.first * m_scale, res.second * m_scale);
}
float m_scale;
float m_scale;
};
};