mirror of
https://github.com/YaLTeR/niri.git
synced 2024-10-03 23:43:26 +03:00
Enable subpixel glyph positioning in Pango
Makes things scale more smoothly.
This commit is contained in:
parent
e7c201abba
commit
7b6fa12854
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2186,6 +2186,7 @@ dependencies = [
|
|||||||
"niri-ipc",
|
"niri-ipc",
|
||||||
"notify-rust",
|
"notify-rust",
|
||||||
"ordered-float",
|
"ordered-float",
|
||||||
|
"pango",
|
||||||
"pangocairo",
|
"pangocairo",
|
||||||
"pipewire",
|
"pipewire",
|
||||||
"png",
|
"png",
|
||||||
|
@ -64,6 +64,7 @@ niri-config = { version = "0.1.7", path = "niri-config" }
|
|||||||
niri-ipc = { version = "0.1.7", path = "niri-ipc", features = ["clap"] }
|
niri-ipc = { version = "0.1.7", path = "niri-ipc", features = ["clap"] }
|
||||||
notify-rust = { version = "~4.10.0", optional = true }
|
notify-rust = { version = "~4.10.0", optional = true }
|
||||||
ordered-float = "4.2.0"
|
ordered-float = "4.2.0"
|
||||||
|
pango = { version = "0.19.8", features = ["v1_44"] }
|
||||||
pangocairo = "0.19.8"
|
pangocairo = "0.19.8"
|
||||||
pipewire = { version = "0.8.0", optional = true }
|
pipewire = { version = "0.8.0", optional = true }
|
||||||
png = "0.17.13"
|
png = "0.17.13"
|
||||||
|
@ -192,6 +192,7 @@ fn render(
|
|||||||
let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?;
|
let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?;
|
||||||
let cr = cairo::Context::new(&surface)?;
|
let cr = cairo::Context::new(&surface)?;
|
||||||
let layout = pangocairo::functions::create_layout(&cr);
|
let layout = pangocairo::functions::create_layout(&cr);
|
||||||
|
layout.context().set_round_glyph_positions(false);
|
||||||
layout.set_font_description(Some(&font));
|
layout.set_font_description(Some(&font));
|
||||||
layout.set_markup(&text);
|
layout.set_markup(&text);
|
||||||
|
|
||||||
@ -206,6 +207,7 @@ fn render(
|
|||||||
|
|
||||||
cr.move_to(padding.into(), padding.into());
|
cr.move_to(padding.into(), padding.into());
|
||||||
let layout = pangocairo::functions::create_layout(&cr);
|
let layout = pangocairo::functions::create_layout(&cr);
|
||||||
|
layout.context().set_round_glyph_positions(false);
|
||||||
layout.set_font_description(Some(&font));
|
layout.set_font_description(Some(&font));
|
||||||
layout.set_markup(&text);
|
layout.set_markup(&text);
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ fn render(scale: f64) -> anyhow::Result<MemoryBuffer> {
|
|||||||
let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?;
|
let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?;
|
||||||
let cr = cairo::Context::new(&surface)?;
|
let cr = cairo::Context::new(&surface)?;
|
||||||
let layout = pangocairo::functions::create_layout(&cr);
|
let layout = pangocairo::functions::create_layout(&cr);
|
||||||
|
layout.context().set_round_glyph_positions(false);
|
||||||
layout.set_font_description(Some(&font));
|
layout.set_font_description(Some(&font));
|
||||||
layout.set_alignment(Alignment::Center);
|
layout.set_alignment(Alignment::Center);
|
||||||
layout.set_markup(TEXT);
|
layout.set_markup(TEXT);
|
||||||
@ -124,6 +125,7 @@ fn render(scale: f64) -> anyhow::Result<MemoryBuffer> {
|
|||||||
|
|
||||||
cr.move_to(padding.into(), padding.into());
|
cr.move_to(padding.into(), padding.into());
|
||||||
let layout = pangocairo::functions::create_layout(&cr);
|
let layout = pangocairo::functions::create_layout(&cr);
|
||||||
|
layout.context().set_round_glyph_positions(false);
|
||||||
layout.set_font_description(Some(&font));
|
layout.set_font_description(Some(&font));
|
||||||
layout.set_alignment(Alignment::Center);
|
layout.set_alignment(Alignment::Center);
|
||||||
layout.set_markup(TEXT);
|
layout.set_markup(TEXT);
|
||||||
|
@ -250,6 +250,7 @@ fn render(
|
|||||||
let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?;
|
let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?;
|
||||||
let cr = cairo::Context::new(&surface)?;
|
let cr = cairo::Context::new(&surface)?;
|
||||||
let layout = pangocairo::functions::create_layout(&cr);
|
let layout = pangocairo::functions::create_layout(&cr);
|
||||||
|
layout.context().set_round_glyph_positions(false);
|
||||||
layout.set_font_description(Some(&font));
|
layout.set_font_description(Some(&font));
|
||||||
|
|
||||||
let bold = AttrList::new();
|
let bold = AttrList::new();
|
||||||
@ -301,6 +302,7 @@ fn render(
|
|||||||
|
|
||||||
cr.move_to(padding.into(), padding.into());
|
cr.move_to(padding.into(), padding.into());
|
||||||
let layout = pangocairo::functions::create_layout(&cr);
|
let layout = pangocairo::functions::create_layout(&cr);
|
||||||
|
layout.context().set_round_glyph_positions(false);
|
||||||
layout.set_font_description(Some(&font));
|
layout.set_font_description(Some(&font));
|
||||||
|
|
||||||
cr.set_source_rgb(1., 1., 1.);
|
cr.set_source_rgb(1., 1., 1.);
|
||||||
|
Loading…
Reference in New Issue
Block a user