Struct rin::graphics::ttf::Ttf[][src]

pub struct Ttf { /* fields omitted */ }

Implementations

impl Ttf[src]

pub fn line_height(&self) -> f32[src]

distance between baselines

pub fn ascender(&self) -> f32[src]

distance between baseline and top of highest character in the font

pub fn descender(&self) -> f32[src]

a negative number indicating the distance between the baseline and bottom of the lowest character in the font

pub fn line_gap(&self) -> f32[src]

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]

returns the type of antialiasing of this font

pub fn mesh(
    &self,
    string: &str,
    pos: &Point<f32, U2>,
    coordinate_origin: CoordinateOrigin
) -> Mesh<Vertex2DTex>
[src]

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 mesh_color<C>(
    &self,
    string: &str,
    pos: &Point<f32, U2>,
    coordinate_origin: CoordinateOrigin,
    color: &C
) -> Mesh<Vertex2DTexColor> where
    C: ToRgba
[src]

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 append_mesh(
    &self,
    string: &str,
    pos: &Point<f32, U2>,
    coordinate_origin: CoordinateOrigin,
    mesh: &mut Mesh<Vertex2DTex>
)
[src]

pub fn append_mesh_color<C>(
    &self,
    string: &str,
    pos: &Point<f32, U2>,
    coordinate_origin: CoordinateOrigin,
    color: &C,
    mesh: &mut Mesh<Vertex2DTexColor>
) where
    C: ToRgba
[src]

pub fn bounding_box(
    &self,
    string: &str,
    pos: &Point<f32, U2>,
    coordinate_origin: CoordinateOrigin
) -> Rect<f32>
[src]

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 width(&self, string: &str) -> f32[src]

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<H>(
    &self,
    string: &str,
    pos: &Point<f32, U2>,
    w: BoxCoordinatesX,
    h: H,
    coordinate_origin: CoordinateOrigin,
    flags: BoxFlags
) -> BoxMesh<Vertex2DTex> where
    H: Into<Option<BoxCoordinatesY>>, 
[src]

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_mesh_color<H, C>(
    &self,
    string: &str,
    pos: &Point<f32, U2>,
    w: BoxCoordinatesX,
    h: H,
    coordinate_origin: CoordinateOrigin,
    flags: BoxFlags,
    color: &C
) -> BoxMesh<Vertex2DTexColor> where
    C: ToRgba,
    H: Into<Option<BoxCoordinatesY>>, 
[src]

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_size(
    &self,
    string: &str,
    w: BoxCoordinatesX
) -> Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>
[src]

returns the bounding box size of text rendered to a box with width w

pub fn next_pos(
    &self,
    string: &str,
    pos: &Point<f32, U2>,
    coordinate_origin: CoordinateOrigin
) -> Point<f32, U2>
[src]

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 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_iter(
    &'a self,
    string: &'a str,
    pos: &'a Point<f32, U2>,
    coordinate_origin: CoordinateOrigin
) -> impl Iterator<Item = Shape> + 'a
[src]

useful for advanced layout, iterrates through 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_iter<H>(
    &'a self,
    string: &'a str,
    pos: &Point<f32, U2>,
    w: BoxCoordinatesX,
    h: H,
    coordinate_origin: CoordinateOrigin,
    flags: BoxFlags
) -> impl Iterator<Item = Shape> + 'a where
    H: Into<Option<BoxCoordinatesY>>, 
[src]

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

by default the position y coordinate is the top or bottom of the box (depending on the CoordinateOrigin). This can be changed to the baseline of the first line of text using the BoxFlags::Y_START_AT_BASELINE flag.

The cut unit is by default the word, if a word doesn’t fit the box it’ll be sent to the next line if possible. When using the BoxFlags::CUT_LETTERS the cut uint will be the letter instead and words will be cut at any point.

pub fn freetypegl(&self) -> &TextureFont[src]

Trait Implementations

impl Send for Ttf[src]

Auto Trait Implementations

impl RefUnwindSafe for Ttf

impl !Sync for Ttf

impl Unpin for Ttf

impl UnwindSafe for Ttf

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]