Text engine for OpenGL renderer

Ben Abbott bpabbott at mac.com
Sat Jun 27 11:08:32 CDT 2009


On Jun 27, 2009, at 11:58 AM, Shai Ayal wrote:

> On Sat, Jun 27, 2009 at 5:46 PM, Ben Abbott<bpabbott at mac.com> wrote:
>> On Jun 26, 2009, at 4:19 PM, Michael Goffioul wrote:
>>
>>> Hi,
>>>
>>> For those interested, I just commited a new Freetype/Fontconfig  
>>> based text
>>> engine for the OpenGL backend. At the moment, it's very basic.  
>>> It's mainly
>>> a skeleton that contains enough to render tick labels, axes  
>>> labels, titles
>>> and
>>> simple text objects. It will be enhanced later on.
>>>
>>> Note that if fontconfig is not available, the engine uses a  
>>> hardcoded
>>> font, which
>>> defaults to Verdana under Win32 platform. As I didn't what font to  
>>> use
>>> under
>>> UNIX platform, I left that part empty. This means that if you're  
>>> running
>>> UNIX
>>> without fontconfig (development package), text rendering will  
>>> probably not
>>> work.
>>>
>>> Enjoy,
>>> Michael.
>>
>> Michael / others,
>>
>> I have fontcofig and freetype, but ...
>>
>> octave:1> backend("fltk")
>> octave:2> plot(1:10)
>> octave:3> error: draw_text: cannot render text, Freetype library not
>> available
>> error: draw_text: cannot render text, Freetype library not available
>> error: draw_text: cannot render text, Freetype library not available
>> error: draw_text: cannot render text, Freetype library not available
>> error: draw_text: cannot render text, Freetype library not available
>> error: draw_text: cannot render text, Freetype library not available
>> panic: Bus error -- stopping myself...
>> attempting to save variables to `octave-core'...
>> save to `octave-core' complete
>>
>> I'm using Fink as my package manager.
>>
>> $ fink list fontconf
>> Information about 9092 packages read in 1 seconds.
>>  i   fontconfig-path      20081230-3      Add custom directories to
>> fontconfig search
>>  p   fontconfig1                          [virtual package]
>>  p   fontconfig1-dev                      [virtual package]
>>  p   fontconfig1-shlibs                   [virtual package]
>>  i   fontconfig2-dev      2.4.1-108       Font configuration library
>>  i   fontconfig2-shlibs   2.4.1-108       Fontconfig 2, shared libs  
>> (dummy)
>>  i   system-pkgconfig-fo  2.6.0-1         [virtual pkgconfig package
>> representing fontconfig]
>>
>> $ fink list freetype
>> Information about 9092 packages read in 1 seconds.
>>     freetype             1.3.1-11        TrueType font rendering  
>> library,
>> version 1
>>     freetype-bin         1.3.1-11        TrueType font rendering  
>> library,
>> version 1
>>     freetype-hinting     1.3.1-11        TrueType font rendering  
>> library,
>> version 1, hinting en...
>>     freetype-hinting-bi  1.3.1-11        TrueType font rendering  
>> library,
>> version 1, hinting en...
>>     freetype-hinting-sh  1.3.1-11        TrueType font rendering  
>> library,
>> version 1, hinting en...
>>  i   freetype-shlibs      1.3.1-11        TrueType font rendering  
>> library,
>> version 1
>>     freetype2            2.1.4-12        TrueType font rendering  
>> library,
>> (dummy)
>>  p   freetype2-dev                        [virtual package]
>>     freetype2-hinting    2.1.4-12        TrueType font rendering  
>> library,
>> (dummy)
>>  i   freetype2-hinting-d  2.1.4-12        TrueType font rendering  
>> library,
>> headers
>>  i   freetype2-hinting-s  2.1.4-12        TrueType font rendering  
>> library,
>> shared libs
>>  p   freetype2-shlibs                     [virtual package]
>>  i   freetype219          2.3.8-2         TrueType font rendering  
>> library,
>> headers
>>  i   freetype219-default  2.3.8-2         Transient upgrader package
>>  i   freetype219-shlibs   2.3.8-2         TrueType font rendering  
>> library,
>> shared libs
>>  i   system-pkgconfig-fr  9.20.3-1        [virtual pkgconfig package
>> representing freetype2]
>>
>> The results of ./configure are ...
>>
>> Octave is now configured for i386-apple-darwin9.7.0
>>
>>  Source directory:     .
>>  Installation prefix:  /sw
>>  C compiler:           gcc  -mieee-fp  -Wall -W -Wshadow -Wformat - 
>> g -O2
>>  C++ compiler:         g++  -mieee-fp -I/sw/include/freetype2 -I/sw/ 
>> include
>> -I/usr/X11/include    -Wall -W -Wshadow -Wold-style-cast -Wformat - 
>> g -O2
>>  Fortran compiler:     /sw/bin/gfortran -g -mieee-fp
>>  Fortran libraries:    /sw/lib/gcc4.4/lib/libgfortran.dylib
>>  BLAS libraries:
>>  FFTW libraries:       -lfftw3 -lfftw3f
>>  GLPK libraries:       -lglpk
>>  UMFPACK libraries:    -lumfpack
>>  AMD libraries:        -lamd
>>  CAMD libraries:       -lcamd
>>  COLAMD libraries:     -lcolamd
>>  CCOLAMD libraries:    -lccolamd
>>  CHOLMOD libraries:    -lcholmod
>>  CXSPARSE libraries:   -lcxsparse
>>  ARPACK libraries:
>>  QRUPDATE libraries:
>>  HDF5 libraries:       -lhdf5
>>  CURL libraries:       -lcurl
>>  REGEX libraries:      -L/sw/lib -lpcre
>>  QHULL libraries:      -lqhull
>>  OPENGL libraries:     -L/usr/X11/lib -lfontconfig -lftgl -L/sw/lib
>> -lfreetype -lz -Wl,-framework,CoreServices
>> -Wl,-framework,ApplicationServices -Wl,-framework -Wl,OpenGL
>>  FLTK backend libs:    -L/sw/lib/fltk-aqua/lib -L//sw/lib -L/sw/lib
>> -lfltk_gl -framework AGL -framework OpenGL -lfltk -lpthread - 
>> framework
>> Carbon -framework ApplicationServices
>>  X11 include flags:    /usr/X11/include
>>  X11 libraries:        -L/usr/X11/lib -lX11
>>  CARBON libraries:     -Wl,-framework -Wl,Carbon
>>  LIBS:                 -lreadline  -lncurses
>> -Wl,-framework,Accelerate,-dylib_file,/System/Library/Frameworks/ 
>> Accelerate.framework/Versions/A/Frameworks/vecLib.framework/ 
>> Versions/A/libBLAS.dylib:/System/Library/Frameworks/ 
>> Accelerate.framework/Versions/A/Frameworks/vecLib.framework/ 
>> Versions/A/libBLAS.dylib
>> -lhdf5 -lz -lm
>>  Default pager:        less
>>  gnuplot:              gnuplot
>>  Magick config:        GraphicsMagick++-config
>>
>>  Do internal array bounds checking:  false
>>  Build static libraries:             false
>>  Build shared libraries:             true
>>  Dynamic Linking:                    true (dyld)
>>  Include support for GNU readline:   true
>>  64-bit array dims and indexing:     false
>>
>> configure: WARNING: A BLAS library was detected but found  
>> incompatible with
>> your Fortran 77 compiler.  The reference BLAS implementation will  
>> be used.
>> To improve performance, consider using a different Fortran compiler  
>> or a
>> switch like -ff2c to make your Fortran compiler use a calling  
>> convention
>> compatible with the way your BLAS library was compiled, or use a  
>> different
>> BLAS library.
>> configure: WARNING: qrupdate not found. The QR & Cholesky updating  
>> functions
>> will be slow.
>> configure: WARNING: arpack not found. This will result in a lack of  
>> the eigs
>> function.
>> configure:
>>
>> NOTE: libraries may be skipped if a library is not found OR
>>      if the library on your system is missing required features.
>>
>> Does anyone have some insight as to what is wrong?
>>
>> Ben
>
> Looking into this, this error message is emitted if HAVE_FREETYPE is
> not defined. This means that the check for freetype in the configure
> script has failed. The check there is:
>  AC_CHECK_FT2([9.0.3],[AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if
> you have Freetype library.])],
>
> So it seems we require a minimum version of 9.0.3 (I'm not sure why --
> I think this is leftover from FTGL days). From the fink output you
> sent, it looks like you have freetype2 version 9.20.3-1 which should
> be OK.
> So, for some reason the configure script does not detect your
> installed freetype (maybe because you have an older version of
> freetype installed as well?). You will have to debug this -- look at
> config.log for hints
>
> Note that maybe octave is actually linked against the correct
> freetype, but since HAVE_FREETYPE is not defined, the code is complied
> to emit this error.
>
> Shai

I've been able to resolve the problem (I think).

I cleaned all files not part of the archive

	hg status | grep '^? ' | sed "s/^? /rm /g" | /bin/sh

... and then built again. Now the fonts show up.

Thanks for explaining the error.

Regarding "panic: Bus error -- stopping myself ..." core-dump, if the  
error is being produced by Octave, could the events that follow be  
avoided?

Ben



More information about the Octave-maintainers mailing list