summaryrefslogtreecommitdiff
path: root/Userland/Applications/FontEditor/NewFontDialog.h
blob: 85724436b575873b5999b6dccd5c8bb5809648a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Copyright (c) 2021, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibGUI/Window.h>
#include <LibGUI/Wizards/WizardDialog.h>
#include <LibGUI/Wizards/WizardPage.h>
#include <LibGfx/BitmapFont.h>

class NewFontDialog final : public GUI::WizardDialog {
    C_OBJECT(NewFontDialog);

public:
    auto new_font_metadata()
    {
        save_metadata();
        return m_new_font_metadata;
    }

private:
    NewFontDialog(GUI::Window* parent_window);

    void save_metadata();

    struct NewFontMetadata {
        u8 glyph_width;
        u8 glyph_height;
        u8 glyph_spacing;
        u8 baseline;
        u8 mean_line;
        u8 presentation_size;
        u16 weight;
        String name;
        String family;
        Gfx::FontTypes type;
        bool is_fixed_width;
    } m_new_font_metadata;

    RefPtr<GUI::WizardPage> m_font_selection_page;
    RefPtr<GUI::ComboBox> m_select_font_combobox;
    RefPtr<GUI::Button> m_browse_button;

    RefPtr<GUI::WizardPage> m_font_properties_page;
    RefPtr<GUI::TextBox> m_name_textbox;
    RefPtr<GUI::TextBox> m_family_textbox;
    RefPtr<GUI::ComboBox> m_type_combobox;
    RefPtr<GUI::Label> m_type_info_label;
    RefPtr<GUI::ComboBox> m_weight_combobox;
    RefPtr<GUI::SpinBox> m_presentation_spinbox;

    RefPtr<GUI::WizardPage> m_glyph_properties_page;
    RefPtr<GUI::Widget> m_glyph_editor_container;
    RefPtr<GUI::SpinBox> m_glyph_height_spinbox;
    RefPtr<GUI::SpinBox> m_glyph_width_spinbox;
    RefPtr<GUI::SpinBox> m_baseline_spinbox;
    RefPtr<GUI::SpinBox> m_mean_line_spinbox;
    RefPtr<GUI::SpinBox> m_spacing_spinbox;
    RefPtr<GUI::CheckBox> m_fixed_width_checkbox;

    Vector<String> m_font_list;
    Vector<String> m_font_type_list;
    Vector<String> m_font_weight_list;
};