diff --git a/repos/gems/recipes/src/menu_view/used_apis b/repos/gems/recipes/src/menu_view/used_apis
index 5f95031c9b..973804df2e 100644
--- a/repos/gems/recipes/src/menu_view/used_apis
+++ b/repos/gems/recipes/src/menu_view/used_apis
@@ -13,3 +13,7 @@ framebuffer_session
input_session
timer_session
report_session
+block_session
+file_system_session
+rtc_session
+terminal_session
diff --git a/repos/gems/run/launcher.run b/repos/gems/run/launcher.run
index ad9a8df1f3..54c7887ec3 100644
--- a/repos/gems/run/launcher.run
+++ b/repos/gems/run/launcher.run
@@ -4,6 +4,7 @@ import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/pkg/wm \
genodelabs/raw/genode_bg \
+ genodelabs/pkg/fonts_fs \
genodelabs/pkg/backdrop \
genodelabs/src/demo \
genodelabs/src/init \
@@ -220,38 +221,48 @@ install_config {
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -266,6 +277,7 @@ install_config {
+
@@ -275,5 +287,4 @@ build { app/launcher test/nitpicker app/status_bar app/global_keys_handler }
build_boot_image { testnit launcher global_keys_handler status_bar }
-
run_genode_until forever
diff --git a/repos/gems/run/menu_view.run b/repos/gems/run/menu_view.run
index 996d1341d6..2eedcc16d4 100644
--- a/repos/gems/run/menu_view.run
+++ b/repos/gems/run/menu_view.run
@@ -2,6 +2,7 @@ create_boot_directory
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
+ genodelabs/pkg/fonts_fs \
genodelabs/src/init \
genodelabs/src/dynamic_rom \
genodelabs/src/report_rom \
@@ -162,13 +163,16 @@ install_config {
@@ -204,19 +208,31 @@ install_config {
+
+
+
+
+
+
+
+
+
+
-
+
+
+
diff --git a/repos/gems/src/app/launcher/menu_view_slave.h b/repos/gems/src/app/launcher/menu_view_slave.h
index 8580983cc8..3cb7184f8b 100644
--- a/repos/gems/src/app/launcher/menu_view_slave.h
+++ b/repos/gems/src/app/launcher/menu_view_slave.h
@@ -18,6 +18,7 @@
#include
#include
#include
+#include
/* gems includes */
#include
@@ -43,6 +44,7 @@ class Launcher::Menu_view_slave
Genode::Ram_session,
Genode::Rom_session,
Genode::Log_session,
+ File_system::Session,
Timer::Session>,
public Genode::Slave::Policy
{
@@ -66,6 +68,7 @@ class Launcher::Menu_view_slave
" \n"
" \n"
" \n"
+ " \n"
" \n"
"",
pos.x(), pos.y());
diff --git a/repos/gems/src/app/menu_view/label_widget.h b/repos/gems/src/app/menu_view/label_widget.h
index 3d0047abca..316e4a20dc 100644
--- a/repos/gems/src/app/menu_view/label_widget.h
+++ b/repos/gems/src/app/menu_view/label_widget.h
@@ -35,7 +35,7 @@ struct Menu_view::Label_widget : Widget
void update(Xml_node node)
{
- font = _factory.styles.font(node, "font");
+ font = _factory.styles.font(node);
text = Decorator::string_attribute(node, "text", Text(""));
}
@@ -45,7 +45,7 @@ struct Menu_view::Label_widget : Widget
return Area(0, 0);
return Area(font->string_width(text.string()).decimal(),
- font->bounding_box().h());
+ font->height());
}
void draw(Surface &pixel_surface,
diff --git a/repos/gems/src/app/menu_view/main.cc b/repos/gems/src/app/menu_view/main.cc
index 4bdbc823bd..e4514c97b5 100644
--- a/repos/gems/src/app/menu_view/main.cc
+++ b/repos/gems/src/app/menu_view/main.cc
@@ -28,6 +28,7 @@
/* gems includes */
#include
+#include
namespace Menu_view { struct Main; }
@@ -69,9 +70,34 @@ struct Menu_view::Main
Signal_handler _dialog_update_handler = {
_env.ep(), *this, &Main::_handle_dialog_update};
+ Attached_rom_dataspace _config { _env, "config" };
+
Heap _heap { _env.ram(), _env.rm() };
- Style_database _styles { _env.ram(), _env.rm(), _heap };
+ struct Vfs_env : Vfs::Env, Vfs::Io_response_handler, Vfs::Watch_response_handler
+ {
+ Genode::Env &_env;
+ Allocator &_alloc;
+ Vfs::File_system &_vfs;
+
+ Vfs_env(Genode::Env &env, Allocator &alloc, Vfs::File_system &vfs)
+ : _env(env), _alloc(alloc), _vfs(vfs) { }
+
+ void handle_io_response (Vfs::Vfs_handle::Context *) override { }
+ void handle_watch_response(Vfs::Vfs_watch_handle::Context*) override { }
+
+ Genode::Env &env() override { return _env; }
+ Allocator &alloc() override { return _alloc; }
+ Vfs::File_system &root_dir() override { return _vfs; }
+ Io_response_handler &io_handler() override { return *this; }
+ Watch_response_handler &watch_handler() override { return *this; }
+
+ } _vfs_env;
+
+ Directory _root_dir { _vfs_env };
+ Directory _fonts_dir { _root_dir, "fonts" };
+
+ Style_database _styles { _env.ram(), _env.rm(), _heap, _fonts_dir };
Animator _animator;
@@ -85,8 +111,6 @@ struct Menu_view::Main
Widget::Unique_id _hovered;
- Attached_rom_dataspace _config { _env, "config" };
-
void _handle_config();
Signal_handler _config_handler = {
@@ -138,7 +162,9 @@ struct Menu_view::Main
*/
unsigned _frame_cnt = 0;
- Main(Env &env) : _env(env)
+ Main(Env &env, Vfs::File_system &libc_vfs)
+ :
+ _env(env), _vfs_env(_env, _heap, libc_vfs)
{
_dialog_rom.sigh(_dialog_update_handler);
_config.sigh(_config_handler);
@@ -332,5 +358,8 @@ Menu_view::Widget_factory::create(Xml_node node)
extern "C" void _sigprocmask() { }
-void Libc::Component::construct(Libc::Env &env) { static Menu_view::Main main(env); }
+void Libc::Component::construct(Libc::Env &env)
+{
+ static Menu_view::Main main(env, env.vfs());
+}
diff --git a/repos/gems/src/app/menu_view/style_database.h b/repos/gems/src/app/menu_view/style_database.h
index ffc3cea2b6..482c6d0317 100644
--- a/repos/gems/src/app/menu_view/style_database.h
+++ b/repos/gems/src/app/menu_view/style_database.h
@@ -14,12 +14,11 @@
#ifndef _STYLE_DATABASE_H_
#define _STYLE_DATABASE_H_
-/* Genode includes */
-#include
-
/* gems includes */
#include
#include
+#include
+#include
/* local includes */
#include "types.h"
@@ -33,10 +32,14 @@ class Menu_view::Style_database
enum { PATH_MAX_LEN = 200 };
+ typedef String Path;
+
+ typedef ::File::Reading_failed Reading_failed;
+
struct Texture_entry : List::Element
{
- String path;
- File png_file;
+ Path const path;
+ ::File png_file;
Png_image png_image;
Texture &texture;
@@ -46,10 +49,10 @@ class Menu_view::Style_database
* \throw Reading_failed
*/
Texture_entry(Ram_session &ram, Region_map &rm,
- Allocator &alloc, char const *path)
+ Allocator &alloc, Path const &path)
:
path(path),
- png_file(path, alloc),
+ png_file(path.string(), alloc),
png_image(ram, rm, alloc, png_file.data()),
texture(*png_image.texture())
{ }
@@ -57,31 +60,32 @@ class Menu_view::Style_database
struct Font_entry : List::Element
{
- String path;
+ Path const path;
- File tff_file;
+ Cached_font::Limit _font_cache_limit { 256*1024 };
+ Vfs_font _vfs_font;
+ Cached_font _cached_font;
- Tff_font::Allocated_glyph_buffer glyph_buffer;
-
- Tff_font font;
+ Text_painter::Font const &font() const { return _cached_font; }
/**
* Constructor
*
* \throw Reading_failed
*/
- Font_entry(char const *path, Allocator &alloc)
- :
+ Font_entry(Directory const &fonts_dir, Path const &path, Allocator &alloc)
+ try :
path(path),
- tff_file(path, alloc),
- glyph_buffer(tff_file.data(), alloc),
- font(tff_file.data(), glyph_buffer)
+ _vfs_font(alloc, fonts_dir, path),
+ _cached_font(alloc, _vfs_font, _font_cache_limit)
{ }
+ catch (...) { throw Reading_failed(); }
};
- Ram_session &_ram;
- Region_map &_rm;
- Allocator &_alloc;
+ Ram_session &_ram;
+ Region_map &_rm;
+ Allocator &_alloc;
+ Directory const &_fonts_dir;
/*
* The list is mutable because it is populated as a side effect of
@@ -100,8 +104,6 @@ class Menu_view::Style_database
return 0;
}
- typedef String<256> Path;
-
/*
* Assemble path name 'styles//