diff --git a/noto.ttf b/noto.ttf new file mode 100644 index 0000000..6c730cd Binary files /dev/null and b/noto.ttf differ diff --git a/src/main.rs b/src/main.rs index 2f28070..0fbeb46 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ use iced::Element; fn main() -> iced::Result { iced::application(ScreenState::boot, ScreenState::update, ScreenState::view) - .title("Kana learn app").run() + .title("Kana learn app").font(include_bytes!("../noto.ttf")).run() } #[derive(Debug, Clone)] diff --git a/src/quiz.rs b/src/quiz.rs index cfa5830..11a214d 100644 --- a/src/quiz.rs +++ b/src/quiz.rs @@ -2,7 +2,7 @@ use crate::lang::KanaSet; use crate::Page::PreviousPage; use crate::{NavigatedPage, Page}; use iced::widget::*; -use iced::{alignment, Element, Fill, Font}; +use iced::{alignment, Element, Fill}; use rand::seq::SliceRandom; #[derive(Clone, Debug)] @@ -97,8 +97,7 @@ impl QuizState { iced::widget::column![ row![ text!("{}", self.kana.to_uppercase()) - .size(54) - .font(Font::with_name("AppleGothic")), + .size(54), text!( "{}", if self.is_help { @@ -129,6 +128,7 @@ impl QuizState { .spacing(10) .align_x(alignment::Horizontal::Center), ) + .center_y(Fill) .center_x(Fill) .into() } diff --git a/src/selector.rs b/src/selector.rs index 80ad19b..550a68e 100644 --- a/src/selector.rs +++ b/src/selector.rs @@ -4,7 +4,7 @@ use crate::writing::WritingState; use crate::Page::{Quiz, Writing}; use crate::{NavigatedPage, Page, QuizState}; use iced::widget::*; -use iced::{alignment, Element, Font}; +use iced::{alignment, Element}; pub struct SelectorState { pub set: KanaSet, @@ -87,8 +87,7 @@ impl SelectorState { chars_column = chars_column.push( container( text!("{}", v.0.clone().to_uppercase()) - .size(36) - .font(Font::with_name("AppleGothic")), + .size(36), ) .padding(20) .style(container::rounded_box), diff --git a/src/writing.rs b/src/writing.rs index 82bc5af..9990605 100644 --- a/src/writing.rs +++ b/src/writing.rs @@ -2,7 +2,7 @@ use crate::lang::KanaSet; use crate::Page::PreviousPage; use crate::{NavigatedPage, Page}; use iced::widget::*; -use iced::{alignment, Element, Fill, Font}; +use iced::{alignment, Element, Fill}; use rand::seq::SliceRandom; #[derive(Clone, Debug)] @@ -12,7 +12,6 @@ pub struct WritingState { original_set: Vec<(String, String)>, kana_total: String, roman_total: String, - is_help: bool, next_text: String, } @@ -36,7 +35,6 @@ impl WritingState { original_set: list, kana_total: "".to_string(), roman_total: "".to_string(), - is_help: false, next_text: "Дальше".to_string(), } } @@ -82,13 +80,14 @@ impl WritingState { .align_x(alignment::Horizontal::Center), ) .center_x(Fill) + .center_y(Fill) + .padding(10) .into() } fn answers(&self) -> Element<'_, WritingMessage> { if self.set.is_empty() { text!("{}", self.kana_total) - .font(Font::with_name("AppleGothic")) .size(36) .into() } else { @@ -100,11 +99,4 @@ impl WritingState { pub enum WritingMessage { Next, Back, -} - -#[derive(Default, Debug, Clone)] -pub struct Score { - total: i32, - correct: i32, - fail: i32, -} +} \ No newline at end of file