Commit ac7326cc authored by Mathieu Malaterre's avatar Mathieu Malaterre

ENH: Add a new option: VTK_USE_SYSTEM_FREETYPE. This allow fixing problem when...

ENH: Add a new option: VTK_USE_SYSTEM_FREETYPE. This allow fixing problem when building VTK and having include file being in the path, this also fix issue: http://bugs.debian.org/277602 when two different freetype libs where loaded
parent 9db17ff6
#
# Find the native FREETYPE includes and library
#
# This module defines
# FREETYPE_INCLUDE_DIR, where to find ft2build.h, ftheader.h, ...
# FREETYPE_LIBRARIES, the libraries to link against to use FREETYPE.
# FREETYPE_FOUND, If false, do not try to use FREETYPE.
# also defined, but not for general use are
# FREETYPE_LIBRARY, where to find the FREETYPE library.
FIND_PATH(FREETYPE_INCLUDE_DIR_FT2BUILD ft2build.h
/usr/include/
/usr/local/include/
)
FIND_PATH(FREETYPE_INCLUDE_DIR_FTHEADER freetype/config/ftheader.h
/usr/include/freetype2
/usr/local/include/freetype2
)
FIND_LIBRARY(FREETYPE_LIBRARY freetype
/usr/lib
/usr/local/lib
)
IF (FREETYPE_LIBRARY)
IF (FREETYPE_INCLUDE_DIR_FTHEADER AND FREETYPE_INCLUDE_DIR_FT2BUILD)
SET( FREETYPE_FOUND "YES" )
SET( FREETYPE_INCLUDE_DIR
${FREETYPE_INCLUDE_DIR_FT2BUILD}
${FREETYPE_INCLUDE_DIR_FTHEADER} )
SET( FREETYPE_LIBRARIES ${FREETYPE_LIBRARY} )
ENDIF (FREETYPE_INCLUDE_DIR_FTHEADER AND FREETYPE_INCLUDE_DIR_FT2BUILD)
ENDIF (FREETYPE_LIBRARY)
......@@ -667,6 +667,7 @@ VTK_THIRD_PARTY_OPTION(JPEG jpeg)
VTK_THIRD_PARTY_OPTION(PNG png)
VTK_THIRD_PARTY_OPTION(TIFF tiff)
VTK_THIRD_PARTY_OPTION(EXPAT expat)
VTK_THIRD_PARTY_OPTION(FREETYPE freetype)
#-----------------------------------------------------------------------------
# Configure OpenGL support.
......
......@@ -12,7 +12,7 @@ IF (JAVA_AWT_LIBRARY)
ENDIF (JAVA_AWT_LIBRARY)
SET(KIT_LIBS vtkGraphics vtkImaging vtkIO
vtkftgl
vtkfreetype
${VTK_FREETYPE_LIBRARIES}
)
SET( Kit_SRCS
......
......@@ -30,7 +30,7 @@ class vtkTextProperty;
// FreeType
#include "ft2build.h"
#include "vtk_freetype.h" //since ft2build.h could be in the path
#include FT_FREETYPE_H
#include FT_CACHE_H
#include FT_CACHE_IMAGE_H
......
......@@ -23,7 +23,6 @@
#include "vtkToolkits.h" // for VTK_USE_GL2PS
#include "vtkFreeTypeUtilities.h"
#include "vtkFreeTypeConfig.h"
#include "vtkftglConfig.h"
#include "vtkgluPickMatrix.h"
......@@ -91,7 +90,7 @@ vtkOpenGLFreeTypeTextMapper_GetGL2PSFontName(vtkTextProperty *tprop,
//----------------------------------------------------------------------------
#ifndef VTK_IMPLEMENT_MESA_CXX
vtkCxxRevisionMacro(vtkOpenGLFreeTypeTextMapper, "1.43");
vtkCxxRevisionMacro(vtkOpenGLFreeTypeTextMapper, "1.44");
vtkStandardNewMacro(vtkOpenGLFreeTypeTextMapper);
#endif
......
......@@ -5,6 +5,7 @@ VTK_THIRD_PARTY_SUBDIR(JPEG vtkjpeg)
VTK_THIRD_PARTY_SUBDIR(PNG vtkpng)
VTK_THIRD_PARTY_SUBDIR(TIFF vtktiff)
VTK_THIRD_PARTY_SUBDIR(EXPAT vtkexpat)
VTK_THIRD_PARTY_SUBDIR(FREETYPE vtkfreetype)
VTK_THIRD_PARTY_SUBDIR(DICOMParser DICOMParser)
SUBDIRS(Doxygen)
......@@ -13,7 +14,7 @@ IF(VTK_INCLUDE_NEED_TCL)
ENDIF(VTK_INCLUDE_NEED_TCL)
IF(VTK_USE_RENDERING)
SUBDIRS(freetype ftgl ParseOGLExt)
SUBDIRS(ftgl ParseOGLExt)
ENDIF(VTK_USE_RENDERING)
IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
......@@ -21,7 +22,7 @@ IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
# level.
INSTALL_FILES(${VTK_INSTALL_LIB_DIR} .cmake VTKConfig)
INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR} .h
vtk_expat vtk_jpeg vtk_png vtk_zlib vtk_tiff)
vtk_expat vtk_jpeg vtk_png vtk_zlib vtk_tiff vtk_freetype)
ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
#-----------------------------------------------------------------------------
......
# do not do coverage in this directory
......@@ -11,8 +11,6 @@ INCLUDE_REGULAR_EXPRESSION(".*")
INCLUDE_DIRECTORIES (
${VTKFTGL_SOURCE_DIR}/src
${VTKFTGL_BINARY_DIR}
${VTKFREETYPE_SOURCE_DIR}/include
${VTKFREETYPE_BINARY_DIR}
)
#
......@@ -129,7 +127,7 @@ ENDIF (APPLE)
# Use GL library provided by parent VTK if possible.
#
IF(NOT OPENGL_FOUND)
INCLUDE (${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
FIND_PACKAGE(OpenGL)
IF (OPENGL_INCLUDE_PATH)
INCLUDE_DIRECTORIES (${OPENGL_INCLUDE_PATH})
ENDIF (OPENGL_INCLUDE_PATH)
......@@ -139,7 +137,7 @@ SET (VTKFTGL_LIBS "${VTKFTGL_LIBS};${OPENGL_gl_LIBRARY}")
#
# We obviously need FreeType
#
SET (VTKFTGL_LIBS "${VTKFTGL_LIBS};vtkfreetype")
SET (VTKFTGL_LIBS "${VTKFTGL_LIBS};${VTK_FREETYPE_LIBRARIES}")
#
# Define the library (and install it)
......@@ -176,8 +174,8 @@ IF (FTGL_BUILD_EXAMPLES)
#
# Need GLU and GLUT
#
INCLUDE (${CMAKE_ROOT}/Modules/FindGLU.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/FindGLUT.cmake)
FIND_PACKAGE(GLU)
FIND_PACKAGE(GLUT)
IF (GLU_LIBRARY AND GLUT_LIBRARY)
......@@ -234,7 +232,7 @@ IF (FTGL_BUILD_EXAMPLES)
#
# Link examples to FTGL and Freetype
#
SET (VTKFTGL_EXAMPLES_LIBS "${VTKFTGL_EXAMPLES_LIBS};vtkftgl;vtkfreetype")
SET (VTKFTGL_EXAMPLES_LIBS "${VTKFTGL_EXAMPLES_LIBS};vtkftgl;${VTK_FREETYPE_LIBRARIES}")
#
# Example 1
......
......@@ -2,7 +2,6 @@
#define __FTGL__
#if defined(VTKFTGL)
#include "vtkFreeTypeConfig.h"
#include "vtkftglConfig.h"
#endif
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtk_freetype.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef __vtk_freetype_h
#define __vtk_freetype_h
/* Use the freetype library configured for VTK. */
#include "vtkToolkits.h"
#ifdef VTK_USE_SYSTEM_FREETYPE
#ifndef FTC_Manager_LookupFace
#define FTC_Manager_LookupFace FTC_Manager_Lookup_Face
#endif //FTC_Manager_LookupFace
#ifndef FTC_Manager_LookupSize
#define FTC_Manager_LookupSize FTC_Manager_Lookup_Size
#endif //FTC_Manager_LookupSize
# include <ft2build.h>
#else
# include <vtkfreetype/include/ft2build.h>
# if defined(VTKFREETYPE)
# include "vtkFreeTypeConfig.h"
# endif
#endif
#endif
This diff is collapsed.
This diff is collapsed.
The Catharon Open Source LICENSE
----------------------------
2000-Jul-04
Copyright (C) 2000 by Catharon Productions, Inc.
Introduction
============
This license applies to source files distributed by Catharon
Productions, Inc. in several archive packages. This license
applies to all files found in such packages which do not fall
under their own explicit license.
This license was inspired by the BSD, Artistic, and IJG
(Independent JPEG Group) licenses, which all encourage inclusion
and use of free software in commercial and freeware products
alike. As a consequence, its main points are that:
o We don't promise that this software works. However, we are
interested in any kind of bug reports. (`as is' distribution)
o You can use this software for whatever you want, in parts or
full form, without having to pay us. (`royalty-free' usage)
o You may not pretend that you wrote this software. If you use
it, or only parts of it, in a program, you must acknowledge
somewhere in your documentation that you have used the
Catharon Code. (`credits')
We specifically permit and encourage the inclusion of this
software, with or without modifications, in commercial products.
We disclaim all warranties covering the packages distributed by
Catharon Productions, Inc. and assume no liability related to
their use.
Legal Terms
===========
0. Definitions
--------------
Throughout this license, the terms `Catharon Package', `package',
and `Catharon Code' refer to the set of files originally
distributed by Catharon Productions, Inc.
`You' refers to the licensee, or person using the project, where
`using' is a generic term including compiling the project's source
code as well as linking it to form a `program' or `executable'.
This program is referred to as `a program using one of the
Catharon Packages'.
This license applies to all files distributed in the original
Catharon Package(s), including all source code, binaries and
documentation, unless otherwise stated in the file in its
original, unmodified form as distributed in the original archive.
If you are unsure whether or not a particular file is covered by
this license, you must contact us to verify this.
The Catharon Packages are copyright (C) 2000 by Catharon
Productions, Inc. All rights reserved except as specified below.
1. No Warranty
--------------
THE CATHARON PACKAGES ARE PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OF OR THE INABILITY TO
USE THE CATHARON PACKAGE.
2. Redistribution
-----------------
This license grants a worldwide, royalty-free, perpetual and
irrevocable right and license to use, execute, perform, compile,
display, copy, create derivative works of, distribute and
sublicense the Catharon Packages (in both source and object code
forms) and derivative works thereof for any purpose; and to
authorize others to exercise some or all of the rights granted
herein, subject to the following conditions:
o Redistribution of source code must retain this license file
(`license.txt') unaltered; any additions, deletions or changes
to the original files must be clearly indicated in
accompanying documentation. The copyright notices of the
unaltered, original files must be preserved in all copies of
source files.
o Redistribution in binary form must provide a disclaimer that
states that the software is based in part on the work of
Catharon Productions, Inc. in the distribution documentation.
These conditions apply to any software derived from or based on
the Catharon Packages, not just the unmodified files. If you use
our work, you must acknowledge us. However, no fee need be paid
to us.
3. Advertising
--------------
Neither Catharon Productions, Inc. and contributors nor you shall
use the name of the other for commercial, advertising, or
promotional purposes without specific prior written permission.
We suggest, but do not require, that you use the following phrase
to refer to this software in your documentation: 'this software is
based in part on the Catharon Typography Project'.
As you have not signed this license, you are not required to
accept it. However, as the Catharon Packages are copyrighted
material, only this license, or another one contracted with the
authors, grants you the right to use, distribute, and modify it.
Therefore, by using, distributing, or modifying the Catharon
Packages, you indicate that you understand and accept all the
terms of this license.
--- end of license.txt ---
/***************************************************************************/
/* */
/* ahangles.h */
/* */
/* A routine used to compute vector angles with limited accuracy */
/* and very high speed (body). */
/* */
/* Copyright 2000-2001, 2002 Catharon Productions Inc. */
/* Author: David Turner */
/* */
/* This file is part of the Catharon Typography Project and shall only */
/* be used, modified, and distributed under the terms of the Catharon */
/* Open Source License that should come with this file under the name */
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/* Note that this license is compatible with the FreeType license. */
/* */
/***************************************************************************/
#include <ft2build.h>
#include "ahangles.h"
/* the following table has been automatically generated with */
/* the `mather.py' Python script */
const AH_Angle ah_arctan[1L << AH_ATAN_BITS] =
{
0, 0, 1, 1, 1, 2, 2, 2,
3, 3, 3, 3, 4, 4, 4, 5,
5, 5, 6, 6, 6, 7, 7, 7,
8, 8, 8, 9, 9, 9, 10, 10,
10, 10, 11, 11, 11, 12, 12, 12,
13, 13, 13, 14, 14, 14, 14, 15,
15, 15, 16, 16, 16, 17, 17, 17,
18, 18, 18, 18, 19, 19, 19, 20,
20, 20, 21, 21, 21, 21, 22, 22,
22, 23, 23, 23, 24, 24, 24, 24,
25, 25, 25, 26, 26, 26, 26, 27,
27, 27, 28, 28, 28, 28, 29, 29,
29, 30, 30, 30, 30, 31, 31, 31,
31, 32, 32, 32, 33, 33, 33, 33,
34, 34, 34, 34, 35, 35, 35, 35,
36, 36, 36, 36, 37, 37, 37, 38,
38, 38, 38, 39, 39, 39, 39, 40,
40, 40, 40, 41, 41, 41, 41, 42,
42, 42, 42, 42, 43, 43, 43, 43,
44, 44, 44, 44, 45, 45, 45, 45,
46, 46, 46, 46, 46, 47, 47, 47,
47, 48, 48, 48, 48, 48, 49, 49,
49, 49, 50, 50, 50, 50, 50, 51,
51, 51, 51, 51, 52, 52, 52, 52,
52, 53, 53, 53, 53, 53, 54, 54,
54, 54, 54, 55, 55, 55, 55, 55,
56, 56, 56, 56, 56, 57, 57, 57,
57, 57, 57, 58, 58, 58, 58, 58,
59, 59, 59, 59, 59, 59, 60, 60,
60, 60, 60, 61, 61, 61, 61, 61,
61, 62, 62, 62, 62, 62, 62, 63,
63, 63, 63, 63, 63, 64, 64, 64
};
FT_LOCAL_DEF( AH_Angle )
ah_angle( FT_Vector* v )
{
FT_Pos dx, dy;
AH_Angle angle;
dx = v->x;
dy = v->y;
/* check trivial cases */
if ( dy == 0 )
{
angle = 0;
if ( dx < 0 )
angle = AH_PI;
return angle;
}
else if ( dx == 0 )
{
angle = AH_HALF_PI;
if ( dy < 0 )
angle = -AH_HALF_PI;
return angle;
}
angle = 0;
if ( dx < 0 )
{
dx = -v->x;
dy = -v->y;
angle = AH_PI;
}
if ( dy < 0 )
{
FT_Pos tmp;
tmp = dx;
dx = -dy;
dy = tmp;
angle -= AH_HALF_PI;
}
if ( dx == 0 && dy == 0 )
return 0;
if ( dx == dy )
angle += AH_PI / 4;
else if ( dx > dy )
angle += ah_arctan[FT_DivFix( dy, dx ) >> ( 16 - AH_ATAN_BITS )];
else
angle += AH_HALF_PI -
ah_arctan[FT_DivFix( dx, dy ) >> ( 16 - AH_ATAN_BITS )];
if ( angle > AH_PI )
angle -= AH_2PI;
return angle;
}
FT_LOCAL_DEF( AH_Angle )
ah_angle_diff( AH_Angle angle1,
AH_Angle angle2 )
{
AH_Angle delta;
delta = ( angle2 - angle1 );
if ( delta < 0 )
delta += AH_2PI;
if ( delta > AH_PI )
delta -= AH_2PI;
return delta;
}
/* END */
/***************************************************************************/
/* */
/* ahangles.h */
/* */
/* A routine used to compute vector angles with limited accuracy */
/* and very high speed (specification). */
/* */
/* Copyright 2000-2001, 2002 Catharon Productions Inc. */
/* Author: David Turner */
/* */
/* This file is part of the Catharon Typography Project and shall only */
/* be used, modified, and distributed under the terms of the Catharon */
/* Open Source License that should come with this file under the name */
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/* Note that this license is compatible with the FreeType license. */
/* */
/***************************************************************************/
#ifndef __AHANGLES_H__
#define __AHANGLES_H__
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include "ahtypes.h"
FT_BEGIN_HEADER
/* PI expressed in ah_angles -- we don't really need an important */
/* precision, so 256 should be enough */
#define AH_PI 256
#define AH_2PI ( AH_PI * 2 )
#define AH_HALF_PI ( AH_PI / 2 )
#define AH_2PIMASK ( AH_2PI - 1 )
/* the number of bits used to express an arc tangent; */
/* see the structure of the lookup table */
#define AH_ATAN_BITS 8
extern
const AH_Angle ah_arctan[1L << AH_ATAN_BITS];
FT_LOCAL( AH_Angle )
ah_angle( FT_Vector* v );
FT_LOCAL( AH_Angle )
ah_angle_diff( AH_Angle angle1,
AH_Angle angle2 );
FT_END_HEADER
#endif /* __AHANGLES_H__ */
/* END */
/***************************************************************************/
/* */
/* aherrors.h */
/* */
/* Autohinter error codes (specification only). */
/* */
/* Copyright 2001 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file is used to define the Autohinter error enumeration */
/* constants. */
/* */
/*************************************************************************/
#ifndef __AHERRORS_H__
#define __AHERRORS_H__
#include FT_MODULE_ERRORS_H
#undef __FTERRORS_H__
#define FT_ERR_PREFIX AH_Err_
#define FT_ERR_BASE FT_Mod_Err_Autohint
#include FT_ERRORS_H
#endif /* __AHERRORS_H__ */
/* END */
This diff is collapsed.
/***************************************************************************/
/* */
/* ahglobal.h */
/* */
/* Routines used to compute global metrics automatically */
/* (specification). */
/* */
/* Copyright 2000-2001, 2002, 2003 Catharon Productions Inc. */
/* Author: David Turner */
/* */
/* This file is part of the Catharon Typography Project and shall only */
/* be used, modified, and distributed under the terms of the Catharon */
/* Open Source License that should come with this file under the name */
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/* Note that this license is compatible with the FreeType license. */
/* */
/***************************************************************************/
#ifndef __AHGLOBAL_H__
#define __AHGLOBAL_H__
#include <ft2build.h>
#include "ahtypes.h"
#include FT_INTERNAL_OBJECTS_H
FT_BEGIN_HEADER
#ifdef FT_CONFIG_CHESTER_SMALL_F
#define AH_IS_TOP_BLUE( b ) ( (b) == AH_BLUE_CAPITAL_TOP || \
(b) == AH_BLUE_SMALL_F_TOP || \
(b) == AH_BLUE_SMALL_TOP )