Reduce the size of the tuning popups.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16304
This commit is contained in:
Jeff Young 2023-12-08 19:35:11 +00:00
parent c5d0dcdb15
commit e3c9cf94b7
2 changed files with 8 additions and 8 deletions

View File

@ -68,8 +68,8 @@ KIGFX::PREVIEW::TEXT_DIMS KIGFX::PREVIEW::GetConstantGlyphHeight( KIGFX::GAL* aG
int aRelativeSize ) int aRelativeSize )
{ {
constexpr double aspectRatio = 1.0; constexpr double aspectRatio = 1.0;
constexpr double hdpiSizes[] = { 8, 9, 11, 13, 15 }; constexpr double hdpiSizes[] = { 6, 8, 9, 11, 13, 14, 16 };
constexpr double sizes[] = { 10, 12, 14, 16, 18 }; constexpr double sizes[] = { 8, 10, 12, 14, 15, 16, 18 };
double height; double height;
double thicknessFactor; double thicknessFactor;
@ -80,14 +80,14 @@ KIGFX::PREVIEW::TEXT_DIMS KIGFX::PREVIEW::GetConstantGlyphHeight( KIGFX::GAL* aG
if( canvas && canvas->GetScaleFactor() > 1 ) if( canvas && canvas->GetScaleFactor() > 1 )
{ {
height = hdpiSizes[ 2 + aRelativeSize ]; height = hdpiSizes[ 3 + aRelativeSize ];
thicknessFactor = 0.15; thicknessFactor = 0.15;
shadowFactor = 0.10; shadowFactor = 0.10;
linePitchFactor = 1.7; linePitchFactor = 1.7;
} }
else else
{ {
height = sizes[ 2 + aRelativeSize ]; height = sizes[ 3 + aRelativeSize ];
thicknessFactor = 0.20; thicknessFactor = 0.20;
shadowFactor = 0.15; shadowFactor = 0.15;
linePitchFactor = 1.9; linePitchFactor = 1.9;

View File

@ -143,14 +143,14 @@ public:
gal->PushDepth(); gal->PushDepth();
gal->SetLayerDepth( gal->GetMinDepth() ); gal->SetLayerDepth( gal->GetMinDepth() );
KIGFX::PREVIEW::TEXT_DIMS headerDims = KIGFX::PREVIEW::GetConstantGlyphHeight( gal, -2 ); KIGFX::PREVIEW::TEXT_DIMS headerDims = KIGFX::PREVIEW::GetConstantGlyphHeight( gal, -3 );
KIGFX::PREVIEW::TEXT_DIMS textDims = KIGFX::PREVIEW::GetConstantGlyphHeight( gal, -1 ); KIGFX::PREVIEW::TEXT_DIMS textDims = KIGFX::PREVIEW::GetConstantGlyphHeight( gal, -2 );
KIFONT::FONT* font = KIFONT::FONT::GetFont(); KIFONT::FONT* font = KIFONT::FONT::GetFont();
const KIFONT::METRICS& fontMetrics = KIFONT::METRICS::Default(); const KIFONT::METRICS& fontMetrics = KIFONT::METRICS::Default();
TEXT_ATTRIBUTES textAttrs; TEXT_ATTRIBUTES textAttrs;
int glyphWidth = textDims.GlyphSize.x; int glyphWidth = textDims.GlyphSize.x;
VECTOR2I margin( glyphWidth / 2, glyphWidth ); VECTOR2I margin( KiROUND( glyphWidth * 0.4 ), KiROUND( glyphWidth * 0.9 ) );
VECTOR2I size( glyphWidth * 25 + margin.x * 2, headerDims.GlyphSize.y + textDims.GlyphSize.y ); VECTOR2I size( glyphWidth * 25 + margin.x * 2, headerDims.GlyphSize.y + textDims.GlyphSize.y );
VECTOR2I offset( margin.x * 2, -( size.y + margin.y * 2 ) ); VECTOR2I offset( margin.x * 2, -( size.y + margin.y * 2 ) );
@ -210,7 +210,7 @@ public:
textAttrs.m_StrokeWidth = textDims.StrokeWidth; textAttrs.m_StrokeWidth = textDims.StrokeWidth;
textPos = GetPosition() + offset; textPos = GetPosition() + offset;
textPos.y += KiROUND( headerDims.LinePitch * 1.2 ); textPos.y += KiROUND( headerDims.LinePitch * 1.3 );
font->Draw( gal, m_currentText, textPos, textAttrs, KIFONT::METRICS::Default() ); font->Draw( gal, m_currentText, textPos, textAttrs, KIFONT::METRICS::Default() );
textPos.x += glyphWidth * 11 + margin.x; textPos.x += glyphWidth * 11 + margin.x;