]> git.mjollnir.org Git - moodle.git/commitdiff
Allow a big catch-all Unicode font to be placed in lib/default.ttf
authormoodler <moodler>
Wed, 28 Apr 2004 15:39:32 +0000 (15:39 +0000)
committermoodler <moodler>
Wed, 28 Apr 2004 15:39:32 +0000 (15:39 +0000)
eg ftp://ftp.netscape.com/pub/communicator/extras/fonts/windows/Cyberbit.ZIP

lib/graphlib.php

index 43029e421f4c3337924aad8213d86dd4d03c4886..7e9d428662deeb526cf9ad38c4f5e8dcc588b21a 100644 (file)
@@ -147,14 +147,26 @@ class graph {
 // init all text - title, labels, and axis text.
 function init() {
 
+  /// Moodle mods:  overrides the font path and encodings
 
-  /// Moodle mods:  overrides the font path
   global $CFG;
+
+  /// A default.ttf is searched for in this order:
+  ///      lang/xx/fonts
+  ///      lib/
+  ///      lang/en
+
   $currlang = current_language();
-  $fontpath = $CFG->dirroot."/lang/$currlang/fonts/";
-  if (!file_exists("$fontpath"."default.ttf")) {
-      $fontpath = $CFG->dirroot."/lang/en/fonts/";
+  if (file_exists("$CFG->dirroot/lang/$currlang/fonts/default.ttf")) {
+      $fontpath = "$CFG->dirroot/lang/$currlang/fonts/";
+
+  } else if (file_exists("$CFG->libdir/default.ttf")) {
+      $fontpath = "$CFG->libdir/";
+
+  } else {
+      $fontpath = "$CFG->dirroot/lang/en/fonts/";
   }
+
   $this->parameter['path_to_fonts'] = $fontpath;
 
   if (file_exists("$fontpath"."lang_decode.php")) {