pub struct FontCache { /* private fields */ }Implementations§
Source§impl FontCache
impl FontCache
pub fn new() -> Self
pub fn is_loaded(&self) -> bool
pub fn loaded_from(&self) -> Option<&Path>
pub fn loaded_face_index(&self) -> u32
pub fn load_for_project(&mut self, project_dir: &Path) -> bool
Sourcepub fn load_for_project_named(
&mut self,
project_dir: &Path,
requested_name: &str,
) -> bool
pub fn load_for_project_named( &mut self, project_dir: &Path, requested_name: &str, ) -> bool
Select the effective engine font and load it if necessary.
Siglus resolves the active face in this order: local SCRIPT override,
then the current SYSCOM configuration. tnm_update_font() clears the
original glyph manager when that face changes. This method mirrors the
same boundary and deliberately does not retain the first face forever.
pub fn requested_name(&self) -> &str
pub fn load_from_font_dir(&mut self, font_dir: &Path) -> bool
pub fn render_text( &self, images: &mut ImageManager, text: &str, font_px: f32, max_w: u32, max_h: u32, ) -> Option<ImageHandle>
pub fn render_mwnd_text( &self, images: &mut ImageManager, text: &str, font_px: f32, max_w: u32, max_h: u32, moji_space: Option<(i64, i64)>, ) -> Option<ImageHandle>
pub fn render_mwnd_text_styled( &self, images: &mut ImageManager, text: &str, font_px: f32, max_w: u32, max_h: u32, moji_space: Option<(i64, i64)>, style: TextStyle, ) -> Option<ImageHandle>
pub fn render_mwnd_text_styled_into( &self, images: &mut ImageManager, target: Option<ImageHandle>, text: &str, font_px: f32, max_w: u32, max_h: u32, moji_space: Option<(i64, i64)>, style: TextStyle, ) -> Option<ImageHandle>
pub fn render_positioned_glyphs_into( &self, images: &mut ImageManager, target: Option<ImageHandle>, glyphs: &[PositionedTextGlyph], min_w: u32, min_h: u32, ) -> Option<PositionedTextRender>
pub fn render_positioned_glyph_layer_into( &self, images: &mut ImageManager, target: Option<ImageHandle>, glyphs: &[PositionedTextGlyph], min_w: u32, min_h: u32, layer: Option<TextSpriteLayer>, ) -> Option<PositionedTextRender>
Sourcepub fn render_single_glyph_layer_into(
&self,
images: &mut ImageManager,
target: Option<ImageHandle>,
glyph: PositionedTextGlyph,
layer: TextSpriteLayer,
) -> Option<PositionedTextRender>
pub fn render_single_glyph_layer_into( &self, images: &mut ImageManager, target: Option<ImageHandle>, glyph: PositionedTextGlyph, layer: TextSpriteLayer, ) -> Option<PositionedTextRender>
Rasterize one glyph into a tight texture for the original shadow/fuchi/body-per-glyph sprite model. The returned offsets are relative to the requested glyph anchor and include outline/shadow padding and font bearing.
pub fn render_text_into( &self, images: &mut ImageManager, target: Option<ImageHandle>, text: &str, font_px: f32, max_w: u32, max_h: u32, ) -> Option<ImageHandle>
pub fn render_editbox_into( &self, images: &mut ImageManager, target: Option<ImageHandle>, text: &str, cursor_pos: usize, selection: Option<(usize, usize)>, composition_text: &str, composition_cursor: Option<(usize, usize)>, composition_range: Option<(usize, usize)>, scroll_x_px: i32, caret_visible: bool, font_px: f32, max_w: u32, max_h: u32, ) -> Option<ImageHandle>
pub fn render_text_rgba( &self, text: &str, font_px: f32, max_w: u32, max_h: u32, ) -> Option<RgbaImage>
Sourcepub fn text_line_metrics(
&self,
text: &str,
font_px: f32,
max_w: u32,
max_h: u32,
) -> (usize, f32)
pub fn text_line_metrics( &self, text: &str, font_px: f32, max_w: u32, max_h: u32, ) -> (usize, f32)
Rendered line count and line pitch of the layout Self::render_text_into
would produce for the same arguments.
Text drawn as one image has no per-row rectangles, so hit-testing has to be derived from the layout. Reporting it from the renderer keeps the drawn rows and the clickable rows identical (an estimate such as “40 + lines * 30” drifts by rows as soon as the pitch or the wrapped line count differs).
pub fn render_mwnd_text_rgba( &self, text: &str, font_px: f32, max_w: u32, max_h: u32, moji_space: Option<(i64, i64)>, ) -> Option<RgbaImage>
pub fn render_mwnd_text_rgba_styled( &self, text: &str, font_px: f32, max_w: u32, max_h: u32, moji_space: Option<(i64, i64)>, style: TextStyle, ) -> Option<RgbaImage>
pub fn render_mwnd_text_layer_styled_into( &self, images: &mut ImageManager, target: Option<ImageHandle>, text: &str, font_px: f32, max_w: u32, max_h: u32, moji_space: Option<(i64, i64)>, style: TextStyle, vertical: bool, layer: TextSpriteLayer, ) -> Option<ImageHandle>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FontCache
impl !UnwindSafe for FontCache
impl Freeze for FontCache
impl Send for FontCache
impl Sync for FontCache
impl Unpin for FontCache
impl UnsafeUnpin for FontCache
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.