summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-05-14 11:50:32 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-05-14 11:50:32 +0200
commitce19ed8ddffd05e0dc846470be7b22b530d5dc6d (patch)
treed7a154356e9b013d8d7352f381f297eb1988cdd3 /Makefile.am
Initial import
Import new mmap-unifont package, a pre-compiled version of the GNU-Unifont font files: GNU-Unifont is a bitmap Unicode font with almost complete Unicode coverage. It is perfectly suited for low-level system binaries, as fallback font, in emergency situations, and more. mmap-unifont compiles a binary font format based on GNU-Unifont. This compiled file can be memory-mapped by applications to get direct font-access. This extremely simplifies font-usage for system-applications. Advantages over using the original BDF font are: * On-demand glyph loading: The whole font is pre-compiled with fixed offsets. The header includes offsets and limits. Hence, an application can directly access the memory-location of a glyph on-demand. The operating-system can load the required memory-pages on first-access, thus reducing the memory footprint considerably. With BDF fonts, the application has to scan the whole BDF file to find a given glyph. This requires loading 9MB of font-data just to display the U+FFFD glyph. * No need to write a BDF-format parser: While BDF is a quite simple format, it still requires a parser. This is tedious and overkill, if you don't intend to use other fonts than GNU-Unifont. * Stronger guarantees: GNU-Unifont has some very handy features, which cannot be expressed in most font-formats. While it is possible to rely on them using any font-format, you usually violate the rules of the font-format and thus make your application dependent on GNU-Unifont (questioning why you wrote a BDF-parser in the first place). Those features include: * fixed size for all glyphs * fixed underline position and thickness * fixed horizontal/vertical advancement * ... * Additional annotations: Given the very precice use-case of mmap-unifont, we can add additional glyph-annotations that simplify rendering. For instance, combining-characters require you to draw multiple glyphs on top of each other. The mmap-unifont package provides annotations that describe the relative positioning of the glyphs when drawn together. mmap-unifont is strongly targetted at system-applications. It has no external dependencies, is very memory-friendly, but still provides a font with full Unicode-coverage. However, please note that it does not provide any advanced layout-features (like RTL/LTR annotations). To render fully-internationalized text, a layout-engine like HarfBuzz/Pango is required. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am160
1 files changed, 160 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..09ea475
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,160 @@
+#
+# mmap-unifont - Global Makefile
+# Copyright (c) 2012-2014 David Herrmann <dh.herrmann@gmail.com>
+#
+
+#
+# Global Configurations and Initializations
+#
+
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+AM_MAKEFLAGS = --no-print-directory
+AUTOMAKE_OPTIONS = color-tests
+
+SUBDIRS = .
+
+.DELETE_ON_ERROR:
+
+include_HEADERS =
+EXTRA_DIST = \
+ README \
+ COPYING \
+ NEWS \
+ DOCUMENTATION
+CLEANFILES =
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA =
+dist_pkgdata_DATA =
+TPHONY =
+
+TESTS =
+MEMTESTS =
+check_PROGRAMS =
+bin_PROGRAMS =
+lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
+
+#
+# Default CFlags
+#
+
+AM_CFLAGS = \
+ -Wall \
+ -pipe \
+ -fno-common \
+ -ffast-math \
+ -fdiagnostics-show-option \
+ -fno-strict-aliasing \
+ -fvisibility=hidden \
+ -ffunction-sections \
+ -fdata-sections
+AM_CPPFLAGS = \
+ -include $(top_builddir)/config.h \
+ -I $(srcdir)/src \
+ '-DPKGDATADIR="$(pkgdatadir)"'
+AM_LDFLAGS = \
+ -Wl,--as-needed \
+ -Wl,--gc-sections \
+ -Wl,-z,relro \
+ -Wl,-z,now
+
+#
+# mmap-unifont
+#
+
+pkgconfig_DATA += src/mmap-unifont.pc
+
+EXTRA_DIST += \
+ src/mmap-unifont.pc.in \
+ src/unifont.hex
+
+dist_pkgdata_DATA += src/mmap-unifont.bin
+
+src/mmap-unifont.bin: src/compile-unifont.py src/unifont.hex
+ $(AM_V_GEN)cat $(top_srcdir)/src/unifont.hex | $(PYTHON) $< >$@
+
+src/mmap-unifont.cmp: src/compile-unifont.py src/mmap-unifont.bin
+ $(AM_V_GEN)cat $(top_srcdir)/src/mmap-unifont.bin | $(PYTHON) $< verify >$@
+
+update-unifont: src/mmap-unifont.bin src/mmap-unifont.cmp
+ @RET=`diff -u src/unifont.hex src/mmap-unifont.cmp | wc -l` ; \
+ if test "x$$?" != "x0" -o "x$$RET" != "x0" ; then \
+ echo "Generated Unifont-file differs from original; generator probably broken" ; \
+ exit 1 ; \
+ fi
+ @echo "mmap-unifont.bin has been regenerated"
+
+#
+# Tests
+# We add a separate "memcheck" target which runs valgrind on all tests in
+# MEMTESTS. Note that we fail if _any_ leak is detected by valgrind. Thus, you
+# need to have valgrind installed and libcheck running properly (without leaks)
+# to make memcheck succeed.
+# A separate memcheck-verify actually runs a faulty test and verifies the
+# valgrind tests work properly.
+#
+
+if BUILD_HAVE_CHECK
+MEMTESTS += \
+ test-glyphs
+check_PROGRAMS += \
+ $(MEMTESTS) \
+ test-valgrind
+TESTS += \
+ $(MEMTESTS) \
+ test-valgrind
+endif
+
+test_sources = \
+ test/test-common.h
+test_libs = \
+ $(CHECK_LIBS)
+test_cflags = \
+ $(AM_CPPFLAGS) \
+ $(CHECK_CFLAGS)
+test_lflags = \
+ $(AM_LDFLAGS)
+
+test_glyphs_SOURCES = test/test-glyphs.c $(test_sources)
+test_glyphs_CPPFLAGS = $(test_cflags)
+test_glyphs_LDADD = $(test_libs)
+test_glyphs_LDFLAGS = $(test_lflags)
+
+test_valgrind_SOURCES = test/test-valgrind.c $(test_sources)
+test_valgrind_CPPFLAGS = $(test_cflags)
+test_valgrind_LDADD = $(test_libs)
+test_valgrind_LDFLAGS = $(test_lflags)
+
+EXTRA_DIST += test.supp
+
+VALGRIND = CK_FORK=no valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --leak-resolution=high --error-exitcode=1 --suppressions=$(top_builddir)/test.supp
+
+# verify that test-valgrind actually leaks data
+memcheck-verify: check
+ $(AM_V_GEN)$(VALGRIND) --log-file=/dev/null ./test-valgrind >/dev/null ; test 1 = $$?
+
+TPHONY += memcheck-verify
+
+# run memcheck tests via valgrind
+memcheck: memcheck-verify
+ $(AM_V_GEN)for i in $(MEMTESTS) ; do \
+ $(VALGRIND) --log-file=$(top_builddir)/$$i.memlog \
+ $(top_builddir)/$$i >/dev/null || (echo "memcheck failed on: $$i" ; exit 1) ; \
+ done
+
+TPHONY += memcheck memcheck-verify
+
+distcheck-hook: memcheck
+
+#
+# Phony targets
+#
+
+.PHONY: $(TPHONY)
+
+#
+# Empty .SECONDARY target causes alle intermediate files to be treated as
+# secondary files. That is, they don't get deleted after make finished.
+#
+
+.SECONDARY: