Documentation
#[cfg(any(target_vendor = "apple", feature = "dev"))]
#[allow(dead_code)]
mod coretext;

#[cfg(any(target_family = "windows", feature = "dev"))]
#[allow(dead_code)]
mod dwrite;

#[cfg(any(target_os = "android", feature = "dev"))]
#[allow(dead_code)]
mod android;

#[cfg(any(target_os = "linux", feature = "dev"))]
#[allow(dead_code)]
mod fontconfig;

#[allow(dead_code)]
mod empty;

#[cfg(target_vendor = "apple")]
pub use coretext::XFont;

#[cfg(target_family = "windows")]
pub use dwrite::XFont;

#[cfg(target_os = "android")]
pub use android::XFont;

#[cfg(target_os = "linux")]
pub use fontconfig::XFont;

#[cfg(not(any(target_vendor = "apple", target_family = "windows", target_os = "android", target_os = "linux")))]
pub use empty::XFont;

mod family;
pub use family::*;
mod generic;
pub use generic::*;

pub trait XFontType: Default {
	fn system() -> String;
	fn fallback(&self, family: &Family, text: &str) -> Fallback;
}

#[derive(Debug, Default)]
pub struct Fallback {
	pub index: Option<u32>,
	pub unique: Option<String>,
	// TODO Variation attr
	pub file: std::path::PathBuf,
}

impl Family {
	pub fn serif() -> Self {
		Generic::Serif.system().into()
	}
	pub fn sans_serif() -> Self {
		Generic::SansSerif.system().into()
	}
	pub fn monospace() -> Self {
		Generic::Monospace.system().into()
	}
	pub fn cursive() -> Self {
		Generic::Cursive.system().into()
	}
	pub fn fantasy() -> Self {
		Generic::Fantasy.system().into()
	}
	pub fn system_ui() -> Self {
		Generic::SystemUi.system().into()
	}
	pub fn ui_serif() -> Self {
		Generic::UiSerif.system().into()
	}
	pub fn ui_sans_serif() -> Self {
		Generic::UiSansSerif.system().into()
	}
	pub fn ui_monospace() -> Self {
		Generic::UiMonospace.system().into()
	}
	pub fn ui_rounded() -> Self {
		Generic::UiRounded.system().into()
	}
	pub fn emoji() -> Self {
		Generic::Emoji.system().into()
	}
	pub fn math() -> Self {
		Generic::Math.system().into()
	}
	pub fn fang_song() -> Self {
		Generic::FangSong.system().into()
	}
}