Font update
This commit is contained in:
+36
-29
@@ -30,7 +30,7 @@ use crate::writing::{WritingMessage, WritingState};
|
||||
use crate::Page::{Dictionary, DictionaryQuiz, History, Quiz, Randomizer, Repetition, Repetitions, Selector, Sync, Word, Writing};
|
||||
use crate::RootMessage::Keyboard;
|
||||
use iced::keyboard::Event;
|
||||
use iced::widget::text;
|
||||
use iced::widget::{text, text_input, TextInput};
|
||||
use iced::{keyboard, Element, Program, Subscription, Theme};
|
||||
use iced::{Font, Task};
|
||||
use rusqlite::Connection;
|
||||
@@ -47,13 +47,13 @@ fn main() -> iced::Result {
|
||||
.subscription(subscription)
|
||||
.title("Kana learn app")
|
||||
.settings(iced::Settings{
|
||||
default_text_size: iced::Pixels(16.0),
|
||||
default_text_size: iced::Pixels(20.0),
|
||||
..iced::Settings::default()
|
||||
})
|
||||
.font(include_bytes!("../ibmplex.ttf"))
|
||||
.font(include_bytes!("../noto.ttf"))
|
||||
.default_font(USER_FONT)
|
||||
.scale_factor(|x| 1.5)
|
||||
.default_font(Font::with_name("IBM Plex Sans"))
|
||||
// .scale_factor(|x| 1.5)
|
||||
|
||||
.theme(Theme::GruvboxDark)
|
||||
.run()
|
||||
@@ -63,6 +63,38 @@ fn subscription(_state: &ScreenState) -> Subscription<RootMessage> {
|
||||
keyboard::listen().map(|e| Keyboard(e))
|
||||
}
|
||||
|
||||
pub fn jl_text_input<'a, Message, Theme, Renderer>(placeholder: &str, value: &str) -> TextInput<'a, Message, Theme, Renderer>
|
||||
where
|
||||
Message: Clone,
|
||||
Theme: text_input::Catalog + 'a, Renderer: iced_core::text::Renderer<Font = Font>{
|
||||
text_input(placeholder, value).font(USER_FONT)
|
||||
}
|
||||
|
||||
pub struct AppState {
|
||||
pub dictionary: Vec<WordData>,
|
||||
pub card_sets: Vec<CardSetSettings>,
|
||||
pub word_groups: Vec<WordGroup>,
|
||||
pub connection: Connection,
|
||||
pub sync_data: AppSettings,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
pub fn new() -> Self {
|
||||
let path = app_data_dir();
|
||||
let db_file = path.join("data.db");
|
||||
let connection = Connection::open(db_file).unwrap();
|
||||
connection.execute("PRAGMA foreign_keys = ON;", []).unwrap();
|
||||
|
||||
Self{
|
||||
dictionary: vec![],
|
||||
card_sets: vec![],
|
||||
word_groups: vec![],
|
||||
connection,
|
||||
sync_data: AppSettings { key: None },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum RootMessage {
|
||||
Selector(SelectorMessage),
|
||||
@@ -98,31 +130,6 @@ pub struct ScreenState {
|
||||
stack: Vec<Page>,
|
||||
}
|
||||
|
||||
pub struct AppState {
|
||||
pub dictionary: Vec<WordData>,
|
||||
pub card_sets: Vec<CardSetSettings>,
|
||||
pub word_groups: Vec<WordGroup>,
|
||||
pub connection: Connection,
|
||||
pub sync_data: AppSettings,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
pub fn new() -> Self {
|
||||
let path = app_data_dir();
|
||||
let db_file = path.join("data.db");
|
||||
let connection = Connection::open(db_file).unwrap();
|
||||
connection.execute("PRAGMA foreign_keys = ON;", []).unwrap();
|
||||
|
||||
Self{
|
||||
dictionary: vec![],
|
||||
card_sets: vec![],
|
||||
word_groups: vec![],
|
||||
connection,
|
||||
sync_data: AppSettings { key: None },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ScreenState {
|
||||
fn default() -> Self {
|
||||
let mut state = AppState::new();
|
||||
|
||||
Reference in New Issue
Block a user