@@ -49,6 +49,7 @@ namespace lsp
4949 c->sColor .bind(" inactive.text.hover.color" , this );
5050
5151 sTextLayout .bind(" text.layout" , this );
52+ sClipTextLayout .bind(" text.clip.layout" , this );
5253 sTextAdjust .bind(" text.adjust" , this );
5354 sTextClip .bind(" text.clip" , this );
5455 sFont .bind(" font" , this );
@@ -70,6 +71,7 @@ namespace lsp
7071 c->sColor .set_rgb24(0xcc0000 );
7172
7273 sTextLayout .set(0 .0f , 0 .0f );
74+ sClipTextLayout .set(0 .0f , 0 .0f );
7375 sTextAdjust .set(TA_NONE);
7476 sTextClip .set(false );
7577 sFont .set_size(12 .0f );
@@ -95,6 +97,7 @@ namespace lsp
9597 Label::Label (Display *dpy):
9698 Widget (dpy),
9799 sTextLayout (&sProperties ),
100+ sClipTextLayout (&sProperties ),
98101 sTextAdjust (&sProperties ),
99102 sFont (&sProperties ),
100103 sHover (&sProperties ),
@@ -134,6 +137,7 @@ namespace lsp
134137 c->sColor .bind (" inactive.text.hover.color" , &sStyle );
135138
136139 sTextLayout .bind (" text.layout" , &sStyle );
140+ sClipTextLayout .bind (" text.clip.layout" , &sStyle );
137141 sTextAdjust .bind (" text.adjust" , &sStyle );
138142 sFont .bind (" font" , &sStyle );
139143 sHover .bind (" text.hover" , &sStyle );
@@ -160,7 +164,7 @@ namespace lsp
160164 if (colors->property_changed (prop))
161165 query_draw ();
162166
163- if (prop->one_of (sTextLayout , sHover ))
167+ if (prop->one_of (sTextLayout , sClipTextLayout , sHover ))
164168 query_draw ();
165169
166170 if (prop->one_of (sTextAdjust , sTextClip , sFont , sText , sConstraints , sIPadding ))
@@ -239,9 +243,12 @@ namespace lsp
239243 // Draw background
240244 s->clear (bg_color);
241245
246+ const bool exceeds = (tp.Width > r.nWidth ) || (tp.Height > r.nHeight );
247+ const TextLayout *layout = (exceeds) ? &sClipTextLayout : &sTextLayout ;
248+
242249 draw_multiline_text (s,
243250 &sFont , &r, f_color, &fp, &tp,
244- sTextLayout . halign (), sTextLayout . valign (),
251+ layout-> halign (), layout-> valign (),
245252 fscaling, &text);
246253 }
247254
0 commit comments