yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
font_picker.h
Go to the documentation of this file.
1#ifndef YAZE_APP_GUI_WIDGETS_FONT_PICKER_H_
2#define YAZE_APP_GUI_WIDGETS_FONT_PICKER_H_
3
4#include "imgui/imgui.h"
5
6namespace yaze {
7namespace gui {
8
9// Dropdown listing all fonts registered with ImGui::GetIO().Fonts. The
10// preview row renders each font's name in its own face. Returns true on
11// the frame the user selects a different font and mutates *index.
12//
13// Persistence, active-font application, and undo are intentionally the
14// caller's responsibility:
15//
16// int idx = prefs.font_family_index;
17// if (gui::FontPicker("Font", &idx)) {
18// prefs.font_family_index = idx;
19// gui::SetActiveFontIndex(idx);
20// settings_dirty_ = true;
21// }
22//
23// `label` is shown left of the combo per ImGui convention. Pass the empty
24// string or "##foo" to suppress the label.
25bool FontPicker(const char* label, int* index);
26
27namespace font_picker_internal {
28
29// Returns a human-readable name for the font at the given index.
30// Uses ImFont::GetDebugName() when non-empty, otherwise "Font #N".
31const char* FontNameAt(int index);
32
33// Returns the count of registered fonts (ImGui::GetIO().Fonts->Fonts.Size),
34// or 0 when the ImGui context/font atlas isn't set up yet.
36
37} // namespace font_picker_internal
38
39} // namespace gui
40} // namespace yaze
41
42#endif // YAZE_APP_GUI_WIDGETS_FONT_PICKER_H_
const char * FontNameAt(int index)
bool FontPicker(const char *label, int *index)