From 80a7afd7f58cdd429bde12148b5709329d2c2f79 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sun, 9 Jan 2022 14:42:42 -0500 Subject: [PATCH] Account for font bearing in centering of text number in Qt branch cards. --- src/drivers/Qt/TasEditor/branches.cpp | 29 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/drivers/Qt/TasEditor/branches.cpp b/src/drivers/Qt/TasEditor/branches.cpp index a8b9f487..de8e82a6 100644 --- a/src/drivers/Qt/TasEditor/branches.cpp +++ b/src/drivers/Qt/TasEditor/branches.cpp @@ -111,7 +111,7 @@ void BRANCHES::setFont( QFont &newFont ) void BRANCHES::calcFontData(void) { - int w,h,ch='0'; + int w,h,ch='0',bs; QWidget::setFont(font); QFontMetrics metrics(font); #if QT_VERSION > QT_VERSION_CHECK(5, 11, 0) @@ -119,15 +119,16 @@ void BRANCHES::calcFontData(void) #else pxCharWidth = metrics.width(QLatin1Char(ch)); #endif - //printf(" Width: %i\n", metrics.width(ch) ); - //printf(" Advance: %i\n", metrics.horizontalAdvance(ch) ); - //printf(" Left Bearing: %i\n", metrics.leftBearing(ch) ); - //printf("Right Bearing: %i\n", metrics.rightBearing(ch) ); - //printf(" Ascent: %i\n", metrics.ascent() ); - //printf(" Descent: %i\n", metrics.descent() ); - //printf(" Height: %i\n", metrics.height() ); - //printf(" Line Spacing: %i\n", metrics.lineSpacing() ); - //printf(" Line Leading: %i\n", metrics.leading() ); + printf(" Width: %i\n", metrics.width(ch) ); + printf(" Advance: %i\n", metrics.horizontalAdvance(ch) ); + printf(" Left Bearing: %i\n", metrics.leftBearing(ch) ); + printf("Right Bearing: %i\n", metrics.rightBearing(ch) ); + printf(" Ascent: %i\n", metrics.ascent() ); + printf(" Descent: %i\n", metrics.descent() ); + printf(" Height: %i\n", metrics.height() ); + printf(" Cap Height: %i\n", metrics.capHeight() ); + printf(" Line Spacing: %i\n", metrics.lineSpacing() ); + printf(" Line Leading: %i\n", metrics.leading() ); //for (int i=0; i