Thread Previous • Date Previous • Date Next • Thread Next |
Hello. Problem: if the line width in settings more than 10 mils then text touches lines (no margins). Underscores in text become bad visible. Second bug: plotting graphic text without margins. ![](https://link.nylas.com/open/ac7n0u7eu8cj6vjow9ajimqdr/local-4d76a036-b083)
Attachment:
plot_afterpatch.pdf
Description: Adobe PDF document
Attachment:
rev6691.png
Description: PNG image
>From 3d559f5b6ad3a200658b72437118c5e9c2646e15 Mon Sep 17 00:00:00 2001 From: Eldar Khayrullin <eldar.khayrullin@xxxxxxx> Date: Fri, 15 Apr 2016 22:54:35 +0300 Subject: [PATCH 3/3] eeschema: fix a plotting of graphic text (not margin) --- eeschema/sch_text.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index c0c29fb..b1f0427 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -661,7 +661,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) static std::vector <wxPoint> Poly; EDA_COLOR_T color = GetLayerColor( GetLayer() ); - wxPoint textpos = m_Pos + GetSchematicTextOffset(); + wxPoint text_offset = GetSchematicTextOffset(); int thickness = GetPenSize(); aPlotter->SetCurrentLineWidth( thickness ); @@ -673,19 +673,21 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) wxStringSplit( GetShownText(), strings_list, '\n' ); positions.reserve( strings_list.Count() ); - GetPositionsOfLinesOfMultilineText(positions, strings_list.Count() ); + GetPositionsOfLinesOfMultilineText( positions, strings_list.Count() ); for( unsigned ii = 0; ii < strings_list.Count(); ii++ ) { wxString& txt = strings_list.Item( ii ); - aPlotter->Text( positions[ii], color, txt, m_Orient, m_Size, m_HJustify, - m_VJustify, thickness, m_Italic, m_Bold ); + aPlotter->Text( positions[ii] + text_offset, color, txt, m_Orient, + m_Size, m_HJustify, m_VJustify, thickness, m_Italic, + m_Bold ); } } else { - aPlotter->Text( textpos, color, GetShownText(), m_Orient, m_Size, m_HJustify, - m_VJustify, thickness, m_Italic, m_Bold ); + aPlotter->Text( m_Pos + text_offset, color, GetShownText(), m_Orient, + m_Size, m_HJustify, m_VJustify, thickness, m_Italic, + m_Bold ); } /* Draw graphic symbol for global or hierarchical labels */ -- 2.5.0
Attachment:
plot_rev6691.pdf
Description: Adobe PDF document
>From 56f3912d39d4f672cb6f1f4f394eb606018a6d66 Mon Sep 17 00:00:00 2001 From: Eldar Khayrullin <eldar.khayrullin@xxxxxxx> Date: Fri, 15 Apr 2016 22:26:35 +0300 Subject: [PATCH 2/3] eeschema: set position of pin num and pin name in accordance a line thickness --- eeschema/lib_pin.cpp | 50 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 1220d6a..86badff 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -1165,9 +1165,14 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, int nameLineWidth = GetPenSize(); nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false ); - int numLineWidth = GetPenSize(); + int numLineWidth = GetPenSize(); numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false ); + int name_offset = TXTMARGE + + ( nameLineWidth + GetDefaultLineThickness() ) / 2; + int num_offset = TXTMARGE + + ( numLineWidth + GetDefaultLineThickness() ) / 2; + GRSetDrawMode( DC, DrawMode ); EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; @@ -1243,7 +1248,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, { DrawGraphicText( clipbox, DC, wxPoint( (x1 + pin_pos.x) / 2, - y1 - TXTMARGE ), NumColor, + y1 - num_offset ), NumColor, StringPinNum, TEXT_ORIENT_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1268,7 +1273,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinNum ) DrawGraphicText( clipbox, DC, - wxPoint( x1 - TXTMARGE, + wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum, TEXT_ORIENT_VERT, PinNumSize, @@ -1290,7 +1295,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinNum ) DrawGraphicText( clipbox, DC, - wxPoint( x1 - TXTMARGE, + wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum, TEXT_ORIENT_VERT, PinNumSize, @@ -1308,7 +1313,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinName ) { x = (x1 + pin_pos.x) / 2; - DrawGraphicText( clipbox, DC, wxPoint( x, y1 - TXTMARGE ), + DrawGraphicText( clipbox, DC, wxPoint( x, y1 - name_offset ), NameColor, m_name, TEXT_ORIENT_HORIZ, PinNameSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1318,7 +1323,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinNum ) { x = (x1 + pin_pos.x) / 2; - DrawGraphicText( clipbox, DC, wxPoint( x, y1 + TXTMARGE ), + DrawGraphicText( clipbox, DC, wxPoint( x, y1 + num_offset ), NumColor, StringPinNum, TEXT_ORIENT_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1331,7 +1336,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinName ) { y = (y1 + pin_pos.y) / 2; - DrawGraphicText( clipbox, DC, wxPoint( x1 - TXTMARGE, y ), + DrawGraphicText( clipbox, DC, wxPoint( x1 - name_offset, y ), NameColor, m_name, TEXT_ORIENT_VERT, PinNameSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1342,7 +1347,8 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, if( DrawPinNum ) { DrawGraphicText( clipbox, DC, - wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ), + wxPoint( x1 + num_offset, (y1 + pin_pos.y) + / 2 ), NumColor, StringPinNum, TEXT_ORIENT_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1526,6 +1532,16 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize ); wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize ); + int nameLineWidth = GetPenSize(); + nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false ); + int numLineWidth = GetPenSize(); + numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false ); + + int name_offset = TXTMARGE + + ( nameLineWidth + GetDefaultLineThickness() ) / 2; + int num_offset = TXTMARGE + + ( numLineWidth + GetDefaultLineThickness() ) / 2; + /* Get the num and name colors */ EDA_COLOR_T NameColor = GetLayerColor( LAYER_PINNAM ); EDA_COLOR_T NumColor = GetLayerColor( LAYER_PINNUM ); @@ -1585,7 +1601,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, } if( DrawPinNum ) { - plotter->Text( wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ), + plotter->Text( wxPoint( (x1 + pin_pos.x) / 2, + y1 - num_offset ), NumColor, StringPinNum, TEXT_ORIENT_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1609,7 +1626,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, if( DrawPinNum ) { - plotter->Text( wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ), + plotter->Text( wxPoint( x1 - num_offset, + (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum, TEXT_ORIENT_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1631,7 +1649,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, if( DrawPinNum ) { - plotter->Text( wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ), + plotter->Text( wxPoint( x1 - num_offset, + (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum, TEXT_ORIENT_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1649,7 +1668,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, if( DrawPinName ) { x = (x1 + pin_pos.x) / 2; - plotter->Text( wxPoint( x, y1 - TXTMARGE ), + plotter->Text( wxPoint( x, y1 - name_offset ), NameColor, m_name, TEXT_ORIENT_HORIZ, PinNameSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1660,7 +1679,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, if( DrawPinNum ) { x = ( x1 + pin_pos.x ) / 2; - plotter->Text( wxPoint( x, y1 + TXTMARGE ), + plotter->Text( wxPoint( x, y1 + num_offset ), NumColor, StringPinNum, TEXT_ORIENT_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1673,7 +1692,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, if( DrawPinName ) { y = ( y1 + pin_pos.y ) / 2; - plotter->Text( wxPoint( x1 - TXTMARGE, y ), + plotter->Text( wxPoint( x1 - name_offset, y ), NameColor, m_name, TEXT_ORIENT_VERT, PinNameSize, GR_TEXT_HJUSTIFY_CENTER, @@ -1683,7 +1702,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, if( DrawPinNum ) { - plotter->Text( wxPoint( x1 + TXTMARGE, ( y1 + pin_pos.y ) / 2 ), + plotter->Text( wxPoint( x1 + num_offset, + ( y1 + pin_pos.y ) / 2 ), NumColor, StringPinNum, TEXT_ORIENT_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, -- 2.5.0
>From 411b40d7046b69b0db87cbaf8385cd825e8b63a0 Mon Sep 17 00:00:00 2001 From: Eldar Khayrullin <eldar.khayrullin@xxxxxxx> Date: Fri, 15 Apr 2016 21:04:45 +0300 Subject: [PATCH 1/3] eeschema: set position of local label and text in accordance a line thickness --- eeschema/sch_text.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 73d7840..c0c29fb 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -143,23 +143,26 @@ wxPoint SCH_TEXT::GetSchematicTextOffset() const // add a small offset (TXTMARGE) to x ( or y) position to allow a text to // be on a wire or a line and be readable + int thick_offset = TXTMARGE + + ( GetPenSize() + GetDefaultLineThickness() ) / 2; + switch( m_schematicOrientation ) { default: case 0: /* Horiz Normal Orientation (left justified) */ - text_offset.y = -TXTMARGE; + text_offset.y = -thick_offset; break; case 1: /* Vert Orientation UP */ - text_offset.x = -TXTMARGE; + text_offset.x = -thick_offset; break; case 2: /* Horiz Orientation - Right justified */ - text_offset.y = -TXTMARGE; + text_offset.y = -thick_offset; break; case 3: /* Vert Orientation BOTTOM */ - text_offset.x = -TXTMARGE; + text_offset.x = -thick_offset; break; } -- 2.5.0
Attachment:
after_patch.png
Description: PNG image
Thread Previous • Date Previous • Date Next • Thread Next |