Skip to main content

FontCache

Struct FontCache 

Source
pub struct FontCache { /* private fields */ }

Implementations§

Source§

impl FontCache

Source

pub fn new() -> Self

Source

pub fn is_loaded(&self) -> bool

Source

pub fn loaded_from(&self) -> Option<&Path>

Source

pub fn loaded_face_index(&self) -> u32

Source

pub fn load_for_project(&mut self, project_dir: &Path) -> bool

Source

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.

Source

pub fn requested_name(&self) -> &str

Source

pub fn load_from_font_dir(&mut self, font_dir: &Path) -> bool

Source

pub fn render_text( &self, images: &mut ImageManager, text: &str, font_px: f32, max_w: u32, max_h: u32, ) -> Option<ImageHandle>

Source

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>

Source

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>

Source

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>

Source

pub fn render_positioned_glyphs_into( &self, images: &mut ImageManager, target: Option<ImageHandle>, glyphs: &[PositionedTextGlyph], min_w: u32, min_h: u32, ) -> Option<PositionedTextRender>

Source

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>

Source

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.

Source

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>

Source

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>

Source

pub fn render_text_rgba( &self, text: &str, font_px: f32, max_w: u32, max_h: u32, ) -> Option<RgbaImage>

Source

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).

Source

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>

Source

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>

Source

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§

Source§

impl Debug for FontCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FontCache

Source§

fn default() -> FontCache

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more