mod cache;
mod error;
mod text_atlas;
mod text_render;
mod viewport;
pub use cache::Cache;
pub use error::{PrepareError, RenderError};
pub use text_atlas::{ColorMode, TextAtlas};
pub use text_render::TextRenderer;
pub use viewport::Viewport;
use text_render::ContentType;
#[doc(no_inline)]
pub use cosmic_text::{
self, Action, Affinity, Attrs, AttrsList, AttrsOwned, Buffer, BufferLine, CacheKey, Color,
Command, Cursor, Edit, Editor, Family, FamilyOwned, Font, FontSystem, LayoutCursor,
LayoutGlyph, LayoutLine, LayoutRun, LayoutRunIter, Metrics, ShapeGlyph, ShapeLine, ShapeSpan,
ShapeWord, Shaping, Stretch, Style, SubpixelBin, SwashCache, SwashContent, SwashImage, Weight,
Wrap, fontdb,
};
use etagere::AllocId;
pub(crate) enum GpuCacheStatus {
InAtlas {
x: u16,
y: u16,
content_type: ContentType,
},
SkipRasterization,
}
pub(crate) struct GlyphDetails {
width: u16,
height: u16,
gpu_cache: GpuCacheStatus,
atlas_id: Option<AllocId>,
top: i16,
left: i16,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub(crate) struct GlyphToRender {
pos: [i32; 2],
dim: [u16; 2],
uv: [u16; 2],
color: u32,
content_type_with_srgb: [u16; 2],
depth: f32,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct Resolution {
pub width: u32,
pub height: u32,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) struct Params {
screen_resolution: Resolution,
_pad: [u32; 2],
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct TextBounds {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
impl Default for TextBounds {
fn default() -> Self {
Self {
left: i32::MIN,
top: i32::MIN,
right: i32::MAX,
bottom: i32::MAX,
}
}
}
#[derive(Clone)]
pub struct TextArea<'a> {
pub buffer: &'a Buffer,
pub left: f32,
pub top: f32,
pub scale: f32,
pub bounds: TextBounds,
pub default_color: Color,
}