Commit e33355a4 authored by Kurt Hindenburg's avatar Kurt Hindenburg

Add option to use the selected font's line characters

Konsole has builtin code to manually write out line characters.  There
are certain reasons why this might not be desired.  This adds a profile
option to use the fonts line characters.  The default is as-is today
using the builtin code.

BUG: 364992
(cherry picked from commit a4de3feb)
parent 4e83f5a9
...@@ -447,6 +447,10 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile) ...@@ -447,6 +447,10 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile)
_ui->boldIntenseButton->setChecked(profile->boldIntense()); _ui->boldIntenseButton->setChecked(profile->boldIntense());
connect(_ui->boldIntenseButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::setBoldIntense); connect(_ui->boldIntenseButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::setBoldIntense);
_ui->useFontLineCharactersButton->setChecked(profile->useFontLineCharacters());
connect(_ui->useFontLineCharactersButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::useFontLineCharacters);
_ui->enableMouseWheelZoomButton->setChecked(profile->mouseWheelZoomEnabled()); _ui->enableMouseWheelZoomButton->setChecked(profile->mouseWheelZoomEnabled());
connect(_ui->enableMouseWheelZoomButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::toggleMouseWheelZoom); connect(_ui->enableMouseWheelZoomButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::toggleMouseWheelZoom);
} }
...@@ -474,6 +478,11 @@ void EditProfileDialog::setBoldIntense(bool enable) ...@@ -474,6 +478,11 @@ void EditProfileDialog::setBoldIntense(bool enable)
preview(Profile::BoldIntense, enable); preview(Profile::BoldIntense, enable);
updateTempProfileProperty(Profile::BoldIntense, enable); updateTempProfileProperty(Profile::BoldIntense, enable);
} }
void EditProfileDialog::useFontLineCharacters(bool enable)
{
preview(Profile::UseFontLineCharacters, enable);
updateTempProfileProperty(Profile::UseFontLineCharacters, enable);
}
void EditProfileDialog::toggleMouseWheelZoom(bool enable) void EditProfileDialog::toggleMouseWheelZoom(bool enable)
{ {
updateTempProfileProperty(Profile::MouseWheelZoomEnabled, enable); updateTempProfileProperty(Profile::MouseWheelZoomEnabled, enable);
......
...@@ -126,6 +126,7 @@ private slots: ...@@ -126,6 +126,7 @@ private slots:
void showAllFontsButtonWarning(bool enable); void showAllFontsButtonWarning(bool enable);
void setAntialiasText(bool enable); void setAntialiasText(bool enable);
void setBoldIntense(bool enable); void setBoldIntense(bool enable);
void useFontLineCharacters(bool enable);
void showFontDialog(); void showFontDialog();
void newColorScheme(); void newColorScheme();
void editColorScheme(); void editColorScheme();
......
...@@ -613,6 +613,16 @@ ...@@ -613,6 +613,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="useFontLineCharactersButton">
<property name="toolTip">
<string>Use the selected font for line characters instead of the builtin code</string>
</property>
<property name="text">
<string>Use line characters contained in font</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
......
...@@ -78,6 +78,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = { ...@@ -78,6 +78,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
, { ColorScheme , "colors" , 0 , QVariant::String } , { ColorScheme , "colors" , 0 , QVariant::String }
, { AntiAliasFonts, "AntiAliasFonts" , APPEARANCE_GROUP , QVariant::Bool } , { AntiAliasFonts, "AntiAliasFonts" , APPEARANCE_GROUP , QVariant::Bool }
, { BoldIntense, "BoldIntense", APPEARANCE_GROUP, QVariant::Bool } , { BoldIntense, "BoldIntense", APPEARANCE_GROUP, QVariant::Bool }
, { UseFontLineCharacters, "UseFontLineChararacters", APPEARANCE_GROUP, QVariant::Bool }
, { LineSpacing , "LineSpacing" , APPEARANCE_GROUP , QVariant::Int } , { LineSpacing , "LineSpacing" , APPEARANCE_GROUP , QVariant::Int }
// Keyboard // Keyboard
...@@ -199,6 +200,7 @@ FallbackProfile::FallbackProfile() ...@@ -199,6 +200,7 @@ FallbackProfile::FallbackProfile()
setProperty(DefaultEncoding, QString(QTextCodec::codecForLocale()->name())); setProperty(DefaultEncoding, QString(QTextCodec::codecForLocale()->name()));
setProperty(AntiAliasFonts, true); setProperty(AntiAliasFonts, true);
setProperty(BoldIntense, true); setProperty(BoldIntense, true);
setProperty(UseFontLineCharacters, false);
setProperty(WordCharacters, ":@-./_~?&=%+#"); setProperty(WordCharacters, ":@-./_~?&=%+#");
......
...@@ -223,6 +223,9 @@ public: ...@@ -223,6 +223,9 @@ public:
/** (bool) Whether character with intense colors should be rendered /** (bool) Whether character with intense colors should be rendered
* in bold font or just in bright color. */ * in bold font or just in bright color. */
BoldIntense, BoldIntense,
/** (bool) Whether to use font's line characters instead of the
* builtin code. */
UseFontLineCharacters,
/** (bool) Whether new sessions should be started in the same /** (bool) Whether new sessions should be started in the same
* directory as the currently active session. * directory as the currently active session.
*/ */
...@@ -479,6 +482,11 @@ public: ...@@ -479,6 +482,11 @@ public:
return property<bool>(Profile::BoldIntense); return property<bool>(Profile::BoldIntense);
} }
/** Convenience method for property<bool>(Profile::UseFontLineCharacters)*/
bool useFontLineCharacters() const {
return property<bool>(Profile::UseFontLineCharacters);
}
/** Convenience method for property<bool>(Profile::StartInCurrentSessionDir) */ /** Convenience method for property<bool>(Profile::StartInCurrentSessionDir) */
bool startInCurrentSessionDir() const { bool startInCurrentSessionDir() const {
return property<bool>(Profile::StartInCurrentSessionDir); return property<bool>(Profile::StartInCurrentSessionDir);
......
...@@ -375,6 +375,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent) ...@@ -375,6 +375,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent)
, _filterUpdateRequired(true) , _filterUpdateRequired(true)
, _cursorShape(Enum::BlockCursor) , _cursorShape(Enum::BlockCursor)
, _antialiasText(true) , _antialiasText(true)
, _useFontLineCharacters(false)
, _printerFriendly(false) , _printerFriendly(false)
, _sessionController(0) , _sessionController(0)
, _trimTrailingSpaces(false) , _trimTrailingSpaces(false)
...@@ -854,7 +855,7 @@ void TerminalDisplay::drawCharacters(QPainter& painter, ...@@ -854,7 +855,7 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
} }
// draw text // draw text
if (isLineCharString(text)) { if (isLineCharString(text) && !_useFontLineCharacters) {
drawLineCharString(painter, rect.x(), rect.y(), text, style); drawLineCharString(painter, rect.x(), rect.y(), text, style);
} else { } else {
// Force using LTR as the document layout for the terminal area, because // Force using LTR as the document layout for the terminal area, because
......
...@@ -414,6 +414,21 @@ public: ...@@ -414,6 +414,21 @@ public:
return _boldIntense; return _boldIntense;
} }
/**
* Specifies whether line characters will be displayed using font instead
* of builtin code.
* as bold. Defaults to false.
*/
void setUseFontLineCharacters(bool value) {
_useFontLineCharacters = value;
}
/**
* Returns true if font line characters will be used.
*/
bool getFontLineCharacters() const {
return _useFontLineCharacters;
}
/** /**
* Sets whether or not the current height and width of the * Sets whether or not the current height and width of the
* terminal in lines and columns is displayed whilst the widget * terminal in lines and columns is displayed whilst the widget
...@@ -920,6 +935,7 @@ private: ...@@ -920,6 +935,7 @@ private:
InputMethodData _inputMethodData; InputMethodData _inputMethodData;
bool _antialiasText; // do we anti-alias or not bool _antialiasText; // do we anti-alias or not
bool _useFontLineCharacters;
bool _printerFriendly; // are we currently painting to a printer in black/white mode bool _printerFriendly; // are we currently painting to a printer in black/white mode
......
...@@ -777,6 +777,7 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr ...@@ -777,6 +777,7 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
// load font // load font
view->setAntialias(profile->antiAliasFonts()); view->setAntialias(profile->antiAliasFonts());
view->setBoldIntense(profile->boldIntense()); view->setBoldIntense(profile->boldIntense());
view->setUseFontLineCharacters(profile->useFontLineCharacters());
view->setVTFont(profile->font()); view->setVTFont(profile->font());
// set scroll-bar position // set scroll-bar position
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment