Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 253a5cc8 authored by Valentine Sinitsyn's avatar Valentine Sinitsyn

Make bold font for bright (intensive) ANSI colors a user-configurable option...

Make bold font for bright (intensive) ANSI colors a user-configurable option rather than hardcoded default.
BUG: 226308


svn path=/trunk/KDE/kdebase/apps/konsole/; revision=1133477
parent ee7b0500
......@@ -477,6 +477,11 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr info)
_ui->antialiasTextButton->setChecked(antialias);
connect( _ui->antialiasTextButton , SIGNAL(toggled(bool)) , this ,
SLOT(setAntialiasText(bool)) );
bool boldIntense = info->property<bool>(Profile::BoldIntense);
_ui->boldIntenseButton->setChecked(boldIntense);
connect( _ui->boldIntenseButton , SIGNAL(toggled(bool)) , this ,
SLOT(setBoldIntense(bool)));
}
void EditProfileDialog::setAntialiasText(bool enable)
{
......@@ -488,6 +493,11 @@ void EditProfileDialog::setAntialiasText(bool enable)
// update preview to reflect text smoothing state
fontSelected(font);
}
void EditProfileDialog::setBoldIntense(bool enable)
{
_tempProfile->setProperty(Profile::BoldIntense,enable);
preview(Profile::BoldIntense,enable);
}
void EditProfileDialog::colorSchemeAnimationUpdate()
{
QAbstractItemModel* model = _ui->colorSchemeList->model();
......
......@@ -130,6 +130,7 @@ private slots:
void setFontSliderRange(const QFont&);
void setFontSliderValue(const QFont&);
void setAntialiasText(bool enable);
void setBoldIntense(bool enable);
void showFontDialog();
void newColorScheme();
void editColorScheme();
......
......@@ -580,6 +580,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="boldIntenseButton">
<property name="text">
<string>Draw intense colors in bold font</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
......@@ -87,6 +87,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] =
, { ColorScheme , "ColorScheme" , APPEARANCE_GROUP , QVariant::String }
, { ColorScheme , "colors" , 0 , QVariant::String }
, { AntiAliasFonts, "AntiAliasFonts" , APPEARANCE_GROUP , QVariant::Bool }
, { BoldIntense, "BoldIntense", APPEARANCE_GROUP, QVariant::Bool }
// Keyboard
, { KeyBindings , "KeyBindings" , KEYBOARD_GROUP , QVariant::String }
......@@ -179,6 +180,7 @@ FallbackProfile::FallbackProfile()
setProperty(DefaultEncoding,QString(QTextCodec::codecForLocale()->name()));
setProperty(AntiAliasFonts,true);
setProperty(BoldIntense,true);
// default taken from KDE 3
setProperty(WordCharacters,":@-./_~?&=%+#");
......
......@@ -184,6 +184,9 @@ public:
AntiAliasFonts,
/** (bool) Whether new sessions should be started in the same directory as the
* currently active session. */
BoldIntense,
/** (bool) Whether character with intense colors should be rendered in bold font
* or just in bright color. */
StartInCurrentSessionDir,
/** (bool) Whether a 'New Tab' and 'Close Tab' buttons should be shown on the tab bar */
ShowNewAndCloseTabButtons,
......
......@@ -286,6 +286,7 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
,_fontHeight(1)
,_fontWidth(1)
,_fontAscent(1)
,_boldIntense(true)
,_lines(1)
,_columns(1)
,_usedLines(1)
......@@ -516,7 +517,7 @@ void TerminalDisplay::drawLineCharString( QPainter& painter, int x, int y, co
{
const QPen& currentPen = painter.pen();
if ( attributes->rendition & RE_BOLD )
if ( (attributes->rendition & RE_BOLD) && _boldIntense )
{
QPen boldPen(currentPen);
boldPen.setWidth(3);
......@@ -672,9 +673,9 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
// setup bold and underline
bool useBold;
ColorEntry::FontWeight weight = style->fontWeight(_colorTable);
ColorEntry::FontWeight weight = style->fontWeight(_colorTable);
if (weight == ColorEntry::UseCurrentFormat)
useBold = style->rendition & RE_BOLD || font().bold();
useBold = ((style->rendition & RE_BOLD) && _boldIntense) || font().bold();
else
useBold = (weight == ColorEntry::Bold) ? true : false;
bool useUnderline = style->rendition & RE_UNDERLINE || font().underline();
......
......@@ -355,6 +355,16 @@ public:
* Returns true if anti-aliasing of text in the terminal is enabled.
*/
static bool antialias() { return _antialiasText; }
/**
* Specifies whether characters with intense colors should be rendered
* as bold. Defaults to true.
*/
void setBoldIntense(bool value) { _boldIntense = value; }
/**
* Returns true if characters with intense colors are rendered in bold.
*/
bool getBoldIntense() { return _boldIntense; }
/**
* Sets whether or not the current height and width of the
......@@ -676,6 +686,7 @@ private:
int _fontHeight; // height
int _fontWidth; // width
int _fontAscent; // ascend
bool _boldIntense; // Whether intense colors should be rendered with bold font
int _leftMargin; // offset
int _topMargin; // offset
......
......@@ -832,6 +832,7 @@ void ViewManager::applyProfile(TerminalDisplay* view , const Profile::Ptr info,
// load font
view->setAntialias(info->property<bool>(Profile::AntiAliasFonts));
view->setBoldIntense(info->property<bool>(Profile::BoldIntense));
view->setVTFont(info->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