Skip to content
Permalink
Browse files

[layouts] Default svg export setting for label text as outlines/text …

…to use project setting
  • Loading branch information
nyalldawson committed Dec 11, 2018
1 parent a4509bd commit cd8b91bdfe5c8f27f0c671f56fd9173dff32de34
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/app/layout/qgslayoutdesignerdialog.cpp
@@ -39,6 +39,7 @@
#include "qgslayoutitemmap.h"
#include "qgsprintlayout.h"
#include "qgsmapcanvas.h"
#include "qgsrendercontext.h"
#include "qgsmessagebar.h"
#include "qgsmessageviewer.h"
#include "qgsgui.h"
@@ -3961,7 +3962,7 @@ bool QgsLayoutDesignerDialog::getRasterExportSettings( QgsLayoutExporter::ImageE
bool QgsLayoutDesignerDialog::getSvgExportSettings( QgsLayoutExporter::SvgExportSettings &settings )
{
bool groupLayers = false;
bool prevSettingLabelsAsOutlines = false;
QgsRenderContext::TextRenderFormat prevTextRenderFormat = mMasterLayout->layoutProject()->labelingEngineSettings().defaultTextRenderFormat();
bool clipToContent = false;
double marginTop = 0.0;
double marginRight = 0.0;
@@ -3985,14 +3986,19 @@ bool QgsLayoutDesignerDialog::getSvgExportSettings( QgsLayoutExporter::SvgExport
bottomMargin = mLayout->customProperty( QStringLiteral( "svgCropMarginBottom" ), 0 ).toInt();
leftMargin = mLayout->customProperty( QStringLiteral( "svgCropMarginLeft" ), 0 ).toInt();
includeMetadata = mLayout->customProperty( QStringLiteral( "svgIncludeMetadata" ), 1 ).toBool();
prevSettingLabelsAsOutlines = mLayout->customProperty( QStringLiteral( "svgRenderTextAsOutlines" ), 1 ).toBool();
const int prevLayoutSettingLabelsAsOutlines = mLayout->customProperty( QStringLiteral( "svgTextFormat" ), -1 ).toInt();
if ( prevLayoutSettingLabelsAsOutlines >= 0 )
{
// previous layout setting takes default over project setting
prevTextRenderFormat = static_cast< QgsRenderContext::TextRenderFormat >( prevLayoutSettingLabelsAsOutlines );
}
}

// open options dialog
QDialog dialog;
Ui::QgsSvgExportOptionsDialog options;
options.setupUi( &dialog );
options.chkTextAsOutline->setChecked( prevSettingLabelsAsOutlines );
options.chkTextAsOutline->setChecked( prevTextRenderFormat == QgsRenderContext::TextFormatAlwaysOutlines );
options.chkMapLayersAsGroup->setChecked( layersAsGroup );
options.mClipToContentGroupBox->setChecked( cropToContents );
options.mForceVectorCheckBox->setChecked( previousForceVector );
@@ -4024,7 +4030,7 @@ bool QgsLayoutDesignerDialog::getSvgExportSettings( QgsLayoutExporter::SvgExport
mLayout->setCustomProperty( QStringLiteral( "svgCropMarginBottom" ), marginBottom );
mLayout->setCustomProperty( QStringLiteral( "svgCropMarginLeft" ), marginLeft );
mLayout->setCustomProperty( QStringLiteral( "svgIncludeMetadata" ), includeMetadata ? 1 : 0 );
mLayout->setCustomProperty( QStringLiteral( "svgRenderTextAsOutlines" ), textRenderFormat == QgsRenderContext::TextFormatAlwaysOutlines ? 1 : 0 );
mLayout->setCustomProperty( QStringLiteral( "svgTextFormat" ), static_cast< int >( textRenderFormat ) );
}

settings.cropToContents = clipToContent;

0 comments on commit cd8b91b

Please sign in to comment.
You can’t perform that action at this time.