Improve overbar rendering in PCB and global labels
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8584 Moves the font slightly down in global labels Keeps font with overbar at the same size in PCB OpenGL renderer
This commit is contained in:
parent
78fd268b18
commit
bab13debcb
|
@ -2040,7 +2040,7 @@ void OPENGL_GAL::drawBitmapOverbar( double aLength, double aHeight )
|
||||||
|
|
||||||
Save();
|
Save();
|
||||||
|
|
||||||
Translate( VECTOR2D( -aLength, -aHeight - 1.5 * H ) );
|
Translate( VECTOR2D( -aLength, -aHeight ) );
|
||||||
|
|
||||||
m_currentManager->Reserve( 6 );
|
m_currentManager->Reserve( 6 );
|
||||||
m_currentManager->Color( m_strokeColor.r, m_strokeColor.g, m_strokeColor.b, m_strokeColor.a );
|
m_currentManager->Color( m_strokeColor.r, m_strokeColor.g, m_strokeColor.b, m_strokeColor.a );
|
||||||
|
@ -2109,15 +2109,7 @@ std::pair<VECTOR2D, float> OPENGL_GAL::computeBitmapTextSize( const UTF8& aText
|
||||||
}
|
}
|
||||||
|
|
||||||
if( glyph )
|
if( glyph )
|
||||||
{
|
|
||||||
textSize.x += glyph->advance;
|
textSize.x += glyph->advance;
|
||||||
|
|
||||||
if( overbarDepth != -1 )
|
|
||||||
{
|
|
||||||
const float H = lineGlyph->maxy - lineGlyph->miny;
|
|
||||||
textSize.y = std::max<float>( textSize.y, charHeight + 1.5 * H );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
textSize.y = std::max<float>( textSize.y, charHeight );
|
textSize.y = std::max<float>( textSize.y, charHeight );
|
||||||
|
|
|
@ -994,15 +994,17 @@ void SCH_GLOBALLABEL::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFu
|
||||||
|
|
||||||
wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const
|
wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const
|
||||||
{
|
{
|
||||||
wxPoint text_offset;
|
int horiz = GetTextOffset( aSettings );
|
||||||
int dist = GetTextOffset( aSettings );
|
|
||||||
|
// Center the text on the center line of "E" instead of "R" to make room for an overbar
|
||||||
|
int vert = GetTextHeight() * 0.0715;
|
||||||
|
|
||||||
switch( m_shape )
|
switch( m_shape )
|
||||||
{
|
{
|
||||||
case PINSHEETLABEL_SHAPE::PS_INPUT:
|
case PINSHEETLABEL_SHAPE::PS_INPUT:
|
||||||
case PINSHEETLABEL_SHAPE::PS_BIDI:
|
case PINSHEETLABEL_SHAPE::PS_BIDI:
|
||||||
case PINSHEETLABEL_SHAPE::PS_TRISTATE:
|
case PINSHEETLABEL_SHAPE::PS_TRISTATE:
|
||||||
dist += GetTextHeight() * 3 / 4; // Use three-quarters-height as proxy for triangle size
|
horiz += GetTextHeight() * 3 / 4; // Use three-quarters-height as proxy for triangle size
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PINSHEETLABEL_SHAPE::PS_OUTPUT:
|
case PINSHEETLABEL_SHAPE::PS_OUTPUT:
|
||||||
|
@ -1014,13 +1016,11 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSetting
|
||||||
switch( GetLabelSpinStyle() )
|
switch( GetLabelSpinStyle() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case LABEL_SPIN_STYLE::LEFT: text_offset.x -= dist; break;
|
case LABEL_SPIN_STYLE::LEFT: return wxPoint( -horiz, vert );
|
||||||
case LABEL_SPIN_STYLE::UP: text_offset.y -= dist; break;
|
case LABEL_SPIN_STYLE::UP: return wxPoint( vert, -horiz );
|
||||||
case LABEL_SPIN_STYLE::RIGHT: text_offset.x += dist; break;
|
case LABEL_SPIN_STYLE::RIGHT: return wxPoint( horiz, vert );
|
||||||
case LABEL_SPIN_STYLE::BOTTOM: text_offset.y += dist; break;
|
case LABEL_SPIN_STYLE::BOTTOM: return wxPoint( vert, horiz );
|
||||||
}
|
}
|
||||||
|
|
||||||
return text_offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue