freetype/lib.rs
1//!
2//! Rust wrapper around freetype 2 library
3//!
4//! # Initialization
5//!
6//! To create a new freetype context, instantiate the Library struct as below.
7//! The Library (along with other objects) obeys RAII and is dropped when the struct goes out of
8//! scope.
9//!
10//! # Example
11//!
12//! ```ignore
13//! extern crate freetype;
14//!
15//! fn main() {
16//! use freetype::Library;
17//! use freetype::face::LoadFlag;
18//!
19//! // Init the library
20//! let lib = Library::init().unwrap();
21//! // Load a font face
22//! let face = lib.new_face("/path/to/a/font/file.ttf", 0).unwrap();
23//! // Set the font size
24//! face.set_char_size(40 * 64, 0, 50, 0).unwrap();
25//! // Load a character
26//! face.load_char('A' as usize, LoadFlag::RENDER).unwrap();
27//! // Get the glyph instance
28//! let glyph = face.glyph();
29//! do_something_with_bitmap(glyph.bitmap());
30//! }
31//! ```
32//!
33//! See in the `examples/` folder for more examples.
34//!
35//! # External links
36//! - See [freetype docs](http://www.freetype.org/freetype2/docs/reference/ft2-index.html)
37//! for more information
38
39#![no_std]
40
41#![deny(missing_copy_implementations)]
42
43#[macro_use]
44extern crate bitflags;
45extern crate fallible;
46extern crate libc;
47extern crate null_terminated;
48pub extern crate freetype_sys;
49
50pub use bitmap::Bitmap;
51pub use bitmap_glyph::BitmapGlyph;
52pub use error::{Error, FtResult};
53pub use face::Face;
54pub use glyph::Glyph;
55pub use glyph_slot::GlyphSlot;
56pub use library::{LcdFilter, Library};
57pub use outline::Outline;
58pub use render_mode::RenderMode;
59pub use stroker::{Stroker, StrokerLineCap, StrokerLineJoin };
60pub use freetype_sys as ffi;
61
62pub mod bitmap;
63pub mod bitmap_glyph;
64pub mod error;
65pub mod face;
66pub mod glyph;
67pub mod glyph_slot;
68pub mod library;
69pub mod outline;
70pub mod render_mode;
71pub mod stroker;
72pub mod tt_os2;
73
74pub type BBox = ffi::FT_BBox;
75pub type GlyphMetrics = ffi::FT_Glyph_Metrics;
76pub type Matrix = ffi::FT_Matrix;
77pub type Vector = ffi::FT_Vector;
78
79use null_terminated::Nul;