1mod cache;
8mod custom_glyph;
9mod error;
10mod text_atlas;
11mod text_render;
12mod viewport;
13
14pub use cache::Cache;
15pub use custom_glyph::{
16 ContentType, CustomGlyph, CustomGlyphId, RasterizeCustomGlyphRequest, RasterizedCustomGlyph,
17};
18pub use error::{PrepareError, RenderError};
19pub use text_atlas::{ColorMode, TextAtlas};
20pub use text_render::TextRenderer;
21pub use viewport::Viewport;
22
23#[doc(no_inline)]
25pub use ramp_text::{
26 self, fontdb, Action, Affinity, Attrs, AttrsList, AttrsOwned, Buffer, BufferLine, CacheKey,
27 Color, Command, Cursor, Edit, Editor, Family, FamilyOwned, Font, FontSystem, LayoutCursor,
28 LayoutGlyph, LayoutLine, LayoutRun, LayoutRunIter, Metrics, ShapeGlyph, ShapeLine, ShapeSpan,
29 ShapeWord, Shaping, Stretch, Style, SubpixelBin, SwashCache, SwashContent, SwashImage, Weight,
30 Wrap,
31};
32
33use etagere::AllocId;
34
35pub(crate) enum GpuCacheStatus {
36 InAtlas {
37 x: u16,
38 y: u16,
39 content_type: ContentType,
40 },
41 SkipRasterization,
42}
43
44pub(crate) struct GlyphDetails {
45 width: u16,
46 height: u16,
47 gpu_cache: GpuCacheStatus,
48 atlas_id: Option<AllocId>,
49 top: i16,
50 left: i16,
51}
52
53#[repr(C)]
54#[derive(Clone, Copy, Debug)]
55pub(crate) struct GlyphToRender {
56 pos: [i32; 2],
57 dim: [u16; 2],
58 uv: [u16; 2],
59 color: u32,
60 content_type_with_srgb: [u16; 2],
61 depth: f32,
62}
63
64#[repr(C)]
66#[derive(Clone, Copy, Debug, Eq, PartialEq)]
67pub struct Resolution {
68 pub width: u32,
70 pub height: u32,
72}
73
74#[repr(C)]
75#[derive(Clone, Copy, Debug, Eq, PartialEq)]
76pub(crate) struct Params {
77 screen_resolution: Resolution,
78 _pad: [u32; 2],
79}
80
81#[derive(Clone, Copy, Debug, Eq, PartialEq)]
83pub struct TextBounds {
84 pub left: i32,
86 pub top: i32,
88 pub right: i32,
90 pub bottom: i32,
92}
93
94impl Default for TextBounds {
96 fn default() -> Self {
97 Self {
98 left: i32::MIN,
99 top: i32::MIN,
100 right: i32::MAX,
101 bottom: i32::MAX,
102 }
103 }
104}
105
106#[derive(Clone)]
108pub struct TextArea<'a> {
109 pub buffer: &'a Buffer,
111 pub left: f32,
113 pub top: f32,
115 pub scale: f32,
117 pub bounds: TextBounds,
120 pub default_color: Color,
122 pub custom_glyphs: &'a [CustomGlyph],
124}