1
0
Fork 0

Add font re-exports for vizia

This commit is contained in:
Robbert van der Helm 2022-03-18 00:22:58 +01:00
parent fb5ce3c670
commit fd6836b891
3 changed files with 26 additions and 2 deletions

View file

@ -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 {

View file

@ -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";

View file

@ -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