diff --git a/nih_plug_iced/src/assets.rs b/nih_plug_iced/src/assets.rs index a40e5294..66aef5aa 100644 --- a/nih_plug_iced/src/assets.rs +++ b/nih_plug_iced/src/assets.rs @@ -2,7 +2,7 @@ use crate::Font; -// This module provides a re-export and simple font wrapeprs aroudn the re-exported fonts. +// This module provides a re-export and simple font wrappers around the re-exported fonts. pub use nih_plug_assets::*; pub const NOTO_SANS_REGULAR: Font = Font::External { diff --git a/nih_plug_vizia/src/assets.rs b/nih_plug_vizia/src/assets.rs new file mode 100644 index 00000000..fc34ddf4 --- /dev/null +++ b/nih_plug_vizia/src/assets.rs @@ -0,0 +1,24 @@ +//! Binary assets for use with `nih_plug_iced. These fonts first need to be registered by calling +//! [`nih_plug_iced::assets::register_fonts()`][register_fonts()`]. + +use crate::vizia::Context; + +// This module provides a re-export and simple font wrappers around the re-exported fonts. +pub use nih_plug_assets::*; + +/// Register the fonts from this module so they can be used with VIZIA. +pub fn register_fonts(cx: &mut Context) { + cx.add_font_mem(NOTO_SANS_REGULAR, fonts::NOTO_SANS_REGULAR); + cx.add_font_mem(NOTO_SANS_REGULAR_ITALIC, fonts::NOTO_SANS_REGULAR_ITALIC); + cx.add_font_mem(NOTO_SANS_LIGHT, fonts::NOTO_SANS_LIGHT); + cx.add_font_mem(NOTO_SANS_LIGHT_ITALIC, fonts::NOTO_SANS_LIGHT_ITALIC); + cx.add_font_mem(NOTO_SANS_BOLD, fonts::NOTO_SANS_BOLD); + cx.add_font_mem(NOTO_SANS_BOLD_ITALIC, fonts::NOTO_SANS_BOLD_ITALIC); +} + +pub const NOTO_SANS_REGULAR: &str = "Noto Sans Regular"; +pub const NOTO_SANS_REGULAR_ITALIC: &str = "Noto Sans Regular Italic"; +pub const NOTO_SANS_LIGHT: &str = "Noto Sans Light"; +pub const NOTO_SANS_LIGHT_ITALIC: &str = "Noto Sans Light Italic"; +pub const NOTO_SANS_BOLD: &str = "Noto Sans Bold"; +pub const NOTO_SANS_BOLD_ITALIC: &str = "Noto Sans Bold Italic"; diff --git a/nih_plug_vizia/src/lib.rs b/nih_plug_vizia/src/lib.rs index 62ef33ae..d183b78d 100644 --- a/nih_plug_vizia/src/lib.rs +++ b/nih_plug_vizia/src/lib.rs @@ -10,7 +10,7 @@ use vizia::{Application, Context, WindowDescription}; // Re-export for convenience pub use vizia; -// TODO: Add exports for the nih_plug_assets fonts +pub mod assets; /// Create an [`Editor`] instance using a [`vizia`][::vizia] GUI. The [`ViziaState`] passed to this /// function contains the GUI's intitial size, and this is kept in sync whenever the GUI gets