mirror of
https://github.com/robbert-vdh/nih-plug.git
synced 2026-07-01 02:36:54 +00:00
Upgrade Vizia for the cosmic-text changes
This brings some breaking changes, and vertical positioning of text may have changed slightly.
This commit is contained in:
@@ -11,10 +11,11 @@ description = "An adapter to use VIZIA GUIs with NIH-plug"
|
||||
nih_plug = { path = ".." }
|
||||
nih_plug_assets = { git = "https://github.com/robbert-vdh/nih_plug_assets.git" }
|
||||
|
||||
baseview = { git = "https://github.com/robbert-vdh/baseview.git", branch = "feature/resize" }
|
||||
baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "7001c2521fa1a439a01967cb881b411cd75d9ee0" }
|
||||
crossbeam = "0.8"
|
||||
# To make the state persistable
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
# This fork contains changed for better keyboard modifier handling and DPI
|
||||
# scaling, window scaling, and a lot more fixes and improvements
|
||||
# This fork contains some additional patches on top of Vizia to make it more
|
||||
# suitable for use in NIH-plug. The set of patches constantly changes as things
|
||||
# are merged into upstream Vizia.
|
||||
vizia = { git = "https://github.com/robbert-vdh/vizia.git", branch = "patched", default_features = false, features = ["baseview", "clipboard", "x11"] }
|
||||
|
||||
@@ -32,26 +32,26 @@ pub const NOTO_SANS_BOLD: &str = "Noto Sans Bold";
|
||||
pub const NOTO_SANS_BOLD_ITALIC: &str = "Noto Sans Bold Italic";
|
||||
|
||||
pub fn register_noto_sans_regular(cx: &mut Context) {
|
||||
cx.add_font_mem(NOTO_SANS_REGULAR, fonts::NOTO_SANS_REGULAR);
|
||||
cx.add_fonts_mem(&[fonts::NOTO_SANS_REGULAR]);
|
||||
}
|
||||
pub fn register_noto_sans_regular_italic(cx: &mut Context) {
|
||||
cx.add_font_mem(NOTO_SANS_REGULAR_ITALIC, fonts::NOTO_SANS_REGULAR_ITALIC);
|
||||
cx.add_fonts_mem(&[fonts::NOTO_SANS_REGULAR_ITALIC]);
|
||||
}
|
||||
pub fn register_noto_sans_thin(cx: &mut Context) {
|
||||
cx.add_font_mem(NOTO_SANS_THIN, fonts::NOTO_SANS_THIN);
|
||||
cx.add_fonts_mem(&[fonts::NOTO_SANS_THIN]);
|
||||
}
|
||||
pub fn register_noto_sans_thin_italic(cx: &mut Context) {
|
||||
cx.add_font_mem(NOTO_SANS_THIN_ITALIC, fonts::NOTO_SANS_THIN_ITALIC);
|
||||
cx.add_fonts_mem(&[fonts::NOTO_SANS_THIN_ITALIC]);
|
||||
}
|
||||
pub fn register_noto_sans_light(cx: &mut Context) {
|
||||
cx.add_font_mem(NOTO_SANS_LIGHT, fonts::NOTO_SANS_LIGHT);
|
||||
cx.add_fonts_mem(&[fonts::NOTO_SANS_LIGHT]);
|
||||
}
|
||||
pub fn register_noto_sans_light_italic(cx: &mut Context) {
|
||||
cx.add_font_mem(NOTO_SANS_LIGHT_ITALIC, fonts::NOTO_SANS_LIGHT_ITALIC);
|
||||
cx.add_fonts_mem(&[fonts::NOTO_SANS_LIGHT_ITALIC]);
|
||||
}
|
||||
pub fn register_noto_sans_bold(cx: &mut Context) {
|
||||
cx.add_font_mem(NOTO_SANS_BOLD, fonts::NOTO_SANS_BOLD);
|
||||
cx.add_fonts_mem(&[fonts::NOTO_SANS_BOLD]);
|
||||
}
|
||||
pub fn register_noto_sans_bold_italic(cx: &mut Context) {
|
||||
cx.add_font_mem(NOTO_SANS_BOLD_ITALIC, fonts::NOTO_SANS_BOLD_ITALIC);
|
||||
cx.add_fonts_mem(&[fonts::NOTO_SANS_BOLD_ITALIC]);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ impl Editor for ViziaEditor {
|
||||
if theming >= ViziaTheming::Custom {
|
||||
// NOTE: vizia's font rendering looks way too dark and thick. Going one font weight
|
||||
// lower seems to compensate for this.
|
||||
cx.set_default_font(assets::NOTO_SANS_LIGHT);
|
||||
cx.set_default_font(&[assets::NOTO_SANS_LIGHT]);
|
||||
cx.add_theme(include_str!("../assets/theme.css"));
|
||||
|
||||
// There doesn't seem to be any way to bundle styles with a widget, so we'll always
|
||||
|
||||
@@ -8,38 +8,38 @@ pub use vizia::fonts;
|
||||
|
||||
/// The font name for the Roboto (Regular) font, needs to be registered using [`register_roboto()`]
|
||||
/// first.
|
||||
pub const ROBOTO: &str = "roboto";
|
||||
pub const ROBOTO: &str = "Roboto";
|
||||
/// The font name for the Roboto Bold font, needs to be registered using [`register_roboto_bold()`]
|
||||
/// first.
|
||||
pub const ROBOTO_BOLD: &str = "roboto-bold";
|
||||
pub const ROBOTO_BOLD: &str = "Roboto Bold";
|
||||
/// The font name for the icon font (Entypo), needs to be registered using [`register_icons()`]
|
||||
/// first.
|
||||
pub const ICONS: &str = "icons";
|
||||
pub const ICONS: &str = "Entypo";
|
||||
/// The font name for the emoji font (Open Sans Eomji), needs to be registered using
|
||||
/// [`register_emoji()`] first.
|
||||
pub const EMOJI: &str = "emoji";
|
||||
pub const EMOJI: &str = "OpenSansEmoji";
|
||||
/// The font name for the arabic font (Amiri Regular), needs to be registered using
|
||||
/// [`register_arabic()`] first.
|
||||
pub const ARABIC: &str = "arabic";
|
||||
pub const ARABIC: &str = "Amiri";
|
||||
/// The font name for the material font (Material Icons), needs to be registered using
|
||||
/// [`register_material()`] first.
|
||||
pub const MATERIAL: &str = "material";
|
||||
pub const MATERIAL: &str = "Material Icons";
|
||||
|
||||
pub fn register_roboto(cx: &mut Context) {
|
||||
cx.add_font_mem(ROBOTO, fonts::ROBOTO_REGULAR);
|
||||
cx.add_fonts_mem(&[fonts::ROBOTO_REGULAR]);
|
||||
}
|
||||
pub fn register_roboto_bold(cx: &mut Context) {
|
||||
cx.add_font_mem(ROBOTO_BOLD, fonts::ROBOTO_BOLD);
|
||||
cx.add_fonts_mem(&[fonts::ROBOTO_BOLD]);
|
||||
}
|
||||
pub fn register_icons(cx: &mut Context) {
|
||||
cx.add_font_mem(ICONS, fonts::ENTYPO);
|
||||
cx.add_fonts_mem(&[fonts::ENTYPO]);
|
||||
}
|
||||
pub fn register_emoji(cx: &mut Context) {
|
||||
cx.add_font_mem(EMOJI, fonts::OPEN_SANS_EMOJI);
|
||||
cx.add_fonts_mem(&[fonts::OPEN_SANS_EMOJI]);
|
||||
}
|
||||
pub fn register_arabic(cx: &mut Context) {
|
||||
cx.add_font_mem(ARABIC, fonts::AMIRI_REGULAR);
|
||||
cx.add_fonts_mem(&[fonts::AMIRI_REGULAR]);
|
||||
}
|
||||
pub fn register_material(cx: &mut Context) {
|
||||
cx.add_font_mem(MATERIAL, fonts::MATERIAL_ICONS_REGULAR);
|
||||
cx.add_fonts_mem(&[fonts::MATERIAL_ICONS_REGULAR]);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ impl Model for WindowModel {
|
||||
fn event(&mut self, cx: &mut EventContext, event: &mut Event) {
|
||||
// This gets fired whenever the inner window gets resized
|
||||
event.map(|window_event, _| {
|
||||
if let WindowEvent::WindowResize = window_event {
|
||||
if let WindowEvent::GeometryChanged { .. } = window_event {
|
||||
let logical_size = (cx.window_size().width, cx.window_size().height);
|
||||
let old_logical_size @ (old_logical_width, old_logical_height) =
|
||||
self.vizia_state.size.load();
|
||||
|
||||
Reference in New Issue
Block a user