Debian Codegraph @

m4/font.m4

raw
1 dnl FTGL_CHECK_FONT()
2 dnl Look for a TrueType font somewhere on the system. If no font is found,
3 dnl no big deal, example programs will just require one in the command line.
4 dnl This finds DejaVu, Bitstream and Microsoft fonts on Debian, Ubuntu, Gentoo,
5 dnl Fedora, Mandriva, Slackware and OS X systems.
6 dnl Also, we prefer serif fonts because they have elegant curves that render
7 dnl well in OpenGL.
8 dnl
9 AC_DEFUN([FTGL_CHECK_FONT],
10 [dnl
11 AC_MSG_CHECKING(for a TrueType font on the system)
12
13 dnl First try: fontconfig
14 FONT_FILE="`fc-match -sv serif 2>/dev/null| sed -ne 's/.*\file:@<:@^"@:>@*"\(@<:@^"@:>@*\)".*/\1/p' | sed q`"
15
16 dnl Second try: look into known paths
17 if test "$FONT_FILE" = ""; then
18 for font in \
19 DejaVuSerif.ttf VeraSe.ttf DejaVuSans.ttf Vera.ttf \
20 times.ttf Times.ttf arial.ttf Arial.ttf; do
21 for dir in \
22 /usr/share/fonts \
23 /usr/share/fonts/truetype \
24 /usr/share/fonts/truetype/ttf-dejavu \
25 /usr/share/fonts/truetype/ttf-bitstream-vera \
26 /usr/share/fonts/TTF \
27 /usr/share/fonts/TTF/dejavu \
28 /usr/share/fonts/dejavu \
29 /usr/share/fonts/ttf-dejavu \
30 /usr/share/fonts/ttf-bitstream-vera \
31 /usr/X11R6/lib/X11/fonts \
32 /usr/X11R6/lib/X11/fonts/TTF; do
33 if test -f "$dir/$font"; then FONT_FILE="$dir/$font"; break; fi
34 done
35 if test "$FONT_FILE" != no; then break; fi
36 done
37 fi
38
39 if test "$FONT_FILE" != ""; then
40 AC_DEFINE_UNQUOTED(FONT_FILE, "$FONT_FILE", [Define to the path to a TrueType font])
41 fi
42 AC_MSG_RESULT($FONT_FILE)
43 ])