From 9b3316341b69c34ecb4a6f7e58a1bd4c971e4e84 Mon Sep 17 00:00:00 2001 From: jsancho Date: Thu, 15 Mar 2012 20:46:47 +0000 Subject: [PATCH] Save font size into font smob. --- Makefile | 59 +++++++++++++++++---------------------------------- src/ftgl.c | 14 +++++++----- src/video.scm | 2 +- 3 files changed, 30 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index 7c07ee6..a3751b2 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.2 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # Makefile. Generated from Makefile.in by configure. # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -38,8 +38,7 @@ subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(top_srcdir)/configure COPYING \ - config.guess config.rpath config.sub depcomp install-sh \ - ltmain.sh missing + config.guess config.sub depcomp install-sh ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ @@ -83,12 +82,6 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } am__installdirs = "$(DESTDIR)$(docdir)" DATA = $(dist_doc_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ @@ -134,8 +127,6 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = ${SHELL} /home/jsancho/proyectos/gacela/trunk/missing --run aclocal-1.11 AMTAR = ${SHELL} /home/jsancho/proyectos/gacela/trunk/missing --run tar @@ -267,7 +258,7 @@ all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: -am--refresh: Makefile +am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ @@ -303,8 +294,10 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): config.h: stamp-h1 - @if test ! -f $@; then rm -f stamp-h1; else :; fi - @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 @@ -342,7 +335,9 @@ uninstall-dist_docDATA: @$(NORMAL_UNINSTALL) @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(docdir)" && rm -f $$files # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -551,7 +546,7 @@ dist-gzip: distdir $(am__remove_distdir) dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir @@ -559,7 +554,7 @@ dist-lzma: distdir $(am__remove_distdir) dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir @@ -609,7 +604,6 @@ distcheck: dist && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ @@ -638,16 +632,8 @@ distcheck: dist list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ @@ -681,15 +667,10 @@ install-am: all-am installcheck: installcheck-recursive install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: diff --git a/src/ftgl.c b/src/ftgl.c index 2dc79a0..57fbbf8 100644 --- a/src/ftgl.c +++ b/src/ftgl.c @@ -22,12 +22,13 @@ struct font { SCM filename; FTGLfont *font_address; + int size; }; static scm_t_bits font_tag; SCM -make_font (SCM file, FTGLfont *font_address) +make_font (SCM file, SCM size, FTGLfont *font_address) { SCM smob; struct font *font; @@ -35,6 +36,7 @@ make_font (SCM file, FTGLfont *font_address) font = (struct font *) scm_gc_malloc (sizeof (struct font), "font"); font->filename = SCM_BOOL_F; + font->size = scm_to_int (size); font->font_address = NULL; SCM_NEWSMOB (smob, font_tag, font); @@ -83,7 +85,9 @@ print_font (SCM font_smob, SCM port, scm_print_state *pstate) scm_puts ("#filename, port); - scm_puts ("\">", port); + scm_puts ("\", size ", port); + scm_display (scm_from_int (font->size), port); + scm_puts (">", port); /* non-zero means success */ return 1; @@ -91,12 +95,12 @@ print_font (SCM font_smob, SCM port, scm_print_state *pstate) SCM -gacela_ftglCreateTextureFont (SCM file) +gacela_ftglCreateTextureFont (SCM file, SCM size) { FTGLfont *font_address = ftglCreateTextureFont (scm_to_locale_string (file)); if (font_address) { - return make_font (file, font_address); + return make_font (file, size, font_address); } else { return SCM_BOOL_F; @@ -135,7 +139,7 @@ init_gacela_ftgl (void *data) 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", 1, 0, 0, gacela_ftglCreateTextureFont); + scm_c_define_gsubr ("ftglCreateTextureFont", 2, 0, 0, gacela_ftglCreateTextureFont); scm_c_define_gsubr ("ftglSetFontFaceSize", 3, 0, 0, gacela_ftglSetFontFaceSize); scm_c_define_gsubr ("ftglSetFontCharMap", 2, 0, 0, gacela_ftglSetFontCharMap); scm_c_define_gsubr ("ftglRenderFont", 3, 0, 0, gacela_ftglRenderFont); diff --git a/src/video.scm b/src/video.scm index 18d5185..5a5ef2b 100644 --- a/src/video.scm +++ b/src/video.scm @@ -402,7 +402,7 @@ ;;; Text and fonts (define* (load-font font-file #:key (size 40) (encoding ft_encoding_unicode)) - (let ((font (ftglCreateTextureFont font-file))) + (let ((font (ftglCreateTextureFont font-file size))) (ftglSetFontFaceSize font size 72) (ftglSetFontCharMap font encoding) font)) -- 2.39.2