diff options
Diffstat (limited to 'Applications/FontEditor')
-rw-r--r-- | Applications/FontEditor/FontEditor.cpp | 4 | ||||
-rw-r--r-- | Applications/FontEditor/FontEditor.h | 5 | ||||
-rw-r--r-- | Applications/FontEditor/GlyphEditorWidget.cpp | 4 | ||||
-rw-r--r-- | Applications/FontEditor/GlyphEditorWidget.h | 9 | ||||
-rw-r--r-- | Applications/FontEditor/GlyphMapWidget.cpp | 4 | ||||
-rw-r--r-- | Applications/FontEditor/GlyphMapWidget.h | 9 | ||||
-rw-r--r-- | Applications/FontEditor/main.cpp | 12 |
7 files changed, 25 insertions, 22 deletions
diff --git a/Applications/FontEditor/FontEditor.cpp b/Applications/FontEditor/FontEditor.cpp index 25e3479346..56cbf3e06b 100644 --- a/Applications/FontEditor/FontEditor.cpp +++ b/Applications/FontEditor/FontEditor.cpp @@ -38,11 +38,11 @@ #include <LibGUI/SpinBox.h> #include <LibGUI/TextBox.h> #include <LibGUI/Window.h> -#include <LibGfx/Font.h> +#include <LibGfx/BitmapFont.h> #include <LibGfx/Palette.h> #include <stdlib.h> -FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::Font>&& edited_font) +FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&& edited_font) : m_edited_font(move(edited_font)) , m_path(path) { diff --git a/Applications/FontEditor/FontEditor.h b/Applications/FontEditor/FontEditor.h index 785af863e3..ed904e8e7d 100644 --- a/Applications/FontEditor/FontEditor.h +++ b/Applications/FontEditor/FontEditor.h @@ -28,6 +28,7 @@ #include <AK/Function.h> #include <LibGUI/Widget.h> +#include <LibGfx/BitmapFont.h> class GlyphEditorWidget; class GlyphMapWidget; @@ -45,8 +46,8 @@ public: const String& path() { return m_path; } private: - FontEditorWidget(const String& path, RefPtr<Gfx::Font>&&); - RefPtr<Gfx::Font> m_edited_font; + FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&); + RefPtr<Gfx::BitmapFont> m_edited_font; RefPtr<GlyphMapWidget> m_glyph_map_widget; RefPtr<GlyphEditorWidget> m_glyph_editor_widget; diff --git a/Applications/FontEditor/GlyphEditorWidget.cpp b/Applications/FontEditor/GlyphEditorWidget.cpp index 57cbed8058..6f545c1ccd 100644 --- a/Applications/FontEditor/GlyphEditorWidget.cpp +++ b/Applications/FontEditor/GlyphEditorWidget.cpp @@ -26,10 +26,10 @@ #include "GlyphEditorWidget.h" #include <LibGUI/Painter.h> -#include <LibGfx/Font.h> +#include <LibGfx/BitmapFont.h> #include <LibGfx/Palette.h> -GlyphEditorWidget::GlyphEditorWidget(Gfx::Font& mutable_font) +GlyphEditorWidget::GlyphEditorWidget(Gfx::BitmapFont& mutable_font) : m_font(mutable_font) { set_relative_rect({ 0, 0, preferred_width(), preferred_height() }); diff --git a/Applications/FontEditor/GlyphEditorWidget.h b/Applications/FontEditor/GlyphEditorWidget.h index f53d78d851..a54c551642 100644 --- a/Applications/FontEditor/GlyphEditorWidget.h +++ b/Applications/FontEditor/GlyphEditorWidget.h @@ -28,6 +28,7 @@ #include <AK/Function.h> #include <LibGUI/Frame.h> +#include <LibGfx/BitmapFont.h> class GlyphEditorWidget final : public GUI::Frame { C_OBJECT(GlyphEditorWidget) @@ -40,20 +41,20 @@ public: int preferred_width() const; int preferred_height() const; - Gfx::Font& font() { return *m_font; } - const Gfx::Font& font() const { return *m_font; } + Gfx::BitmapFont& font() { return *m_font; } + const Gfx::BitmapFont& font() const { return *m_font; } Function<void(u8)> on_glyph_altered; private: - GlyphEditorWidget(Gfx::Font&); + GlyphEditorWidget(Gfx::BitmapFont&); virtual void paint_event(GUI::PaintEvent&) override; virtual void mousedown_event(GUI::MouseEvent&) override; virtual void mousemove_event(GUI::MouseEvent&) override; void draw_at_mouse(const GUI::MouseEvent&); - RefPtr<Gfx::Font> m_font; + RefPtr<Gfx::BitmapFont> m_font; int m_glyph { 0 }; int m_scale { 10 }; }; diff --git a/Applications/FontEditor/GlyphMapWidget.cpp b/Applications/FontEditor/GlyphMapWidget.cpp index 6d0561ad89..ed6a65493f 100644 --- a/Applications/FontEditor/GlyphMapWidget.cpp +++ b/Applications/FontEditor/GlyphMapWidget.cpp @@ -26,10 +26,10 @@ #include "GlyphMapWidget.h" #include <LibGUI/Painter.h> -#include <LibGfx/Font.h> +#include <LibGfx/BitmapFont.h> #include <LibGfx/Palette.h> -GlyphMapWidget::GlyphMapWidget(Gfx::Font& mutable_font) +GlyphMapWidget::GlyphMapWidget(Gfx::BitmapFont& mutable_font) : m_font(mutable_font) { m_glyph_count = mutable_font.glyph_count(); diff --git a/Applications/FontEditor/GlyphMapWidget.h b/Applications/FontEditor/GlyphMapWidget.h index 4c6243ef68..2c8443a251 100644 --- a/Applications/FontEditor/GlyphMapWidget.h +++ b/Applications/FontEditor/GlyphMapWidget.h @@ -29,6 +29,7 @@ #include <AK/Function.h> #include <AK/StdLibExtras.h> #include <LibGUI/Frame.h> +#include <LibGfx/BitmapFont.h> class GlyphMapWidget final : public GUI::Frame { C_OBJECT(GlyphMapWidget) @@ -44,22 +45,22 @@ public: int preferred_width() const; int preferred_height() const; - Gfx::Font& font() { return *m_font; } - const Gfx::Font& font() const { return *m_font; } + Gfx::BitmapFont& font() { return *m_font; } + const Gfx::BitmapFont& font() const { return *m_font; } void update_glyph(int); Function<void(int)> on_glyph_selected; private: - explicit GlyphMapWidget(Gfx::Font&); + explicit GlyphMapWidget(Gfx::BitmapFont&); virtual void paint_event(GUI::PaintEvent&) override; virtual void mousedown_event(GUI::MouseEvent&) override; virtual void keydown_event(GUI::KeyEvent&) override; Gfx::IntRect get_outer_rect(int glyph) const; - RefPtr<Gfx::Font> m_font; + RefPtr<Gfx::BitmapFont> m_font; int m_glyph_count; int m_columns { 32 }; int m_horizontal_spacing { 2 }; diff --git a/Applications/FontEditor/main.cpp b/Applications/FontEditor/main.cpp index 9108445f1b..873248bd4e 100644 --- a/Applications/FontEditor/main.cpp +++ b/Applications/FontEditor/main.cpp @@ -36,7 +36,7 @@ #include <LibGUI/MessageBox.h> #include <LibGUI/Window.h> #include <LibGfx/Bitmap.h> -#include <LibGfx/Font.h> +#include <LibGfx/BitmapFont.h> #include <LibGfx/FontDatabase.h> #include <LibGfx/Point.h> #include <stdio.h> @@ -60,12 +60,12 @@ int main(int argc, char** argv) args_parser.add_positional_argument(path, "The font file for editing.", "file", Core::ArgsParser::Required::No); args_parser.parse(argc, argv); - RefPtr<Gfx::Font> edited_font; + RefPtr<Gfx::BitmapFont> edited_font; if (path == nullptr) { path = "/tmp/saved.font"; - edited_font = Gfx::FontDatabase::default_font().clone(); + edited_font = static_ptr_cast<Gfx::BitmapFont>(Gfx::FontDatabase::default_font().clone()); } else { - edited_font = Gfx::Font::load_from_file(path)->clone(); + edited_font = static_ptr_cast<Gfx::BitmapFont>(Gfx::Font::load_from_file(path)->clone()); if (!edited_font) { String message = String::formatted("Couldn't load font: {}\n", path); GUI::MessageBox::show(nullptr, message, "Font Editor", GUI::MessageBox::Type::Error); @@ -78,7 +78,7 @@ int main(int argc, char** argv) auto window = GUI::Window::construct(); window->set_icon(app_icon.bitmap_for_size(16)); - auto set_edited_font = [&](const String& path, RefPtr<Gfx::Font>&& font, Gfx::IntPoint point) { + auto set_edited_font = [&](const String& path, RefPtr<Gfx::BitmapFont>&& font, Gfx::IntPoint point) { // Convert 256 char font to 384 char font. if (font->type() == Gfx::FontTypes::Default) font->set_type(Gfx::FontTypes::LatinExtendedA); @@ -97,7 +97,7 @@ int main(int argc, char** argv) if (!open_path.has_value()) return; - RefPtr<Gfx::Font> new_font = Gfx::Font::load_from_file(open_path.value())->clone(); + RefPtr<Gfx::BitmapFont> new_font = static_ptr_cast<Gfx::BitmapFont>(Gfx::Font::load_from_file(open_path.value())->clone()); if (!new_font) { String message = String::formatted("Couldn't load font: {}\n", open_path.value()); GUI::MessageBox::show(window, message, "Font Editor", GUI::MessageBox::Type::Error); |