[GRASS5] 5.7: making Freetype optional

Making Freetype support optional:
... to do so, should I add tons of

  #include "config.h"

  #ifdef HAVE_FT2BUILD_H
  ...
  #endif

statements into the following files?

cvsgrass57/display/drivers/lib
command.c
font_freetype.c
Font_get.c
Get_t_box.c
Text.c

cvsgrass57/lib/raster
Font.c

Would appreciate a recommendation how to proceed.

Markus

Markus Neteler wrote:

Making Freetype support optional:
... to do so, should I add tons of

  #include "config.h"

  #ifdef HAVE_FT2BUILD_H
  ...
  #endif

statements into the following files?

cvsgrass57/display/drivers/lib
command.c
font_freetype.c
Font_get.c
Get_t_box.c
Text.c

cvsgrass57/lib/raster
Font.c

Would appreciate a recommendation how to proceed.

display/drivers/lib/Text3.c appears to be the only file which depends
directly upon FreeType. Of the functions in that file:

+ The body of drawMain() should be conditionalised upon
HAVE_FT2BUILD_H, so that the function itself is a no-op if FreeType
isn't available.

+ Other functions which require FreeType should be conditionalised
upon HAVE_FT2BUILD_H, so that the function doesn't exist if FreeType
isn't available.

+ Functions which don't need to be exported (AFAICT, everything except
soft_text_freetype(), soft_text_ext_freetype() and get_text_ext_freetype())
should be declared "static".

The drivers and raster library will support the FONT_FREETYPE and
FONT_FREETYPE_RELEASE operations regardless of whether FreeType was
enabled, except that those operations won't actually work.

--
Glynn Clements <glynn@gclements.plus.com>

On Wed, Nov 10, 2004 at 02:18:52PM +0000, glynn@gclements.plus.com wrote:

Markus Neteler wrote:

> Making Freetype support optional:
> ... to do so, should I add tons of
>
> #include "config.h"
>
> #ifdef HAVE_FT2BUILD_H
> ...
> #endif
>
> statements into the following files?
>
> cvsgrass57/display/drivers/lib
> command.c
> font_freetype.c
> Font_get.c
> Get_t_box.c
> Text.c
>
> cvsgrass57/lib/raster
> Font.c
>
> Would appreciate a recommendation how to proceed.

display/drivers/lib/Text3.c appears to be the only file which depends
directly upon FreeType. Of the functions in that file:

+ The body of drawMain() should be conditionalised upon
HAVE_FT2BUILD_H, so that the function itself is a no-op if FreeType
isn't available.

+ Other functions which require FreeType should be conditionalised
upon HAVE_FT2BUILD_H, so that the function doesn't exist if FreeType
isn't available.

+ Functions which don't need to be exported (AFAICT, everything except
soft_text_freetype(), soft_text_ext_freetype() and get_text_ext_freetype())
should be declared "static".

The drivers and raster library will support the FONT_FREETYPE and
FONT_FREETYPE_RELEASE operations regardless of whether FreeType was
enabled, except that those operations won't actually work.

I have made several changes, now it seems to work (please test with and
without Freetype). However, I was not quite lucky with defining functions
static. So I used ifdefs there as well (sorry, I'm still geographer).

Markus

Markus Neteler wrote:

I have made several changes, now it seems to work (please test with and
without Freetype). However, I was not quite lucky with defining functions
static. So I used ifdefs there as well (sorry, I'm still geographer).

I've committed a less invasive fix, that only changes Text3.c and the
Makefile.

--
Glynn Clements <glynn@gclements.plus.com>