Bug 12549: Hard coded font Paths ( DejaVu ) cause problems for non-Debian systems
authorNicholas van Oudtshoorn <vanoudt@gmail.com>
Tue, 22 Dec 2015 04:25:47 +0000 (12:25 +0800)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Wed, 24 Feb 2016 01:06:13 +0000 (01:06 +0000)
Allows for selection of DejaVu font path when installing from the command line. This
is useful for non-debian distributions that don't store the fonts in the same place.

Adds a new configuration variable to Makefile.PL: FONT_DIR

Defaults to the Debian install location for the fonts.

Test plan:
1. Run a CLI install, accepting the defaults.
2. Compare the generated koha-conf.xml to a
previous install - the font path for DejaVu fonts should be the same.
3. Run another CLI install, this time choosing a custom path for the fonts
4. Check that the path selected is reflected in the koha-conf.xml file.

NOTE: 'perl Makefile.pl' and 'make' generates blib/KOHA_CONF_DIR/koha-conf.xml
      ran with a weird string for the font dir
      copied that koha-conf.xml to my home dir
      reran with all defaults
      compared the two, and only the font paths differed.
      Also, I cleaned up the tabs that snuck in. :)

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com

Makefile.PL
etc/koha-conf.xml
rewrite-config.PL

index b2a8daa..5ffde51 100644 (file)
@@ -240,6 +240,10 @@ Directory for external Koha plugins.
 
 Directory for PazPar2 configuration files.
 
+=item FONT_DIR
+
+Directory where DejaVu fonts are installed.
+
 =item NONE
 
 This is a dummy target used to explicitly state
@@ -442,7 +446,8 @@ my %config_defaults = (
   'PATH_TO_ZEBRA' => '',
   'USE_MEMCACHED'     => 'no',
   'MEMCACHED_SERVERS' => '127.0.0.1:11211',
-  'MEMCACHED_NAMESPACE' => 'KOHA'
+  'MEMCACHED_NAMESPACE' => 'KOHA',
+  'FONT_DIR'          => '/usr/share/fonts/truetype/ttf-dejavu'
 );
 
 # set some default configuration options based on OS
@@ -1082,6 +1087,8 @@ Memcached namespace?);
       $config{'MEMCACHED_NAMESPACE'} = _get_value('MEMCACHED_NAMESPACE', $msg, $defaults->{'MEMCACHED_NAMESPACE'}, $valid_values, $install_log_values);
   }
 
+  $msg = q(Path to DejaVu fonts?);
+  $config{'FONT_DIR'} = _get_value('FONT_DIR', $msg, $defaults->{'FONT_DIR'}, $valid_values, $install_log_values);
 
 
   $msg = q(
index 74a5720..c361846 100644 (file)
@@ -122,18 +122,18 @@ __PAZPAR2_TOGGLE_XML_POST__
 
  <!-- true type font mapping accoding to type from $font_types in C4/Creators/Lib.pm -->
  <ttf>
-    <font type="TR" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf</font>
-    <font type="TB" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf</font>
-    <font type="TI" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Italic.ttf</font>
-    <font type="TBI">/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-BoldItalic.ttf</font>
-    <font type="C"  >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf</font>
-    <font type="CB" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf</font>
-    <font type="CO" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Oblique.ttf</font>
-    <font type="CBO">/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-BoldOblique.ttf</font>
-    <font type="H"  >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf</font>
-    <font type="HO" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Oblique.ttf</font>
-    <font type="HB" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf</font>
-    <font type="HBO">/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf</font>
+    <font type="TR" >__FONT_DIR__/DejaVuSerif.ttf</font>
+    <font type="TB" >__FONT_DIR__/DejaVuSerif-Bold.ttf</font>
+    <font type="TI" >__FONT_DIR__/DejaVuSerif-Italic.ttf</font>
+    <font type="TBI">__FONT_DIR__/DejaVuSerif-BoldItalic.ttf</font>
+    <font type="C"  >__FONT_DIR__/DejaVuSansMono.ttf</font>
+    <font type="CB" >__FONT_DIR__/DejaVuSansMono-Bold.ttf</font>
+    <font type="CO" >__FONT_DIR__/DejaVuSansMono-Oblique.ttf</font>
+    <font type="CBO">__FONT_DIR__/DejaVuSansMono-BoldOblique.ttf</font>
+    <font type="H"  >__FONT_DIR__/DejaVuSans.ttf</font>
+    <font type="HO" >__FONT_DIR__/DejaVuSans-Oblique.ttf</font>
+    <font type="HB" >__FONT_DIR__/DejaVuSans-Bold.ttf</font>
+    <font type="HBO">__FONT_DIR__/DejaVuSans-BoldOblique.ttf</font>
  </ttf>
 
 </config>
index 91f74cb..3239a59 100644 (file)
@@ -147,6 +147,7 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr";
   "__USE_MEMCACHED__" => 'no',
   "__MEMCACHED_SERVERS__" => "",
   "__MEMCACHED_NAMESPACE__" => "",
+  "__FONT_DIR__" => "/usr/share/fonts/truetype/ttf-dejavu",
 );
 
 # Override configuration from the environment