Bug 12549 - Hard coded font Paths ( DejaVu ) cause problems for non-Debian systems
Summary: Hard coded font Paths ( DejaVu ) cause problems for non-Debian systems
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (command-line installer) (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Nicholas van Oudtshoorn
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-10 06:47 UTC by Nicholas van Oudtshoorn
Modified: 2017-06-14 22:10 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Allows selecting the path for fonts at installation time (4.54 KB, patch)
2015-12-22 04:32 UTC, Nicholas van Oudtshoorn
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 12549 - Hard coded font Paths ( DejaVu ) cause problems for non-Debian systems (4.91 KB, patch)
2016-02-12 20:48 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 12549: Hard coded font Paths ( DejaVu ) cause problems for non-Debian systems (4.95 KB, patch)
2016-02-16 13:19 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 12549: (QA followup) missing newline in CLI dialog (1.37 KB, patch)
2016-02-16 13:19 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nicholas van Oudtshoorn 2014-07-10 06:47:32 UTC
In Koha-conf.xml, the font paths for the DejaVu fonts are hardcoded. Unfortunately, the paths don't match the installed font locations in other distributions (such as Fedora).

Ideally, the system should enquire of fontconfig where the fonts are installed. Something like: 
   
    fc-list : file | grep Deja
spits out the correct paths, and should work across distributions.

Just spent quite a long time trying to figure out why the Creators.t test was continually failing during make test even though they ran fine manually. Problem seems to have been this!
Comment 1 Nicholas van Oudtshoorn 2014-07-10 07:01:55 UTC
It's not in perl, but the following bash snippet (hacky, but works!) could set the proper paths...

#!/bin/bash
tr=$(fc-list : file | grep DejaVuSerif.ttf)
tb=$(fc-list : file | grep DejaVuSerif-Bold.ttf)
ti=$(fc-list : file | grep DejaVuSerif-Italic.ttf)
tbi=$(fc-list : file | grep DejaVuSerif-BoldItalic.ttf)
c=$(fc-list : file | grep DejaVuSansMono.ttf)
cb=$(fc-list : file | grep DejaVuSansMono-Bold.ttf)
co=$(fc-list : file | grep DejaVuSansMono-Oblique.ttf)
cbo=$(fc-list : file | grep DejaVuSansMono-BoldOblique.ttf)
h=$(fc-list : file | grep DejaVuSans.ttf)
ho=$(fc-list : file | grep DejaVuSans-Oblique.ttf)
hb=$(fc-list : file | grep DejaVuSans-Bold.ttf)
hbo=$(fc-list : file | grep DejaVuSans-BoldOblique.ttf)
echo "<font type=\"TR\" >${tr%??}</font>"
echo "<font type=\"TB\" >${tb%??}</font>"
echo "<font type=\"TI\" >${ti%??}</font>"
echo "<font type=\"TBI\" >${tbi%??}</font>"
echo "<font type=\"C\" >${c%??}</font>"
echo "<font type=\"CB\" >${cb%??}</font>"
echo "<font type=\"CO\" >${co%??}</font>"
echo "<font type=\"CBO\" >${cbo%??}</font>"
echo "<font type=\"H\" >${h%??}</font>"
echo "<font type=\"HO\" >${ho%??}</font>"
echo "<font type=\"HB\" >${hb%??}</font>"
echo "<font type=\"HBO\" >${hbo%??}</font>"
Comment 2 Nicholas van Oudtshoorn 2015-12-22 04:32:26 UTC Comment hidden (obsolete)
Comment 3 Mark Tompsett 2016-02-12 20:48:16 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2016-02-15 17:08:47 UTC
I don't know if we should update debian/templates/koha-conf-site.xml.in as weel, to keep both files in sync.
Comment 5 Tomás Cohen Arazi 2016-02-16 13:19:44 UTC
Created attachment 48118 [details] [review]
Bug 12549: Hard coded font Paths ( DejaVu ) cause problems for non-Debian systems

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>
Comment 6 Tomás Cohen Arazi 2016-02-16 13:19:51 UTC
Created attachment 48119 [details] [review]
Bug 12549: (QA followup) missing newline in CLI dialog

Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Comment 7 Tomás Cohen Arazi 2016-02-16 13:26:03 UTC
I don't think is necessary to add placeholders for font path into the packages template right now. In the mid term the packages-way should be integrated into the source install so we should have a single file to maintain.
Comment 8 Brendan Gallagher 2016-02-24 01:07:04 UTC
Pushed to Master - Should be in the May 2016 release.  Thanks
Comment 9 Julian Maurice 2016-02-26 12:45:12 UTC
Patches pushed to 3.22.x, will be in 3.22.4
Comment 10 Frédéric Demians 2016-03-01 16:52:10 UTC
This patch has been pushed to 3.20.x, will be in 3.20.9.