OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
anonymous_namespace{GLGizmoEmboss.cpp}::TextDataBase Struct Reference
Inheritance diagram for anonymous_namespace{GLGizmoEmboss.cpp}::TextDataBase:
Collaboration diagram for anonymous_namespace{GLGizmoEmboss.cpp}::TextDataBase:

Public Member Functions

 TextDataBase (DataBase &&parent, const FontFileWithCache &font_file, TextConfiguration &&text_configuration, const EmbossProjection &projection)
EmbossShape & create_shape () override
 Create shape e.g. Text extract glyphs from font Not 'const' function because it could modify shape.
void write (ModelVolume &volume) const override
 Write data how to reconstruct shape to volume.

Public Attributes

bool is_outside = true
Slic3r::Emboss::TextLines text_lines = {}
std::optional< float > from_surface
std::string volume_name
std::shared_ptr< std::atomic< bool > > cancel
EmbossShape shape

Private Attributes

FontFileWithCache m_font_file
TextConfiguration m_text_configuration

Detailed Description

Constructor & Destructor Documentation

◆ TextDataBase()

anonymous_namespace{GLGizmoEmboss.cpp}::TextDataBase::TextDataBase ( DataBase && parent,
const FontFileWithCache & font_file,
TextConfiguration && text_configuration,
const EmbossProjection & projection )
3436 : DataBase(std::move(parent)), m_font_file(font_file) /* copy */, m_text_configuration(std::move(text_configuration))
3437{
3438 assert(m_font_file.has_value());
3439 shape.projection = projection; // copy
3440
3441 const FontProp &fp = m_text_configuration.style.prop;
3442 const FontFile &ff = *m_font_file.font_file;
3443 shape.scale = get_text_shape_scale(fp, ff);
3444}
DataBase(const std::string &volume_name, std::shared_ptr< std::atomic< bool > > cancel)
Definition EmbossJob.hpp:44
EmbossShape shape
Definition EmbossJob.hpp:86
double get_text_shape_scale(const FontProp &fp, const FontFile &ff)
Calculate scale for glyph shape convert from shape points to mm.
Definition Emboss.cpp:1570
TextConfiguration m_text_configuration
Definition GLGizmoEmboss.cpp:191
FontFileWithCache m_font_file
Definition GLGizmoEmboss.cpp:189

References Slic3r::GUI::Emboss::DataBase::DataBase(), Slic3r::Emboss::get_text_shape_scale(), m_font_file, m_text_configuration, and Slic3r::GUI::Emboss::DataBase::shape.

Here is the call graph for this function:

Member Function Documentation

◆ create_shape()

EmbossShape & anonymous_namespace{GLGizmoEmboss.cpp}::TextDataBase::create_shape ( )
overridevirtual

Create shape e.g. Text extract glyphs from font Not 'const' function because it could modify shape.

Reimplemented from Slic3r::GUI::Emboss::DataBase.

3447{
3448 if (!shape.shapes_with_ids.empty())
3449 return shape;
3450
3451 // create shape by configuration
3452 const char *text = m_text_configuration.text.c_str();
3453 std::wstring text_w = boost::nowide::widen(text);
3454 const FontProp &fp = m_text_configuration.style.prop;
3455 auto was_canceled = [&c = cancel](){ return c->load(); };
3456
3457 shape.shapes_with_ids = text2vshapes(m_font_file, text_w, fp, was_canceled);
3458 return shape;
3459}
std::shared_ptr< std::atomic< bool > > cancel
Definition EmbossJob.hpp:83
ExPolygonsWithIds text2vshapes(FontFileWithCache &font, const std::wstring &text, const FontProp &font_prop, const std::function< bool()> &was_canceled=[]() {return false;})
Definition Emboss.cpp:1409
auto was_canceled(const Job::Ctl &ctl, const DataBase &base)
Definition EmbossJob.cpp:292

References Slic3r::GUI::Emboss::DataBase::cancel, m_font_file, m_text_configuration, Slic3r::GUI::Emboss::DataBase::shape, and Slic3r::Emboss::text2vshapes().

Here is the call graph for this function:

◆ write()

void anonymous_namespace{GLGizmoEmboss.cpp}::TextDataBase::write ( ModelVolume & volume) const
overridevirtual

Write data how to reconstruct shape to volume.

Parameters
volumeData object for store emboss params

Reimplemented from Slic3r::GUI::Emboss::DataBase.

3462{
3463 DataBase::write(volume);
3465 assert(volume.emboss_shape.has_value());
3466}
virtual void write(ModelVolume &volume) const
Write data how to reconstruct shape to volume.
Definition EmbossJob.cpp:302
std::optional< EmbossShape > emboss_shape
Definition Model.hpp:1019
std::optional< TextConfiguration > text_configuration
Definition Model.hpp:1015

References Slic3r::ModelVolume::emboss_shape, m_text_configuration, Slic3r::ModelVolume::text_configuration, and Slic3r::GUI::Emboss::DataBase::write().

Here is the call graph for this function:

Member Data Documentation

◆ cancel

◆ from_surface

std::optional<float> Slic3r::GUI::Emboss::DataBase::from_surface
inherited

◆ is_outside

◆ m_font_file

FontFileWithCache anonymous_namespace{GLGizmoEmboss.cpp}::TextDataBase::m_font_file
private

Referenced by TextDataBase(), and create_shape().

◆ m_text_configuration

TextConfiguration anonymous_namespace{GLGizmoEmboss.cpp}::TextDataBase::m_text_configuration
private

Referenced by TextDataBase(), create_shape(), and write().

◆ shape

◆ text_lines

◆ volume_name


The documentation for this struct was generated from the following file: