feat: move fonts/icons/man to 0:/os, add capabilities GUI app
This commit is contained in:
1 parent
80b5beb17d
commit
75e85f24ef
35 files changed
+1035
-177
No files matched your search
@@ -446,7 +446,7 @@ static int wp_split_at(WordProcessorState* wp, int abs_pos) {
|
||||
// ============================================================================
|
||||
// Font discovery
|
||||
//
|
||||
// Fonts live in 0:/fonts as "<Family>-<Style>.ttf" (e.g. Roboto-BoldItalic.ttf).
|
||||
// Fonts live in 0:/os/fonts as "<Family>-<Style>.ttf" (e.g. Roboto-BoldItalic.ttf).
|
||||
// We scan that directory at startup, group files by family, and slot each file
|
||||
// into one of four style variants. Families are sorted deterministically so a
|
||||
// given set of installed fonts yields stable font ids across runs. Documents
|
||||
@@ -560,7 +560,7 @@ static void wp_register_font_file(const char* filename) {
|
||||
WpFontFamily* fam = &g_wp_fonts.families[fi];
|
||||
if (fam->paths[variant][0]) return; // first file wins for this slot
|
||||
|
||||
montauk::strncpy(fam->paths[variant], "0:/fonts/", WP_FONT_PATH_MAX);
|
||||
montauk::strncpy(fam->paths[variant], "0:/os/fonts/", WP_FONT_PATH_MAX);
|
||||
int plen = montauk::slen(fam->paths[variant]);
|
||||
montauk::strncpy(fam->paths[variant] + plen, filename, WP_FONT_PATH_MAX - plen);
|
||||
montauk::strncpy(fam->basenames[variant], stem, WP_FONT_BASENAME_MAX);
|
||||
@@ -601,7 +601,7 @@ void wp_load_fonts() {
|
||||
g_wp_fonts.count = 0;
|
||||
|
||||
const char* names[256];
|
||||
int count = montauk::readdir("0:/fonts", names, 256);
|
||||
int count = montauk::readdir("0:/os/fonts", names, 256);
|
||||
|
||||
// Sort entries so per-slot conflicts resolve deterministically. With
|
||||
// first-wins below, "Roboto-Medium" sorts before "Roboto-Regular" and
|
||||
@@ -653,7 +653,7 @@ void wp_load_fonts() {
|
||||
}
|
||||
}
|
||||
|
||||
// Defensive fallback: if 0:/fonts yielded nothing usable, expose the
|
||||
// Defensive fallback: if 0:/os/fonts yielded nothing usable, expose the
|
||||
// shared system font so the editor still renders.
|
||||
if (g_wp_fonts.count == 0 && fonts::system_font) {
|
||||
WpFontFamily* fam = &g_wp_fonts.families[0];
|
||||
|
||||
@@ -31,36 +31,36 @@ TrueTypeFont* g_ui_bold = nullptr;
|
||||
void wp_load_icons() {
|
||||
Color def_color = colors::ICON_COLOR;
|
||||
if (!g_icon_folder.pixels)
|
||||
g_icon_folder = svg_load("0:/icons/folder.svg", 16, 16, def_color);
|
||||
g_icon_folder = svg_load("0:/os/icons/folder.svg", 16, 16, def_color);
|
||||
if (!g_icon_save.pixels)
|
||||
g_icon_save = svg_load("0:/icons/document-save-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_save = svg_load("0:/os/icons/document-save-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_print.pixels)
|
||||
g_icon_print = svg_load("0:/icons/printer-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_print = svg_load("0:/os/icons/printer-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_export_pdf.pixels) {
|
||||
g_icon_export_pdf = svg_load("0:/icons/document-export-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_export_pdf = svg_load("0:/os/icons/document-export-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_export_pdf.pixels)
|
||||
g_icon_export_pdf = svg_load("0:/icons/text-x-generic-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_export_pdf = svg_load("0:/os/icons/text-x-generic-symbolic.svg", 16, 16, def_color);
|
||||
}
|
||||
if (!g_icon_undo.pixels)
|
||||
g_icon_undo = svg_load("0:/icons/edit-undo-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_undo = svg_load("0:/os/icons/edit-undo-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_redo.pixels)
|
||||
g_icon_redo = svg_load("0:/icons/edit-redo-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_redo = svg_load("0:/os/icons/edit-redo-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_align_left.pixels)
|
||||
g_icon_align_left = svg_load("0:/icons/format-justify-left-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_align_left = svg_load("0:/os/icons/format-justify-left-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_align_center.pixels)
|
||||
g_icon_align_center = svg_load("0:/icons/format-justify-center-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_align_center = svg_load("0:/os/icons/format-justify-center-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_align_right.pixels)
|
||||
g_icon_align_right = svg_load("0:/icons/format-justify-right-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_align_right = svg_load("0:/os/icons/format-justify-right-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_list_bullet.pixels)
|
||||
g_icon_list_bullet = svg_load("0:/icons/view-list-bullet-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_list_bullet = svg_load("0:/os/icons/view-list-bullet-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_list_number.pixels)
|
||||
g_icon_list_number = svg_load("0:/icons/view-list-ordered-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_list_number = svg_load("0:/os/icons/view-list-ordered-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_indent_less.pixels)
|
||||
g_icon_indent_less = svg_load("0:/icons/format-indent-less-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_indent_less = svg_load("0:/os/icons/format-indent-less-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_indent_more.pixels)
|
||||
g_icon_indent_more = svg_load("0:/icons/format-indent-more-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_indent_more = svg_load("0:/os/icons/format-indent-more-symbolic.svg", 16, 16, def_color);
|
||||
if (!g_icon_page_view.pixels)
|
||||
g_icon_page_view = svg_load("0:/icons/view-paged-symbolic.svg", 16, 16, def_color);
|
||||
g_icon_page_view = svg_load("0:/os/icons/view-paged-symbolic.svg", 16, 16, def_color);
|
||||
}
|
||||
|
||||
void wp_cleanup_state() {
|
||||
|
||||
@@ -82,12 +82,12 @@ static constexpr int WP_DIVIDER_FLYOUT_W = 216;
|
||||
static constexpr int WP_SPECIAL_CHAR_ROW_H = 24;
|
||||
static constexpr int WP_SPECIAL_CHAR_FLYOUT_W = 144;
|
||||
|
||||
// Fonts are discovered at runtime by scanning 0:/fonts (see wp_load_fonts).
|
||||
// Fonts are discovered at runtime by scanning 0:/os/fonts (see wp_load_fonts).
|
||||
// A font id is an index into the discovered family table (g_wp_fonts). The
|
||||
// table is bounded by WP_MAX_FONTS; ids beyond the table fall back to default.
|
||||
static constexpr int WP_MAX_FONTS = 24; // max discovered families
|
||||
static constexpr int WP_FONT_NAME_MAX = 32; // family/display name
|
||||
static constexpr int WP_FONT_PATH_MAX = 96; // "0:/fonts/<file>.ttf"
|
||||
static constexpr int WP_FONT_PATH_MAX = 96; // "0:/os/fonts/<file>.ttf"
|
||||
static constexpr int WP_FONT_BASENAME_MAX = 48; // filename stem (PDF base font)
|
||||
|
||||
static constexpr uint8_t STYLE_BOLD = 0x01;
|
||||
|
||||
Reference in new issue
Block a user