Mir

Merge lp:~alan-griffiths/mir/sync-fix-from-0.28.1-release into lp:mir

Proposed by Alan Griffiths on 2017-10-27
Status: Rejected
Rejected by: Michał Sawicz on 2017-11-02
Proposed branch: lp:~alan-griffiths/mir/sync-fix-from-0.28.1-release
Merge into: lp:mir
Prerequisite: lp:~alan-griffiths/mir/fix-FTBFS
Diff against target: 56 lines (+19/-11)
2 files modified
examples/miral-shell/CMakeLists.txt (+0/-10)
examples/miral-shell/titlebar_config.cpp (+19/-1)
To merge this branch: bzr merge lp:~alan-griffiths/mir/sync-fix-from-0.28.1-release
Reviewer Review Type Date Requested Status
Michał Sawicz 2017-10-27 Resubmit on 2017-11-02
Mir CI Bot continuous-integration Approve on 2017-10-27
Review via email: mp+332931@code.launchpad.net

Commit message

[miral-shell] Try to find default font at runtime, not build time (as builders may not have fonts installed)

Description of the change

[miral-shell] Try to find default font at runtime, not build time (as builders may not have fonts installed)

Fixes a problem seen while testing 0.28.1

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4306
https://mir-jenkins.ubuntu.com/job/mir-ci/3763/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/5185
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5422
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5409
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5409
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5409
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5228
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5228/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5228
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5228/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5228
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5228/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5228
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5228/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5228
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5228/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5228
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5228/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5228
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5228/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5228
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5228/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3763/rebuild

review: Approve (continuous-integration)
Michał Sawicz (saviq) wrote :
review: Resubmit

Unmerged revisions

4306. By Alan Griffiths on 2017-10-27

Try to find default font at runtime, not build time

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/miral-shell/CMakeLists.txt'
2--- examples/miral-shell/CMakeLists.txt 2017-10-20 13:39:42 +0000
3+++ examples/miral-shell/CMakeLists.txt 2017-10-27 17:40:44 +0000
4@@ -53,16 +53,6 @@
5 titlebar_config.cpp titlebar_config.h
6 )
7
8-find_file(MIRAL_DEFAULT_FONT_FILE
9- NAMES Ubuntu-B.ttf FreeSansBold.ttf
10- DOC "Font to be used in titlebars by miral-shell"
11- PATHS /usr/share/fonts/truetype/ubuntu-font-family # Ubuntu Ubuntu-B.ttf
12- /usr/share/fonts/truetype/freefont # Debian FreeSansBold.ttf
13- /usr/share/fonts/gnu-free) # Fedora FreeSansBold.ttf
14-
15-set_source_files_properties(titlebar_config.cpp PROPERTIES
16- COMPILE_DEFINITIONS MIRAL_DEFAULT_FONT_FILE="${MIRAL_DEFAULT_FONT_FILE}")
17-
18 pkg_check_modules(FREETYPE freetype2 REQUIRED)
19 target_include_directories(miral-shell-lib PRIVATE ${FREETYPE_INCLUDE_DIRS})
20 target_compile_definitions(miral-shell-lib PRIVATE -DTYPO_SUPPORTS_FREETYPE)
21
22=== modified file 'examples/miral-shell/titlebar_config.cpp'
23--- examples/miral-shell/titlebar_config.cpp 2017-10-19 12:00:16 +0000
24+++ examples/miral-shell/titlebar_config.cpp 2017-10-27 17:40:44 +0000
25@@ -17,12 +17,30 @@
26 */
27
28 #include "titlebar_config.h"
29+#include <unistd.h>
30 #include <mutex>
31
32 namespace
33 {
34+auto default_font() -> std::string
35+{
36+ for (std::string const file : { "Ubuntu-B.ttf", "FreeSansBold.ttf" })
37+ {
38+ for (auto const path : { "/usr/share/fonts/truetype/ubuntu-font-family/", // Ubuntu Ubuntu-B.ttf
39+ "/usr/share/fonts/truetype/freefont/", // Debian FreeSansBold.ttf
40+ "/usr/share/fonts/gnu-free/"}) // Fedora FreeSansBold.ttf
41+ {
42+ auto const full_path = path + file;
43+ if (access(full_path.c_str(), R_OK) == 0)
44+ return full_path;
45+ }
46+ }
47+
48+ return "/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf";
49+}
50+
51 std::mutex mutex;
52-std::string font_file{MIRAL_DEFAULT_FONT_FILE};
53+std::string font_file{default_font()};
54 }
55
56 void titlebar::font_file(std::string const& font_file)

Subscribers

People subscribed via source and target branches