summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-07-19 14:15:38 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-07-20 02:13:23 +0200
commit1d9f2b132e9c6acf6258c65c0dacd46ec26bc5b5 (patch)
tree1410f64bb213be9810950a24639cfc06624765c3
parentfa5e20339cc0cb2f9b964a034e64d6224803fa94 (diff)
downloadcrawl-ref-1d9f2b132e9c6acf6258c65c0dacd46ec26bc5b5.tar.gz
crawl-ref-1d9f2b132e9c6acf6258c65c0dacd46ec26bc5b5.zip
Move the shipped font to contribs, upgrade to DejaVu.
Sadly, this fails to handle CJK well; I played long with fontforge trying to get at least Korean in, but without much success. In theory, hangul glyphs are built from few jamo (24, around a hundred graphical variants), but fontforge seems to copy all 11184 glyphs as combined splines. It may be possible to have a completely separate font, and load it if the .ko or .zh translations are selected, but since 99.9% of the game is still in English (you read descs once), it would need to be a good monospaced font, and I can't seem to find one. They're always either proportional or abysmally bad. This is an issue only for 0.11, I plan to look into fontconfig (/ pango?) integration later so the single font requirement or the inability to use system fonts will be no more. Also, the way font detection in the Makefile is done is a good example of something that shouldn't be done in make...
-rw-r--r--.gitmodules3
-rw-r--r--crawl-ref/source/AppHdr.h12
-rw-r--r--crawl-ref/source/Makefile82
m---------crawl-ref/source/contrib/fonts0
-rw-r--r--crawl-ref/source/dat/tiles/Vera.ttfbin65932 -> 0 bytes
-rw-r--r--crawl-ref/source/dat/tiles/VeraMono.ttfbin49224 -> 0 bytes
6 files changed, 80 insertions, 17 deletions
diff --git a/.gitmodules b/.gitmodules
index 99c0948777..f99052b1bc 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -25,3 +25,6 @@
[submodule "crawl-ref/source/contrib/zlib"]
path = crawl-ref/source/contrib/zlib
url = git://gitorious.org/crawl/crawl-zlib.git
+[submodule "crawl-ref/source/contrib/fonts"]
+ path = crawl-ref/source/contrib/fonts
+ url = git://gitorious.org/crawl/crawl-fonts.git
diff --git a/crawl-ref/source/AppHdr.h b/crawl-ref/source/AppHdr.h
index bfd9bf74aa..19c30a9500 100644
--- a/crawl-ref/source/AppHdr.h
+++ b/crawl-ref/source/AppHdr.h
@@ -378,11 +378,13 @@
// Uncomment these if you can't find these functions on your system
// #define NEED_USLEEP
-#ifndef PROPORTIONAL_FONT
- #define PROPORTIONAL_FONT "Vera.ttf"
-#endif
-#ifndef MONOSPACED_FONT
- #define MONOSPACED_FONT "VeraMono.ttf"
+#ifdef USE_TILE_LOCAL
+# ifndef PROPORTIONAL_FONT
+# error PROPORTIONAL_FONT not defined
+# endif
+# ifndef MONOSPACED_FONT
+# error MONOSPACED_FONT not defined
+# endif
#endif
#ifdef __cplusplus
diff --git a/crawl-ref/source/Makefile b/crawl-ref/source/Makefile
index 644a5982e4..fe90cae92e 100644
--- a/crawl-ref/source/Makefile
+++ b/crawl-ref/source/Makefile
@@ -52,6 +52,7 @@
# font; if not set, a copy of Bitstream Vera Sans
# shipped with Crawl will be used
# MONOSPACED_FONT -- monospaced font; Bitstream Vera Mono Sans
+# COPY_FONTS -- force installing fonts
#
# WEBTILES -- set to anything to compile for Webtiles
# WEBDIR -- place to hold the Webtiles client data. Can be either
@@ -220,6 +221,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
ifeq ($(shell gcc -v -static-libstdc++ 2>&1 | grep 'unrecognized option'),)
EXTRA_LIBS += -static-libgcc -static-libstdc++
endif
+ COPY_FONTS = yes
endif
ifeq ($(uname_S),Darwin)
STRIP := strip -x
@@ -235,6 +237,7 @@ ifeq ($(uname_S),Darwin)
BUILD_SDLIMAGE = YesPlease
BUILD_LIBPNG = YesPlease
endif
+ COPY_FONTS = yes
endif
ifdef USE_LUAJIT
BUILD_LUA := YesPlease
@@ -246,6 +249,7 @@ ifneq (,$(findstring CYGWIN,$(uname_S)))
GAME = crawl.exe
NO_RDYNAMIC = YesPlease
BUILD_PCRE = YesPlease
+ CONTRIB_FONTS = yes
endif
ifdef BUILD_ALL
@@ -626,13 +630,6 @@ endif
DEFINES_L += $(PNG_CFLAGS) $(FREETYPE_CFLAGS) $(SDL_CFLAGS)
INCLUDES_L += $(PNG_INCLUDE) $(FREETYPE_INCLUDE) $(SDL_INCLUDE)
-ifdef PROPORTIONAL_FONT
-DEFINES += -DPROPORTIONAL_FONT=\"$(PROPORTIONAL_FONT)\"
-endif
-ifdef MONOSPACED_FONT
-DEFINES += -DMONOSPACED_FONT=\"$(MONOSPACED_FONT)\"
-endif
-
endif # TILES
# On clang, unknown -Wfoo is merely a warning, thus -Werror.
@@ -771,9 +768,17 @@ ifneq ($(strip $(DATADIR)),)
endif
endif
CFOTHERS_L += -DDATA_DIR_PATH=\"$(abspath $(DATADIR))/\"
+ FONTDIR = $(abspath $(DATADIR))dat/tiles/
else
ifneq ($(prefix),)
DATADIR := $(strip $(prefix))/$(strip $(DATADIR))
+ FONTDIR = $(strip $(prefix))/$(strip $(DATADIR))dat/tiles/
+ else
+ ifneq ($(DESTDIR),)
+ FONTDIR = dat/tiles/
+ else
+ FONTDIR = contrib/fonts/
+ endif
endif
endif
datadir_fp := $(abspath $(strip $(DESTDIR))$(strip $(DATADIR)))
@@ -793,6 +798,62 @@ else
endif
webdir_fp := $(abspath $(strip $(DESTDIR))$(strip $(WEBDIR)))
+
+# Fonts.
+ifdef TILES
+
+OUR_PROPORTIONAL_FONT=DejaVuSans.ttf
+OUR_MONOSPACED_FONT=DejaVuSansMono.ttf
+
+ifdef PROPORTIONAL_FONT
+ DEFINES += -DPROPORTIONAL_FONT=\"$(PROPORTIONAL_FONT)\"
+ ifneq (,$(COPY_FONTS))
+ INSTALL_FONTS += $(PROPORTIONAL_FONT)
+ endif
+else
+ SYS_PROPORTIONAL_FONT = $(shell find /usr/share/fonts -iname $(OUR_PROPORTIONAL_FONT)|head -n 1)
+ ifeq (,$(SYS_PROPORTIONAL_FONT))
+ SYS_PROPORTIONAL_FONT = $(shell find /usr/local/share/fonts -iname $(OUR_PROPORTIONAL_FONT)|head -n 1)
+ endif
+ ifneq (,$(SYS_PROPORTIONAL_FONT))
+ ifeq (,$(COPY_FONTS))
+ DEFINES += -DPROPORTIONAL_FONT=\"$(SYS_PROPORTIONAL_FONT)\"
+ else
+ DEFINES += -DPROPORTIONAL_FONT=\"$(FONTDIR)$(OUR_PROPORTIONAL_FONT)\"
+ INSTALL_FONTS += $(SYS_PROPORTIONAL_FONT)
+ endif
+ else
+ DEFINES += -DPROPORTIONAL_FONT=\"$(FONTDIR)$(OUR_PROPORTIONAL_FONT)\"
+ INSTALL_FONTS += contrib/fonts/$(OUR_PROPORTIONAL_FONT)
+ endif
+endif
+
+ifdef MONOSPACED_FONT
+ DEFINES += -DMONOSPACED_FONT=\"$(MONOSPACED_FONT)\"
+ ifneq (,$(COPY_FONTS))
+ INSTALL_FONTS += $(MONOSPACED_FONT)
+ endif
+else
+ SYS_MONOSPACED_FONT = $(shell find /usr/share/fonts -iname $(OUR_MONOSPACED_FONT)|head -n 1)
+ ifeq (,$(SYS_MONOSPACED_FONT))
+ SYS_MONOSPACED_FONT = $(shell find /usr/local/share/fonts -iname $(OUR_MONOSPACED_FONT)|head -n 1)
+ endif
+ ifneq (,$(SYS_MONOSPACED_FONT))
+ ifeq (,$(COPY_FONTS))
+ DEFINES += -DMONOSPACED_FONT=\"$(SYS_MONOSPACED_FONT)\"
+ else
+ DEFINES += -DMONOSPACED_FONT=\"$(FONTDIR)$(OUR_MONOSPACED_FONT)\"
+ INSTALL_FONTS += $(SYS_MONOSPACED_FONT)
+ endif
+ else
+ DEFINES += -DMONOSPACED_FONT=\"$(FONTDIR)$(OUR_MONOSPACED_FONT)\"
+ INSTALL_FONTS += contrib/fonts/$(OUR_MONOSPACED_FONT)
+ endif
+endif
+
+endif
+
+
ifndef NO_NCURSES
ifndef CROSSHOST
@@ -1182,11 +1243,8 @@ endif
ifdef TILES
mkdir -p $(datadir_fp)/dat/tiles
$(COPY) dat/tiles/*.png $(datadir_fp)/dat/tiles/
-ifndef PROPORTIONAL_FONT
- $(COPY) dat/tiles/Vera.ttf $(datadir_fp)/dat/tiles/
-endif
-ifndef MONOSPACED_FONT
- $(COPY) dat/tiles/VeraMono.ttf $(datadir_fp)/dat/tiles/
+ifneq (,$(INSTALL_FONTS))
+ $(COPY) $(INSTALL_FONTS) $(datadir_fp)/dat/tiles/
endif
endif
ifdef WEBTILES
diff --git a/crawl-ref/source/contrib/fonts b/crawl-ref/source/contrib/fonts
new file mode 160000
+Subproject 6d3046974f35189a679a4d84b254efe82d1653b
diff --git a/crawl-ref/source/dat/tiles/Vera.ttf b/crawl-ref/source/dat/tiles/Vera.ttf
deleted file mode 100644
index 58cd6b5e61..0000000000
--- a/crawl-ref/source/dat/tiles/Vera.ttf
+++ /dev/null
Binary files differ
diff --git a/crawl-ref/source/dat/tiles/VeraMono.ttf b/crawl-ref/source/dat/tiles/VeraMono.ttf
deleted file mode 100644
index 139f0b4311..0000000000
--- a/crawl-ref/source/dat/tiles/VeraMono.ttf
+++ /dev/null
Binary files differ