51    virtual bool Run() 
override;
 
   53    virtual const wxString 
GetName()
 const override { 
return wxT( 
"text_dimensions" ); };
 
 
   59    const int progressDelta = 250;
 
   66        REPORT_AUX( wxT( 
"Text dimension violations ignored. Tests not run." ) );
 
   73        REPORT_AUX( wxT( 
"No text height or text thickness constraints found. Tests not run." ) );
 
   80    auto checkTextHeight =
 
   92                int  actualHeight = 
text->GetTextSize().y;
 
   97                    wxString msg = 
formatMsg( 
_( 
"(%s min height %s; actual %s)" ),
 
  102                    drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( 
" " ) + msg );
 
  103                    drcItem->SetItems( item );
 
  112                    wxString msg = 
formatMsg( 
_( 
"(%s max height %s; actual %s)" ),
 
  117                    drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( 
" " ) + msg );
 
  118                    drcItem->SetItems( item );
 
  127    auto checkTextThickness =
 
  143                    auto* glyphs = 
text->GetRenderCache( font, 
text->GetShownText( 
true ) );
 
  144                    bool  collapsedStroke = 
false;
 
  145                    bool  collapsedArea = 
false;
 
  147                    for( 
const std::unique_ptr<KIFONT::GLYPH>& glyph : *glyphs )
 
  151                        if( !glyph->IsOutline() )
 
  158                        if( outlineCount == 0 )
 
  161                        for( ii = 0; ii < outlineCount; ++ii )
 
  162                            holeCount += outlineGlyph->HoleCount( ii );
 
  170                        int resultingHoleCount = 0;
 
  172                        for( ii = 0; ii < resultingOutlineCount; ++ii )
 
  173                            resultingHoleCount += poly.
HoleCount( ii );
 
  175                        if( ( resultingOutlineCount != outlineCount )
 
  176                                || ( resultingHoleCount != holeCount ) )
 
  178                            collapsedStroke = 
true;
 
  182                        double glyphArea = outlineGlyph->Area();
 
  190                        double resultingGlyphArea = poly.
Area();
 
  192                        if( ( 
std::abs( resultingGlyphArea - glyphArea ) / glyphArea ) > 0.1 )
 
  194                            collapsedArea = 
true;
 
  199                    if( collapsedStroke || collapsedArea )
 
  204                        msg = 
_( 
"(TrueType font characters with insufficient stroke weight)" );
 
  206                        drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( 
" " ) + msg );
 
  207                        drcItem->SetItems( item );
 
  215                    int actualThickness = 
text->GetEffectiveTextPenWidth();
 
  220                        wxString msg = 
formatMsg( 
_( 
"(%s min thickness %s; actual %s)" ),
 
  225                        drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( 
" " ) + msg );
 
  226                        drcItem->SetItems( item );
 
  235                        wxString msg = 
formatMsg( 
_( 
"(%s max thickness %s; actual %s)" ),
 
  240                        drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( 
" " ) + msg );
 
  241                        drcItem->SetItems( item );
 
  251    static const std::vector<KICAD_T> itemTypes = {
 
  274                    if( !
text->IsVisible() )
 
  280                        checkTextThickness( item, 
text );
 
  285                        checkTextHeight( item, 
text );
 
 
constexpr int ARC_LOW_DEF
 
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
 
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
 
SEVERITY GetSeverity() const
 
MINOPTMAX< int > & Value()
 
DRC_RULE * GetParentRule() const
 
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
 
DRC_TEST_PROVIDER_TEXT_DIMS()
 
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
 
virtual ~DRC_TEST_PROVIDER_TEXT_DIMS()=default
 
virtual const wxString GetName() const override
 
virtual bool reportPhase(const wxString &aStageName)
 
int forEachGeometryItem(const std::vector< KICAD_T > &aTypes, const LSET &aLayers, const std::function< bool(BOARD_ITEM *)> &aFunc)
 
void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer, const std::function< void(PCB_MARKER *)> &aPathGenerator=[](PCB_MARKER *){})
 
wxString formatMsg(const wxString &aFormatString, const wxString &aSource, double aConstraint, double aActual, EDA_DATA_TYPE aDataType=EDA_DATA_TYPE::DISTANCE)
 
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
 
virtual VECTOR2I GetPosition() const
 
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
 
FONT is an abstract base class for both outline and stroke fonts.
 
virtual bool IsOutline() const
 
static const LSET & AllLayersMask()
 
Represent a set of closed polygons.
 
double Area()
Return the area of this poly set.
 
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
 
int HoleCount(int aOutline) const
Returns the number of holes in a given outline.
 
void Simplify()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
 
void Deflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError)
 
int OutlineCount() const
Return the number of outlines in the set.
 
SHAPE_POLY_SET CloneDropTriangulation() const
 
@ CHAMFER_ALL_CORNERS
All angles are chamfered.
 
@ TEXT_THICKNESS_CONSTRAINT
 
This file contains miscellaneous commonly used macros and functions.
 
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
 
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
 
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
 
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
 
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
 
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
 
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type