1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
# cmake/modules/freetype.cmake
#
# Copyright (C) 2006 Andrew Ross
# Copyright (C) 2014 Alan W. Irwin
#
# This file is part of PLplot.
#
# PLplot 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; version 2 of the License.
#
# PLplot 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 the file PLplot; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# Configuration for the freetype support in plplot.
option(
WITH_FREETYPE
"Enable driver options for using freetype library for fonts"
ON
)
# Look for freetype libraries
if (WITH_FREETYPE)
find_package(Freetype)
if (FREETYPE_FOUND)
#message(STATUS "FREETYPE_INCLUDE_DIRS = ${FREETYPE_INCLUDE_DIRS}")
string(REGEX REPLACE ";" " -I" FREETYPE_INCLUDE_CFLAGS "-I${FREETYPE_INCLUDE_DIRS}")
message(STATUS "FREETYPE_CFLAGS = ${FREETYPE_INCLUDE_CFLAGS}")
message(STATUS "FREETYPE_LIBRARIES = ${FREETYPE_LIBRARIES}")
else (FREETYPE_FOUND)
set(WITH_FREETYPE OFF
CACHE BOOL "Enable driver options for using freetype library for fonts"
FORCE
)
endif (FREETYPE_FOUND)
endif (WITH_FREETYPE)
if (WITH_FREETYPE)
if(WIN32_OR_CYGWIN)
set(
PL_FREETYPE_FONT_PATH
"c:/windows/fonts"
CACHE PATH "Path for TrueType fonts"
)
else(WIN32_OR_CYGWIN)
set(
PL_FREETYPE_FONT_PATH
"/usr/share/fonts/truetype/freefont"
CACHE PATH "Path for TrueType fonts"
)
endif(WIN32_OR_CYGWIN)
# PLplot internally needs a trailing slash for this path.
set(PL_FREETYPE_FONT_DIR "${PL_FREETYPE_FONT_PATH}/")
set(PL_FREETYPE_FONT_LIST
"PL_FREETYPE_MONO:FreeMono.ttf:cour.ttf"
"PL_FREETYPE_MONO_BOLD:FreeMonoBold.ttf:courbd.ttf"
"PL_FREETYPE_MONO_BOLD_ITALIC:FreeMonoBoldOblique.ttf:courbi.ttf"
"PL_FREETYPE_MONO_BOLD_OBLIQUE:FreeMonoBoldOblique.ttf:courbi.ttf"
"PL_FREETYPE_MONO_ITALIC:FreeMonoOblique.ttf:couri.ttf"
"PL_FREETYPE_MONO_OBLIQUE:FreeMonoOblique.ttf:couri.ttf"
"PL_FREETYPE_SANS:FreeSans.ttf:arial.ttf"
"PL_FREETYPE_SANS_BOLD:FreeSansBold.ttf:arialbd.ttf"
"PL_FREETYPE_SANS_BOLD_ITALIC:FreeSansBoldOblique.ttf:arialbi.ttf"
"PL_FREETYPE_SANS_BOLD_OBLIQUE:FreeSansBoldOblique.ttf:arialbi.ttf"
"PL_FREETYPE_SANS_ITALIC:FreeSansOblique.ttf:ariali.ttf"
"PL_FREETYPE_SANS_OBLIQUE:FreeSansOblique.ttf:ariali.ttf"
"PL_FREETYPE_SCRIPT:FreeSerif.ttf:arial.ttf"
"PL_FREETYPE_SCRIPT_BOLD:FreeSerifBold.ttf:arialbd.ttf"
"PL_FREETYPE_SCRIPT_BOLD_ITALIC:FreeSerifBoldItalic.ttf:arialbi.ttf"
"PL_FREETYPE_SCRIPT_BOLD_OBLIQUE:FreeSerifBoldItalic.ttf:arialbi.ttf"
"PL_FREETYPE_SCRIPT_ITALIC:FreeSerifItalic.ttf:ariali.ttf"
"PL_FREETYPE_SCRIPT_OBLIQUE:FreeSerifItalic.ttf:ariali.ttf"
"PL_FREETYPE_SERIF:FreeSerif.ttf:times.ttf"
"PL_FREETYPE_SERIF_BOLD:FreeSerifBold.ttf:timesbd.ttf"
"PL_FREETYPE_SERIF_BOLD_ITALIC:FreeSerifBoldItalic.ttf:timesbi.ttf"
"PL_FREETYPE_SERIF_BOLD_OBLIQUE:FreeSerifBoldItalic.ttf:timesbi.ttf"
"PL_FREETYPE_SERIF_ITALIC:FreeSerifItalic.ttf:timesi.ttf"
"PL_FREETYPE_SERIF_OBLIQUE:FreeSerifItalic.ttf:timesi.ttf"
"PL_FREETYPE_SYMBOL:FreeSans.ttf:arial.ttf"
"PL_FREETYPE_SYMBOL_BOLD:FreeSansBold.ttf:arialbd.ttf"
"PL_FREETYPE_SYMBOL_BOLD_ITALIC:FreeSansBoldOblique.ttf:arialbi.ttf"
"PL_FREETYPE_SYMBOL_BOLD_OBLIQUE:FreeSansBoldOblique.ttf:arialbi.ttf"
"PL_FREETYPE_SYMBOL_ITALIC:FreeSansOblique.ttf:ariali.ttf"
"PL_FREETYPE_SYMBOL_OBLIQUE:FreeSansOblique.ttf:ariali.ttf"
)
foreach(FONT_ENTRY ${PL_FREETYPE_FONT_LIST})
string(REGEX REPLACE "^(.*):.*:.*$" "\\1" NAME ${FONT_ENTRY})
if (WIN32_OR_CYGWIN)
string(REGEX REPLACE "^.*:.*:(.*)$" "\\1" FONT ${FONT_ENTRY})
else (WIN32_OR_CYGWIN)
string(REGEX REPLACE "^.*:(.*):.*$" "\\1" FONT ${FONT_ENTRY})
endif (WIN32_OR_CYGWIN)
set(${NAME} ${FONT}
CACHE FILEPATH "Font file for ${NAME}"
)
endforeach(FONT_ENTRY PL_FREETYPE_FONT_LIST)
# Check a couple of fonts actually exists
if (EXISTS ${PL_FREETYPE_FONT_DIR}${PL_FREETYPE_SANS})
if (EXISTS ${PL_FREETYPE_FONT_DIR}${PL_FREETYPE_SYMBOL})
else (EXISTS ${PL_FREETYPE_FONT_DIR}${PL_FREETYPE_SYMBOL})
message("Fonts not found - disabling freetype")
set(WITH_FREETYPE OFF CACHE BOOL
"Enable driver options for using freetype library for fonts" FORCE
)
endif (EXISTS ${PL_FREETYPE_FONT_DIR}${PL_FREETYPE_SYMBOL})
else (EXISTS ${PL_FREETYPE_FONT_DIR}${PL_FREETYPE_SANS})
message("Fonts not found - disabling freetype")
set(WITH_FREETYPE OFF CACHE BOOL
"Enable driver options for using freetype library for fonts" FORCE
)
endif (EXISTS ${PL_FREETYPE_FONT_DIR}${PL_FREETYPE_SANS})
endif (WITH_FREETYPE)
if (WITH_FREETYPE)
set(PL_HAVE_FREETYPE ON)
endif (WITH_FREETYPE)
|