1 /* 2 For general Scribus (>=1.3.2) copyright and licensing information please refer 3 to the COPYING file provided with the program. Following this notice may exist 4 a copyright and/or license notice that predates the release of Scribus 1.3.2 5 for which a new license (GPL+exception) is in place. 6 */ 7 8 #include "prefs_typography.h" 9 #include "prefsstructs.h" 10 #include "scribusdoc.h" 11 Prefs_Typography(QWidget * parent,ScribusDoc * doc)12Prefs_Typography::Prefs_Typography(QWidget* parent, ScribusDoc* doc) 13 : Prefs_Pane(parent) 14 { 15 setupUi(this); 16 languageChange(); 17 18 m_caption = tr("Typography"); 19 m_icon = "16/draw-text.png"; 20 } 21 22 Prefs_Typography::~Prefs_Typography() = default; 23 languageChange()24void Prefs_Typography::languageChange() 25 { 26 QString autoText=tr( "Auto" ); 27 underlineDisplacementSpinBox->setSpecialValueText(autoText); 28 underlineLineWidthSpinBox->setSpecialValueText(autoText); 29 strikeoutDisplacementSpinBox->setSpecialValueText(autoText); 30 strikeoutLineWidthSpinBox->setSpecialValueText(autoText); 31 32 subscriptDisplacementSpinBox->setToolTip( tr( "Displacement below the baseline of the normal font on a line" ) ); 33 subscriptScalingSpinBox->setToolTip( tr( "Relative size of the subscript compared to the normal font" ) ); 34 superscriptDisplacementSpinBox->setToolTip( tr( "Displacement above the baseline of the font on a line" ) ); 35 superscriptScalingSpinBox->setToolTip( tr( "Relative size of the superscript compared to the normal font" ) ); 36 underlineDisplacementSpinBox->setToolTip( tr( "Displacement below the baseline of the normal font expressed as a percentage of the fonts descender" ) ); 37 underlineLineWidthSpinBox->setToolTip( tr( "Line width expressed as a percentage of the font size" ) ); 38 strikeoutDisplacementSpinBox->setToolTip( tr( "Displacement above the baseline of the normal font expressed as a percentage of the fonts ascender" ) ); 39 strikeoutLineWidthSpinBox->setToolTip( tr( "Line width expressed as a percentage of the font size" ) ); 40 smallcapsScalingSpinBox->setToolTip( tr( "Relative size of the small caps font compared to the normal font" ) ); 41 automaticLineSpacingSpinBox->setToolTip( tr( "Percentage increase over the font size for the line spacing" ) ); 42 } 43 restoreDefaults(struct ApplicationPrefs * prefsData)44void Prefs_Typography::restoreDefaults(struct ApplicationPrefs *prefsData) 45 { 46 subscriptDisplacementSpinBox->setValue(prefsData->typoPrefs.valueSubScript); 47 subscriptScalingSpinBox->setValue(prefsData->typoPrefs.scalingSubScript); 48 superscriptDisplacementSpinBox->setValue(prefsData->typoPrefs.valueSuperScript); 49 superscriptScalingSpinBox->setValue(prefsData->typoPrefs.scalingSuperScript); 50 underlineDisplacementSpinBox->setValue(prefsData->typoPrefs.valueUnderlinePos / 10.0); 51 underlineLineWidthSpinBox->setValue(prefsData->typoPrefs.valueUnderlineWidth / 10.0); 52 strikeoutDisplacementSpinBox->setValue(prefsData->typoPrefs.valueStrikeThruPos / 10.0); 53 strikeoutLineWidthSpinBox->setValue(prefsData->typoPrefs.valueStrikeThruWidth / 10.0); 54 smallcapsScalingSpinBox->setValue(prefsData->typoPrefs.valueSmallCaps); 55 automaticLineSpacingSpinBox->setValue(prefsData->typoPrefs.autoLineSpacing); 56 } 57 saveGuiToPrefs(struct ApplicationPrefs * prefsData) const58void Prefs_Typography::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const 59 { 60 prefsData->typoPrefs.valueSubScript=subscriptDisplacementSpinBox->value(); 61 prefsData->typoPrefs.scalingSubScript=subscriptScalingSpinBox->value(); 62 prefsData->typoPrefs.valueSuperScript=superscriptDisplacementSpinBox->value(); 63 prefsData->typoPrefs.scalingSuperScript=superscriptScalingSpinBox->value(); 64 prefsData->typoPrefs.valueUnderlinePos=underlineDisplacementSpinBox->value() * 10.0; 65 prefsData->typoPrefs.valueUnderlineWidth=underlineLineWidthSpinBox->value() * 10.0; 66 prefsData->typoPrefs.valueStrikeThruPos=strikeoutDisplacementSpinBox->value() * 10.0; 67 prefsData->typoPrefs.valueStrikeThruWidth=strikeoutLineWidthSpinBox->value() * 10.0; 68 prefsData->typoPrefs.valueSmallCaps=smallcapsScalingSpinBox->value(); 69 prefsData->typoPrefs.autoLineSpacing=automaticLineSpacingSpinBox->value(); 70 } 71 72