Enable subpixel glyph positioning in Pango
Browse files at this commit7b6fa1285475896ad8dbc2f4b11099b0c036e4b7Parent: e7c201a5 changed files +8 -0
- Cargo.lock +1 -0
- Cargo.toml +1 -0
- src/ui/config_error_notification.rs +2 -0
- src/ui/exit_confirm_dialog.rs +2 -0
- src/ui/hotkey_overlay.rs +2 -0
Cargo.lockmodified+1 -0
| @@ -2186,6 +2186,7 @@ dependencies = [ | |||
| 2186 | "niri-ipc", | 2186 | "niri-ipc", |
| 2187 | "notify-rust", | 2187 | "notify-rust", |
| 2188 | "ordered-float", | 2188 | "ordered-float", |
| 2189 | + "pango", | ||
| 2189 | "pangocairo", | 2190 | "pangocairo", |
| 2190 | "pipewire", | 2191 | "pipewire", |
| 2191 | "png", | 2192 | "png", |
Cargo.tomlmodified+1 -0
| @@ -64,6 +64,7 @@ niri-config = { version = "0.1.7", path = "niri-config" } | |||
| 64 | niri-ipc = { version = "0.1.7", path = "niri-ipc", features = ["clap"] } | 64 | niri-ipc = { version = "0.1.7", path = "niri-ipc", features = ["clap"] } |
| 65 | notify-rust = { version = "~4.10.0", optional = true } | 65 | notify-rust = { version = "~4.10.0", optional = true } |
| 66 | ordered-float = "4.2.0" | 66 | ordered-float = "4.2.0" |
| 67 | +pango = { version = "0.19.8", features = ["v1_44"] } | ||
| 67 | pangocairo = "0.19.8" | 68 | pangocairo = "0.19.8" |
| 68 | pipewire = { version = "0.8.0", optional = true } | 69 | pipewire = { version = "0.8.0", optional = true } |
| 69 | png = "0.17.13" | 70 | png = "0.17.13" |
src/ui/config_error_notification.rsmodified+2 -0
| @@ -192,6 +192,7 @@ fn render( | |||
| 192 | let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?; | 192 | let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?; |
| 193 | let cr = cairo::Context::new(&surface)?; | 193 | let cr = cairo::Context::new(&surface)?; |
| 194 | let layout = pangocairo::functions::create_layout(&cr); | 194 | let layout = pangocairo::functions::create_layout(&cr); |
| 195 | + layout.context().set_round_glyph_positions(false); | ||
| 195 | layout.set_font_description(Some(&font)); | 196 | layout.set_font_description(Some(&font)); |
| 196 | layout.set_markup(&text); | 197 | layout.set_markup(&text); |
| 197 | 198 | ||
| @@ -206,6 +207,7 @@ fn render( | |||
| 206 | 207 | ||
| 207 | cr.move_to(padding.into(), padding.into()); | 208 | cr.move_to(padding.into(), padding.into()); |
| 208 | let layout = pangocairo::functions::create_layout(&cr); | 209 | let layout = pangocairo::functions::create_layout(&cr); |
| 210 | + layout.context().set_round_glyph_positions(false); | ||
| 209 | layout.set_font_description(Some(&font)); | 211 | layout.set_font_description(Some(&font)); |
| 210 | layout.set_markup(&text); | 212 | layout.set_markup(&text); |
| 211 | 213 | ||
src/ui/exit_confirm_dialog.rsmodified+2 -0
| @@ -109,6 +109,7 @@ fn render(scale: f64) -> anyhow::Result<MemoryBuffer> { | |||
| 109 | let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?; | 109 | let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?; |
| 110 | let cr = cairo::Context::new(&surface)?; | 110 | let cr = cairo::Context::new(&surface)?; |
| 111 | let layout = pangocairo::functions::create_layout(&cr); | 111 | let layout = pangocairo::functions::create_layout(&cr); |
| 112 | + layout.context().set_round_glyph_positions(false); | ||
| 112 | layout.set_font_description(Some(&font)); | 113 | layout.set_font_description(Some(&font)); |
| 113 | layout.set_alignment(Alignment::Center); | 114 | layout.set_alignment(Alignment::Center); |
| 114 | layout.set_markup(TEXT); | 115 | layout.set_markup(TEXT); |
| @@ -124,6 +125,7 @@ fn render(scale: f64) -> anyhow::Result<MemoryBuffer> { | |||
| 124 | 125 | ||
| 125 | cr.move_to(padding.into(), padding.into()); | 126 | cr.move_to(padding.into(), padding.into()); |
| 126 | let layout = pangocairo::functions::create_layout(&cr); | 127 | let layout = pangocairo::functions::create_layout(&cr); |
| 128 | + layout.context().set_round_glyph_positions(false); | ||
| 127 | layout.set_font_description(Some(&font)); | 129 | layout.set_font_description(Some(&font)); |
| 128 | layout.set_alignment(Alignment::Center); | 130 | layout.set_alignment(Alignment::Center); |
| 129 | layout.set_markup(TEXT); | 131 | layout.set_markup(TEXT); |
src/ui/hotkey_overlay.rsmodified+2 -0
| @@ -250,6 +250,7 @@ fn render( | |||
| 250 | let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?; | 250 | let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?; |
| 251 | let cr = cairo::Context::new(&surface)?; | 251 | let cr = cairo::Context::new(&surface)?; |
| 252 | let layout = pangocairo::functions::create_layout(&cr); | 252 | let layout = pangocairo::functions::create_layout(&cr); |
| 253 | + layout.context().set_round_glyph_positions(false); | ||
| 253 | layout.set_font_description(Some(&font)); | 254 | layout.set_font_description(Some(&font)); |
| 254 | 255 | ||
| 255 | let bold = AttrList::new(); | 256 | let bold = AttrList::new(); |
| @@ -301,6 +302,7 @@ fn render( | |||
| 301 | 302 | ||
| 302 | cr.move_to(padding.into(), padding.into()); | 303 | cr.move_to(padding.into(), padding.into()); |
| 303 | let layout = pangocairo::functions::create_layout(&cr); | 304 | let layout = pangocairo::functions::create_layout(&cr); |
| 305 | + layout.context().set_round_glyph_positions(false); | ||
| 304 | layout.set_font_description(Some(&font)); | 306 | layout.set_font_description(Some(&font)); |
| 305 | 307 | ||
| 306 | cr.set_source_rgb(1., 1., 1.); | 308 | cr.set_source_rgb(1., 1., 1.); |