KiCad PCB EDA Suite
eda_text.cpp File Reference

Implementation of base KiCad text object. More...

#include <algorithm>
#include <stddef.h>
#include <type_traits>
#include <vector>
#include <eda_item.h>
#include <base_units.h>
#include <basic_gal.h>
#include <convert_to_biu.h>
#include <convert_basic_shapes_to_polygon.h>
#include <eda_rect.h>
#include <eda_text.h>
#include <gal/color4d.h>
#include <gal/stroke_font.h>
#include <gr_text.h>
#include <string_utils.h>
#include <math/util.h>
#include <math/vector2d.h>
#include <richio.h>
#include <render_settings.h>
#include <trigo.h>
#include <i18n_utility.h>
#include <geometry/shape_segment.h>
#include <geometry/shape_compound.h>
#include <geometry/shape_poly_set.h>
#include <wx/debug.h>
#include <wx/string.h>
#include <wx/gdicmn.h>

Go to the source code of this file.

Classes

struct  EDA_TEXT_DESC
 

Macros

#define EPSILON   2
 
#define TEST(a, b)   { if( a != b ) return a - b; }
 
#define TEST_E(a, b)   { if( abs( a - b ) > EPSILON ) return a - b; }
 
#define TEST_PT(a, b)   { TEST_E( a.x, b.x ); TEST_E( a.y, b.y ); }
 

Functions

void addTextSegmToPoly (int x0, int y0, int xf, int yf, void *aData)
 Callback function used to convert text segments to polygons. More...
 
static void addTextSegmToBuffer (int x0, int y0, int xf, int yf, void *aData)
 

Variables

static struct EDA_TEXT_DESC _EDA_TEXT_DESC
 

Detailed Description

Implementation of base KiCad text object.

Definition in file eda_text.cpp.

Macro Definition Documentation

◆ EPSILON

#define EPSILON   2

◆ TEST

#define TEST (   a,
 
)    { if( a != b ) return a - b; }

◆ TEST_E

#define TEST_E (   a,
 
)    { if( abs( a - b ) > EPSILON ) return a - b; }

◆ TEST_PT

#define TEST_PT (   a,
 
)    { TEST_E( a.x, b.x ); TEST_E( a.y, b.y ); }

Function Documentation

◆ addTextSegmToBuffer()

static void addTextSegmToBuffer ( int  x0,
int  y0,
int  xf,
int  yf,
void *  aData 
)
static

Definition at line 598 of file eda_text.cpp.

599 {
600  std::vector<wxPoint>* cornerBuffer = static_cast<std::vector<wxPoint>*>( aData );
601  cornerBuffer->push_back( wxPoint( x0, y0 ) );
602  cornerBuffer->push_back( wxPoint( xf, yf ) );
603 }

Referenced by EDA_TEXT::TransformToSegmentList().

◆ addTextSegmToPoly()

void addTextSegmToPoly ( int  x0,
int  y0,
int  xf,
int  yf,
void *  aData 
)

Callback function used to convert text segments to polygons.

Definition at line 65 of file eda_text.cpp.

66 {
67  TSEGM_2_POLY_PRMS* prm = static_cast<TSEGM_2_POLY_PRMS*>( aData );
68  TransformOvalToPolygon( *prm->m_cornerBuffer, wxPoint( x0, y0 ), wxPoint( xf, yf ),
69  prm->m_textWidth, prm->m_error, ERROR_INSIDE );
70 }
SHAPE_POLY_SET * m_cornerBuffer
Definition: eda_text.h:50
A helper for the text to polygon callback function.
Definition: eda_text.h:46
void TransformOvalToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aStart, const wxPoint &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.

References ERROR_INSIDE, TSEGM_2_POLY_PRMS::m_cornerBuffer, TSEGM_2_POLY_PRMS::m_error, TSEGM_2_POLY_PRMS::m_textWidth, and TransformOvalToPolygon().

Referenced by PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), and FP_TEXT::TransformTextShapeWithClearanceToPolygon().

Variable Documentation

◆ _EDA_TEXT_DESC

struct EDA_TEXT_DESC _EDA_TEXT_DESC
static