+THEME = theme.nonfree
+
+THEMES = theme.nonfree
+
+TOP_DIR = $(shell pwd)
+FONTS_DIR = $(TOP_DIR)/$(THEME)/fonts
+
all:
- xelatex example.tex && make clean
+ "$(TOP_DIR)/bin/gen_font_config.pl" "$(FONTS_DIR)"
+
+ FONTCONFIG_FILE="$(FONTS_DIR)/fonts.conf" fc-cache
+ FONTCONFIG_FILE="$(FONTS_DIR)/fonts.conf" xelatex example.tex && make clean
clean:
rm -f *.log *.aux *.out *.snm *.nav *.toc *.vrb
+ $(foreach theme,$(THEMES), rm -f "$(TOP_DIR)/$(theme)/fonts/fonts.conf";)
+ $(foreach theme,$(THEMES), rm -rf "$(TOP_DIR)/$(theme)/fonts-cache";)
+
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+
+my $font_path = $ARGV[0];
+
+die "Please specify path to font dir as a first arg\n" unless $font_path;
+
+my $data = <<ENDOFDATA;
+
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+ <dir>$font_path</dir>
+ <cachedir>$font_path-cache</cachedir>
+</fontconfig>
+
+ENDOFDATA
+
+$data =~ s/^\s+//s; # Remove all spaces at the beginning of the text, to make xml parser happy
+
+open F, ">", "$font_path/fonts.conf" or die "Cannot open $font_path/fonts.conf: $!";
+print F $data;
+close F;
+