Skip to content

Commit c925b17

Browse files
committed
Design updates to better match COSMIC
1 parent cc6f871 commit c925b17

File tree

5 files changed

+119
-133
lines changed

5 files changed

+119
-133
lines changed

res/open-sans/LICENSE

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
Copyright 2020 The Open Sans Project Authors (https://github.com/googlefonts/opensans)
2+
3+
-----------------------------------------------------------
4+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
5+
-----------------------------------------------------------
6+
7+
PREAMBLE
8+
The goals of the Open Font License (OFL) are to stimulate worldwide
9+
development of collaborative font projects, to support the font
10+
creation efforts of academic and linguistic communities, and to
11+
provide a free and open framework in which fonts may be shared and
12+
improved in partnership with others.
13+
14+
The OFL allows the licensed fonts to be used, studied, modified and
15+
redistributed freely as long as they are not sold by themselves. The
16+
fonts, including any derivative works, can be bundled, embedded,
17+
redistributed and/or sold with any software provided that any reserved
18+
names are not used by derivative works. The fonts and derivatives,
19+
however, cannot be released under any other type of license. The
20+
requirement for fonts to remain under this license does not apply to
21+
any document created using the fonts or their derivatives.
22+
23+
DEFINITIONS
24+
"Font Software" refers to the set of files released by the Copyright
25+
Holder(s) under this license and clearly marked as such. This may
26+
include source files, build scripts and documentation.
27+
28+
"Reserved Font Name" refers to any names specified as such after the
29+
copyright statement(s).
30+
31+
"Original Version" refers to the collection of Font Software
32+
components as distributed by the Copyright Holder(s).
33+
34+
"Modified Version" refers to any derivative made by adding to,
35+
deleting, or substituting -- in part or in whole -- any of the
36+
components of the Original Version, by changing formats or by porting
37+
the Font Software to a new environment.
38+
39+
"Author" refers to any designer, engineer, programmer, technical
40+
writer or other person who contributed to the Font Software.
41+
42+
PERMISSION & CONDITIONS
43+
Permission is hereby granted, free of charge, to any person obtaining
44+
a copy of the Font Software, to use, study, copy, merge, embed,
45+
modify, redistribute, and sell modified and unmodified copies of the
46+
Font Software, subject to the following conditions:
47+
48+
1) Neither the Font Software nor any of its individual components, in
49+
Original or Modified Versions, may be sold by itself.
50+
51+
2) Original or Modified Versions of the Font Software may be bundled,
52+
redistributed and/or sold with any software, provided that each copy
53+
contains the above copyright notice and this license. These can be
54+
included either as stand-alone text files, human-readable headers or
55+
in the appropriate machine-readable metadata fields within text or
56+
binary files as long as those fields can be easily viewed by the user.
57+
58+
3) No Modified Version of the Font Software may use the Reserved Font
59+
Name(s) unless explicit written permission is granted by the
60+
corresponding Copyright Holder. This restriction only applies to the
61+
primary font name as presented to the users.
62+
63+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
64+
Software shall not be used to promote, endorse or advertise any
65+
Modified Version, except to acknowledge the contribution(s) of the
66+
Copyright Holder(s) and the Author(s) or with their explicit written
67+
permission.
68+
69+
5) The Font Software, modified or unmodified, in part or in whole,
70+
must be distributed entirely under this license, and must not be
71+
distributed under any other license. The requirement for fonts to
72+
remain under this license does not apply to any document created using
73+
the Font Software.
74+
75+
TERMINATION
76+
This license becomes null and void if any of the above conditions are
77+
not met.
78+
79+
DISCLAIMER
80+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
81+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
82+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
83+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
84+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
85+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
86+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
87+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
88+
OTHER DEALINGS IN THE FONT SOFTWARE.

res/open-sans/OpenSans-Regular.ttf

212 KB
Binary file not shown.

src/fde.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ fn form_display_inner(form: &Form, user_input: &mut UserInput) -> Result<()> {
378378
&mut *DISPLAY
379379
};
380380

381+
// If you want to test the security screen, uncomment this line:
382+
// crate::security::confirm(display);
383+
381384
let (display_w, display_h) = (display.width(), display.height());
382385

383386
let scale = if display_h > 1440 {
@@ -389,12 +392,12 @@ fn form_display_inner(form: &Form, user_input: &mut UserInput) -> Result<()> {
389392
};
390393

391394
// Style {
392-
let margin_lr = 8 * scale;
395+
let margin_lr = 12 * scale;
393396
let margin_tb = 4 * scale;
394397

395-
let title_font_size = (20 * scale) as f32;
396-
let font_size = (16 * scale) as f32; // (display_h as f32) / 26.0
397-
let help_font_size = (12 * scale) as f32;
398+
let title_font_size = (12 * scale) as f32;
399+
let font_size = (10 * scale) as f32; // (display_h as f32) / 26.0
400+
let help_font_size = (10 * scale) as f32;
398401
// } Style
399402

400403
let ui = Ui::new()?;
@@ -674,7 +677,7 @@ fn form_display_inner(form: &Form, user_input: &mut UserInput) -> Result<()> {
674677
if selected == !0 {
675678
render_hotkey_help("");
676679
} else if !editing || !editing_value {
677-
render_hotkey_help("↑↓=Move Highlight");
680+
render_hotkey_help("Up/Down=Move Highlight");
678681
}
679682

680683
if editing {

src/security.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Timeout for UefiTimeout {
4040
}
4141
}
4242

43-
fn confirm(display: &mut Display) -> Result<()> {
43+
pub(crate) fn confirm(display: &mut Display) -> Result<()> {
4444
let (display_w, display_h) = (display.width(), display.height());
4545

4646
let scale: i32 = if display_h > 1440 {
@@ -52,14 +52,14 @@ fn confirm(display: &mut Display) -> Result<()> {
5252
};
5353

5454
// Style {
55-
let margin_lr = 16 * scale;
56-
let margin_tb = 8 * scale;
55+
let margin_lr = 12 * scale;
56+
let margin_tb = 4 * scale;
5757

5858
let form_width = cmp::min(640 * scale as u32, display_w - margin_lr as u32 * 2);
5959
let form_x = (display_w as i32 - form_width as i32) / 2;
6060

61-
let title_font_size = (20 * scale) as f32;
62-
let font_size = (16 * scale) as f32;
61+
let title_font_size = (12 * scale) as f32;
62+
let font_size = (10 * scale) as f32;
6363
// } Style
6464

6565
let ui = Ui::new()?;

src/ui.rs

Lines changed: 18 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::prelude::*;
88
use crate::display::Display;
99
use crate::image::{self, Image};
1010

11-
static FONT_TTF: &[u8] = include_bytes!("../res/FiraSans-Regular.ttf");
11+
static FONT_TTF: &[u8] = include_bytes!("../res/open-sans/OpenSans-Regular.ttf");
1212
static CHECKBOX_CHECKED_BMP: &[u8] = include_bytes!("../res/checkbox_checked.bmp");
1313
static CHECKBOX_UNCHECKED_BMP: &[u8] = include_bytes!("../res/checkbox_unchecked.bmp");
1414

@@ -29,11 +29,11 @@ pub struct Ui {
2929

3030
impl Ui {
3131
pub fn new() -> Result<Self> {
32-
let background_color = Color::rgb(0x36, 0x32, 0x2F);
33-
let highlight_color = Color::rgb(0xFB, 0xB8, 0x6C);
32+
let background_color = Color::rgb(0x1B, 0x1B, 0x1B);
33+
let highlight_color = Color::rgb(0x63, 0xD0, 0xDF);
3434
let outline_color = Color::rgba(0xfe, 0xff, 0xff, 0xc4);
35-
let text_color = Color::rgb(0xCC, 0xCC, 0xCC);
36-
let highlight_text_color = Color::rgb(0x27, 0x27, 0x27);
35+
let text_color = Color::rgb(0xC4, 0xC4, 0xC4);
36+
let highlight_text_color = Color::rgb(0x00, 0x00, 0x00);
3737

3838
let font = unsafe {
3939
if FONT.is_null() {
@@ -151,126 +151,21 @@ impl Ui {
151151
// Style {
152152
let padding_lr = 4 * scale;
153153
let padding_tb = 2 * scale;
154-
155-
//TODO: does not scale due to hardcoded checkbox image!
156-
let rect_radius = 4;
157154
// } Style
158155

159-
let checkbox = if highlighted {
160-
// Center
161-
display.rect(
162-
x - padding_lr,
163-
y - padding_tb + rect_radius,
164-
w + padding_lr as u32 * 2,
165-
h + (padding_tb - rect_radius) as u32 * 2,
166-
self.highlight_color,
167-
);
168-
169-
// Top middle
170-
display.rect(
171-
x - padding_lr + rect_radius,
172-
y - padding_tb,
173-
w + (padding_lr - rect_radius) as u32 * 2,
174-
rect_radius as u32,
175-
self.highlight_color,
176-
);
177-
178-
// Bottom middle
179-
display.rect(
180-
x - padding_lr + rect_radius,
181-
y + h as i32 + padding_tb - rect_radius,
182-
w + (padding_lr - rect_radius) as u32 * 2,
183-
rect_radius as u32,
184-
self.highlight_color,
185-
);
186-
187-
self.checkbox_checked
188-
} else {
189-
// Top middle
190-
display.rect(
191-
x - padding_lr + rect_radius,
192-
y - padding_tb,
193-
w + (padding_lr - rect_radius) as u32 * 2,
194-
2,
195-
self.outline_color,
196-
);
197-
198-
// Bottom middle
199-
display.rect(
200-
x - padding_lr + rect_radius,
201-
y + h as i32 + padding_tb - 2,
202-
w + (padding_lr - rect_radius) as u32 * 2,
203-
2,
204-
self.outline_color,
205-
);
206-
207-
// Left middle
208-
display.rect(
209-
x - padding_lr,
210-
y - padding_tb + rect_radius,
211-
2,
212-
h + (padding_tb - rect_radius) as u32 * 2,
213-
self.outline_color,
214-
);
215-
216-
// Right middle
217-
display.rect(
218-
x + w as i32 + padding_lr - 2,
219-
y - padding_tb + rect_radius,
220-
2,
221-
h + (padding_tb - rect_radius) as u32 * 2,
222-
self.outline_color,
223-
);
224-
225-
self.checkbox_unchecked
226-
};
227-
228-
// Top left
229-
checkbox
230-
.roi(0, 0, rect_radius as u32, rect_radius as u32)
231-
.draw(display, x - padding_lr, y - padding_tb);
232-
233-
// Top right
234-
checkbox
235-
.roi(
236-
checkbox.width() - rect_radius as u32,
237-
0,
238-
rect_radius as u32,
239-
rect_radius as u32,
240-
)
241-
.draw(
242-
display,
243-
x + w as i32 + padding_lr - rect_radius,
244-
y - padding_tb,
245-
);
246-
247-
// Bottom left
248-
checkbox
249-
.roi(
250-
0,
251-
checkbox.height() - rect_radius as u32,
252-
rect_radius as u32,
253-
rect_radius as u32,
254-
)
255-
.draw(
256-
display,
257-
x - padding_lr,
258-
y + h as i32 + padding_tb - rect_radius,
259-
);
260-
261-
// Bottom right
262-
checkbox
263-
.roi(
264-
checkbox.width() - rect_radius as u32,
265-
checkbox.height() - rect_radius as u32,
266-
rect_radius as u32,
267-
rect_radius as u32,
268-
)
269-
.draw(
270-
display,
271-
x + w as i32 + padding_lr - rect_radius,
272-
y + h as i32 + padding_tb - rect_radius,
273-
);
156+
display.rounded_rect(
157+
x - padding_lr,
158+
y - padding_tb,
159+
w + (padding_lr * 2) as u32,
160+
h + (padding_tb * 2) as u32,
161+
0,
162+
highlighted,
163+
if highlighted {
164+
self.highlight_color
165+
} else {
166+
self.outline_color
167+
}
168+
);
274169
}
275170

276171
pub fn draw_text_box(

0 commit comments

Comments
 (0)