/* This file is part of DarkFi (https://dark.fi)
*
* Copyright (C) 2020-2026 Dyne.org foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
use async_trait::async_trait;
use parking_lot::Mutex as SyncMutex;
use rand::{rngs::OsRng, Rng};
use std::sync::Arc;
use tracing::instrument;
use crate::{
gfx::{gfxtag, DrawCall, DrawInstruction, Rectangle, RenderApi, Renderer},
mesh::{Color, MeshBuilder},
prop::{
BatchGuardPtr, PropertyAtomicGuard, PropertyBool, PropertyColor, PropertyEnum,
PropertyFloat32, PropertyRect, PropertyStr, PropertyUint32, Role,
},
scene::{Pimpl, SceneNodeWeak},
text,
util::i18n::I18nBabelFish,
ExecutorPtr,
};
use super::{DrawUpdate, OnModify, UIObject};
pub type TextPtr = Arc;
pub struct Text {
node: SceneNodeWeak,
renderer: Renderer,
i18n_fish: I18nBabelFish,
tasks: SyncMutex>>,
dc_key: u64,
rect: PropertyRect,
height: PropertyFloat32,
z_index: PropertyUint32,
priority: PropertyUint32,
text: PropertyStr,
font_size: PropertyFloat32,
text_color: PropertyColor,
lineheight: PropertyFloat32,
text_align: PropertyEnum,
overflow_wrap: PropertyEnum,
use_i18n: PropertyBool,
debug: PropertyBool,
window_scale: PropertyFloat32,
parent_rect: SyncMutex