From 0a0b29d349c56f6e99243457000aee4c0617b6d4 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Sun, 25 Jul 2021 11:37:17 -0500 Subject: [PATCH] (librunview) Fix use of B_REGULAR_FACE if not default --- libs/librunview/RunView.cpp | 20 +++++++++++++++++--- libs/librunview/RunView.h | 5 +++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/libs/librunview/RunView.cpp b/libs/librunview/RunView.cpp index 04acb50..0122f9b 100644 --- a/libs/librunview/RunView.cpp +++ b/libs/librunview/RunView.cpp @@ -177,10 +177,8 @@ RunView::Select(int32 startOffset, int32 endOffset) void -RunView::Append(const char* text, rgb_color color, uint16 fontFace) +RunView::Append(const char* text, rgb_color color, BFont font) { - BFont font; - font.SetFace(fontFace); text_run run = { 0, font, color }; text_run_array array = { 1, {run} }; @@ -189,6 +187,22 @@ RunView::Append(const char* text, rgb_color color, uint16 fontFace) } +void +RunView::Append(const char* text, rgb_color color, uint16 fontFace) +{ + BFont font; + font.SetFace(fontFace); + Append(text, color, font); +} + + +void +RunView::Append(const char* text, rgb_color color) +{ + Append(text, color, BFont()); +} + + void RunView::Append(const char* text) { diff --git a/libs/librunview/RunView.h b/libs/librunview/RunView.h index 8bd0fdb..34648f6 100644 --- a/libs/librunview/RunView.h +++ b/libs/librunview/RunView.h @@ -26,8 +26,9 @@ public: virtual void Select(int32 startOffset, int32 endOffset); - void Append(const char* text, rgb_color color, - uint16 fontFace = B_REGULAR_FACE); + void Append(const char* text, rgb_color color, BFont font); + void Append(const char* text, rgb_color color, uint16 fontFace); + void Append(const char* text, rgb_color color); void Append(const char* text); BString WordAt(BPoint point);