Loading common/drawtxt.cpp +10 −12 Original line number Original line Diff line number Diff line Loading @@ -54,11 +54,9 @@ double s_HersheyScaleFactor = HERSHEY_SCALE_FACTOR; double s_HersheyScaleFactor = HERSHEY_SCALE_FACTOR; /* Helper function for texts with over bar int OverbarPositionY( int size_v ) */ int OverbarPositionY( int size_v, int thickness ) { { return KiROUND( ( (double) size_v * 1.1 ) + ( (double) thickness * 1.5 ) ); return KiROUND( size_v * 1.22 ); } } Loading Loading @@ -155,7 +153,7 @@ static const char* GetHersheyShapeDescription( int AsciiCode ) AsciiCode = '?'; AsciiCode = '?'; if( AsciiCode < 32 ) if( AsciiCode < 32 ) AsciiCode = 32; /* Clamp control chars */ AsciiCode = 32; // Clamp control chars AsciiCode -= 32; AsciiCode -= 32; Loading Loading @@ -391,9 +389,9 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, /* if a text size is too small, the text cannot be drawn, and it is drawn as a single /* if a text size is too small, the text cannot be drawn, and it is drawn as a single * graphic line */ * graphic line */ if( std::abs( aSize.x ) < 3 ) if( aDC && ( aDC->LogicalToDeviceYRel( std::abs( aSize.y ) ) < MIN_TEXT_SIZE )) { { /* draw the text as a line always vertically centered */ // draw the text as a line always vertically centered wxPoint end( current_char_pos.x + dx, current_char_pos.y ); wxPoint end( current_char_pos.x + dx, current_char_pos.y ); RotatePoint( ¤t_char_pos, aPos, aOrient ); RotatePoint( ¤t_char_pos, aPos, aOrient ); Loading @@ -417,7 +415,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, if( aItalic ) if( aItalic ) { { overbar_italic_comp = OverbarPositionY( size_v, aWidth ) / 8; overbar_italic_comp = OverbarPositionY( size_v ) / 8; if( italic_reverse ) if( italic_reverse ) { { Loading Loading @@ -450,7 +448,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, // Starting the overbar // Starting the overbar overbar_pos = current_char_pos; overbar_pos = current_char_pos; overbar_pos.x += overbar_italic_comp; overbar_pos.x += overbar_italic_comp; overbar_pos.y -= OverbarPositionY( size_v, aWidth ); overbar_pos.y -= OverbarPositionY( size_v ); RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient ); } } else else Loading @@ -459,7 +457,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, coord[0] = overbar_pos; coord[0] = overbar_pos; overbar_pos = current_char_pos; overbar_pos = current_char_pos; overbar_pos.x += overbar_italic_comp; overbar_pos.x += overbar_italic_comp; overbar_pos.y -= OverbarPositionY( size_v, aWidth ); overbar_pos.y -= OverbarPositionY( size_v ); RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient ); coord[1] = overbar_pos; coord[1] = overbar_pos; // Plot the overbar segment // Plot the overbar segment Loading Loading @@ -520,7 +518,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, else else { { wxPoint currpoint; wxPoint currpoint; hc1 -= xsta; hc2 -= 11; // Align the midpoint hc1 -= xsta; hc2 -= 10; // Align the midpoint hc1 = KiROUND( hc1 * size_h * s_HersheyScaleFactor ); hc1 = KiROUND( hc1 * size_h * s_HersheyScaleFactor ); hc2 = KiROUND( hc2 * size_v * s_HersheyScaleFactor ); hc2 = KiROUND( hc2 * size_v * s_HersheyScaleFactor ); Loading Loading @@ -551,7 +549,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, // Close the last overbar // Close the last overbar coord[0] = overbar_pos; coord[0] = overbar_pos; overbar_pos = current_char_pos; overbar_pos = current_char_pos; overbar_pos.y -= OverbarPositionY( size_v, aWidth ); overbar_pos.y -= OverbarPositionY( size_v ); RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient ); coord[1] = overbar_pos; coord[1] = overbar_pos; Loading eeschema/sch_text.cpp +2 −3 Original line number Original line Diff line number Diff line Loading @@ -46,7 +46,6 @@ extern void IncrementLabelMember( wxString& name ); extern void IncrementLabelMember( wxString& name ); extern int OverbarPositionY( int size_v, int thickness ); /* Names of sheet label types. */ /* Names of sheet label types. */ Loading Loading @@ -1320,11 +1319,11 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const int x = symb_len + linewidth + 3; int x = symb_len + linewidth + 3; // Use negation bar Y position to calculate full vertical size // Use negation bar Y position to calculate full vertical size #define Y_CORRECTION 1.22 #define Y_CORRECTION 1.3 // Note: this factor is due to the fact the negation bar Y position // Note: this factor is due to the fact the negation bar Y position // does not give exactly the full Y size of text // does not give exactly the full Y size of text // and is experimentally set to this value // and is experimentally set to this value int y = KiROUND( OverbarPositionY( HalfSize, linewidth ) * Y_CORRECTION ); int y = KiROUND( OverbarPositionY( HalfSize ) * Y_CORRECTION ); // add room for line thickness and space between top of text and graphic shape // add room for line thickness and space between top of text and graphic shape y += linewidth; y += linewidth; Loading include/drawtxt.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,12 @@ int ReturnGraphicTextWidth( const wxString& aText, int size_h, bool italic, bool * Return the text length of a negable string, excluding the ~ markers */ * Return the text length of a negable string, excluding the ~ markers */ int NegableTextLength( const wxString& aText ); int NegableTextLength( const wxString& aText ); /** * Helper function for texts with over bar, can be used as strut value * for multiline text (add interline spacing) */ int OverbarPositionY( int size_v ); /** /** * Function DrawGraphicText * Function DrawGraphicText * Draw a graphic text (like module texts) * Draw a graphic text (like module texts) Loading pcbnew/class_pad_draw_functions.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -551,7 +551,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) // Not drawable when size too small. if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) // Not drawable when size too small. { { // tsize reserve room for marges and segments thickness // tsize reserve room for marges and segments thickness tsize = ( tsize * 8 ) / 10; tsize = ( tsize * 7 ) / 10; DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, aDrawInfo.m_Color, BLACK, WHITE, aDrawInfo.m_Color, BLACK, WHITE, buffer, t_angle, buffer, t_angle, Loading @@ -578,7 +578,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) RotatePoint( &tpos, shape_pos, angle ); RotatePoint( &tpos, shape_pos, angle ); // tsize reserve room for marges and segments thickness // tsize reserve room for marges and segments thickness tsize = ( tsize * 8 ) / 10; tsize = ( tsize * 7 ) / 10; DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, aDrawInfo.m_Color, BLACK, WHITE, aDrawInfo.m_Color, BLACK, WHITE, m_ShortNetname, t_angle, m_ShortNetname, t_angle, Loading pcbnew/class_track.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -750,7 +750,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, if( (aDrawMode & GR_XOR) == 0 ) if( (aDrawMode & GR_XOR) == 0 ) GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY ); tsize = (tsize * 8) / 10; // small reduction to give a better look tsize = (tsize * 7) / 10; // small reduction to give a better look DrawGraphicHaloText( panel, aDC, tpos, DrawGraphicHaloText( panel, aDC, tpos, color, BLACK, WHITE, net->GetShortNetname(), angle, color, BLACK, WHITE, net->GetShortNetname(), angle, wxSize( tsize, tsize ), wxSize( tsize, tsize ), Loading Loading @@ -961,7 +961,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) { { tsize = (tsize * 8) / 10; // small reduction to give a better look, inside via tsize = (tsize * 7) / 10; // small reduction to give a better look, inside via if( (aDrawMode & GR_XOR) == 0 ) if( (aDrawMode & GR_XOR) == 0 ) GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY ); Loading Loading
common/drawtxt.cpp +10 −12 Original line number Original line Diff line number Diff line Loading @@ -54,11 +54,9 @@ double s_HersheyScaleFactor = HERSHEY_SCALE_FACTOR; double s_HersheyScaleFactor = HERSHEY_SCALE_FACTOR; /* Helper function for texts with over bar int OverbarPositionY( int size_v ) */ int OverbarPositionY( int size_v, int thickness ) { { return KiROUND( ( (double) size_v * 1.1 ) + ( (double) thickness * 1.5 ) ); return KiROUND( size_v * 1.22 ); } } Loading Loading @@ -155,7 +153,7 @@ static const char* GetHersheyShapeDescription( int AsciiCode ) AsciiCode = '?'; AsciiCode = '?'; if( AsciiCode < 32 ) if( AsciiCode < 32 ) AsciiCode = 32; /* Clamp control chars */ AsciiCode = 32; // Clamp control chars AsciiCode -= 32; AsciiCode -= 32; Loading Loading @@ -391,9 +389,9 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, /* if a text size is too small, the text cannot be drawn, and it is drawn as a single /* if a text size is too small, the text cannot be drawn, and it is drawn as a single * graphic line */ * graphic line */ if( std::abs( aSize.x ) < 3 ) if( aDC && ( aDC->LogicalToDeviceYRel( std::abs( aSize.y ) ) < MIN_TEXT_SIZE )) { { /* draw the text as a line always vertically centered */ // draw the text as a line always vertically centered wxPoint end( current_char_pos.x + dx, current_char_pos.y ); wxPoint end( current_char_pos.x + dx, current_char_pos.y ); RotatePoint( ¤t_char_pos, aPos, aOrient ); RotatePoint( ¤t_char_pos, aPos, aOrient ); Loading @@ -417,7 +415,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, if( aItalic ) if( aItalic ) { { overbar_italic_comp = OverbarPositionY( size_v, aWidth ) / 8; overbar_italic_comp = OverbarPositionY( size_v ) / 8; if( italic_reverse ) if( italic_reverse ) { { Loading Loading @@ -450,7 +448,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, // Starting the overbar // Starting the overbar overbar_pos = current_char_pos; overbar_pos = current_char_pos; overbar_pos.x += overbar_italic_comp; overbar_pos.x += overbar_italic_comp; overbar_pos.y -= OverbarPositionY( size_v, aWidth ); overbar_pos.y -= OverbarPositionY( size_v ); RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient ); } } else else Loading @@ -459,7 +457,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, coord[0] = overbar_pos; coord[0] = overbar_pos; overbar_pos = current_char_pos; overbar_pos = current_char_pos; overbar_pos.x += overbar_italic_comp; overbar_pos.x += overbar_italic_comp; overbar_pos.y -= OverbarPositionY( size_v, aWidth ); overbar_pos.y -= OverbarPositionY( size_v ); RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient ); coord[1] = overbar_pos; coord[1] = overbar_pos; // Plot the overbar segment // Plot the overbar segment Loading Loading @@ -520,7 +518,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, else else { { wxPoint currpoint; wxPoint currpoint; hc1 -= xsta; hc2 -= 11; // Align the midpoint hc1 -= xsta; hc2 -= 10; // Align the midpoint hc1 = KiROUND( hc1 * size_h * s_HersheyScaleFactor ); hc1 = KiROUND( hc1 * size_h * s_HersheyScaleFactor ); hc2 = KiROUND( hc2 * size_v * s_HersheyScaleFactor ); hc2 = KiROUND( hc2 * size_v * s_HersheyScaleFactor ); Loading Loading @@ -551,7 +549,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, // Close the last overbar // Close the last overbar coord[0] = overbar_pos; coord[0] = overbar_pos; overbar_pos = current_char_pos; overbar_pos = current_char_pos; overbar_pos.y -= OverbarPositionY( size_v, aWidth ); overbar_pos.y -= OverbarPositionY( size_v ); RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient ); coord[1] = overbar_pos; coord[1] = overbar_pos; Loading
eeschema/sch_text.cpp +2 −3 Original line number Original line Diff line number Diff line Loading @@ -46,7 +46,6 @@ extern void IncrementLabelMember( wxString& name ); extern void IncrementLabelMember( wxString& name ); extern int OverbarPositionY( int size_v, int thickness ); /* Names of sheet label types. */ /* Names of sheet label types. */ Loading Loading @@ -1320,11 +1319,11 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const int x = symb_len + linewidth + 3; int x = symb_len + linewidth + 3; // Use negation bar Y position to calculate full vertical size // Use negation bar Y position to calculate full vertical size #define Y_CORRECTION 1.22 #define Y_CORRECTION 1.3 // Note: this factor is due to the fact the negation bar Y position // Note: this factor is due to the fact the negation bar Y position // does not give exactly the full Y size of text // does not give exactly the full Y size of text // and is experimentally set to this value // and is experimentally set to this value int y = KiROUND( OverbarPositionY( HalfSize, linewidth ) * Y_CORRECTION ); int y = KiROUND( OverbarPositionY( HalfSize ) * Y_CORRECTION ); // add room for line thickness and space between top of text and graphic shape // add room for line thickness and space between top of text and graphic shape y += linewidth; y += linewidth; Loading
include/drawtxt.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,12 @@ int ReturnGraphicTextWidth( const wxString& aText, int size_h, bool italic, bool * Return the text length of a negable string, excluding the ~ markers */ * Return the text length of a negable string, excluding the ~ markers */ int NegableTextLength( const wxString& aText ); int NegableTextLength( const wxString& aText ); /** * Helper function for texts with over bar, can be used as strut value * for multiline text (add interline spacing) */ int OverbarPositionY( int size_v ); /** /** * Function DrawGraphicText * Function DrawGraphicText * Draw a graphic text (like module texts) * Draw a graphic text (like module texts) Loading
pcbnew/class_pad_draw_functions.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -551,7 +551,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) // Not drawable when size too small. if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) // Not drawable when size too small. { { // tsize reserve room for marges and segments thickness // tsize reserve room for marges and segments thickness tsize = ( tsize * 8 ) / 10; tsize = ( tsize * 7 ) / 10; DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, aDrawInfo.m_Color, BLACK, WHITE, aDrawInfo.m_Color, BLACK, WHITE, buffer, t_angle, buffer, t_angle, Loading @@ -578,7 +578,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) RotatePoint( &tpos, shape_pos, angle ); RotatePoint( &tpos, shape_pos, angle ); // tsize reserve room for marges and segments thickness // tsize reserve room for marges and segments thickness tsize = ( tsize * 8 ) / 10; tsize = ( tsize * 7 ) / 10; DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, aDrawInfo.m_Color, BLACK, WHITE, aDrawInfo.m_Color, BLACK, WHITE, m_ShortNetname, t_angle, m_ShortNetname, t_angle, Loading
pcbnew/class_track.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -750,7 +750,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, if( (aDrawMode & GR_XOR) == 0 ) if( (aDrawMode & GR_XOR) == 0 ) GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY ); tsize = (tsize * 8) / 10; // small reduction to give a better look tsize = (tsize * 7) / 10; // small reduction to give a better look DrawGraphicHaloText( panel, aDC, tpos, DrawGraphicHaloText( panel, aDC, tpos, color, BLACK, WHITE, net->GetShortNetname(), angle, color, BLACK, WHITE, net->GetShortNetname(), angle, wxSize( tsize, tsize ), wxSize( tsize, tsize ), Loading Loading @@ -961,7 +961,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) { { tsize = (tsize * 8) / 10; // small reduction to give a better look, inside via tsize = (tsize * 7) / 10; // small reduction to give a better look, inside via if( (aDrawMode & GR_XOR) == 0 ) if( (aDrawMode & GR_XOR) == 0 ) GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY ); Loading