[Chore] update dependencies (#125)

* [Chore] Update dependencies

* [Chore]: Rename .cargo/config to .cargo/config.toml
This commit is contained in:
Uzair Aftab 2024-07-30 09:16:26 +02:00 committed by GitHub
parent beb628156d
commit 538b717bb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 528 additions and 332 deletions

817
generator/Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -4,16 +4,16 @@ version = "0.1.0"
edition = "2021"
[dependencies]
nvim-oxi = {features = ["neovim-0-9", "libuv", "oxi-libuv"], version = "0.3"}
nvim-oxi = { features = ["neovim-0-9", "libuv", "oxi-libuv"], version = "0.3" }
tiny-skia = "0.11.4"
syntect = "5.2.0"
cosmic-text = "0.11.2"
serde = "1.0.197"
arboard = {features = ["wayland-data-control"], version = "3.3.2"}
thiserror = "1.0.58"
regex = "1.10.3"
two-face = "0.3.0"
cached = "0.49.3"
cosmic-text = "0.12.0"
serde = "1.0.204"
arboard = { features = ["wayland-data-control"], version = "3.4.0" }
thiserror = "1.0.63"
regex = "1.10.5"
two-face = "0.4.0"
cached = "0.53.1"
[lib]
crate-type = ["cdylib"]

View file

@ -1,5 +1,6 @@
use cosmic_text::{
Align, Attrs, AttrsList, Buffer, BufferLine, Color, FontSystem, Metrics, Shaping, SwashCache,
Align, Attrs, AttrsList, Buffer, BufferLine, Color, FontSystem, LineEnding, Metrics, Shaping,
SwashCache,
};
use tiny_skia::{Paint, Pixmap, Rect, Transform};
@ -41,8 +42,8 @@ impl FontRenderer {
let mut buffer = Buffer::new(&mut self.font_system, self.metrics);
buffer.set_size(
&mut self.font_system,
w * self.scale_factor,
h * self.scale_factor,
Some(w * self.scale_factor),
Some(h * self.scale_factor),
);
buffer.set_rich_text(
&mut self.font_system,
@ -65,11 +66,27 @@ impl FontRenderer {
pixmap: &mut Pixmap,
) {
let mut buffer = Buffer::new(&mut self.font_system, self.metrics);
let mut line = BufferLine::new(line, AttrsList::new(attrs), Shaping::Advanced);
let mut line = if cfg!(unix) {
BufferLine::new(
line,
LineEnding::Lf,
AttrsList::new(attrs),
Shaping::Advanced,
)
} else if cfg!(windows) {
BufferLine::new(
line,
LineEnding::CrLf,
AttrsList::new(attrs),
Shaping::Advanced,
)
} else {
panic!("Unsupported OS")
};
line.set_align(align);
buffer.lines = vec![line];
buffer.set_size(&mut self.font_system, w, h);
buffer.set_size(&mut self.font_system, Some(w), Some(h));
self.draw(x, y, &mut buffer, pixmap);
}