70 lines
1.9 KiB
C++
70 lines
1.9 KiB
C++
#ifndef slic3r_TextConfiguration_hpp_
|
|
#define slic3r_TextConfiguration_hpp_
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
namespace Slic3r {
|
|
|
|
// represent selected font
|
|
// Name must be human readable is visible in gui
|
|
// (Path + Type) must define how to open font for using on different OS
|
|
struct FontItem
|
|
{
|
|
std::string name;
|
|
std::string path;
|
|
enum class Type;
|
|
Type type;
|
|
|
|
FontItem() : type(Type::undefined) {}
|
|
FontItem(const std::string &name, const std::string &path, Type type = Type::file_path)
|
|
: name(name), path(path), type(type)
|
|
{}
|
|
|
|
// way of load font described in path string
|
|
enum class Type {
|
|
undefined = 0,
|
|
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>;
|
|
|
|
// 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;
|
|
};
|
|
|
|
// define how to create 'Text volume'
|
|
struct TextConfiguration
|
|
{
|
|
// define font
|
|
FontItem font_item;
|
|
// user modification of font
|
|
FontProp font_prop;
|
|
|
|
std::string text;
|
|
|
|
TextConfiguration() = default;
|
|
TextConfiguration(const FontItem & font_item,
|
|
const FontProp & font_prop,
|
|
const std::string &text)
|
|
: font_item(font_item), font_prop(font_prop), text(text)
|
|
{}
|
|
};
|
|
} // namespace Slic3r
|
|
|
|
#endif // slic3r_TextConfiguration_hpp_
|