Complete the documentation
This commit is contained in:
parent
6261c87b89
commit
d306ef01d1
|
@ -75,7 +75,6 @@ fn main() {
|
|||
None => 0,
|
||||
};
|
||||
|
||||
// FIXME(pcwalton)
|
||||
let (outlines, atlas);
|
||||
unsafe {
|
||||
let font = Font::from_collection_index(file.as_slice(), font_index).unwrap();
|
||||
|
|
29
src/lib.rs
29
src/lib.rs
|
@ -36,13 +36,40 @@
|
|||
//!
|
||||
//! See `examples/generate-atlas.rs` for a simple example.
|
||||
//!
|
||||
//! Typically, the steps to use Pathfidner are:
|
||||
//! Typically, the steps to use Pathfinder are:
|
||||
//!
|
||||
//! 1. Create a `Rasterizer` object. This holds the OpenGL state.
|
||||
//!
|
||||
//! 2. Open the font from disk (or elsewhere), and call `Font::new()` (or
|
||||
//! `Font::from_collection_index` in the case of a `.ttc` or `.dfont` collection) to load it.
|
||||
//!
|
||||
//! 3. If the text to be rendered is not already shaped, call
|
||||
//! `Font::glyph_mapping_for_codepoint_ranges()` to determine the glyphs needed to render the
|
||||
//! text, and call `shaper::shape_text()` to convert the text to glyph IDs.
|
||||
//!
|
||||
//! 4. Create an `OutlineBuilder` and call `OutlineBuilder::add_glyph()` on each glyph to parse
|
||||
//! each outline from the font. Then upload the outlines to the GPU with
|
||||
//! `OutlineBuilder::create_buffers()`.
|
||||
//!
|
||||
//! 5. Create an `AtlasBuilder` with a suitable width (1024 or 2048 is usually fine) and call
|
||||
//! `AtlasBuilder::pack_glyph()` on each glyph you need to render. Then call
|
||||
//! `AtlasBuilder::create_atlas()` to upload the atlas buffer to the GPU.
|
||||
//!
|
||||
//! 6. Make a `CoverageBuffer` of an appropriate size (1024 or 2048 pixels on each side is
|
||||
//! typically reasonable).
|
||||
//!
|
||||
//! 7. Create an image to render the atlas to with `Rasterizer::device().create_image()`. The
|
||||
//! format should be `R8` and the buffer should be created read-write.
|
||||
//!
|
||||
//! 8. Draw the glyphs with `Rasterizer::draw_atlas()`.
|
||||
//!
|
||||
//! Don't forget to flush the queue (`Rasterizer::queue().flush()`) and/or perform appropriate
|
||||
//! synchronization (`glMemoryBarrier()`) as necessary.
|
||||
//!
|
||||
//! ## Hardware requirements
|
||||
//!
|
||||
//! Pathfinder requires at least OpenGL 3.3 and either OpenGL 4.3 compute shader or OpenCL 1.2.
|
||||
//! Intel GPUs in Sandy Bridge processors or later should be OK.
|
||||
|
||||
#![cfg_attr(test, feature(test))]
|
||||
|
||||
|
|
Loading…
Reference in New Issue