1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

WindowServer+LibGUI+FontEditor: Encode special characters as UTF-8

This commit is contained in:
Sergey Bugaev 2019-09-04 23:50:40 +03:00 committed by Andreas Kling
parent 84bc6a92a7
commit 22e6978c71
5 changed files with 17 additions and 7 deletions

View file

@ -2,6 +2,7 @@
#include "GlyphEditorWidget.h" #include "GlyphEditorWidget.h"
#include "GlyphMapWidget.h" #include "GlyphMapWidget.h"
#include "UI_FontEditorBottom.h" #include "UI_FontEditorBottom.h"
#include <AK/StringBuilder.h>
#include <LibGUI/GButton.h> #include <LibGUI/GButton.h>
#include <LibGUI/GCheckBox.h> #include <LibGUI/GCheckBox.h>
#include <LibGUI/GGroupBox.h> #include <LibGUI/GGroupBox.h>
@ -77,7 +78,16 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_fon
m_glyph_map_widget->on_glyph_selected = [this](u8 glyph) { m_glyph_map_widget->on_glyph_selected = [this](u8 glyph) {
m_glyph_editor_widget->set_glyph(glyph); m_glyph_editor_widget->set_glyph(glyph);
m_ui->width_spinbox->set_value(m_edited_font->glyph_width(m_glyph_map_widget->selected_glyph())); m_ui->width_spinbox->set_value(m_edited_font->glyph_width(m_glyph_map_widget->selected_glyph()));
m_ui->info_label->set_text(String::format("0x%b (%c)", glyph, glyph)); StringBuilder builder;
builder.appendf("0x%b (", glyph);
if (glyph < 128) {
builder.append(glyph);
} else {
builder.append(128 | 64 | (glyph / 64));
builder.append(128 | (glyph % 64));
}
builder.append(')');
m_ui->info_label->set_text(builder.to_string());
}; };
m_ui->fixed_width_checkbox->on_checked = [this, update_demo](bool checked) { m_ui->fixed_width_checkbox->on_checked = [this, update_demo](bool checked) {

View file

@ -20,7 +20,7 @@ GComboBox::GComboBox(GWidget* parent)
}; };
m_open_button = new GButton(this); m_open_button = new GButton(this);
m_open_button->set_focusable(false); m_open_button->set_focusable(false);
m_open_button->set_text("\xf7"); m_open_button->set_text("\xc3\xb6");
m_open_button->on_click = [this](auto&) { m_open_button->on_click = [this](auto&) {
if (m_list_window->is_visible()) if (m_list_window->is_visible())
close(); close();

View file

@ -17,12 +17,12 @@ GSpinBox::GSpinBox(GWidget* parent)
}; };
m_increment_button = new GButton(this); m_increment_button = new GButton(this);
m_increment_button->set_focusable(false); m_increment_button->set_focusable(false);
m_increment_button->set_text("\xf6"); m_increment_button->set_text("\xc3\xb6");
m_increment_button->on_click = [this](GButton&) { set_value(m_value + 1); }; m_increment_button->on_click = [this](GButton&) { set_value(m_value + 1); };
m_increment_button->set_auto_repeat_interval(150); m_increment_button->set_auto_repeat_interval(150);
m_decrement_button = new GButton(this); m_decrement_button = new GButton(this);
m_decrement_button->set_focusable(false); m_decrement_button->set_focusable(false);
m_decrement_button->set_text("\xf7"); m_decrement_button->set_text("\xc3\xb7");
m_decrement_button->on_click = [this](GButton&) { set_value(m_value - 1); }; m_decrement_button->on_click = [this](GButton&) { set_value(m_value - 1); };
m_decrement_button->set_auto_repeat_interval(150); m_decrement_button->set_auto_repeat_interval(150);
} }

View file

@ -341,9 +341,9 @@ void GTableView::paint_headers(Painter& painter)
builder.append(model()->column_name(column_index)); builder.append(model()->column_name(column_index));
auto sort_order = model()->sort_order(); auto sort_order = model()->sort_order();
if (sort_order == GSortOrder::Ascending) if (sort_order == GSortOrder::Ascending)
builder.append(" \xf6"); builder.append(" \xc3\xb6");
else if (sort_order == GSortOrder::Descending) else if (sort_order == GSortOrder::Descending)
builder.append(" \xf7"); builder.append(" \xc3\xb7");
text = builder.to_string(); text = builder.to_string();
} else { } else {
text = model()->column_name(column_index); text = model()->column_name(column_index);

View file

@ -56,7 +56,7 @@ WSWindowManager::WSWindowManager()
{ "/bin/SystemMonitor", "Open SystemMonitor...", "/res/icons/16x16/app-system-monitor.png" } { "/bin/SystemMonitor", "Open SystemMonitor...", "/res/icons/16x16/app-system-monitor.png" }
}; };
u8 system_menu_name[] = { 0xf8, 0 }; u8 system_menu_name[] = { 0xc3, 0xb8, 0 };
m_system_menu = make<WSMenu>(nullptr, -1, String((const char*)system_menu_name)); m_system_menu = make<WSMenu>(nullptr, -1, String((const char*)system_menu_name));
int appIndex = 1; int appIndex = 1;