From c70a39c96166341bf62dd41dcb8535ee0011c96d Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 30 Mar 2013 13:42:30 +0100 Subject: [PATCH] Minor repairs per jriegel/jmaustpc (fixes from wandererfan) --- CMakeLists.txt | 11 ++- cMake/FindFreeType.cmake | 117 ----------------------------- src/Mod/Part/App/AppPartPy.cpp | 2 +- src/Mod/Part/App/FT2FC.cpp | 29 ++++++- src/Mod/Part/App/FT2FC.h | 28 +++++++ src/Mod/Test/CMakeLists.txt | 1 + src/Mod/Test/testmakeWireString.py | 4 +- 7 files changed, 67 insertions(+), 125 deletions(-) delete mode 100644 cMake/FindFreeType.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 307fe0c8e..c5ed653fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -326,12 +326,17 @@ MARK_AS_ADVANCED(FORCE FREECAD_LIBPACK_CHECKFILE6X FREECAD_LIBPACK_CHECKFILE7X) endmacro(fc_wrap_cpp) #--------------------FreeType----------------------- + if(FREECAD_USE_FREETYPE) - find_package(FreeType) - endif(FREECAD_USE_FREETYPE) + find_package(Freetype) + if(NOT FREETYPE_FOUND) + MESSAGE("FreeType2 library is not available. Part module will lack of makeWireString().") + endif(NOT FREETYPE_FOUND) + endif(FREECAD_USE_FREETYPE) + #--------------------------------------------------- - if(FREECAD_BUILD_GUI) + if(FREECAD_BUILD_GUI) # -------------------------------- OpenGL -------------------------------- find_package(OpenGL) diff --git a/cMake/FindFreeType.cmake b/cMake/FindFreeType.cmake deleted file mode 100644 index 0e16dd44a..000000000 --- a/cMake/FindFreeType.cmake +++ /dev/null @@ -1,117 +0,0 @@ -# - Locate FreeType library -# This module defines -# FREETYPE_LIBRARY, the library to link against -# FREETYPE_FOUND, if false, do not try to link to FREETYPE -# FREETYPE_INCLUDE_DIRS, where to find headers. -# This is the concatenation of the paths: -# FREETYPE_INCLUDE_DIR_ft2build -# FREETYPE_INCLUDE_DIR_freetype2 -# -# $FREETYPE_DIR is an environment variable that would -# correspond to the ./configure --prefix=$FREETYPE_DIR -# used in building FREETYPE. -# Created by Eric Wing. - -# Ugh, FreeType seems to use some #include trickery which -# makes this harder than it should be. It looks like they -# put ft2build.h in a common/easier-to-find location which -# then contains a #include to a more specific header in a -# more specific location (#include ). -# Then from there, they need to set a bunch of #define's -# so you can do something like: -# #include FT_FREETYPE_H -# Unfortunately, using CMake's mechanisms like INCLUDE_DIRECTORIES() -# wants explicit full paths and this trickery doesn't work too well. -# I'm going to attempt to cut out the middleman and hope -# everything still works. -FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h - PATHS - $ENV{FREETYPE_DIR} - NO_DEFAULT_PATH - PATH_SUFFIXES include -) -FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h - PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. - NO_DEFAULT_PATH - PATH_SUFFIXES include -) -FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h - PATHS - /usr/local - /usr - /usr/local/X11R6 - /usr/local/X11 - /usr/X11R6 - /usr/X11 - /sw - /opt/local - /opt/csw - /opt - /usr/freeware - PATH_SUFFIXES include -) - -FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h - $ENV{FREETYPE_DIR}/include/freetype2 - NO_DEFAULT_PATH -) -FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h - PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. - NO_DEFAULT_PATH - PATH_SUFFIXES include/freetype2 -) -FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h - /usr/local/include/freetype2 - /usr/include/freetype2 - /usr/local/X11R6/include/freetype2 - /usr/local/X11/include/freetype2 - /usr/X11R6/include/freetype2 - /usr/X11/include/freetype2 - /sw/include/freetype2 - /opt/local/include/freetype2 - /opt/csw/include/freetype2 - /opt/include/freetype2 - /usr/freeware/include/freetype2 -) - -FIND_LIBRARY(FREETYPE_LIBRARY - NAMES freetype libfreetype freetype219 - PATHS - $ENV{FREETYPE_DIR} - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) -FIND_LIBRARY(FREETYPE_LIBRARY - NAMES freetype libfreetype freetype219 - PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. - NO_DEFAULT_PATH - PATH_SUFFIXES lib64 lib -) -FIND_LIBRARY(FREETYPE_LIBRARY - NAMES freetype libfreetype freetype219 - PATHS - /usr/local - /usr - /usr/local/X11R6 - /usr/local/X11 - /usr/X11R6 - /usr/X11 - /sw - /opt/local - /opt/csw - /opt - /usr/freeware - PATH_SUFFIXES lib64 lib -) - -IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) - SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}") -ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) - - -SET(FREETYPE_FOUND "NO") -IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - SET(FREETYPE_FOUND "YES") -ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - - diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 7af1d3c30..6d5640d87 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -1589,7 +1589,7 @@ struct PyMethodDef Part_methods[] = { "makeLoft(list of wires) -- Create a loft shape."}, {"makeWireString" ,makeWireString ,METH_VARARGS, - "makeWireString(fontdir,fontfile,string,height,[track]) -- Make list of wires in the form of a string's characters."}, + "makeWireString(string,fontdir,fontfile,height,[track]) -- Make list of wires in the form of a string's characters."}, {"cast_to_shape" ,cast_to_shape,METH_VARARGS, "cast_to_shape(shape) -- Cast to the actual shape type"}, diff --git a/src/Mod/Part/App/FT2FC.cpp b/src/Mod/Part/App/FT2FC.cpp index 4eefd3be9..cc3c7c3f3 100644 --- a/src/Mod/Part/App/FT2FC.cpp +++ b/src/Mod/Part/App/FT2FC.cpp @@ -1,8 +1,33 @@ -//$$INSERT legal.txt +/*************************************************************************** + * Copyright (c) wandererfan 2013 * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ +/*************************************************************************** + * FreeType License (FTL) credit: * + * Portions of this software are copyright (c) <1996-2011> The FreeType * + * Project (www.freetype.org). All rights reserved. * + ***************************************************************************/ + #ifdef FCUseFreeType - #include "PreCompiled.h" #include diff --git a/src/Mod/Part/App/FT2FC.h b/src/Mod/Part/App/FT2FC.h index cff39e9c0..20fda5705 100644 --- a/src/Mod/Part/App/FT2FC.h +++ b/src/Mod/Part/App/FT2FC.h @@ -1,3 +1,31 @@ +/*************************************************************************** + * Copyright (c) wandererfan 2013 * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ +/*************************************************************************** + * FreeType License (FTL) credit: * + * Portions of this software are copyright (c) <1996-2011> The FreeType * + * Project (www.freetype.org). All rights reserved. * + ***************************************************************************/ + + // Public header for FT2FC.cpp #ifndef FT2FC_H #define FT2FC_H diff --git a/src/Mod/Test/CMakeLists.txt b/src/Mod/Test/CMakeLists.txt index 8e0aae840..a77582da0 100644 --- a/src/Mod/Test/CMakeLists.txt +++ b/src/Mod/Test/CMakeLists.txt @@ -11,6 +11,7 @@ SET(Test_SRCS Workbench.py unittestgui.py InitGui.py + testmakeWireString.py ) SOURCE_GROUP("" FILES ${Test_SRCS}) diff --git a/src/Mod/Test/testmakeWireString.py b/src/Mod/Test/testmakeWireString.py index a75a58357..f8d11031c 100644 --- a/src/Mod/Test/testmakeWireString.py +++ b/src/Mod/Test/testmakeWireString.py @@ -26,8 +26,8 @@ String = 'FreeCAD' # ASCII #FontPath = '/usr/share/fonts/truetype/msttcorefonts/' #FontName = 'Times_New_Roman_Italic.ttf' FontPath = '/usr/share/fonts/truetype/msttcorefonts/' -#FontName = 'Arial.ttf' -FontName = 'NOTArial.ttf' # font file not found error +FontName = 'Arial.ttf' +#FontName = 'NOTArial.ttf' # font file not found error #FontPath = '/usr/share/fonts/truetype/msttcorefonts/' #FontName = 'ariali.ttf' #symlink to ttf #FontPath = '/usr/share/fonts/truetype/'