Merge branch 'master' into features/effectnode

This commit is contained in:
Uwe Rathmann 2025-02-18 16:23:18 +01:00
commit 3834597d51
4 changed files with 30 additions and 9 deletions

View File

@ -1880,7 +1880,6 @@ void Editor::setupTextFieldColors(
{ {
using Q = QskTextField; using Q = QskTextField;
using A = QskAspect; using A = QskAspect;
using W = QskFluent2Skin;
const auto& pal = theme.palette; const auto& pal = theme.palette;

View File

@ -1007,6 +1007,10 @@ void QskItem::itemChange( QQuickItem::ItemChange change,
case QQuickItem::ItemRotationHasChanged: case QQuickItem::ItemRotationHasChanged:
case QQuickItem::ItemAntialiasingHasChanged: case QQuickItem::ItemAntialiasingHasChanged:
case QQuickItem::ItemDevicePixelRatioHasChanged: case QQuickItem::ItemDevicePixelRatioHasChanged:
#if QT_VERSION >= QT_VERSION_CHECK( 6, 9, 0 )
case QQuickItem::ItemScaleHasChanged:
case QQuickItem::ItemTransformHasChanged:
#endif
{ {
break; break;
} }

View File

@ -50,15 +50,18 @@ namespace PostTableParser
const auto from = reinterpret_cast< const uint8_t* >( glyphData + nglyphs ); const auto from = reinterpret_cast< const uint8_t* >( glyphData + nglyphs );
const auto to = reinterpret_cast< const uint8_t* >( blob.data() + blob.size() ); const auto to = reinterpret_cast< const uint8_t* >( blob.data() + blob.size() );
for ( auto s = from; s < to; s += *s + 1 ) if ( to > from )
strings += s;
for ( int i = 0; i < nglyphs; i++ )
{ {
const int idx = qFromBigEndian( glyphData[i] ) - 258; for ( auto s = from; s < to; s += *s + 1 )
strings += s;
if ( idx >= 0 ) for ( int i = 0; i < nglyphs; i++ )
names.insert( toString( strings[idx] ), i ); {
const int idx = qFromBigEndian( glyphData[i] ) - 258;
if ( idx >= 0 && idx < strings.size() )
names.insert( toString( strings[idx] ), i );
}
} }
} }
@ -323,6 +326,12 @@ static uint qskGlyphCount( const QRawFont& font )
return fontEngine ? fontEngine->glyphCount() : 0; 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 ) static GlyphNameTable qskGlyphNameTable( const QRawFont& font )
{ {
const auto count = qskGlyphCount( font ); const auto count = qskGlyphCount( font );
@ -453,6 +462,10 @@ QskGraphic QskGlyphTable::glyphGraphic( uint glyphIndex ) const
if ( !path.isEmpty() ) if ( !path.isEmpty() )
{ {
// vertical glyph coordinates are in the range [-sz, 0.0]
const auto sz = qskPixelSize( m_data->font );
graphic.setViewBox( QRectF( 0.0, -sz, sz, sz ) );
QPainter painter( &graphic ); QPainter painter( &graphic );
painter.setRenderHint( QPainter::Antialiasing, true ); painter.setRenderHint( QPainter::Antialiasing, true );
painter.fillPath( path, Qt::black ); painter.fillPath( path, Qt::black );

View File

@ -34,9 +34,11 @@ int main( int argc, char* argv[] )
return -1; return -1;
} }
const int sz = 24; // something
QGuiApplication app( argc, argv ); QGuiApplication app( argc, argv );
QRawFont font( QString( argv[1] ), 16 ); QRawFont font( QString( argv[1] ), sz );
if ( !font.isValid() ) if ( !font.isValid() )
{ {
qWarning() << "invalid font name:" << argv[1]; qWarning() << "invalid font name:" << argv[1];
@ -61,6 +63,9 @@ int main( int argc, char* argv[] )
QskGraphic graphic; QskGraphic graphic;
// vertical glyph coordinates are in the range [-sz, 0.0]
graphic.setViewBox( QRectF( 0.0, -sz, sz, sz ) );
QPainter painter( &graphic ); QPainter painter( &graphic );
painter.setRenderHint( QPainter::Antialiasing, true ); painter.setRenderHint( QPainter::Antialiasing, true );
painter.fillPath( path, Qt::black ); painter.fillPath( path, Qt::black );