Fix some documentation 🚧

This commit is contained in:
Laurenz Mädje 2019-06-02 12:39:59 +02:00
parent 0274e93810
commit c4eb4ee362
4 changed files with 10 additions and 11 deletions

View File

@ -24,7 +24,7 @@ pub struct Page {
pub actions: Vec<TextAction>,
}
/// A series of text layouting actions.
/// A text layouting action.
#[derive(Debug, Clone)]
pub enum TextAction {
/// Move from the _start_ of the current line by an (x, y) offset.

View File

@ -395,8 +395,8 @@ impl<'p> FontLoader<'p> {
}
drop(state);
// The outermost loop goes over the families because we want to serve
// the font that matches the first possible family.
// The outermost loop goes over the families because we want to serve the font that matches
// the first possible family.
for family in &query.families {
// For each family now go over all font infos from all font providers.
for (provider, infos) in self.providers.iter().zip(&self.provider_fonts) {
@ -405,9 +405,9 @@ impl<'p> FontLoader<'p> {
if Self::matches(&query, family, info) {
let mut state = self.state.borrow_mut();
// Check if we have already loaded this font before, otherwise, we will
// load it from the provider. Anyway, have it stored and find out its
// internal index.
// Check if we have already loaded this font before, otherwise, we will load
// it from the provider. Anyway, have it stored and find out its internal
// index.
let index = if let Some(&index) = state.info_cache.get(info) {
index
} else if let Some(mut source) = provider.get(info) {
@ -469,9 +469,9 @@ impl<'p> FontLoader<'p> {
/// Move the whole list of fonts out.
pub fn into_fonts(self) -> Vec<Font> {
// Sort the fonts by external index so that they are in the correct order.
// All fonts that were cached but not used by the outside are sorted to the back
// and are removed in the next step.
// Sort the fonts by external index so that they are in the correct order. All fonts that
// were cached but not used by the outside are sorted to the back and are removed in the
// next step.
let mut fonts = self.state.into_inner().fonts;
fonts.sort_by_key(|&(maybe_index, _)| match maybe_index {
Some(index) => index,

View File

@ -80,6 +80,7 @@ pub struct LayoutContext<'a, 'p> {
pub text_style: TextStyle,
}
/// A space to layout in.
#[derive(Debug, Clone)]
pub struct LayoutDimensions {
/// Horizontal extent.

View File

@ -140,8 +140,6 @@ impl<'p> Typesetter<'p> {
let tree = self.parse(src)?;
let (layout, fonts) = self.layout(&tree)?;
let document = layout.into_document(fonts);
println!("fonts = {}", document.fonts.len());
println!("document = {:?}", document.pages);
Ok(document)
}
}