Mercurial > projects > mde
diff mde/gui/widget/miscWidgets.d @ 49:bca7e2342d77
Enabled getting the size of a text block (before or after rendering).
committer: Diggory Hardy <diggory.hardy@gmail.com>
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 31 May 2008 13:10:06 +0100 |
parents | a98ffb64f066 |
children | 9e1f05fbbcef |
line wrap: on
line diff
--- a/mde/gui/widget/miscWidgets.d Sat May 31 12:40:26 2008 +0100 +++ b/mde/gui/widget/miscWidgets.d Sat May 31 13:10:06 2008 +0100 @@ -107,19 +107,20 @@ { this (IWindow wind, int[] data) { if (data.length != 1) throw new WidgetDataException; - mw = 100; //FIXME: set properly - mh = 50; + if (font is null) font = FontStyle.get("default"); + font.updateBlock (str, textCache); + mw = textCache.w; + mh = textCache.h; super (wind,data); } void draw () { super.draw(); - if (font is null) font = FontStyle.get("default"); - font.textBlock (x,y, "|−|−| .,.,.", textCache); // test new-lines and unicode characters - //old string: "Text Widget\nαβγ − ΑΒΓ" + font.textBlock (x,y, str, textCache); // test new-lines and unicode characters } protected: + const str = "Text Widget\nαβγ − ΑΒΓ"; TextBlock textCache; static FontStyle font; }