|
|
@ -2,28 +2,27 @@
|
|
|
|
pub struct FontOptions {
|
|
|
|
pub struct FontOptions {
|
|
|
|
previous_guifont_setting: Option<String>,
|
|
|
|
previous_guifont_setting: Option<String>,
|
|
|
|
pub fallback_list: Vec<String>,
|
|
|
|
pub fallback_list: Vec<String>,
|
|
|
|
pub size: f32
|
|
|
|
pub size: f32,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl FontOptions {
|
|
|
|
impl FontOptions {
|
|
|
|
pub fn new(name: String, size: f32) -> FontOptions {
|
|
|
|
pub fn new(name: String, size: f32) -> FontOptions {
|
|
|
|
FontOptions {
|
|
|
|
FontOptions {
|
|
|
|
previous_guifont_setting: None,
|
|
|
|
previous_guifont_setting: None,
|
|
|
|
fallback_list: vec!(name),
|
|
|
|
fallback_list: vec![name],
|
|
|
|
size
|
|
|
|
size,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn update(self: &mut FontOptions, guifont_setting: &str) -> bool {
|
|
|
|
pub fn update(self: &mut FontOptions, guifont_setting: &str) -> bool {
|
|
|
|
if self.previous_guifont_setting.is_some() &&
|
|
|
|
if self.previous_guifont_setting.is_some()
|
|
|
|
guifont_setting == self.previous_guifont_setting.as_ref().unwrap() {
|
|
|
|
&& guifont_setting == self.previous_guifont_setting.as_ref().unwrap()
|
|
|
|
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self.previous_guifont_setting = Some(guifont_setting.to_string());
|
|
|
|
self.previous_guifont_setting = Some(guifont_setting.to_string());
|
|
|
|
|
|
|
|
|
|
|
|
let mut parts = guifont_setting
|
|
|
|
let mut parts = guifont_setting.split(':').filter(|part| !part.is_empty());
|
|
|
|
.split(':')
|
|
|
|
|
|
|
|
.filter(|part| !part.is_empty());
|
|
|
|
|
|
|
|
let mut updated = false;
|
|
|
|
let mut updated = false;
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(parts) = parts.next() {
|
|
|
|
if let Some(parts) = parts.next() {
|
|
|
|