-
Notifications
You must be signed in to change notification settings - Fork 4
/
Program.cs
66 lines (48 loc) · 1.65 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
namespace example;
// example-0014
// heavy text test
class Program
{
static void Main(string[] args)
{
var PHRASE = "The quick brown fox jumps over the lazy dog";
var N = 100;
const float TEXT_HEIGHT = 1f;
InitAvalonia();
var w = GLWindow.Create();
w.GLModel.BuildModel = (glCtl, isInitial) =>
{
if (!isInitial) return;
var glCtx = glCtl.GLContext;
var glModel = glCtl.GLModel;
glModel.Clear();
glModel.AddFigure(MakeWCSFigure());
void addText(Vector3 insPt, string text, GLTextVHAlignment alignment)
{
glModel.AddFigure(new GLPointFigure(new GLPoint(new GLVertex(insPt, Color.Cyan))) { PointSize = 10 });
var figs = glCtx.MakeTextFigure(new GLText(WCS.Move(insPt), text)
{
Height = TEXT_HEIGHT,
Alignment = alignment,
SpacingBetweenLines = 1
});
glModel.AddFigure(figs);
var figBBox = new BBox(figs.Select(fig => fig.OBBox))
.MakeFigure(Color.Yellow);
glModel.AddFigure(figBBox);
}
var sb = new StringBuilder();
for (int i = 0; i < N; ++i)
{
sb.AppendLine(PHRASE);
}
// add multiline huge text
addText(
insPt: new Vector3(0, 0, 0),
text: sb.ToString(),
alignment: GLTextVHAlignment.TopCenter);
glCtl.LoadView();
};
w.ShowSync();
}
}