diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-06 14:06:40 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-06 14:06:40 +0100 |
commit | 66a5ddd94a78818eb6a56b8aec6e1040171fc8ed (patch) | |
tree | 6b72baf79308539b2196271812ee9e2c6f06d278 /Applications/Terminal | |
parent | e53cef02d5a66591efb2d85f9ca576dcfe7a5421 (diff) | |
download | serenity-66a5ddd94a78818eb6a56b8aec6e1040171fc8ed.zip |
More work on the variable-width font support.
Katica is now the default system font, and it looks quite nice. :^)
I'm gonna need to refine the GTextBox movement stuff eventually,
but it works well-enough for basic editing now.
Diffstat (limited to 'Applications/Terminal')
-rw-r--r-- | Applications/Terminal/Terminal.cpp | 4 | ||||
-rw-r--r-- | Applications/Terminal/Terminal.h | 3 | ||||
-rw-r--r-- | Applications/Terminal/main.cpp | 2 |
3 files changed, 3 insertions, 6 deletions
diff --git a/Applications/Terminal/Terminal.cpp b/Applications/Terminal/Terminal.cpp index 136f47e86d..25df6def7d 100644 --- a/Applications/Terminal/Terminal.cpp +++ b/Applications/Terminal/Terminal.cpp @@ -19,9 +19,9 @@ Terminal::Terminal(int ptm_fd) : m_ptm_fd(ptm_fd) - , m_font(Font::default_font()) , m_notifier(ptm_fd, GNotifier::Read) { + set_font(Font::default_fixed_width_font()); m_notifier.on_ready_to_read = [this] (GNotifier& notifier) { byte buffer[BUFSIZ]; ssize_t nread = read(notifier.fd(), buffer, sizeof(buffer)); @@ -798,7 +798,7 @@ void Terminal::force_repaint() void Terminal::resize_event(GResizeEvent& event) { - int new_columns = event.size().width() / m_font->glyph_width('x'); + int new_columns = event.size().width() / font().glyph_width('x'); int new_rows = event.size().height() / m_line_height; set_size(new_columns, new_rows); } diff --git a/Applications/Terminal/Terminal.h b/Applications/Terminal/Terminal.h index 0e1a5f2d54..ec11a62f0e 100644 --- a/Applications/Terminal/Terminal.h +++ b/Applications/Terminal/Terminal.h @@ -30,7 +30,6 @@ private: virtual void keydown_event(GKeyEvent&) override; virtual const char* class_name() const override { return "Terminal"; } - Font& font() { return *m_font; } void scroll_up(); void newline(); void set_cursor(unsigned row, unsigned column); @@ -145,8 +144,6 @@ private: bool m_in_active_window { false }; bool m_need_full_flush { false }; - RetainPtr<Font> m_font; - GNotifier m_notifier; float m_opacity { 0.8f }; diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp index 6bb0482efd..dfbc2fa6fa 100644 --- a/Applications/Terminal/main.cpp +++ b/Applications/Terminal/main.cpp @@ -108,7 +108,7 @@ int main(int argc, char** argv) menubar->add_menu(move(app_menu)); auto font_menu = make<GMenu>("Font"); - GFontDatabase::the().for_each_font([&] (const String& font_name) { + GFontDatabase::the().for_each_fixed_width_font([&] (const String& font_name) { font_menu->add_action(GAction::create(font_name, [&terminal] (const GAction& action) { terminal.set_font(GFontDatabase::the().get_by_name(action.text())); terminal.force_repaint(); |