Skip to content

Commit

Permalink
labeling: fix missing fonts warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jul 27, 2013
1 parent 8b5f22e commit 51dbbe1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
20 changes: 11 additions & 9 deletions src/app/qgslabelinggui.cpp
Expand Up @@ -48,7 +48,8 @@
QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent )
: QWidget( parent ), mLBL( lbl ), mLayer( layer ), mMapCanvas( mapCanvas )
{
if ( !layer ) return;
if ( !layer )
return;

setupUi( this );
mCharDlg = new QgsCharacterSelectorDialog( this );
Expand Down Expand Up @@ -111,8 +112,8 @@ QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsM
break;
case QGis::NoGeometry:
break;
default:
Q_ASSERT( 0 && "NOOOO!" );
case QGis::UnknownGeometry:
qFatal( "unknown geometry type unexpected" );
}

// show/hide options based upon geometry type
Expand Down Expand Up @@ -281,8 +282,6 @@ void QgsLabelingGui::init()
case QgsPalLayerSettings::Free:
radPolygonFree->setChecked( true );
break;
default:
Q_ASSERT( 0 && "NOOO!" );
}

if ( lyr.placement == QgsPalLayerSettings::Line || lyr.placement == QgsPalLayerSettings::Curved )
Expand Down Expand Up @@ -366,9 +365,9 @@ void QgsLabelingGui::init()
updateFont( mRefFont );

// show 'font not found' if substitution has occurred (should come after updateFont())
mFontMissingLabel->setVisible( !lyr.mTextFontFound );
if ( !lyr.mTextFontFound )
{
mFontMissingLabel->setVisible( true );
QString missingTxt = tr( "%1 not found. Default substituted." );
QString txtPrepend = tr( "Chosen font" );
if ( !lyr.mTextFontFamily.isEmpty() )
Expand Down Expand Up @@ -565,7 +564,9 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
lyr.placement = QgsPalLayerSettings::Free;
}
else
Q_ASSERT( 0 && "NOOO!" );
{
qFatal( "Invalid settings" );
}


lyr.textColor = btnTextColor->color();
Expand Down Expand Up @@ -1048,7 +1049,7 @@ void QgsLabelingGui::updateFont( QFont font )
}

// test if font is actually available
mFontMissingLabel->setVisible( QgsFontUtils::fontMatchOnSystem( mRefFont ) );
mFontMissingLabel->setVisible( !QgsFontUtils::fontMatchOnSystem( mRefFont ) );

mDirectSymbLeftLineEdit->setFont( mRefFont );
mDirectSymbRightLineEdit->setFont( mRefFont );
Expand Down Expand Up @@ -1115,7 +1116,8 @@ void QgsLabelingGui::updatePreview()
}
else // in points
{
previewFont.setPointSize( fontSize );
if ( fontSize > 0 )
previewFont.setPointSize( fontSize );
mPreviewSizeSlider->setEnabled( false );
grpboxtitle = sampleTxt;

Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsfontutils.cpp
Expand Up @@ -53,7 +53,8 @@ bool QgsFontUtils::fontFamilyMatchOnSystem( const QString& family, QString* chos
{
// full 'family [foundry]' strings have to match
*match = ( *it == family );
if ( match ) { break; }
if ( *match )
break;
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgspallabeling.cpp
Expand Up @@ -1778,6 +1778,7 @@ void QgsPalLayerSettings::registerFeature( QgsVectorLayer* layer, QgsFeature& f
}
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
QgsDebugMsgLevel( QString( "Ignoring feature %1 due transformation exception" ).arg( f.id() ), 4 );
return;
}
Expand Down Expand Up @@ -2085,6 +2086,7 @@ void QgsPalLayerSettings::registerFeature( QgsVectorLayer* layer, QgsFeature& f
}
catch ( QgsCsException &e )
{
Q_UNUSED( e );
QgsDebugMsgLevel( QString( "Ignoring feature %1 due transformation exception on data-defined position" ).arg( f.id() ), 4 );
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgslabelingguibase.ui
Expand Up @@ -1287,7 +1287,7 @@
font-style: italic;</string>
</property>
<property name="text">
<string notr="true">missing font text</string>
<string>Font is missing.</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
Expand Down

0 comments on commit 51dbbe1

Please sign in to comment.