Skip to main content

reda_gds/models/
text.rs

1use crate::{GdsCoord, GdsTransform};
2use derive_builder::Builder;
3use super::{GdsPathType, GdsPresentation};
4
5#[derive(Debug, Clone, Builder)]
6#[builder(setter(strip_option, into))]
7pub struct GdsText {
8    #[builder(default)]
9    pub elf_flags: Option<i16>,
10    #[builder(default)]
11    pub plex: Option<i32>,
12
13    pub layer: i16,
14    pub text_type: i16,
15    pub position: GdsCoord,
16    pub string: String,
17
18    #[builder(default)]
19    pub presentation: Option<GdsPresentation>,
20    #[builder(default)]
21    pub path_type: GdsPathType,
22    #[builder(default)]
23    pub width: Option<i32>,
24
25    #[builder(default)]
26    pub transform: Option<GdsTransform>,
27}
28
29impl GdsText {
30    pub fn new(layer: i16, position: impl Into<GdsCoord>, text: impl Into<String>) -> Self {
31        GdsTextBuilder::default()
32            .layer(layer)
33            .text_type(0i16)
34            .position(position)
35            .string(text)
36            .build()
37            .unwrap()
38    }
39}