Skip to content

Commit ccd9e32

Browse files
committed
use standard font size
1 parent 323d822 commit ccd9e32

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ edition = "2021"
1010
[dependencies.gtk]
1111
package = "gtk4"
1212
git = "https://github.com/gtk-rs/gtk4-rs.git"
13+
features = ["v4_6"]
1314

1415
[dependencies]
1516
async-net = "1.4.7"

src/config.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Not sure if I want to keep this
2+
13
use once_cell::sync::Lazy;
24
use serde::{Deserialize, Serialize};
35

@@ -14,7 +16,6 @@ pub static DEFAULT_CONFIG: Lazy<Config> = Lazy::new(|| Config {
1416
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
1517
pub struct Font {
1618
pub family: String,
17-
pub size: i32,
1819
pub weight: i32,
1920
}
2021

@@ -31,31 +32,27 @@ impl Fonts {
3132
pub fn default_heading() -> Font {
3233
Font {
3334
family: String::from("Cantarell"),
34-
size: 18,
3535
weight: 800,
3636
}
3737
}
3838

3939
pub fn default_preformatted() -> Font {
4040
Font {
4141
family: String::from("monospace"),
42-
size: 13,
4342
weight: 500,
4443
}
4544
}
4645

4746
pub fn default_quote() -> Font {
4847
Font {
4948
family: String::from("Cantarell"),
50-
size: 13,
5149
weight: 500,
5250
}
5351
}
5452

5553
pub fn default_paragraph() -> Font {
5654
Font {
5755
family: String::from("Cantarell"),
58-
size: 13,
5956
weight: 500,
6057
}
6158
}

src/draw_ctx.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ impl DrawCtx {
3535
.or_else(|| default_config.fonts.heading.as_ref())
3636
.unwrap()
3737
});
38-
tag_h1.set_size_points(tag_h1.size_points() * 1.4);
38+
tag_h1.set_scale(2.0);
39+
tag_h1.set_sentence(true);
3940

4041
let tag_h2 = DrawCtx::create_tag("h2", {
4142
self.config
@@ -45,7 +46,8 @@ impl DrawCtx {
4546
.or_else(|| default_config.fonts.heading.as_ref())
4647
.unwrap()
4748
});
48-
tag_h1.set_size_points(tag_h1.size_points() * 1.2);
49+
tag_h2.set_scale(1.5);
50+
tag_h1.set_sentence(true);
4951

5052
let tag_h3 = DrawCtx::create_tag(
5153
"h3",
@@ -56,6 +58,9 @@ impl DrawCtx {
5658
.or_else(|| default_config.fonts.heading.as_ref())
5759
.unwrap(),
5860
);
61+
tag_h2.set_scale(1.4);
62+
tag_h1.set_sentence(true);
63+
5964
let tag_p = DrawCtx::create_tag(
6065
"p",
6166
self.config
@@ -111,7 +116,6 @@ impl DrawCtx {
111116
pub fn create_tag(name: &str, config: &crate::config::Font) -> gtk::TextTag {
112117
gtk::builders::TextTagBuilder::new()
113118
.family(&config.family)
114-
.size_points(config.size as f64)
115119
.weight(config.weight)
116120
.name(name)
117121
.build()
@@ -178,7 +182,6 @@ impl DrawCtx {
178182

179183
let tag = gtk::builders::TextTagBuilder::new()
180184
.family(&config.family)
181-
.size_points(config.size as f64)
182185
.weight(config.weight)
183186
.build();
184187

0 commit comments

Comments
 (0)