Add documentation and improve API
This commit is contained in:
parent
de572b1645
commit
a242d817e9
10 changed files with 76 additions and 71 deletions
|
|
@ -23,7 +23,6 @@ use cosmic_text::{
|
|||
};
|
||||
use std::{
|
||||
env,
|
||||
fmt,
|
||||
fs,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
|
@ -135,8 +134,7 @@ impl Application for Window {
|
|||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
let buffer = self.buffer.lock().unwrap();
|
||||
format!("COSMIC Text - iced - {}", buffer.font_matches().locale)
|
||||
format!("COSMIC Text - iced - {}", FONT_SYSTEM.locale)
|
||||
}
|
||||
|
||||
fn update(&mut self, message: Message) -> iced::Command<Self::Message> {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use cosmic::iced_native::{
|
|||
widget::{self, Widget},
|
||||
};
|
||||
use cosmic_text::{
|
||||
FontLineIndex,
|
||||
TextLineIndex,
|
||||
TextAction,
|
||||
TextBuffer,
|
||||
};
|
||||
|
|
@ -136,7 +136,7 @@ where
|
|||
let line_x = layout.bounds().x as i32;
|
||||
let mut line_y = layout.bounds().y as i32 + font_size;
|
||||
let mut start_line_opt = None;
|
||||
let mut end_line = FontLineIndex::new(0);
|
||||
let mut end_line = TextLineIndex::new(0);
|
||||
for (line_i, line) in buffer
|
||||
.layout_lines()
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use cosmic_text::{FontLineIndex, FontSystem, TextAction, TextBuffer, TextCursor, TextMetrics};
|
||||
use cosmic_text::{FontSystem, TextAction, TextBuffer, TextCursor, TextLineIndex, TextMetrics};
|
||||
use orbclient::{Color, EventOption, Renderer, Window, WindowFlag};
|
||||
use std::{cmp, env, fs, time::Instant};
|
||||
use std::{env, fs, time::Instant};
|
||||
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
|
|
@ -156,7 +156,7 @@ fn main() {
|
|||
|
||||
let mut line_y = line_height;
|
||||
let mut start_line_opt = None;
|
||||
let mut end_line = FontLineIndex::new(0);
|
||||
let mut end_line = TextLineIndex::new(0);
|
||||
for (line_i, line) in buffer
|
||||
.layout_lines()
|
||||
.iter()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue