Loading CHANGELOG.txt +10 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,16 @@ KiCad ChangeLog 2009 Please add newer entries at the top, list the date and your name with email address. 2009-may-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++All: Cleaned and optimized code about new hershey fonts and bold texts handling. Bold texts use now the same font as normal texts. Only the pen size used to draw them is bigger. - The max pen size allowed depending on texts sizes is now tested when loading boards and modules, and clamped if too large. 2009-may-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ Loading common/drawtxt.cpp +75 −59 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #define EDA_DRAWBASE #include "hershey_fonts.h" /* factor used to calculate actual size of shapes from hershey fonts (could be adjusted depending on the font name) * Its value is choosen in order to have letters like M, P .. vertical size equal to the vertical char size parameter * Of course some shapes can be bigger or smaller than the vertical char size parameter Loading @@ -26,6 +27,48 @@ #define HERSHEY_SCALE_FACTOR 1 / 21.0 double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR; /** Function GetPensizeForBold * @return the "best" value for a pen size to draw/plot a bold text * @param aTextSize = the char size (height or width) */ int GetPenSizeForBold( int aTextSize ) { return wxRound( aTextSize / 5.0 ); } /** Function Clamp_Text_PenSize *As a rule, pen width should not be >1/4em, otherwise the character * will be cluttered up in its own fatness * so pen width max is aSize/4 for bold text, and aSize/6 for normal text * The "best" pen width is aSize/5 for bold texts, * so the clamp is consistant with bold option. * @param aPenSize = the pen size to clamp * @param aSize the char size (height or width) * @param aBold = true if text accept bold pen size * @return the max pen size allowed */ int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold ) { int penSize = aPenSize; double scale = aBold ? 4.0 : 6.0; int maxWidth = wxRound( ABS( aSize ) / scale ); if( penSize > maxWidth ) penSize = maxWidth; return penSize; } int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold ) { int size = MIN( ABS( aSize.x ), ABS( aSize.y ) ); return Clamp_Text_PenSize(aPenSize, size, aBold);; } /* Functions to draw / plot a string. * texts have only one line. * They can be in italic. Loading Loading @@ -53,9 +96,15 @@ int NegableTextLength( const wxString& aText ) } static const char* get_hershey_recipe( int AsciiCode, bool bold ) { /* Function GetHersheyShapeDescription() * return a pointer to the shape corresponding to unicode value AsciiCode * Note we use the same font for Bold and Normal texts * because kicad handles a variable pen size to do that * that gives better results in XOR draw mode. */ static const char* GetHersheyShapeDescription( int AsciiCode ) { #if defined(KICAD_CYRILLIC) AsciiCode &= 0x7FF; if( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr Loading @@ -77,18 +126,11 @@ static const char* get_hershey_recipe( int AsciiCode, bool bold ) AsciiCode = 32; /* Clamp control chars */ AsciiCode -= 32; if( bold ) { return hershey_duplex[AsciiCode]; } else { return hershey_simplex[AsciiCode]; } } int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool italic, bool bold ) int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, bool aWidth ) { int tally = 0; int char_count = aText.length(); Loading @@ -102,7 +144,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool italic, bool continue; } const char* ptcar = get_hershey_recipe( AsciiCode, bold ); const char* ptcar = GetHersheyShapeDescription( AsciiCode ); /* Get metrics */ int xsta = *ptcar++ - 'R'; int xsto = *ptcar++ - 'R'; Loading @@ -110,7 +152,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool italic, bool } /* Italic correction, 1/8em */ if( italic ) if( aItalic ) { tally += wxRound( aXSize * 0.125 ); } Loading Loading @@ -149,38 +191,14 @@ static void DrawGraphicTextPline( } /* Helper function for texts with over bar */ static int overbar_position( int size_v, int thickness ) { return wxRound( ( (double) size_v * 26 * s_HerscheyScaleFactor ) + ( (double) thickness * 1.5 ) ); } static int clamp_text_pen_size( int width, int size_h, bool bold ) { /* As a rule, pen width should not be >1/8em, otherwise the character * will be cluttered up in its own fatness */ /* XXX @todo: Should be handled in the UI and gerber plotter too */ int maxWidth = wxRound( ABS( size_h ) / 8.0 ); if( width > maxWidth ) { width = maxWidth; } /* Special rule for bold text: the width should be at least 1.42 times the * quantum unit, otherwise the line pairs will be visible! */ if( bold ) { int minWidth = wxRound( ABS( size_h ) * 1.42 * s_HerscheyScaleFactor + 0.5 ); if( width < minWidth ) { width = minWidth; } } return width; } /** Function DrawGraphicText * Draw a graphic text (like module texts) * @param aPanel = the current DrawPanel. NULL if draw within a 3D GL Canvas Loading @@ -192,10 +210,11 @@ static int clamp_text_pen_size( int width, int size_h, bool bold ) * @param aSize = text size (size.x or size.y can be < 0 for mirrored texts) * @param aH_justify = horizontal justification (Left, center, right) * @param aV_justify = vertical justification (bottom, center, top) * @param aWidth = line width (pen width) (default = 0) * @param aWidth = line width (pen width) (use default width if aWidth = 0) * if width < 0 : draw segments in sketch mode, width = abs(width) * Use a value min(aSize.x, aSize.y) / 5 for a bold text * @param aItalic = true to simulate an italic font * @param aBold = true to use a bold font * @param aBold = true to use a bold font. Useful only with default width value (aWidth = 0) * @param aCallback() = function called (if non null) to draw each segment. * used to draw 3D texts or for plotting, NULL for normal drawings */ Loading Loading @@ -233,6 +252,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, size_h = aSize.x; /* PLEASE NOTE: H is for HORIZONTAL not for HEIGHT */ size_v = aSize.y; if( aWidth == 0 && aBold ) // Use default values if aWidth == 0 aWidth = GetPenSizeForBold( MIN( aSize.x, aSize.y ) ); if( aWidth < 0 ) { aWidth = -aWidth; Loading @@ -241,15 +263,13 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, if( size_h < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis) italic_reverse = true; aWidth = clamp_text_pen_size( aWidth, size_h, aBold ); char_count = NegableTextLength( aText ); if( char_count == 0 ) return; current_char_pos = aPos; dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aBold ); dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aWidth ); dy = size_v; /* Do not draw the text if out of draw area! */ Loading Loading @@ -381,7 +401,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, AsciiCode = aText.GetChar( ptr + overbars ); const char* ptcar = get_hershey_recipe( AsciiCode, aBold ); const char* ptcar = GetHersheyShapeDescription( AsciiCode ); /* Get metrics */ int xsta = *ptcar++ - 'R'; int xsto = *ptcar++ - 'R'; Loading Loading @@ -514,8 +534,9 @@ static void s_Callback_plot( int x0, int y0, int xf, int yf ) * @param aV_justify = vertical justification (bottom, center, top) * @param aWidth = line width (pen width) (default = 0) * if width < 0 : draw segments in sketch mode, width = abs(width) * Use a value min(aSize.x, aSize.y) / 5 for a bold text * @param aItalic = true to simulate an italic font * @param aBold = true to use a bold font * @param aBold = true to use a bold font Useful only with default width value (aWidth = 0) */ /******************************************************************************************/ void PlotGraphicText( int aFormat_plot, Loading @@ -531,14 +552,8 @@ void PlotGraphicText( int aFormat_plot, bool aBold ) /******************************************************************************************/ { if( aWidth > 0 ) { aWidth = clamp_text_pen_size( aWidth, aSize.x, aBold ); } else { aWidth = -clamp_text_pen_size( -aWidth, aSize.x, aBold ); } if( aWidth == 0 && aBold ) // Use default values if aWidth == 0 aWidth = GetPenSizeForBold( MIN( aSize.x, aSize.y ) ); // Initialise the actual function used to plot lines: switch( aFormat_plot ) Loading Loading @@ -568,7 +583,8 @@ void PlotGraphicText( int aFormat_plot, DrawGraphicText( NULL, NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic, aBold, aWidth, aItalic, aBold, s_Callback_plot ); /* end text : pen UP ,no move */ Loading common/gr_basic.cpp +1 −5 Original line number Diff line number Diff line Loading @@ -325,11 +325,7 @@ void GRSetBrush( wxDC* DC, int Color, int fill ) if( ForceBlackPen ) Color = BLACK; wxBrush DrawBrush; DrawBrush.SetColour( ColorRefs[Color].m_Red, ColorRefs[Color].m_Green, ColorRefs[Color].m_Blue ); DrawBrush.SetColour( MakeColour( Color ) ); if( fill ) DrawBrush.SetStyle( wxSOLID ); Loading common/worksheet.cpp +668 −616 Original line number Diff line number Diff line Loading @@ -978,6 +978,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w refx += GRID_REF_W; refy += GRID_REF_W; xg -= GRID_REF_W; yg -= GRID_REF_W; } #endif /* trace des reperes */ Loading @@ -993,13 +994,16 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w { case WS_CADRE: break; case WS_PODPIS_LU: if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende ) msg = WsItem->m_Legende; DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_VERT, size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width, false, false, false); false, false ); break; case WS_SEGMENT_LU: xg = Sheet->m_LeftMargin - WsItem->m_Endx; yg = Sheet->m_Size.y - Sheet->m_BottomMargin - WsItem->m_Endy; Loading @@ -1008,6 +1012,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w break; } } refy = Sheet->m_BottomMargin; /* Left Top corner */ for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext ) { Loading @@ -1024,6 +1029,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w break; } } #else refy = Sheet->m_TopMargin; /* Upper left corner */ xg = Sheet->m_Size.x - Sheet->m_RightMargin; Loading @@ -1045,7 +1051,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); width, false, false ); if( ii < xg - PAS_REF / 2 ) { GRLine( &DrawPanel->m_ClipBox, DC, ii * scale, yg * scale, Loading @@ -1056,7 +1062,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w (yg - GRID_REF_W / 2) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); width, false, false ); } /* Trace des reperes selon l'axe Y */ Loading @@ -1080,7 +1086,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); width, false, false ); if( ii < yg - PAS_REF / 2 ) { GRLine( &DrawPanel->m_ClipBox, DC, xg * scale, ii * scale, Loading @@ -1091,8 +1097,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w (ii - gxpas / 2) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); width, false, false ); } #endif /* Trace du cartouche */ Loading @@ -1110,20 +1117,25 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w { case WS_DATE: break; case WS_REV: break; case WS_KICAD_VERSION: break; case WS_PODPIS: if( WsItem->m_Legende ) msg = WsItem->m_Legende; DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); width, false, false ); break; case WS_SIZESHEET: break; case WS_IDENTSHEET: if( WsItem->m_Legende ) msg = WsItem->m_Legende; Loading @@ -1132,6 +1144,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); break; case WS_SHEETS: if( WsItem->m_Legende ) msg = WsItem->m_Legende; Loading @@ -1140,24 +1153,32 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); break; case WS_COMPANY_NAME: break; case WS_TITLE: break; case WS_COMMENT1: break; case WS_COMMENT2: break; case WS_COMMENT3: break; case WS_COMMENT4: break; case WS_UPPER_SEGMENT: case WS_LEFT_SEGMENT: WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy = WS_MostLeftLine.m_Posy = STAMP_OY; pos.y = (refy - WsItem->m_Posy) * scale; case WS_SEGMENT: xg = Sheet->m_Size.x - Sheet->m_RightMargin - WsItem->m_Endx; Loading @@ -1168,7 +1189,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w break; } } } else { } else { for( WsItem = &WS_CADRE_D; WsItem != NULL; WsItem = WsItem->Pnext ) { pos.x = (refx - WsItem->m_Posx) * scale; Loading @@ -1179,20 +1202,45 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w case WS_CADRE: /* Begin list number > 1 */ case WS_PODPIS_D: if(WsItem->m_Legende) msg = WsItem->m_Legende; DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,width, false, false, false); if( WsItem->m_Legende ) msg = WsItem->m_Legende; DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); break; case WS_IDENTSHEET_D: if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg << screen->m_ScreenNumber; DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,width, false, false, false); DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); break; case WS_LEFT_SEGMENT_D: pos.y = (refy - WsItem->m_Posy) * scale; case WS_SEGMENT_D: xg = Sheet->m_Size.x - Sheet->m_RightMargin - WsItem->m_Endx; Loading Loading @@ -1223,7 +1271,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, true, false ); false, true ); break; case WS_REV: Loading @@ -1232,8 +1280,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w msg += screen->m_Revision; DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, true, false ); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), false, true ); break; case WS_KICAD_VERSION: Loading @@ -1244,7 +1293,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); break; case WS_SIZESHEET: Loading @@ -1254,7 +1303,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); break; Loading @@ -1265,7 +1314,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); break; case WS_FILENAME: Loading @@ -1278,7 +1327,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); } break; Loading @@ -1289,7 +1338,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); break; Loading @@ -1301,8 +1350,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w { DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, true, false ); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), false, true ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; Loading @@ -1313,8 +1363,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w msg += screen->m_Title; DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, true, false ); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), false, true ); break; case WS_COMMENT1: Loading @@ -1326,7 +1377,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; Loading @@ -1340,7 +1391,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; Loading @@ -1354,7 +1405,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; Loading @@ -1368,7 +1419,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; Loading @@ -1393,6 +1444,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w break; } } #endif } Loading eeschema/class_text-label.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -520,7 +520,7 @@ bool SCH_TEXT::Save( FILE* aFile ) const if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n", m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, shape, (m_Bold?1:0), shape, m_Width, CONV_TO_UTF8( text ) ) == EOF ) { success = false; Loading Loading @@ -577,7 +577,7 @@ bool SCH_LABEL::Save( FILE* aFile ) const if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n", m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, shape, (m_Bold?1:0), m_SchematicOrientation, m_Size.x, shape, m_Width, CONV_TO_UTF8( m_Text ) ) == EOF ) { success = false; Loading Loading @@ -616,7 +616,7 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, SheetLabelType[m_Shape], shape, (m_Bold?1:0), shape, m_Width, CONV_TO_UTF8( m_Text ) ) == EOF ) { success = false; Loading Loading @@ -670,7 +670,7 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, SheetLabelType[m_Shape], shape, (m_Bold?1:0), shape, m_Width, CONV_TO_UTF8( m_Text ) ) == EOF ) { success = false; Loading Loading
CHANGELOG.txt +10 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,16 @@ KiCad ChangeLog 2009 Please add newer entries at the top, list the date and your name with email address. 2009-may-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++All: Cleaned and optimized code about new hershey fonts and bold texts handling. Bold texts use now the same font as normal texts. Only the pen size used to draw them is bigger. - The max pen size allowed depending on texts sizes is now tested when loading boards and modules, and clamped if too large. 2009-may-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ Loading
common/drawtxt.cpp +75 −59 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #define EDA_DRAWBASE #include "hershey_fonts.h" /* factor used to calculate actual size of shapes from hershey fonts (could be adjusted depending on the font name) * Its value is choosen in order to have letters like M, P .. vertical size equal to the vertical char size parameter * Of course some shapes can be bigger or smaller than the vertical char size parameter Loading @@ -26,6 +27,48 @@ #define HERSHEY_SCALE_FACTOR 1 / 21.0 double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR; /** Function GetPensizeForBold * @return the "best" value for a pen size to draw/plot a bold text * @param aTextSize = the char size (height or width) */ int GetPenSizeForBold( int aTextSize ) { return wxRound( aTextSize / 5.0 ); } /** Function Clamp_Text_PenSize *As a rule, pen width should not be >1/4em, otherwise the character * will be cluttered up in its own fatness * so pen width max is aSize/4 for bold text, and aSize/6 for normal text * The "best" pen width is aSize/5 for bold texts, * so the clamp is consistant with bold option. * @param aPenSize = the pen size to clamp * @param aSize the char size (height or width) * @param aBold = true if text accept bold pen size * @return the max pen size allowed */ int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold ) { int penSize = aPenSize; double scale = aBold ? 4.0 : 6.0; int maxWidth = wxRound( ABS( aSize ) / scale ); if( penSize > maxWidth ) penSize = maxWidth; return penSize; } int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold ) { int size = MIN( ABS( aSize.x ), ABS( aSize.y ) ); return Clamp_Text_PenSize(aPenSize, size, aBold);; } /* Functions to draw / plot a string. * texts have only one line. * They can be in italic. Loading Loading @@ -53,9 +96,15 @@ int NegableTextLength( const wxString& aText ) } static const char* get_hershey_recipe( int AsciiCode, bool bold ) { /* Function GetHersheyShapeDescription() * return a pointer to the shape corresponding to unicode value AsciiCode * Note we use the same font for Bold and Normal texts * because kicad handles a variable pen size to do that * that gives better results in XOR draw mode. */ static const char* GetHersheyShapeDescription( int AsciiCode ) { #if defined(KICAD_CYRILLIC) AsciiCode &= 0x7FF; if( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr Loading @@ -77,18 +126,11 @@ static const char* get_hershey_recipe( int AsciiCode, bool bold ) AsciiCode = 32; /* Clamp control chars */ AsciiCode -= 32; if( bold ) { return hershey_duplex[AsciiCode]; } else { return hershey_simplex[AsciiCode]; } } int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool italic, bool bold ) int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, bool aWidth ) { int tally = 0; int char_count = aText.length(); Loading @@ -102,7 +144,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool italic, bool continue; } const char* ptcar = get_hershey_recipe( AsciiCode, bold ); const char* ptcar = GetHersheyShapeDescription( AsciiCode ); /* Get metrics */ int xsta = *ptcar++ - 'R'; int xsto = *ptcar++ - 'R'; Loading @@ -110,7 +152,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool italic, bool } /* Italic correction, 1/8em */ if( italic ) if( aItalic ) { tally += wxRound( aXSize * 0.125 ); } Loading Loading @@ -149,38 +191,14 @@ static void DrawGraphicTextPline( } /* Helper function for texts with over bar */ static int overbar_position( int size_v, int thickness ) { return wxRound( ( (double) size_v * 26 * s_HerscheyScaleFactor ) + ( (double) thickness * 1.5 ) ); } static int clamp_text_pen_size( int width, int size_h, bool bold ) { /* As a rule, pen width should not be >1/8em, otherwise the character * will be cluttered up in its own fatness */ /* XXX @todo: Should be handled in the UI and gerber plotter too */ int maxWidth = wxRound( ABS( size_h ) / 8.0 ); if( width > maxWidth ) { width = maxWidth; } /* Special rule for bold text: the width should be at least 1.42 times the * quantum unit, otherwise the line pairs will be visible! */ if( bold ) { int minWidth = wxRound( ABS( size_h ) * 1.42 * s_HerscheyScaleFactor + 0.5 ); if( width < minWidth ) { width = minWidth; } } return width; } /** Function DrawGraphicText * Draw a graphic text (like module texts) * @param aPanel = the current DrawPanel. NULL if draw within a 3D GL Canvas Loading @@ -192,10 +210,11 @@ static int clamp_text_pen_size( int width, int size_h, bool bold ) * @param aSize = text size (size.x or size.y can be < 0 for mirrored texts) * @param aH_justify = horizontal justification (Left, center, right) * @param aV_justify = vertical justification (bottom, center, top) * @param aWidth = line width (pen width) (default = 0) * @param aWidth = line width (pen width) (use default width if aWidth = 0) * if width < 0 : draw segments in sketch mode, width = abs(width) * Use a value min(aSize.x, aSize.y) / 5 for a bold text * @param aItalic = true to simulate an italic font * @param aBold = true to use a bold font * @param aBold = true to use a bold font. Useful only with default width value (aWidth = 0) * @param aCallback() = function called (if non null) to draw each segment. * used to draw 3D texts or for plotting, NULL for normal drawings */ Loading Loading @@ -233,6 +252,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, size_h = aSize.x; /* PLEASE NOTE: H is for HORIZONTAL not for HEIGHT */ size_v = aSize.y; if( aWidth == 0 && aBold ) // Use default values if aWidth == 0 aWidth = GetPenSizeForBold( MIN( aSize.x, aSize.y ) ); if( aWidth < 0 ) { aWidth = -aWidth; Loading @@ -241,15 +263,13 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, if( size_h < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis) italic_reverse = true; aWidth = clamp_text_pen_size( aWidth, size_h, aBold ); char_count = NegableTextLength( aText ); if( char_count == 0 ) return; current_char_pos = aPos; dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aBold ); dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aWidth ); dy = size_v; /* Do not draw the text if out of draw area! */ Loading Loading @@ -381,7 +401,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, AsciiCode = aText.GetChar( ptr + overbars ); const char* ptcar = get_hershey_recipe( AsciiCode, aBold ); const char* ptcar = GetHersheyShapeDescription( AsciiCode ); /* Get metrics */ int xsta = *ptcar++ - 'R'; int xsto = *ptcar++ - 'R'; Loading Loading @@ -514,8 +534,9 @@ static void s_Callback_plot( int x0, int y0, int xf, int yf ) * @param aV_justify = vertical justification (bottom, center, top) * @param aWidth = line width (pen width) (default = 0) * if width < 0 : draw segments in sketch mode, width = abs(width) * Use a value min(aSize.x, aSize.y) / 5 for a bold text * @param aItalic = true to simulate an italic font * @param aBold = true to use a bold font * @param aBold = true to use a bold font Useful only with default width value (aWidth = 0) */ /******************************************************************************************/ void PlotGraphicText( int aFormat_plot, Loading @@ -531,14 +552,8 @@ void PlotGraphicText( int aFormat_plot, bool aBold ) /******************************************************************************************/ { if( aWidth > 0 ) { aWidth = clamp_text_pen_size( aWidth, aSize.x, aBold ); } else { aWidth = -clamp_text_pen_size( -aWidth, aSize.x, aBold ); } if( aWidth == 0 && aBold ) // Use default values if aWidth == 0 aWidth = GetPenSizeForBold( MIN( aSize.x, aSize.y ) ); // Initialise the actual function used to plot lines: switch( aFormat_plot ) Loading Loading @@ -568,7 +583,8 @@ void PlotGraphicText( int aFormat_plot, DrawGraphicText( NULL, NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic, aBold, aWidth, aItalic, aBold, s_Callback_plot ); /* end text : pen UP ,no move */ Loading
common/gr_basic.cpp +1 −5 Original line number Diff line number Diff line Loading @@ -325,11 +325,7 @@ void GRSetBrush( wxDC* DC, int Color, int fill ) if( ForceBlackPen ) Color = BLACK; wxBrush DrawBrush; DrawBrush.SetColour( ColorRefs[Color].m_Red, ColorRefs[Color].m_Green, ColorRefs[Color].m_Blue ); DrawBrush.SetColour( MakeColour( Color ) ); if( fill ) DrawBrush.SetStyle( wxSOLID ); Loading
common/worksheet.cpp +668 −616 Original line number Diff line number Diff line Loading @@ -978,6 +978,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w refx += GRID_REF_W; refy += GRID_REF_W; xg -= GRID_REF_W; yg -= GRID_REF_W; } #endif /* trace des reperes */ Loading @@ -993,13 +994,16 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w { case WS_CADRE: break; case WS_PODPIS_LU: if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende ) msg = WsItem->m_Legende; DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_VERT, size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width, false, false, false); false, false ); break; case WS_SEGMENT_LU: xg = Sheet->m_LeftMargin - WsItem->m_Endx; yg = Sheet->m_Size.y - Sheet->m_BottomMargin - WsItem->m_Endy; Loading @@ -1008,6 +1012,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w break; } } refy = Sheet->m_BottomMargin; /* Left Top corner */ for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext ) { Loading @@ -1024,6 +1029,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w break; } } #else refy = Sheet->m_TopMargin; /* Upper left corner */ xg = Sheet->m_Size.x - Sheet->m_RightMargin; Loading @@ -1045,7 +1051,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); width, false, false ); if( ii < xg - PAS_REF / 2 ) { GRLine( &DrawPanel->m_ClipBox, DC, ii * scale, yg * scale, Loading @@ -1056,7 +1062,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w (yg - GRID_REF_W / 2) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); width, false, false ); } /* Trace des reperes selon l'axe Y */ Loading @@ -1080,7 +1086,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); width, false, false ); if( ii < yg - PAS_REF / 2 ) { GRLine( &DrawPanel->m_ClipBox, DC, xg * scale, ii * scale, Loading @@ -1091,8 +1097,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w (ii - gxpas / 2) * scale ), Color, Line, TEXT_ORIENT_HORIZ, size_ref, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); width, false, false ); } #endif /* Trace du cartouche */ Loading @@ -1110,20 +1117,25 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w { case WS_DATE: break; case WS_REV: break; case WS_KICAD_VERSION: break; case WS_PODPIS: if( WsItem->m_Legende ) msg = WsItem->m_Legende; DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); width, false, false ); break; case WS_SIZESHEET: break; case WS_IDENTSHEET: if( WsItem->m_Legende ) msg = WsItem->m_Legende; Loading @@ -1132,6 +1144,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); break; case WS_SHEETS: if( WsItem->m_Legende ) msg = WsItem->m_Legende; Loading @@ -1140,24 +1153,32 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); break; case WS_COMPANY_NAME: break; case WS_TITLE: break; case WS_COMMENT1: break; case WS_COMMENT2: break; case WS_COMMENT3: break; case WS_COMMENT4: break; case WS_UPPER_SEGMENT: case WS_LEFT_SEGMENT: WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy = WS_MostLeftLine.m_Posy = STAMP_OY; pos.y = (refy - WsItem->m_Posy) * scale; case WS_SEGMENT: xg = Sheet->m_Size.x - Sheet->m_RightMargin - WsItem->m_Endx; Loading @@ -1168,7 +1189,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w break; } } } else { } else { for( WsItem = &WS_CADRE_D; WsItem != NULL; WsItem = WsItem->Pnext ) { pos.x = (refx - WsItem->m_Posx) * scale; Loading @@ -1179,20 +1202,45 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w case WS_CADRE: /* Begin list number > 1 */ case WS_PODPIS_D: if(WsItem->m_Legende) msg = WsItem->m_Legende; DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,width, false, false, false); if( WsItem->m_Legende ) msg = WsItem->m_Legende; DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); break; case WS_IDENTSHEET_D: if(WsItem->m_Legende) msg = WsItem->m_Legende; if( WsItem->m_Legende ) msg = WsItem->m_Legende; msg << screen->m_ScreenNumber; DrawGraphicText(DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,width, false, false, false); DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); break; case WS_LEFT_SEGMENT_D: pos.y = (refy - WsItem->m_Posy) * scale; case WS_SEGMENT_D: xg = Sheet->m_Size.x - Sheet->m_RightMargin - WsItem->m_Endx; Loading Loading @@ -1223,7 +1271,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, true, false ); false, true ); break; case WS_REV: Loading @@ -1232,8 +1280,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w msg += screen->m_Revision; DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, true, false ); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), false, true ); break; case WS_KICAD_VERSION: Loading @@ -1244,7 +1293,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); break; case WS_SIZESHEET: Loading @@ -1254,7 +1303,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); break; Loading @@ -1265,7 +1314,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); break; case WS_FILENAME: Loading @@ -1278,7 +1327,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); } break; Loading @@ -1289,7 +1338,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); break; Loading @@ -1301,8 +1350,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w { DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, true, false ); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), false, true ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; Loading @@ -1313,8 +1363,9 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w msg += screen->m_Title; DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, true, false ); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GetPenSizeForBold( MIN( size.x, size.y ) ), false, true ); break; case WS_COMMENT1: Loading @@ -1326,7 +1377,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; Loading @@ -1340,7 +1391,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; Loading @@ -1354,7 +1405,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; Loading @@ -1368,7 +1419,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w DrawGraphicText( DrawPanel, DC, pos, Color, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width, false, false, false ); false, false ); UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT ); } break; Loading @@ -1393,6 +1444,7 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w break; } } #endif } Loading
eeschema/class_text-label.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -520,7 +520,7 @@ bool SCH_TEXT::Save( FILE* aFile ) const if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n", m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, shape, (m_Bold?1:0), shape, m_Width, CONV_TO_UTF8( text ) ) == EOF ) { success = false; Loading Loading @@ -577,7 +577,7 @@ bool SCH_LABEL::Save( FILE* aFile ) const if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n", m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, shape, (m_Bold?1:0), m_SchematicOrientation, m_Size.x, shape, m_Width, CONV_TO_UTF8( m_Text ) ) == EOF ) { success = false; Loading Loading @@ -616,7 +616,7 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, SheetLabelType[m_Shape], shape, (m_Bold?1:0), shape, m_Width, CONV_TO_UTF8( m_Text ) ) == EOF ) { success = false; Loading Loading @@ -670,7 +670,7 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const m_Pos.x, m_Pos.y, m_SchematicOrientation, m_Size.x, SheetLabelType[m_Shape], shape, (m_Bold?1:0), shape, m_Width, CONV_TO_UTF8( m_Text ) ) == EOF ) { success = false; Loading