|
63 | 63 | local TEXT <const> = "[004000]Hello[n], 这个句子中有[s1]大字[n],也有[s2]小字[n]。这句话会在文本区居中。" |
64 | 64 | -- size 32; color 0; alignment center |
65 | 65 | -- local block, layout = mattext.block(fontcobj, fontid, 32, 0, "CV") |
66 | | -local styles = mattext.styles(fontcobj, { |
67 | | - { font = fontid, size = 24, color = 0 }, |
68 | | - { font = fontid, size = 32, color = 0x800000 }, |
69 | | - { font = fontid, size = 16, color = 0x000080 }, |
70 | | -}) |
71 | | -local block, layout = mattext.block(styles, "CV") |
| 66 | +local function text_block() |
| 67 | + local styles = mattext.styles(fontcobj, { |
| 68 | + { font = fontid, size = 24, color = 0 }, |
| 69 | + { font = fontid, size = 32, color = 0x800000 }, |
| 70 | + { font = fontid, size = 16, color = 0x000080 }, |
| 71 | + }) |
| 72 | + return mattext.block(styles, "CV") |
| 73 | +end |
| 74 | + |
| 75 | +local block, layout = text_block() |
| 76 | +collectgarbage "collect" |
| 77 | +collectgarbage "collect" |
72 | 78 | local label = block(TEXT, WIDTH, HEIGHT) |
73 | 79 | local label_layout = layout(TEXT, WIDTH, HEIGHT) |
74 | 80 |
|
|
0 commit comments