pub struct Font {
pub bitmap_file: String,
pub width: u32,
pub height: u32,
pub gl_id: Option<NativeTexture>,
pub tile_size: (u32, u32),
pub explicit_background: Option<RGB>,
pub font_dimensions_glyphs: (u32, u32),
pub font_dimensions_texture: (f32, f32),
}
Expand description
BTerm’s representation of a font or tileset file.
Fields§
§bitmap_file: String
§width: u32
§height: u32
§gl_id: Option<NativeTexture>
§tile_size: (u32, u32)
§explicit_background: Option<RGB>
§font_dimensions_glyphs: (u32, u32)
§font_dimensions_texture: (f32, f32)
Implementations§
Source§impl Font
impl Font
Sourcepub fn new<S>(
filename: S,
width: u32,
height: u32,
tile_size: (u32, u32),
) -> Fontwhere
S: ToString,
pub fn new<S>(
filename: S,
width: u32,
height: u32,
tile_size: (u32, u32),
) -> Fontwhere
S: ToString,
Creates an unloaded texture with filename and size parameters provided.
Sourcepub fn load<S>(
filename: S,
tile_size: (u32, u32),
explicit_background: Option<RGB>,
) -> Fontwhere
S: ToString,
pub fn load<S>(
filename: S,
tile_size: (u32, u32),
explicit_background: Option<RGB>,
) -> Fontwhere
S: ToString,
Loads a font file (texture) to obtain the width and height for you
Sourcepub fn setup_gl_texture(
&mut self,
gl: &Context,
) -> Result<NativeTexture, Box<dyn Error + Send + Sync>>
pub fn setup_gl_texture( &mut self, gl: &Context, ) -> Result<NativeTexture, Box<dyn Error + Send + Sync>>
Load a font, and allocate it as an OpenGL resource. Returns the OpenGL binding number (which is also set in the structure).
Sourcepub fn bind_texture(&self, gl: &Context)
pub fn bind_texture(&self, gl: &Context)
Sets this font file as the active texture
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Font
impl RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin for Font
impl UnwindSafe for Font
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more