From 88290f2259172f0127355b9557a4bc831da24080 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Fri, 7 Feb 2025 10:42:06 +0100 Subject: [PATCH 1/5] Qt 6.9 adjustments --- src/controls/QskItem.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/controls/QskItem.cpp b/src/controls/QskItem.cpp index c0b83dde..5a5a0940 100644 --- a/src/controls/QskItem.cpp +++ b/src/controls/QskItem.cpp @@ -1007,6 +1007,10 @@ void QskItem::itemChange( QQuickItem::ItemChange change, case QQuickItem::ItemRotationHasChanged: case QQuickItem::ItemAntialiasingHasChanged: case QQuickItem::ItemDevicePixelRatioHasChanged: +#if QT_VERSION >= QT_VERSION_CHECK( 6, 9, 0 ) + case QQuickItem::ItemScaleHasChanged: + case QQuickItem::ItemTransformHasChanged: +#endif { break; } From 5c95cbd64a616eb7e5eedfd17afbd2924f305735 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Fri, 7 Feb 2025 10:42:36 +0100 Subject: [PATCH 2/5] compiler warning fixed --- designsystems/fluent2/QskFluent2Skin.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/designsystems/fluent2/QskFluent2Skin.cpp b/designsystems/fluent2/QskFluent2Skin.cpp index 64bd1cc6..e38340ce 100644 --- a/designsystems/fluent2/QskFluent2Skin.cpp +++ b/designsystems/fluent2/QskFluent2Skin.cpp @@ -1880,7 +1880,6 @@ void Editor::setupTextFieldColors( { using Q = QskTextField; using A = QskAspect; - using W = QskFluent2Skin; const auto& pal = theme.palette; From f96dc71b49aee05800cb137671abcbded237c77f Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 10 Feb 2025 14:38:18 +0100 Subject: [PATCH 3/5] avoid crash with incomplete font definitions ( IcoMoon ) --- src/graphic/QskGlyphTable.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/graphic/QskGlyphTable.cpp b/src/graphic/QskGlyphTable.cpp index ca6cccca..c5e63bcb 100644 --- a/src/graphic/QskGlyphTable.cpp +++ b/src/graphic/QskGlyphTable.cpp @@ -50,15 +50,18 @@ namespace PostTableParser const auto from = reinterpret_cast< const uint8_t* >( glyphData + nglyphs ); const auto to = reinterpret_cast< const uint8_t* >( blob.data() + blob.size() ); - for ( auto s = from; s < to; s += *s + 1 ) - strings += s; - - for ( int i = 0; i < nglyphs; i++ ) + if ( to > from ) { - const int idx = qFromBigEndian( glyphData[i] ) - 258; + for ( auto s = from; s < to; s += *s + 1 ) + strings += s; - if ( idx >= 0 ) - names.insert( toString( strings[idx] ), i ); + for ( int i = 0; i < nglyphs; i++ ) + { + const int idx = qFromBigEndian( glyphData[i] ) - 258; + + if ( idx >= 0 && idx < strings.size() ) + names.insert( toString( strings[idx] ), i ); + } } } From 0a3c3fda73ae660daa369ae0a2b8fe974b6ce6d4 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 10 Feb 2025 14:39:57 +0100 Subject: [PATCH 4/5] viewBox for glyphpaths added --- src/graphic/QskGlyphTable.cpp | 14 +++++++++++++- tools/glyph2qvg/main.cpp | 8 ++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/graphic/QskGlyphTable.cpp b/src/graphic/QskGlyphTable.cpp index c5e63bcb..e166d5d7 100644 --- a/src/graphic/QskGlyphTable.cpp +++ b/src/graphic/QskGlyphTable.cpp @@ -326,6 +326,12 @@ static uint qskGlyphCount( const QRawFont& font ) return fontEngine ? fontEngine->glyphCount() : 0; } +static qreal qskPixelSize( const QRawFont& font ) +{ + const auto fontEngine = QRawFontPrivate::get( font )->fontEngine; + return fontEngine ? fontEngine->fontDef.pixelSize : 0.0; +} + static GlyphNameTable qskGlyphNameTable( const QRawFont& font ) { const auto count = qskGlyphCount( font ); @@ -452,10 +458,16 @@ QskGraphic QskGlyphTable::glyphGraphic( uint glyphIndex ) const if ( glyphIndex > 0 && qskGlyphCount( m_data->font ) > 0 ) { - const auto path = glyphPath( glyphIndex ); + auto path = glyphPath( glyphIndex ); if ( !path.isEmpty() ) { + // vertical glyph coordinates are from [-sz, 0.0] + const auto sz = qskPixelSize( m_data->font ); + + path.translate( 0.0, sz ); + graphic.setViewBox( QRectF( 0.0, 0.0, sz, sz ) ); + QPainter painter( &graphic ); painter.setRenderHint( QPainter::Antialiasing, true ); painter.fillPath( path, Qt::black ); diff --git a/tools/glyph2qvg/main.cpp b/tools/glyph2qvg/main.cpp index d86a7bb6..feea2643 100644 --- a/tools/glyph2qvg/main.cpp +++ b/tools/glyph2qvg/main.cpp @@ -34,9 +34,11 @@ int main( int argc, char* argv[] ) return -1; } + const int pixelSize = 24; // something + QGuiApplication app( argc, argv ); - QRawFont font( QString( argv[1] ), 16 ); + QRawFont font( QString( argv[1] ), pixelSize ); if ( !font.isValid() ) { qWarning() << "invalid font name:" << argv[1]; @@ -52,14 +54,16 @@ int main( int argc, char* argv[] ) return -3; } - const auto path = font.pathForGlyph( glyphIndex ); + auto path = font.pathForGlyph( glyphIndex ); if ( path.isEmpty() ) { qWarning() << "no glyph for index:" << argv[2]; return -3; } + path.translate( 0.0, pixelSize ); QskGraphic graphic; + graphic.setViewBox( QRectF( 0.0, 0.0, pixelSize, pixelSize ) ); QPainter painter( &graphic ); painter.setRenderHint( QPainter::Antialiasing, true ); From 88a501d998b00791e8974ad31202360669fc00d5 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 10 Feb 2025 15:14:41 +0100 Subject: [PATCH 5/5] avoid viewBox translation --- src/graphic/QskGlyphTable.cpp | 8 +++----- tools/glyph2qvg/main.cpp | 11 ++++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/graphic/QskGlyphTable.cpp b/src/graphic/QskGlyphTable.cpp index e166d5d7..13cd7607 100644 --- a/src/graphic/QskGlyphTable.cpp +++ b/src/graphic/QskGlyphTable.cpp @@ -458,15 +458,13 @@ QskGraphic QskGlyphTable::glyphGraphic( uint glyphIndex ) const if ( glyphIndex > 0 && qskGlyphCount( m_data->font ) > 0 ) { - auto path = glyphPath( glyphIndex ); + const auto path = glyphPath( glyphIndex ); if ( !path.isEmpty() ) { - // vertical glyph coordinates are from [-sz, 0.0] + // vertical glyph coordinates are in the range [-sz, 0.0] const auto sz = qskPixelSize( m_data->font ); - - path.translate( 0.0, sz ); - graphic.setViewBox( QRectF( 0.0, 0.0, sz, sz ) ); + graphic.setViewBox( QRectF( 0.0, -sz, sz, sz ) ); QPainter painter( &graphic ); painter.setRenderHint( QPainter::Antialiasing, true ); diff --git a/tools/glyph2qvg/main.cpp b/tools/glyph2qvg/main.cpp index feea2643..ba3053c5 100644 --- a/tools/glyph2qvg/main.cpp +++ b/tools/glyph2qvg/main.cpp @@ -34,11 +34,11 @@ int main( int argc, char* argv[] ) return -1; } - const int pixelSize = 24; // something + const int sz = 24; // something QGuiApplication app( argc, argv ); - QRawFont font( QString( argv[1] ), pixelSize ); + QRawFont font( QString( argv[1] ), sz ); if ( !font.isValid() ) { qWarning() << "invalid font name:" << argv[1]; @@ -54,16 +54,17 @@ int main( int argc, char* argv[] ) return -3; } - auto path = font.pathForGlyph( glyphIndex ); + const auto path = font.pathForGlyph( glyphIndex ); if ( path.isEmpty() ) { qWarning() << "no glyph for index:" << argv[2]; return -3; } - path.translate( 0.0, pixelSize ); QskGraphic graphic; - graphic.setViewBox( QRectF( 0.0, 0.0, pixelSize, pixelSize ) ); + + // vertical glyph coordinates are in the range [-sz, 0.0] + graphic.setViewBox( QRectF( 0.0, -sz, sz, sz ) ); QPainter painter( &graphic ); painter.setRenderHint( QPainter::Antialiasing, true );