File: freetype.cmake

package info (click to toggle)
plplot 5.9.0-8
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 26,256 kB
  • ctags: 9,353
  • sloc: ansic: 64,079; xml: 22,799; cpp: 8,562; tcl: 8,314; perl: 4,872; python: 4,462; f90: 4,310; java: 4,090; sh: 1,481; makefile: 261; php: 102; fortran: 59; sed: 5
file content (122 lines) | stat: -rw-r--r-- 4,564 bytes parent folder | download
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
# cmake/modules/freetype.cmake
#
# Copyright (C) 2006  Andrew Ross
#
# 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 (NOT FREETYPE_FOUND)
    set(WITH_FREETYPE OFF
    CACHE BOOL "Enable driver options for using freetype library for fonts"
    FORCE
    )
  endif (NOT FREETYPE_FOUND)
endif (WITH_FREETYPE)

if (WITH_FREETYPE)

if(WIN32)
  set(
  PL_FREETYPE_FONT_PATH
  "c:/windows/fonts"
  CACHE PATH "Path for TrueType fonts"
  )
else(WIN32)
  set(
  PL_FREETYPE_FONT_PATH
  "/usr/share/fonts/truetype/freefont"
  CACHE PATH "Path for TrueType fonts"
  )
endif(WIN32)
# 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:FreeSerif.ttf:times.ttf"
"PL_FREETYPE_SYMBOL_BOLD:FreeSerifBold.ttf:timesbd.ttf"
"PL_FREETYPE_SYMBOL_BOLD_ITALIC:FreeSerifBoldItalic.ttf:timesbi.ttf"
"PL_FREETYPE_SYMBOL_BOLD_OBLIQUE:FreeSerifBoldItalic.ttf:timesbi.ttf"
"PL_FREETYPE_SYMBOL_ITALIC:FreeSerifItalic.ttf:timesi.ttf"
"PL_FREETYPE_SYMBOL_OBLIQUE:FreeSerifItalic.ttf:timesi.ttf"
)

foreach(FONT_ENTRY ${PL_FREETYPE_FONT_LIST}) 
  string(REGEX REPLACE "^(.*):.*:.*$" "\\1" NAME ${FONT_ENTRY})
  if (WIN32)
    string(REGEX REPLACE "^.*:.*:(.*)$" "\\1" FONT ${FONT_ENTRY})
  else (WIN32)
    string(REGEX REPLACE "^.*:(.*):.*$" "\\1" FONT ${FONT_ENTRY})
  endif (WIN32)
  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(HAVE_FREETYPE ON)
endif (WITH_FREETYPE)