![]() |
Prusa Slicer 2.6.0
|
class with only static function add ability to engraved OR raised text OR polygons onto model surface More...
Classes | |
| struct | FontFile |
| keep information from file about font (store file data itself) More... | |
| struct | FontFileWithCache |
| Add caching for shape of glyphs. More... | |
| struct | Glyph |
| class | IProject3d |
| Project spatial point. More... | |
| class | IProjection |
| Project 2d point into space Could be plane, sphere, cylindric, ... More... | |
| class | OrthoProject |
| class | OrthoProject3d |
| class | ProjectScale |
| class | ProjectZ |
Typedefs | |
| using | Glyphs = std::map< int, Glyph > |
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 | |
| ExPolygons | text2shapes (FontFileWithCache &font, const char *text, const FontProp &font_prop, std::function< bool()> was_canceled=nullptr) |
| Convert text into polygons. | |
| ExPolygons | heal_shape (const Polygons &shape) |
| Fix duplicit points and self intersections in polygons. Also try to reduce amount of points and remove useless polygon parts. | |
| bool | heal_shape (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 FontProp &font_prop, Transform3d &transformation) |
| Use data from font property to modify transformation. | |
| void | apply_transformation (const std::optional< float > &angle, const std::optional< float > &distance, Transform3d &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_shape_scale (const FontProp &fp, const FontFile &ff) |
| Calculate scale for glyph shape convert from shape points to mm. | |
| 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. | |
Variables | |
| static constexpr double | SHAPE_SCALE = 0.001 |
class with only static function add ability to engraved OR raised text OR polygons onto model surface
| struct Slic3r::Emboss::Glyph |
Collaboration diagram for Slic3r::Emboss::Glyph:| Class Members | ||
|---|---|---|
| int | advance_width =0 | |
| int | left_side_bearing =0 | |
| ExPolygons | shape | |
| using Slic3r::Emboss::Glyphs = typedef std::map<int, Glyph> |
| void Slic3r::Emboss::apply_transformation | ( | const FontProp & | font_prop, |
| Transform3d & | transformation | ||
| ) |
Use data from font property to modify transformation.
| font_prop | Z-move as surface distance(FontProp::distance) Z-rotation as angle to Y axis(FontProp::angle) |
| transformation | In / Out transformation to modify by property |
References Slic3r::FontProp::angle, apply_transformation(), and Slic3r::FontProp::distance.
Referenced by apply_transformation(), Slic3r::GUI::on_mouse_surface_drag(), and priv::start_create_volume_on_surface_job().
Here is the call graph for this function:
Here is the caller graph for this function:| void Slic3r::Emboss::apply_transformation | ( | const std::optional< float > & | angle, |
| const std::optional< float > & | distance, | ||
| Transform3d & | transformation | ||
| ) |
References Slic3r::angle(), and Eigen::Transform< _Scalar, _Dim, _Mode, _Options >::translate().
Here is the call graph for this function:| 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(), Eigen::Transform< _Scalar, _Dim, _Mode, _Options >::linear(), and suggest_up().
Referenced by Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::on_mouse_for_translate(), Slic3r::GUI::on_mouse_surface_drag(), Slic3r::GUI::GLGizmoEmboss::on_stop_dragging(), and Slic3r::GUI::GLGizmoEmboss::set_volume_by_selection().
Here is the call graph for this function:
Here is the caller graph for this function:Load font file into buffer.
| file_path | Location of .ttf or .ttc font file |
References create_font_file(), error, and L.
Referenced by create_font_file(), Slic3r::GUI::WxFontUtils::create_font_file(), and Slic3r::GUI::Emboss::StyleManager::load_style().
Here is the call graph for this function:
Here is the caller graph for this function:| std::unique_ptr< FontFile > Slic3r::Emboss::create_font_file | ( | std::unique_ptr< std::vector< unsigned char > > | data | ) |
References priv::load_font_info(), stbtt_GetFontVMetrics(), stbtt_GetNumberOfFonts(), and stbtt_ScaleForMappingEmToPixels().
Here is the call graph for this function:| 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, priv::is_valid(), priv::load_font_info(), boost::nowide::narrow(), and boost::nowide::widen().
Referenced by Slic3r::GUI::GLGizmoEmboss::draw_text_input().
Here is the call graph for this function:
Here is the caller graph for this function:| 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 Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign >::Identity(), Slic3r::is_approx(), M_PI, Eigen::RotationBase< Derived, _Dim >::matrix(), suggest_up(), and Slic3r::transform().
Referenced by priv::start_create_volume_on_surface_job().
Here is the call graph for this function:
Here is the caller graph for this function:| 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, Slic3r::ExPolygonsIndices::cvt(), Slic3r::ExPolygonsIndices::get_count(), Slic3r::ExPolygon::holes, Slic3r::ExPolygonsIndices::is_last_point(), Slic3r::MultiPoint::points, priv::remove_same_neighbor(), and Slic3r::to_linesf().
Here is the call graph for this function:| 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 |
Calculate scale for glyph shape convert from shape points to mm.
| fp | Property of font |
| ff | Font data |
References Slic3r::FontProp::collection_number, Slic3r::Emboss::FontFile::infos, scale(), SHAPE_SCALE, Slic3r::FontProp::size_in_mm, and Slic3r::Emboss::FontFile::Info::unit_per_em.
Referenced by priv::cut_surface().
Here is the call graph for this function:
Here is the caller graph for this function:| ExPolygons Slic3r::Emboss::heal_shape | ( | const Polygons & | shape | ) |
Fix duplicit points and self intersections in polygons. Also try to reduce amount of points and remove useless polygon parts.
| precision | Define wanted precision of shape after heal |
References ClipperLib::CleanPolygons(), Slic3r::collect_duplicates(), heal_shape(), ClipperLib::pftNonZero, priv::pts_3x3(), ClipperLib::SimplifyPolygons(), Slic3r::to_points(), Slic3r::to_polygons(), Slic3r::MultiPoint::translate(), and Slic3r::union_ex().
Referenced by priv::get_glyph(), heal_shape(), and text2shapes().
Here is the call graph for this function:
Here is the caller graph for this function:| bool Slic3r::Emboss::heal_shape | ( | 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 |
References priv::heal_dupl_inter().
Here is the call graph for this function: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(), priv::load_font_info(), stbtt_GetFontNameString(), STBTT_MS_EID_UNICODE_BMP, STBTT_MS_LANG_ENGLISH, and STBTT_PLATFORM_ID_MICROSOFT.
Referenced by Slic3r::GUI::Emboss::StyleManager::is_font_changed().
Here is the call graph for this function:
Here is the caller graph for this function:| 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, priv::get_glyph(), priv::is_valid(), and priv::load_font_info().
Here is the call graph for this function:| 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(), priv::polygons2model_duplicit(), priv::polygons2model_unique(), and Slic3r::to_points().
Here is the call graph for this function: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().
Referenced by calc_up(), create_transformation_onto_surface(), and Slic3r::GUI::on_mouse_surface_drag().
Here is the call graph for this function:
Here is the caller graph for this function:| ExPolygons Slic3r::Emboss::text2shapes | ( | FontFileWithCache & | font, |
| const char * | text, | ||
| const FontProp & | font_prop, | ||
| std::function< bool()> | was_canceled = nullptr |
||
| ) |
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 Slic3r::Emboss::Glyph::advance_width, Slic3r::Emboss::FontFile::Info::ascent, Slic3r::Emboss::FontFileWithCache::cache, Slic3r::FontProp::collection_number, Slic3r::Emboss::FontFile::Info::descent, Slic3r::expolygons_append(), Slic3r::Emboss::FontFileWithCache::font_file, priv::get_glyph(), Slic3r::Emboss::FontFileWithCache::has_value(), heal_shape(), Slic3r::Emboss::FontFile::infos, priv::is_valid(), Slic3r::FontProp::line_gap, Slic3r::Emboss::FontFile::Info::linegap, Slic3r::Emboss::Glyph::shape, SHAPE_SCALE, Slic3r::union_ex(), and boost::nowide::widen().
Referenced by Slic3r::GUI::CreateFontImageJob::process(), and Slic3r::GUI::Emboss::CreateFontStyleImagesJob::process().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticconstexpr |
Referenced by Slic3r::Emboss::ProjectZ::create_front_back(), priv::get_glyph(), get_shape_scale(), Slic3r::GUI::Emboss::CreateFontStyleImagesJob::process(), priv::remove_spikes_in_duplicates(), priv::select_patches(), text2shapes(), priv::to_point(), Slic3r::Emboss::ProjectZ::unproject(), and priv::visualize_heal().