Commit d3dc65b6 authored by charras's avatar charras

minot changes

parent 866d5c3a
......@@ -193,7 +193,7 @@ EDA_TextStruct::~EDA_TextStruct()
*/
int EDA_TextStruct::LenSize( const wxString& aLine ) const
{
return TextWidth(aLine, m_Size.x, m_Italic, m_Bold ) + m_Width;
return ReturnGraphicTextWidth(aLine, m_Size.x, m_Italic, m_Bold ) + m_Width;
}
......
......@@ -20,7 +20,7 @@
#define EDA_DRAWBASE
#include "hershey_fonts.h"
#define HERSHEY_SIZE 32.0
#define HERSHEY_SIZE 32.0 // size factor used to calculate actual size of shapes from hershey fonts
/* Functions to draw / plot a string.
* texts have only one line.
......@@ -67,7 +67,7 @@ static const char* get_hershey_recipe( int AsciiCode, bool bold )
}
int TextWidth( const wxString& aText, int size_h, bool italic, bool bold )
int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool italic, bool bold )
{
int tally = 0;
int char_count = aText.length();
......@@ -85,13 +85,13 @@ int TextWidth( const wxString& aText, int size_h, bool italic, bool bold )
/* Get metrics */
int xsta = *ptcar++ - 'R';
int xsto = *ptcar++ - 'R';
tally += wxRound( size_h * (xsto - xsta) / HERSHEY_SIZE );
tally += wxRound( aXSize * (xsto - xsta) / HERSHEY_SIZE );
}
/* Italic correction, 1/8em */
if( italic )
{
tally += wxRound( size_h * 0.125 );
tally += wxRound( aXSize * 0.125 );
}
return tally;
}
......@@ -130,7 +130,7 @@ static void DrawGraphicTextPline(
static int overbar_position( int size_v, int thickness )
{
return wxRound( (double) size_v * 30.0 / HERSHEY_SIZE + (double) thickness );
return wxRound( ((double) size_v * 26/HERSHEY_SIZE ) + ((double) thickness * 1.5) );
}
......@@ -228,7 +228,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
current_char_pos = aPos;
dx = TextWidth( aText, size_h, aItalic, aBold );
dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aBold );
dy = size_v;
/* Do not draw the text if out of draw area! */
......
......@@ -456,7 +456,6 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
int x, y, x1, y1;
wxString StringPinNum;
EDA_Colors NameColor, NumColor;
int PinTxtLen;
wxSize PinNameSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize( m_PinNumSize, m_PinNumSize );
......@@ -491,9 +490,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
x1 += m_PinLen; break;
}
PinTxtLen = TextWidth( m_PinName, PinNameSize.x, false, false) + LineWidth;
if( PinTxtLen == 0 )
if( m_PinName.IsEmpty() )
DrawPinName = FALSE;
if( TextInside ) /* Draw the text inside, but the pin numbers outside. */
......@@ -658,7 +655,6 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
int x, y, x1, y1;
wxString StringPinNum;
EDA_Colors NameColor, NumColor;
int PinTxtLen = 0;
wxSize PinNameSize = wxSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize = wxSize( m_PinNumSize, m_PinNumSize );
bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST)
......@@ -687,8 +683,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
x1 += m_PinLen; break;
}
PinTxtLen = TextWidth( m_PinName, PinNameSize.x, false, false) + aWidth;
if( PinTxtLen == 0 )
if( m_PinName.IsEmpty() )
DrawPinName = FALSE;
if( TextInside ) /* Draw the text inside, but the pin numbers outside. */
......
......@@ -9,7 +9,11 @@
class WinEDA_DrawPanel;
int TextWidth(const wxString& aText, int size_h, bool italic, bool bold );
/** Function ReturnGraphicTextWidth
* @return the X size of the graphic text
* the full X size is ReturnGraphicTextWidth + the thickness of graphic lines
*/
int ReturnGraphicTextWidth(const wxString& aText, int size_h, bool italic, bool bold );
/** Function NegableTextLength
* Return the text length of a negable string, excluding the ~ markers */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment