return font->font_address;
}
+SCM
+get_font_size (SCM font_smob)
+{
+ struct font *font;
+
+ scm_assert_smob_type (font_tag, font_smob);
+ font = (struct font *) SCM_SMOB_DATA (font_smob);
+ return scm_from_int (font->size);
+}
+
SCM
mark_font (SCM font_smob)
{
return scm_from_int (ftglSetFontFaceSize (get_font_address (font), scm_to_int (size), scm_to_int (res)));
}
+SCM
+gacela_ftglGetFontFaceSize (SCM font)
+{
+ return scm_from_int (ftglGetFontFaceSize (get_font_address (font)));
+}
+
SCM
gacela_ftglSetFontCharMap (SCM font, SCM encoding)
{
scm_set_smob_free (font_tag, free_font);
scm_set_smob_print (font_tag, print_font);
// scm_set_smob_equalp (surface_tag, equalp_surface);
+ scm_c_define_gsubr ("font-size", 1, 0, 0, get_font_size);
scm_c_define ("ft_encoding_unicode", scm_from_int (ft_encoding_unicode));
scm_c_define ("FTGL_RENDER_ALL", scm_from_int (FTGL_RENDER_ALL));
scm_c_define_gsubr ("ftglCreateTextureFont", 2, 0, 0, gacela_ftglCreateTextureFont);
scm_c_define_gsubr ("ftglSetFontFaceSize", 3, 0, 0, gacela_ftglSetFontFaceSize);
+ scm_c_define_gsubr ("ftglGetFontFaceSize", 1, 0, 0, gacela_ftglGetFontFaceSize);
scm_c_define_gsubr ("ftglSetFontCharMap", 2, 0, 0, gacela_ftglSetFontCharMap);
scm_c_define_gsubr ("ftglRenderFont", 3, 0, 0, gacela_ftglRenderFont);
}
font))
(define* (render-text text font #:key (size #f))
- (cond (size (ftglSetFontFaceSize font size 72)))
+ (cond (size
+ (cond ((not (= (ftglGetFontFaceSize font) size))
+ (ftglSetFontFaceSize font size 72))))
+ ((not (= (ftglGetFontFaceSize font) (font-size font)))
+ (ftglSetFontFaceSize font (font-size font) 72)))
(ftglRenderFont font text FTGL_RENDER_ALL))