Mercurial > projects > dynamin
comparison dynamin/painting/text_layout.d @ 92:27445f24d5fd
Add TextLayout.layoutBoxes API, but not implementation
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Thu, 05 Aug 2010 03:33:11 -0500 |
parents | 85cd0b04777c |
children | 301e077da540 |
comparison
equal
deleted
inserted
replaced
91:85cd0b04777c | 92:27445f24d5fd |
---|---|
247 /** | 247 /** |
248 * | 248 * |
249 */ | 249 */ |
250 class TextLayout { | 250 class TextLayout { |
251 string text; | 251 string text; |
252 Rect[] layoutBoxes; | |
253 /// | |
254 void delegate(Rect line, List!(Rect) boxes) getLineBoxes; | |
252 | 255 |
253 // character formatting | 256 // character formatting |
254 List!(FormatChange) formatting; // Always sorted by FormatChange.index | 257 List!(FormatChange) formatting; // Always sorted by FormatChange.index |
255 Format initialFormat; | 258 Format initialFormat; |
256 | 259 |
258 double lineSpacing = 1.0; | 261 double lineSpacing = 1.0; |
259 double defaultTabStopLocations = 0; // 0 means default tabs every (4 * width of character '0') | 262 double defaultTabStopLocations = 0; // 0 means default tabs every (4 * width of character '0') |
260 TabStop[] tabStops; | 263 TabStop[] tabStops; |
261 TextAlignment alignment = TextAlignment.Left; | 264 TextAlignment alignment = TextAlignment.Left; |
262 | 265 |
266 void defaultGetLineBoxes(Rect line, List!(Rect) boxes) { | |
267 boxes.add(line); | |
268 } | |
263 this(string fontFamily, double fontSize) { | 269 this(string fontFamily, double fontSize) { |
270 getLineBoxes = &defaultGetLineBoxes; | |
264 formatting = new List!(FormatChange); | 271 formatting = new List!(FormatChange); |
265 initialFormat.fontFamily = fontFamily; | 272 initialFormat.fontFamily = fontFamily; |
266 initialFormat.fontSize = fontSize; | 273 initialFormat.fontSize = fontSize; |
267 } | 274 } |
268 invariant { | 275 invariant { |