From ee4ac974b262d2a46dd5edbd59e49fa74d0107c5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 1 Sep 2024 23:31:26 +0200 Subject: Include noto sans font instead of using system package --- README.md | 8 +++----- depends/mglpp | 2 +- fonts/NotoSans-Bold.ttf | Bin 0 -> 616112 bytes meson.build | 3 ++- src/main.cpp | 18 +----------------- 5 files changed, 7 insertions(+), 24 deletions(-) create mode 100644 fonts/NotoSans-Bold.ttf diff --git a/README.md b/README.md index 60ab4df..cd3d9dd 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,8 @@ These are the dependencies needed to build GPU Screen Recorder Notification: * x11 (libx11, libxrandr, libxrender, libxfixes) * libglvnd (which provides libgl, libglx and libegl) -## Runtime dependencies -There are also additional dependencies needed at runtime: - -* Noto fonts - # Installation Run `sudo ./install.sh`. This will install gsr-notify to `/usr/bin/gsr-notify`. You can run meson commands manually to install gsr-notify to another directory. + +# License +This software is licensed under GPL3.0-only. `fonts/NotoSans-Bold.ttf` is licensed under the `SIL Open Font License` license. \ No newline at end of file diff --git a/depends/mglpp b/depends/mglpp index 8f6c5d2..e16c6ed 160000 --- a/depends/mglpp +++ b/depends/mglpp @@ -1 +1 @@ -Subproject commit 8f6c5d220d3e4c250db4bf3022f99c38811b63fd +Subproject commit e16c6ed3dad61ad9b25344d5133c2223da422f6e diff --git a/fonts/NotoSans-Bold.ttf b/fonts/NotoSans-Bold.ttf new file mode 100644 index 0000000..785ef8a Binary files /dev/null and b/fonts/NotoSans-Bold.ttf differ diff --git a/meson.build b/meson.build index 8f6f56b..f1176b3 100644 --- a/meson.build +++ b/meson.build @@ -30,4 +30,5 @@ executable( cpp_args : '-DGSR_NOTIFY_RESOURCES_PATH="' + gsr_notify_resources_path + '"', ) -install_subdir('images', install_dir : gsr_notify_resources_path) \ No newline at end of file +install_subdir('images', install_dir : gsr_notify_resources_path) +install_subdir('fonts', install_dir : gsr_notify_resources_path) \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index a3503c9..2b3d89f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -156,17 +156,6 @@ static const mgl_monitor* find_monitor_by_cursor_position(mgl::Window &window) { return &win->monitors[0]; } -static std::string find_noto_font_filepath(const char *filename) { - const char *directories[] = { "/usr/share/fonts/noto", "/usr/share/fonts/truetype/noto" }; - char filepath[PATH_MAX]; - for(const char *directory : directories) { - snprintf(filepath, sizeof(filepath), "%s/%s", directory, filename); - if(access(filepath, F_OK) == 0) - return filepath; - } - return ""; -} - int main(int argc, char **argv) { std::string resources_path; if(access("images/stream.png", F_OK) == 0) { @@ -233,12 +222,6 @@ int main(int argc, char **argv) { const mgl::Color icon_color = parse_hex_color(icon_color_str ? icon_color_str : "FFFFFF", resources_path); const mgl::Color bg_color = parse_hex_color(bg_color_str ? bg_color_str : "76b900", resources_path); - const std::string noto_sans_bold_filepath = find_noto_font_filepath("NotoSans-Bold.ttf"); - if(noto_sans_bold_filepath.empty()) { - fprintf(stderr, "error: failed to find NotoSans-Bold.ttf. Make sure noto fonts are installed on your system\n"); - exit(2); - } - mgl::Init init; mgl::Window::CreateParams window_create_params; @@ -263,6 +246,7 @@ int main(int argc, char **argv) { const mgl_monitor *focused_monitor = find_monitor_by_cursor_position(window); + const std::string noto_sans_bold_filepath = resources_path + "fonts/NotoSans-Bold.ttf"; mgl::MemoryMappedFile font_file; if(!font_file.load(noto_sans_bold_filepath.c_str(), mgl::MemoryMappedFile::LoadOptions{true, false})) return 1; -- cgit v1.2.3