     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73

    use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
    use rusttype::{Font, PositionedGlyph, Scale, Rect, point, GlyphId};
    use rusttype::gpu_cache::Cache;
    use vulkano::buffer::{BufferAccess, BufferUsage, ImmutableBuffer, CpuAccessibleBuffer};
    use vulkano::device::{Device, Queue};
    use std::sync::Arc;
    use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
    use vulkano::image::{ImmutableImage, ImageUsage, ImageLayout, Dimensions};
    use vulkano::format::ClearValue;
    use vulkano::format::Format::R8Unorm;
    use std::fs::File;
    use std::io::Read;

    //pub struct Glyph {}
    //
    ///// So currently, I'm using these as container classes which vkprocessor owns
    ///// I then use a CanvasFrame which accumulates lists of handles and vertices.
    //pub struct CanvasFonto {
    //    font: Font<'static>,
    //    font_name: String,
    //    allocated_font_atlas: Arc<(dyn BufferAccess + Send + Sync)>,
    //}
    //
    //impl CanvasFonto {
    //
    //    pub fn parse_to_vertex_buffer(font: Font) -> Vec<TextVertex3D> {
    //
    //        let mut current_x = 0;
    //        let mut current_y = 0;
    //
    //        let mut accumulator = Vec::new();
    //
    //        for i in (0..255) {
    //
    //            let glyph = font.glyph(GlyphId{ 0: 40 });
    //
    //            let glyph_data = glyph.get_data().unwrap();
    //
    //            for vertex in glyph_data.clone().shape.clone().unwrap() {
    //                accumulator.push(TextVertex3D {
    //                    position: [vertex.x as f32, vertex.y as f32, 0.0],
    //                });
    //            }
    //        }
    //
    //        accumulator
    //    }
    //    /// Load the font
    //    pub fn new(device: Arc<Device>, queue: Arc<Queue>, font_name: String) -> CanvasFonto {
    //
    //        let font = Font::from_bytes({
    //            let mut f = File::open("resources/fonts/sansation.ttf").expect("Font file not found");
    //            let mut font_data = Vec::new();
    //            f.read_to_end(&mut font_data).expect("Dont know");
    //            font_data
    //        }).unwrap();
    //
    //        CanvasFont {
    //            font: font.clone(),
    //            font_name: font_name,
    //            allocated_font_atlas: ImmutableBuffer::from_iter(
    //                CanvasFont::parse_to_vertex_buffer(font.clone()).iter().cloned(),
    //                BufferUsage::vertex_buffer(), queue).unwrap().0,
    //        }
    //    }
    //
    //    /// Generate a vertex buffer from the font
    //    pub fn get_vertex_buffer(&self) -> Arc<(dyn BufferAccess + Send + Sync)> {
    //        return self.allocated_font_atlas.clone();
    //    }
    //
    //}

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)