diff --git a/src/apps/terminal/PrefHandler.cpp b/src/apps/terminal/PrefHandler.cpp index 4013e56c76..c9e159c838 100644 --- a/src/apps/terminal/PrefHandler.cpp +++ b/src/apps/terminal/PrefHandler.cpp @@ -81,6 +81,7 @@ static const pref_defaults kTermDefaults[] = { { PREF_BLINK_CURSOR, PREF_TRUE }, { PREF_WARN_ON_EXIT, PREF_TRUE }, { PREF_CURSOR_STYLE, PREF_BLOCK_CURSOR }, + { PREF_EMULATE_BOLD, PREF_FALSE }, { NULL, NULL}, }; diff --git a/src/apps/terminal/TermConst.h b/src/apps/terminal/TermConst.h index 22e4a54cc0..34b57ed1ea 100644 --- a/src/apps/terminal/TermConst.h +++ b/src/apps/terminal/TermConst.h @@ -155,6 +155,7 @@ static const char* const PREF_TEXT_ENCODING = "Text encoding"; static const char* const PREF_BLINK_CURSOR = "Blinking cursor"; static const char* const PREF_WARN_ON_EXIT = "Warn on exit"; static const char* const PREF_CURSOR_STYLE = "Cursor style"; +static const char* const PREF_EMULATE_BOLD = "Emulate bold"; static const char* const PREF_TAB_TITLE = "Tab title"; static const char* const PREF_WINDOW_TITLE = "Window title"; diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 5c9d37d55d..33ae11c571 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -296,6 +296,7 @@ TermView::_InitObject(const ShellParameters& shellParameters) fFontWidth = 0; fFontHeight = 0; fFontAscent = 0; + fEmulateBold = false; fFrameResized = false; fResizeViewDisableCount = 0; fLastActivityTime = 0; @@ -722,6 +723,9 @@ TermView::SetTermFont(const BFont *font) int halfWidth = 0; fHalfFont = font; + fBoldFont = font; + uint16 face = fBoldFont.Face(); + fBoldFont.SetFace(B_BOLD_FACE | (face & ~B_REGULAR_FACE)); fHalfFont.SetSpacing(B_FIXED_SPACING); @@ -754,6 +758,9 @@ TermView::SetTermFont(const BFont *font) : PrefHandler::Default()->getCursor(PREF_CURSOR_STYLE); fCursorBlinking = PrefHandler::Default()->getBool(PREF_BLINK_CURSOR); + fEmulateBold = PrefHandler::Default() == NULL ? false + : PrefHandler::Default()->getBool(PREF_EMULATE_BOLD); + _ScrollTo(0, false); if (fScrollBar != NULL) fScrollBar->SetSteps(fFontHeight, fFontHeight * fRows); @@ -930,7 +937,7 @@ void TermView::_DrawLinePart(int32 x1, int32 y1, uint32 attr, char *buf, int32 width, bool mouse, bool cursor, BView *inView) { - inView->SetFont(&fHalfFont); + inView->SetFont(IS_BOLD(attr) && !fEmulateBold ? &fBoldFont : &fHalfFont); // Set pen point int x2 = x1 + fFontWidth * width; @@ -971,22 +978,19 @@ TermView::_DrawLinePart(int32 x1, int32 y1, uint32 attr, char *buf, inView->SetHighColor(rgb_back); inView->FillRect(BRect(x1, y1, x2 - 1, y2 - 1)); inView->SetLowColor(rgb_back); - inView->SetHighColor(rgb_fore); // Draw character. - inView->MovePenTo(x1, y1 + fFontAscent); - inView->DrawString((char *) buf); - - // bold attribute. - if (IS_BOLD(attr)) { - inView->MovePenTo(x1 + 1, y1 + fFontAscent); - - inView->SetDrawingMode(B_OP_OVER); + if (IS_BOLD(attr) && fEmulateBold) { + inView->MovePenTo(x1 - 1, y1 + fFontAscent - 1); inView->DrawString((char *)buf); - inView->SetDrawingMode(B_OP_COPY); + inView->SetDrawingMode(B_OP_BLEND); } + inView->MovePenTo(x1, y1 + fFontAscent); + inView->DrawString((char *)buf); + inView->SetDrawingMode(B_OP_COPY); + // underline attribute if (IS_UNDER(attr)) { inView->MovePenTo(x1, y1 + fFontAscent); diff --git a/src/apps/terminal/TermView.h b/src/apps/terminal/TermView.h index f0707e3888..c47e5cd2c5 100644 --- a/src/apps/terminal/TermView.h +++ b/src/apps/terminal/TermView.h @@ -230,10 +230,12 @@ private: // Font and Width BFont fHalfFont; + BFont fBoldFont; int fFontWidth; int fFontHeight; int fFontAscent; struct escapement_delta fEscapement; + bool fEmulateBold; // frame resized flag. bool fFrameResized;