class with only static function add ability to engraved OR raised text OR polygons onto model surface More...
Classes | |
| struct | Glyph |
| struct | FontFile |
| keep information from file about font (store file data itself) More... | |
| struct | FontFileWithCache |
| Add caching for shape of glyphs. More... | |
| class | IProject3d |
| Project spatial point. More... | |
| class | IProjection |
| Project 2d point into space Could be plane, sphere, cylindric, ... More... | |
| class | ProjectZ |
| class | ProjectScale |
| class | ProjectTransform |
| class | OrthoProject3d |
| class | OrthoProject |
| struct | TextLine |
| Define polygon for draw letters. More... | |
Typedefs | |
| using | Glyphs = std::map<int, Glyph> |
| using | TextLines = std::vector<TextLine> |
Functions | |
| EmbossStyles | get_font_list () |
| Collect fonts registred inside OS. | |
| std::optional< std::wstring > | get_font_path (const std::wstring &font_face_name) |
| OS dependent function to get location of font by its name descriptor. | |
| std::unique_ptr< FontFile > | create_font_file (const char *file_path) |
| Load font file into buffer. | |
| std::unique_ptr< FontFile > | create_font_file (std::unique_ptr< std::vector< unsigned char > > data) |
| std::optional< Glyph > | letter2glyph (const FontFile &font, unsigned int font_index, int letter, float flatness) |
| convert letter into polygons | |
| HealedExPolygons | text2shapes (FontFileWithCache &font, const char *text, const FontProp &font_prop, const std::function< bool()> &was_canceled=[]() {return false;}) |
| Convert text into polygons. | |
| ExPolygonsWithIds | text2vshapes (FontFileWithCache &font, const std::wstring &text, const FontProp &font_prop, const std::function< bool()> &was_canceled=[]() {return false;}) |
| unsigned | get_count_lines (const std::wstring &ws) |
| Sum of character ' '. | |
| unsigned | get_count_lines (const std::string &text) |
| unsigned | get_count_lines (const ExPolygonsWithIds &shape) |
| HealedExPolygons | heal_polygons (const Polygons &shape, bool is_non_zero=true, unsigned max_iteration=10) |
| Fix duplicit points and self intersections in polygons. Also try to reduce amount of points and remove useless polygon parts. | |
| bool | heal_expolygons (ExPolygons &shape, unsigned max_iteration=10) |
| NOTE: call Slic3r::union_ex before this call. | |
| bool | divide_segments_for_close_point (ExPolygons &expolygons, double distance) |
| Divide line segments in place near to point (which could lead to self intersection due to preccision) Remove same neighbors Note: Possible part of heal shape. | |
| void | apply_transformation (const std::optional< float > &angle, const std::optional< float > &distance, Transform3d &transformation) |
| Use data from font property to modify transformation. | |
| bool | is_italic (const FontFile &font, unsigned int font_index) |
| Read information from naming table of font file search for italic (or oblique), bold italic (or bold oblique). | |
| std::string | create_range_text (const std::string &text, const FontFile &font, unsigned int font_index, bool *exist_unknown=nullptr) |
| Create unique character set from string with filtered from text with only character from font. | |
| double | get_text_shape_scale (const FontProp &fp, const FontFile &ff) |
| Calculate scale for glyph shape convert from shape points to mm. | |
| const FontFile::Info & | get_font_info (const FontFile &font, const FontProp &prop) |
| getter of font info by collection defined in prop | |
| int | get_line_height (const FontFile &font, const FontProp &prop) |
| Read from font file and properties height of line with spacing. | |
| double | get_align_y_offset_in_mm (FontProp::VerticalAlign align, unsigned count_lines, const FontFile &ff, const FontProp &fp) |
| Calculate Vertical align. | |
| indexed_triangle_set | polygons2model (const ExPolygons &shape2d, const IProjection &projection) |
| Create triangle model for text. | |
| Vec3d | suggest_up (const Vec3d normal, double up_limit=0.9) |
| Suggest wanted up vector of embossed text by emboss direction. | |
| std::optional< float > | calc_up (const Transform3d &tr, double up_limit=0.9) |
| By transformation calculate angle between suggested and actual up vector. | |
| Transform3d | create_transformation_onto_surface (const Vec3d &position, const Vec3d &normal, double up_limit=0.9) |
| Create transformation for emboss text object to lay on surface point. | |
| PolygonPoints | sample_slice (const TextLine &slice, const BoundingBoxes &bbs, double scale) |
| Sample slice polygon by bounding boxes centers slice start point has shape_center_x coor. | |
| double | calculate_angle (int32_t distance, PolygonPoint polygon_point, const Polygon &polygon) |
| Calculate angle for polygon point. | |
| std::vector< double > | calculate_angles (int32_t distance, const PolygonPoints &polygon_points, const Polygon &polygon) |
Variables | |
| static const float | UNION_DELTA = 50.0f |
| static const unsigned | UNION_MAX_ITERATIN = 10 |
| const unsigned | ENTER_UNICODE = static_cast<unsigned>('\n') |
class with only static function add ability to engraved OR raised text OR polygons onto model surface
| struct Slic3r::Emboss::Glyph |
| Class Members | ||
|---|---|---|
| int | advance_width =0 | |
| int | left_side_bearing =0 | |
| ExPolygons | shape | |
| struct Slic3r::Emboss::TextLine |
Define polygon for draw letters.
| Class Members | ||
|---|---|---|
| Polygon | polygon | |
| PolygonPoint | start | |
| float | y | |
| using Slic3r::Emboss::Glyphs = std::map<int, Glyph> |
| using Slic3r::Emboss::TextLines = std::vector<TextLine> |
| void Slic3r::Emboss::apply_transformation | ( | const std::optional< float > & | angle, |
| const std::optional< float > & | distance, | ||
| Transform3d & | transformation ) |
Use data from font property to modify transformation.
| angle | Z-rotation as angle to Y axis |
| distance | Z-move as surface distance |
| transformation | In / Out transformation to modify by property |
References Slic3r::angle(), and Slic3r::translate().
Referenced by anonymous_namespace{SurfaceDrag.cpp}::get_volume_transformation(), anonymous_namespace{EmbossJob.cpp}::CreateObjectJob::process(), and anonymous_namespace{EmbossJob.cpp}::start_create_volume_on_surface_job().
| std::optional< float > Slic3r::Emboss::calc_up | ( | const Transform3d & | tr, |
| double | up_limit = 0.9 ) |
By transformation calculate angle between suggested and actual up vector.
| tr | Transformation of embossed volume in world |
| up_limit | Is compared with normal.z to suggest up direction |
References Slic3r::dot(), Slic3r::is_approx(), Slic3r::normal(), and suggest_up().
Referenced by Slic3r::GUI::calc_angle(), Slic3r::GUI::face_selected_volume_to_camera(), and anonymous_namespace{SurfaceDrag.cpp}::start_dragging().
| double Slic3r::Emboss::calculate_angle | ( | int32_t | distance, |
| PolygonPoint | polygon_point, | ||
| const Polygon & | polygon ) |
Calculate angle for polygon point.
| distance | Distance for found normal in point |
| polygon_point | Select point on polygon |
| polygon | Polygon know neighbor of point |
References Slic3r::PolygonPoint::point.
Referenced by calculate_angles().
| std::vector< double > Slic3r::Emboss::calculate_angles | ( | int32_t | distance, |
| const PolygonPoints & | polygon_points, | ||
| const Polygon & | polygon ) |
References calculate_angle().
Referenced by anonymous_namespace{EmbossJob.cpp}::create_mesh_per_glyph(), and anonymous_namespace{EmbossJob.cpp}::cut_per_glyph_surface().
| std::unique_ptr< FontFile > Slic3r::Emboss::create_font_file | ( | const char * | file_path | ) |
Load font file into buffer.
| file_path | Location of .ttf or .ttc font file |
References create_font_file(), and L.
Referenced by create_font_file(), Slic3r::GUI::WxFontUtils::create_font_file(), Slic3r::GUI::Emboss::StyleManager::load_style(), and Slic3r::text_to_regions().
| std::unique_ptr< FontFile > Slic3r::Emboss::create_font_file | ( | std::unique_ptr< std::vector< unsigned char > > | data | ) |
References anonymous_namespace{Emboss.cpp}::load_font_info().
| std::string Slic3r::Emboss::create_range_text | ( | const std::string & | text, |
| const FontFile & | font, | ||
| unsigned int | font_index, | ||
| bool * | exist_unknown = nullptr ) |
Create unique character set from string with filtered from text with only character from font.
| text | Source vector of glyphs |
| font | Font descriptor |
| font_index | Define font in collection |
| exist_unknown | True when text contain glyph unknown in font |
References Slic3r::Emboss::FontFile::data, anonymous_namespace{Emboss.cpp}::is_valid(), and anonymous_namespace{Emboss.cpp}::load_font_info().
Referenced by anonymous_namespace{GLGizmoEmboss.cpp}::can_write(), and Slic3r::GUI::GLGizmoEmboss::draw_text_input().
| Transform3d Slic3r::Emboss::create_transformation_onto_surface | ( | const Vec3d & | position, |
| const Vec3d & | normal, | ||
| double | up_limit = 0.9 ) |
Create transformation for emboss text object to lay on surface point.
| position | Position of surface point |
| normal | Normal of surface point |
| up_limit | Is compared with normal.z to suggest up direction |
References Slic3r::is_approx(), M_PI, Slic3r::normal(), suggest_up(), and Slic3r::transform().
Referenced by anonymous_namespace{EmbossJob.cpp}::start_create_volume_on_surface_job().
| bool Slic3r::Emboss::divide_segments_for_close_point | ( | ExPolygons & | expolygons, |
| double | distance ) |
Divide line segments in place near to point (which could lead to self intersection due to preccision) Remove same neighbors Note: Possible part of heal shape.
| expolygons | Expolygon to edit |
| distance | (epsilon)Euclidean distance from point to line which divide line |
References Slic3r::Linef::a, Slic3r::AABBTreeLines::all_lines_in_radius(), Slic3r::Linef::b, Slic3r::AABBTreeLines::build_aabb_tree_over_indexed_lines(), Slic3r::ExPolygon::contour, count, Slic3r::ExPolygonsIndices::cvt(), Slic3r::ExPolygonsIndices::get_count(), Slic3r::ExPolygon::holes, Slic3r::ExPolygonsIndices::is_last_point(), Slic3r::MultiPoint::points, Slic3r::remove_same_neighbor(), and Slic3r::to_linesf().
| double Slic3r::Emboss::get_align_y_offset_in_mm | ( | FontProp::VerticalAlign | align, |
| unsigned | count_lines, | ||
| const FontFile & | ff, | ||
| const FontProp & | fp ) |
Calculate Vertical align.
| align | Top | Center | Bottom |
| count_lines |
References get_text_shape_scale(), and scale().
Referenced by Slic3r::GUI::TextLinesModel::init().
| unsigned Slic3r::Emboss::get_count_lines | ( | const ExPolygonsWithIds & | shape | ) |
References ENTER_UNICODE.
| unsigned Slic3r::Emboss::get_count_lines | ( | const std::string & | text | ) |
References get_count_lines().
| unsigned Slic3r::Emboss::get_count_lines | ( | const std::wstring & | ws | ) |
Sum of character '
'.
References count.
Referenced by anonymous_namespace{Emboss.cpp}::align_shape(), anonymous_namespace{EmbossJob.cpp}::create_line_bounds(), anonymous_namespace{EmbossJob.cpp}::create_mesh_per_glyph(), anonymous_namespace{EmbossJob.cpp}::cut_per_glyph_surface(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_text_input(), get_count_lines(), anonymous_namespace{GLGizmoEmboss.cpp}::init_text_lines(), and Slic3r::GUI::GLGizmoEmboss::process().
| const FontFile::Info & Slic3r::Emboss::get_font_info | ( | const FontFile & | font, |
| const FontProp & | prop ) |
getter of font info by collection defined in prop
| font | Contain infos about all fonts(collections) in file |
| prop | Index of collection |
References Slic3r::FontProp::collection_number, Slic3r::Emboss::FontFile::infos, and anonymous_namespace{Emboss.cpp}::is_valid().
Referenced by Slic3r::GUI::Emboss::StyleManager::create_imgui_font(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), anonymous_namespace{Emboss.cpp}::get_align_y_offset(), Slic3r::GUI::Emboss::StyleManager::get_imgui_font_size(), get_line_height(), and get_text_shape_scale().
| EmbossStyles Slic3r::Emboss::get_font_list | ( | ) |
Collect fonts registred inside OS.
| std::optional< std::wstring > Slic3r::Emboss::get_font_path | ( | const std::wstring & | font_face_name | ) |
OS dependent function to get location of font by its name descriptor.
| font_face_name | Unique identificator for font |
Read from font file and properties height of line with spacing.
| font | Infos for collections |
| prop | Collection index + Additional line gap |
References Slic3r::Emboss::FontFile::Info::ascent, Slic3r::Emboss::FontFile::Info::descent, get_font_info(), Slic3r::FontProp::line_gap, Slic3r::Emboss::FontFile::Info::linegap, and SHAPE_SCALE.
Referenced by Slic3r::GUI::TextLinesModel::calc_line_height_in_mm(), anonymous_namespace{Emboss.cpp}::get_align_y_offset(), and anonymous_namespace{Emboss.cpp}::letter2shapes().
Calculate scale for glyph shape convert from shape points to mm.
| fp | Property of font |
| ff | Font data |
References get_font_info(), scale(), SHAPE_SCALE, Slic3r::FontProp::size_in_mm, and Slic3r::Emboss::FontFile::Info::unit_per_em.
Referenced by anonymous_namespace{GLGizmoEmboss.cpp}::TextDataBase::TextDataBase(), Slic3r::GUI::TextLinesModel::calc_line_height_in_mm(), get_align_y_offset_in_mm(), and Slic3r::text_to_regions().
| bool Slic3r::Emboss::heal_expolygons | ( | ExPolygons & | shape, |
| unsigned | max_iteration = 10 ) |
NOTE: call Slic3r::union_ex before this call.
Heal (read: Fix) issues in expolygons:
| shape | In/Out shape to heal |
| max_iteration | Heal could create another issue, After healing it is checked again until shape is good or maximal count of iteration |
Referenced by anonymous_namespace{Emboss.cpp}::union_with_delta().
| HealedExPolygons Slic3r::Emboss::heal_polygons | ( | const Polygons & | shape, |
| bool | is_non_zero = true, | ||
| unsigned | max_iteration = 10 ) |
Fix duplicit points and self intersections in polygons. Also try to reduce amount of points and remove useless polygon parts.
| is_non_zero | Fill type pftNonZero for overlapping otherwise |
| max_iteration | Look at heal_expolygon()::max_iteration |
References Slic3r::angle().
Referenced by anonymous_namespace{NSVGUtils.cpp}::fill_to_expolygons(), anonymous_namespace{Emboss.cpp}::get_glyph(), and anonymous_namespace{NSVGUtils.cpp}::stroke_to_expolygons().
| bool Slic3r::Emboss::is_italic | ( | const FontFile & | font, |
| unsigned int | font_index ) |
Read information from naming table of font file search for italic (or oblique), bold italic (or bold oblique).
| font | Selector of font |
| font_index | Index of font in collection |
References Slic3r::Emboss::FontFile::data, Slic3r::Emboss::FontFile::infos, Slic3r::length(), and anonymous_namespace{Emboss.cpp}::load_font_info().
Referenced by Slic3r::GUI::Emboss::StyleManager::is_font_changed().
| std::optional< Glyph > Slic3r::Emboss::letter2glyph | ( | const FontFile & | font, |
| unsigned int | font_index, | ||
| int | letter, | ||
| float | flatness ) |
convert letter into polygons
| font | Define fonts |
| font_index | Index of font in collection |
| letter | One character defined by unicode codepoint |
| flatness | Precision of lettter outline curve in conversion to lines |
References Slic3r::Emboss::FontFile::data, anonymous_namespace{Emboss.cpp}::get_glyph(), anonymous_namespace{Emboss.cpp}::is_valid(), and anonymous_namespace{Emboss.cpp}::load_font_info().
| indexed_triangle_set Slic3r::Emboss::polygons2model | ( | const ExPolygons & | shape2d, |
| const IProjection & | projection ) |
Create triangle model for text.
| shape2d | text or image |
| projection | Define transformation from 2d to 3d(orientation, position, scale, ...) |
References Slic3r::collect_duplicates(), anonymous_namespace{Emboss.cpp}::polygons2model_duplicit(), anonymous_namespace{Emboss.cpp}::polygons2model_unique(), and Slic3r::to_points().
Referenced by anonymous_namespace{EmbossJob.cpp}::create_mesh_per_glyph(), and anonymous_namespace{EmbossJob.cpp}::try_create_mesh().
| PolygonPoints Slic3r::Emboss::sample_slice | ( | const TextLine & | slice, |
| const BoundingBoxes & | bbs, | ||
| double | scale ) |
Sample slice polygon by bounding boxes centers slice start point has shape_center_x coor.
| slice | Polygon and start point[Slic3r scaled millimeters] |
| bbs | Bounding boxes of letter on one line[in font scales] |
| scale | Scale for bbs (after multiply bb is in millimeters) |
References Slic3r::BoundingBoxBase< PointType, APointsType >::center(), Slic3r::BoundingBoxBase< PointType, APointsType >::defined, Slic3r::Emboss::TextLine::polygon, scale(), scale_, and Slic3r::Emboss::TextLine::start.
Referenced by anonymous_namespace{EmbossJob.cpp}::create_mesh_per_glyph(), and anonymous_namespace{EmbossJob.cpp}::cut_per_glyph_surface().
Suggest wanted up vector of embossed text by emboss direction.
| normal | Normalized vector of emboss direction in world |
| up_limit | Is compared with normal.z to suggest up direction |
References Slic3r::is_approx(), and Slic3r::normal().
Referenced by calc_up(), create_transformation_onto_surface(), and anonymous_namespace{SurfaceDrag.cpp}::get_volume_transformation().
| HealedExPolygons Slic3r::Emboss::text2shapes | ( | FontFileWithCache & | font, |
| const char * | text, | ||
| const FontProp & | font_prop, | ||
| const std::function< bool()> & | was_canceled = []() {return false;} ) |
Convert text into polygons.
| font | Define fonts + cache, which could extend |
| text | Characters to convert |
| font_prop | User defined property of the font |
| was_canceled | Way to interupt processing |
References MAX_HEAL_ITERATION_OF_TEXT, SHAPE_SCALE, and text2vshapes().
Referenced by Slic3r::GUI::CreateFontImageJob::process(), and Slic3r::text_to_regions().
| ExPolygonsWithIds Slic3r::Emboss::text2vshapes | ( | FontFileWithCache & | font, |
| const std::wstring & | text, | ||
| const FontProp & | font_prop, | ||
| const std::function< bool()> & | was_canceled = []() {return false;} ) |
References anonymous_namespace{Emboss.cpp}::align_shape(), anonymous_namespace{Emboss.cpp}::CANCEL_CHECK, Slic3r::FontProp::collection_number, Slic3r::Emboss::FontFileWithCache::font_file, Slic3r::Emboss::FontFileWithCache::has_value(), anonymous_namespace{Emboss.cpp}::is_valid(), and anonymous_namespace{Emboss.cpp}::letter2shapes().
Referenced by anonymous_namespace{GLGizmoEmboss.cpp}::TextDataBase::create_shape(), and text2shapes().
| const unsigned Slic3r::Emboss::ENTER_UNICODE = static_cast<unsigned>('\n') |
Referenced by anonymous_namespace{EmbossJob.cpp}::create_line_bounds(), and get_count_lines().
|
static |
Referenced by anonymous_namespace{EmbossJob.cpp}::create_shape().
|
static |
Referenced by anonymous_namespace{EmbossJob.cpp}::create_shape().