@@ -90,6 +90,12 @@ style-tex 1024 dup rgba-newtex
90
90
91
91
\ glues
92
92
93
+ begin-structure glue-s
94
+ cell +field glue-t \ typical size
95
+ cell +field glue-s \ shrink by
96
+ cell +field glue-a \ add by
97
+ end-structure
98
+
93
99
widget class
94
100
3 cells +field hglue-c
95
101
3 cells +field dglue-c
@@ -174,19 +180,20 @@ widget class
174
180
field: text-string
175
181
field: text-font
176
182
field: text-color
183
+ field: text-border
177
184
end-class text
178
185
179
186
Variable glyphs$
180
187
181
188
: text-init ( -- )
182
189
text-font @ to font text-string $@ glyphs$ $+! ;
183
190
: text-text ( -- )
184
- x @ s>f penxy sf! y @ s>f penxy sfloat+ sf!
191
+ x @ text-border @ + s>f penxy sf! y @ s>f penxy sfloat+ sf!
185
192
text-font @ to font text-color @ color !
186
193
text-string $@ render-string ;
187
194
: text-!size ( -- )
188
195
text-string $@ layout-string
189
- f>s d ! f>s h ! f>s w ! ;
196
+ f>s text-border @ + d ! f>s text-border @ + h ! f>s text-border @ 2* + w ! ;
190
197
' text-init text to draw-init
191
198
' text-text text to draw-text
192
199
' text-!size text to !size
@@ -268,7 +275,12 @@ end-class vbox \ vertical alignment
268
275
box class end-class zbox \ overlay alignment
269
276
270
277
: 0glue ( -- t s a ) 0 0 0 ;
271
- : 1glue ( -- t s a ) 0 0 [ -1 1 rshift ]L ;
278
+ : 1glue ( -- t s a ) 0 0 [ -1 8 rshift ]L ; \ can have 128 1glues in a row
279
+
280
+ glue new Constant glue*1
281
+ glue new Constant glue*2
282
+ glue*1 >o 1glue hglue-c glue! 1glue dglue-c glue! 1glue vglue-c glue! o>
283
+ glue*2 >o 1glue 2* hglue-c glue! 1glue 2* dglue-c glue! 1glue 2* vglue-c glue! o>
272
284
273
285
: g3>2 ( t s a -- min a ) over + >r - r> ;
274
286
0 commit comments