Struct ringraphics::ttf::Ttf [−][src]
pub struct Ttf { /* fields omitted */ }
Methods
impl Ttf
[src]
impl Ttf
pub fn line_height(&self) -> f32
[src]
pub fn line_height(&self) -> f32
distance between baselines
pub fn ascender(&self) -> f32
[src]
pub fn ascender(&self) -> f32
distance between baseline and top of highest character in the font
pub fn descender(&self) -> f32
[src]
pub fn descender(&self) -> f32
distance between the baseline and bottom of the lowest character in the font
pub fn line_gap(&self) -> f32
[src]
pub fn line_gap(&self) -> f32
distance between the bottom of the lowest character in the font and the top of the highest character if they were put in consecutive lines. separation between 2 lines
pub fn antialiasing_type(&self) -> Antialiasing
[src]
pub fn antialiasing_type(&self) -> Antialiasing
returns the type of antialiasing of this font
pub fn mesh(
&self,
string: &str,
x: f32,
y: f32,
coordinate_origin: CoordinateOrigin
) -> Mesh<Vertex2DTex>
[src]
pub fn mesh(
&self,
string: &str,
x: f32,
y: f32,
coordinate_origin: CoordinateOrigin
) -> Mesh<Vertex2DTex>
returns the mesh for the string passed, put this mesh in a vao when drawing the same text for a long time or use a renderer draw_string function if it changes very often
pub fn bounding_box(
&self,
string: &str,
x: f32,
y: f32,
coordinate_origin: CoordinateOrigin
) -> Rect<f32>
[src]
pub fn bounding_box(
&self,
string: &str,
x: f32,
y: f32,
coordinate_origin: CoordinateOrigin
) -> Rect<f32>
returns the bounding box of a text drawn from a mesh returned by like the mesh function like gl::draw_string or other renderers do
pub fn box_mesh(
&self,
string: &str,
x: f32,
y: f32,
w: f32,
h: f32,
coordinate_origin: CoordinateOrigin
) -> Mesh<Vertex2DTex>
[src]
pub fn box_mesh(
&self,
string: &str,
x: f32,
y: f32,
w: f32,
h: f32,
coordinate_origin: CoordinateOrigin
) -> Mesh<Vertex2DTex>
returns the mesh of a text so it fits in a box of the size and position passed as parameters, if h<0 it won't adjust for height, if not it'll stop drawing the text before the next line overflows the specified height
pub fn box_height(&self, string: &str, w: f32) -> f32
[src]
pub fn box_height(&self, string: &str, w: f32) -> f32
returns the total height of a box of text with width w
pub fn next_pos(
&self,
string: &str,
x: f32,
y: f32,
coordinate_origin: CoordinateOrigin
) -> Vec2
[src]
pub fn next_pos(
&self,
string: &str,
x: f32,
y: f32,
coordinate_origin: CoordinateOrigin
) -> Vec2
returns the position where a text should be drawn to correctly appear next to the one passed as parameter. the kerning with the next character is of course not added since we don't know which will be that next character yet, and should be added when rendering the next string
pub fn shape<F>(
&self,
string: &str,
x: f32,
y: f32,
coordinate_origin: CoordinateOrigin,
f: F
) -> Vec2 where
F: FnMut(Vec2, Vec2, &TextureGlyph),
[src]
pub fn shape<F>(
&self,
string: &str,
x: f32,
y: f32,
coordinate_origin: CoordinateOrigin,
f: F
) -> Vec2 where
F: FnMut(Vec2, Vec2, &TextureGlyph),
useful for advanced layout, calls back the f closure for each glyph passing the bottom left and top right corners where it should be drawn after applying kerning and the glyph itself which contains information like it's ascendent, descendent, offset, width... http://www.freetype.org/freetype2/docs/tutorial/step2.html#section-1
ⓘImportant traits for ShapeIter<'a>pub fn shape_iter<'a>(
&'a self,
string: &'a str,
x: f32,
y: f32,
coordinate_origin: CoordinateOrigin
) -> ShapeIter<'a>
[src]
pub fn shape_iter<'a>(
&'a self,
string: &'a str,
x: f32,
y: f32,
coordinate_origin: CoordinateOrigin
) -> ShapeIter<'a>
useful for advanced layout, calls back the f closure for each glyph passing the bottom left and top right corners where it should be drawn after applying kerning and the glyph itself which contains information like it's ascendent, descendent, offset, width... http://www.freetype.org/freetype2/docs/tutorial/step2.html#section-1
pub fn box_shape<F>(
&self,
string: &str,
x: f32,
y: f32,
w: f32,
h: f32,
coordinate_origin: CoordinateOrigin,
f: F
) -> f32 where
F: FnMut(&str, f32, f32),
[src]
pub fn box_shape<F>(
&self,
string: &str,
x: f32,
y: f32,
w: f32,
h: f32,
coordinate_origin: CoordinateOrigin,
f: F
) -> f32 where
F: FnMut(&str, f32, f32),
useful for advanced box layout, calculates the layout of text fitted in a box of w x h and calls back the f closure for each word passing the x and y coordinates where it should be drawn, combined with shape it can be used to calculate the layout for each glyph on the text. returns the final height of the bounding box for the resulting text
pub fn freetypegl(&self) -> &TextureFont
[src]
pub fn freetypegl(&self) -> &TextureFont