[PATCH:font/bh-ttf] Install a fontconfig snippet to force treating Luxi Mono fonts as monospaced

Alan Coopersmith alan.coopersmith at oracle.com
Wed Jun 2 17:20:25 PDT 2010


fontconfig detects multiple character advances in some of the Luxi Mono
fonts, so doesn't think they're monospaced.   This causes problems when
running xterm -fa "Luxi Mono", since it adds :spacing=100 to the pattern
when requesting a font from fontconfig to prefer monospaced fonts.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---

For the background here, see the thread "fontconfig not recognizing Luxi Mono
 as monospace" on the fontconfig mailing list recently.

 42-luxi-mono.conf |   12 ++++++++++++
 Makefile.am       |    8 ++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
 create mode 100644 42-luxi-mono.conf

diff --git a/42-luxi-mono.conf b/42-luxi-mono.conf
new file mode 100644
index 0000000..7babe82
--- /dev/null
+++ b/42-luxi-mono.conf
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<!-- force fontconfig to treat the Luxi Mono fonts as monospaced, even
+     though it detects multiple character widths -->
+<fontconfig>
+  <match target="scan">
+        <test name="family">
+                <string>Luxi Mono</string>
+        </test>
+        <edit name="spacing"><int>100</int></edit>
+  </match>
+</fontconfig>
diff --git a/Makefile.am b/Makefile.am
index c709ad9..2417e91 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,6 +36,11 @@ FONT_FILES = \
 fontdir = @FONTDIR@
 font_DATA = $(FONT_FILES)

+fontconfigdir = $(sysconfdir)/fonts/conf
+actualconfigdir = $(fontconfigdir)/conf.d
+availconfigdir = $(fontconfigdir)/conf.avail
+availconfig_DATA = 42-luxi-mono.conf
+
 EXTRA_DIST = $(FONT_FILES) COPYRIGHT.BH

 MAINTAINERCLEANFILES = ChangeLog INSTALL
@@ -45,6 +50,9 @@ install-data-hook:
 	$(MKFONTSCALE) $(DESTDIR)$(fontdir)
 	@rm -f $(DESTDIR)$(fontdir)/font.dir
 	$(MKFONTDIR) $(DESTDIR)$(fontdir)
+	mkdir -p $(DESTDIR)$(actualconfigdir)
+	@rm -f $(DESTDIR)$(actualconfigdir)/$(availconfig_DATA)
+	ln -s ../conf.avail/$(availconfig_DATA) $(DESTDIR)$(actualconfigdir)
 	@RUN_FCCACHE@

 distuninstallcheck:
-- 
1.5.6.5



More information about the xorg-devel mailing list