Changed default text size to 50mils
- Text size is now always written to file - Unspecified text sizes are read as 60mils Fixes lp:1737878 https://bugs.launchpad.net/kicad/+bug/1737878
This commit is contained in:
parent
1396ab0941
commit
900ddca0b4
|
@ -400,9 +400,7 @@ wxString EDA_TEXT::GetTextStyleName()
|
|||
|
||||
bool EDA_TEXT::IsDefaultFormatting() const
|
||||
{
|
||||
return ( GetTextWidth() == Mils2iu( DEFAULT_SIZE_TEXT )
|
||||
&& GetTextHeight() == Mils2iu( DEFAULT_SIZE_TEXT )
|
||||
&& IsVisible()
|
||||
return ( IsVisible()
|
||||
&& !IsMirrored()
|
||||
&& GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER
|
||||
&& GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER
|
||||
|
@ -419,61 +417,49 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
|
|||
#ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
|
||||
// and does not define FMT_IU, used here
|
||||
// however this function should exist
|
||||
if( !IsDefaultFormatting() )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(effects" );
|
||||
|
||||
if( ( GetTextWidth() != Mils2iu( DEFAULT_SIZE_TEXT ) )
|
||||
|| ( GetTextHeight() != Mils2iu( DEFAULT_SIZE_TEXT ) )
|
||||
|| ( GetThickness() != 0 ) || IsBold() || IsItalic() )
|
||||
{
|
||||
aFormatter->Print( 0, " (font" );
|
||||
aFormatter->Print( aNestLevel + 1, "(effects" );
|
||||
|
||||
// Add font support here at some point in the future.
|
||||
// Text size
|
||||
aFormatter->Print( 0, " (font" );
|
||||
|
||||
if( GetTextWidth() != Mils2iu( DEFAULT_SIZE_TEXT )
|
||||
|| GetTextHeight() != Mils2iu( DEFAULT_SIZE_TEXT ) )
|
||||
{
|
||||
aFormatter->Print( 0, " (size %s %s)",
|
||||
FMT_IU( GetTextHeight() ).c_str(),
|
||||
FMT_IU( GetTextWidth() ).c_str()
|
||||
);
|
||||
}
|
||||
aFormatter->Print( 0, " (size %s %s)",
|
||||
FMT_IU( GetTextHeight() ).c_str(),
|
||||
FMT_IU( GetTextWidth() ).c_str() );
|
||||
|
||||
if( GetThickness() )
|
||||
aFormatter->Print( 0, " (thickness %s)", FMT_IU( GetThickness() ).c_str() );
|
||||
if( GetThickness() )
|
||||
aFormatter->Print( 0, " (thickness %s)", FMT_IU( GetThickness() ).c_str() );
|
||||
|
||||
if( IsBold() )
|
||||
aFormatter->Print( 0, " bold" );
|
||||
if( IsBold() )
|
||||
aFormatter->Print( 0, " bold" );
|
||||
|
||||
if( IsItalic() )
|
||||
aFormatter->Print( 0, " italic" );
|
||||
if( IsItalic() )
|
||||
aFormatter->Print( 0, " italic" );
|
||||
|
||||
aFormatter->Print( 0, ")");
|
||||
}
|
||||
aFormatter->Print( 0, ")"); // (font
|
||||
|
||||
if( IsMirrored() || ( GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER )
|
||||
|| ( GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER ) )
|
||||
{
|
||||
aFormatter->Print( 0, " (justify");
|
||||
if( IsMirrored() ||
|
||||
GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER ||
|
||||
GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER )
|
||||
{
|
||||
aFormatter->Print( 0, " (justify");
|
||||
|
||||
if( GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER )
|
||||
aFormatter->Print( 0, (GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
|
||||
if( GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER )
|
||||
aFormatter->Print( 0, (GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
|
||||
|
||||
if( GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER )
|
||||
aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
|
||||
if( GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER )
|
||||
aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
|
||||
|
||||
if( IsMirrored() )
|
||||
aFormatter->Print( 0, " mirror" );
|
||||
if( IsMirrored() )
|
||||
aFormatter->Print( 0, " mirror" );
|
||||
aFormatter->Print( 0, ")" ); // (justify
|
||||
}
|
||||
|
||||
aFormatter->Print( 0, ")" );
|
||||
}
|
||||
if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
|
||||
aFormatter->Print( 0, " hide" );
|
||||
|
||||
if( !(aControlBits & CTL_OMIT_HIDE) && !IsVisible() )
|
||||
aFormatter->Print( 0, " hide" );
|
||||
aFormatter->Print( 0, ")\n" ); // (justify
|
||||
|
||||
aFormatter->Print( 0, ")\n" );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -67,11 +67,9 @@ enum EDA_DRAW_MODE_T {
|
|||
|
||||
/** This is the "default-of-the-default" hardcoded text size; individual
|
||||
* application define their own default policy starting with this
|
||||
* (usually with a user option or project). DO NOT change this value if
|
||||
* you do not fully realize the effect it has on sexp serialization
|
||||
* (text size equal to this is not explicitly wrote, so it would change
|
||||
* subsequent reads) */
|
||||
#define DEFAULT_SIZE_TEXT 60 // default text height (in mils, i.e. 1/1000")
|
||||
* (usually with a user option or project).
|
||||
**/
|
||||
#define DEFAULT_SIZE_TEXT 50 // default text height (in mils, i.e. 1/1000")
|
||||
#define DIM_ANCRE_TEXTE 2 // Anchor size for text
|
||||
|
||||
|
||||
|
|
|
@ -242,6 +242,10 @@ void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
|
|||
|
||||
T token;
|
||||
|
||||
// Prior to v5.0 text size was omitted from file format if equal to 60mils
|
||||
// Now, it is always explicitly written to file
|
||||
bool foundTextSize = false;
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token == T_LEFT )
|
||||
|
@ -264,6 +268,8 @@ void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
|
|||
sz.SetWidth( parseBoardUnits( "text width" ) );
|
||||
aText->SetTextSize( sz );
|
||||
NeedRIGHT();
|
||||
|
||||
foundTextSize = true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -329,6 +335,15 @@ void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
|
|||
Expecting( "font, justify, or hide" );
|
||||
}
|
||||
}
|
||||
|
||||
// Text size was not specified in file, force legacy default units
|
||||
// 60mils is 1.524mm
|
||||
if( !foundTextSize )
|
||||
{
|
||||
const float defaultTextSize = 1.524f * IU_PER_MM;
|
||||
|
||||
aText->SetTextSize( wxSize( defaultTextSize, defaultTextSize ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue