Update example to show emojis and clipping
This commit is contained in:
parent
8c8cfba093
commit
07b04f511a
6 changed files with 21 additions and 3786 deletions
|
@ -86,6 +86,11 @@ impl Default for TextBounds {
|
|||
pub struct TextArea<'a> {
|
||||
/// The buffer containing the text to be rendered.
|
||||
pub buffer: &'a cosmic_text::Buffer<'a>,
|
||||
/// The bounds of the text area.
|
||||
/// The left edge of the buffer.
|
||||
pub left: i32,
|
||||
/// The top edge of the buffer.
|
||||
pub top: i32,
|
||||
/// The visible bounds of the text area. This is used to clip the text and doesn't have to
|
||||
/// match the `left` and `top` values.
|
||||
pub bounds: TextBounds,
|
||||
}
|
||||
|
|
|
@ -252,8 +252,8 @@ impl TextRenderer {
|
|||
|
||||
let details = atlas.glyph(&glyph.cache_key).unwrap();
|
||||
|
||||
let mut x = glyph.x_int + details.left as i32;
|
||||
let mut y = line_y + glyph.y_int - details.top as i32;
|
||||
let mut x = glyph.x_int + details.left as i32 + text_area.left;
|
||||
let mut y = line_y + glyph.y_int - details.top as i32 + text_area.top;
|
||||
|
||||
let (mut atlas_x, mut atlas_y, content_type) = match details.gpu_cache {
|
||||
GpuCacheStatus::InAtlas { x, y, content_type } => (x, y, content_type),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue