Commit a4de3feb 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
parent 4c57169c
......@@ -447,6 +447,10 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile)
_ui->boldIntenseButton->setChecked(profile->boldIntense());
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());
connect(_ui->enableMouseWheelZoomButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::toggleMouseWheelZoom);
}
......@@ -474,6 +478,11 @@ void EditProfileDialog::setBoldIntense(bool enable)
preview(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)
{
updateTempProfileProperty(Profile::MouseWheelZoomEnabled, enable);
......
......@@ -126,6 +126,7 @@ private slots:
void showAllFontsButtonWarning(bool enable);
void setAntialiasText(bool enable);
void setBoldIntense(bool enable);
void useFontLineCharacters(bool enable);
void showFontDialog();
void newColorScheme();
void editColorScheme();
......
......@@ -613,6 +613,16 @@
</property>
</widget>
</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>
</widget>
</item>
......
......@@ -78,6 +78,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
, { ColorScheme , "colors" , 0 , QVariant::String }
, { AntiAliasFonts, "AntiAliasFonts" , APPEARANCE_GROUP , QVariant::Bool }
, { BoldIntense, "BoldIntense", APPEARANCE_GROUP, QVariant::Bool }
, { UseFontLineCharacters, "UseFontLineChararacters", APPEARANCE_GROUP, QVariant::Bool }
, { LineSpacing , "LineSpacing" , APPEARANCE_GROUP , QVariant::Int }
// Keyboard
......@@ -199,6 +200,7 @@ FallbackProfile::FallbackProfile()
setProperty(DefaultEncoding, QString(QTextCodec::codecForLocale()->name()));
setProperty(AntiAliasFonts, true);
setProperty(BoldIntense, true);
setProperty(UseFontLineCharacters, false);
setProperty(WordCharacters, ":@-./_~?&=%+#");
......
......@@ -223,6 +223,9 @@ public:
/** (bool) Whether character with intense colors should be rendered
* in bold font or just in bright color. */
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
* directory as the currently active session.
*/
......@@ -479,6 +482,11 @@ public:
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) */
bool startInCurrentSessionDir() const {
return property<bool>(Profile::StartInCurrentSessionDir);
......
......@@ -375,6 +375,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent)
, _filterUpdateRequired(true)
, _cursorShape(Enum::BlockCursor)
, _antialiasText(true)
, _useFontLineCharacters(false)
, _printerFriendly(false)
, _sessionController(0)
, _trimTrailingSpaces(false)
......@@ -854,7 +855,7 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
}
// draw text
if (isLineCharString(text)) {
if (isLineCharString(text) && !_useFontLineCharacters) {
drawLineCharString(painter, rect.x(), rect.y(), text, style);
} else {
// Force using LTR as the document layout for the terminal area, because
......
......@@ -414,6 +414,21 @@ public:
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
* terminal in lines and columns is displayed whilst the widget
......@@ -920,6 +935,7 @@ private:
InputMethodData _inputMethodData;
bool _antialiasText; // do we anti-alias or not
bool _useFontLineCharacters;
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
// load font
view->setAntialias(profile->antiAliasFonts());
view->setBoldIntense(profile->boldIntense());
view->setUseFontLineCharacters(profile->useFontLineCharacters());
view->setVTFont(profile->font());
// 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