@@ -216,6 +216,31 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
216
216
; ;; Reducing the computational complexity of font operations improves
217
217
; ;; rendering time.
218
218
219
+ (define-type ln-ttf:glyph
220
+ macros: prefix: macro-
221
+ desc ; ; for now legacy: (key (texcoord1..4) X Y Z)
222
+ width
223
+ height
224
+ texture
225
+ texcoords ; ; generic 4 element vector of flownums
226
+ rect-texcoords ; ; 4x2 element f32vector
227
+ ; ; order is sorta important here
228
+ offsetx
229
+ advancex
230
+ offsety
231
+ )
232
+
233
+ (define (ttf:glyph? obj ) (macro-ln-ttf:glyph? obj))
234
+ (define (ttf:glyph-desc obj ) (macro-ln-ttf:glyph-desc obj))
235
+ (define (ttf:glyph-width obj ) (macro-ln-ttf:glyph-width obj))
236
+ (define (ttf:glyph-height obj ) (macro-ln-ttf:glyph-height obj))
237
+ (define (ttf:glyph-image obj ) (macro-ln-ttf:glyph-texture obj))
238
+ (define (ttf:glyph-texcoords obj ) (macro-ln-ttf:glyph-texcoords obj))
239
+ (define (ttf:glyph-rect-texcoords obj ) (macro-ln-ttf:glyph-rect-texcoords obj))
240
+ (define (ttf:glyph-offsetx obj ) (macro-ln-ttf:glyph-offsetx obj))
241
+ (define (ttf:glyph-advancex obj ) (macro-ln-ttf:glyph-advancex obj))
242
+ (define (ttf:glyph-offsety obj ) (macro-ln-ttf:glyph-offsety obj))
243
+
219
244
(define-type ln-ttf:font
220
245
macros: prefix: macro-
221
246
desc ; ; for now the legacy description of a font as a assoc-list
@@ -298,10 +323,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
298
323
(loop (fl+ x0 gax) (cdr cs))))))
299
324
300
325
(define (glgui:fontheight fnt )
301
- (let* ((g (assoc 0 fnt))
302
- (i (if g (glgui:glyph-image g) #f ))
303
- (h (if i (glgui:image-h i)
304
- (cadr (cadr (car fnt)))))) h))
326
+ (cond
327
+ ((macro-ln-ttf:font? fnt) (ttf:glyph-height (MATURITY+1:ln-ttf:font-ref fnt 0 )))
328
+ ((find-font fnt) => glgui:fontheight)
329
+ (else ; ; MATURITY -1 backward compatible, the old code
330
+ (let* ((g (assoc 0 fnt))
331
+ (i (if g (glgui:glyph-image g) #f ))
332
+ (h (if i (glgui:image-h i)
333
+ (cadr (cadr (car fnt)))))) h))))
305
334
306
335
(define (glgui:stringheight txt fnt )
307
336
(define font (find-font fnt))
0 commit comments