From: stronk7 Date: Wed, 5 Apr 2006 23:03:18 +0000 (+0000) Subject: Now graphlib also works with ttf fonts installed under X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=768cf7d5d132021a923dd5ca045199dcffe7a7ea;p=moodle.git Now graphlib also works with ttf fonts installed under moodledata/lang dir. Rest of functionality not modified. --- diff --git a/lib/graphlib.php b/lib/graphlib.php index b284468088..712cc4c6ca 100644 --- a/lib/graphlib.php +++ b/lib/graphlib.php @@ -154,19 +154,17 @@ function init() { global $CFG; /// A default.ttf is searched for in this order: - /// lang/xx/fonts + /// dataroot/lang/xx/fonts + /// dirroot/lang/xx/fonts /// lib/ - /// lang/en $currlang = current_language(); - if (file_exists("$CFG->dirroot/lang/$currlang/fonts/default.ttf")) { + if (file_exists("$CFG->dataroot/lang/$currlang/fonts/default.ttf")) { + $fontpath = "$CFG->dataroot/lang/$currlang/fonts/"; + } else 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/"; + $fontpath = "$CFG->libdir/"; } $this->parameter['path_to_fonts'] = $fontpath; @@ -179,12 +177,10 @@ function init() { $this->parameter['lang_transcode'] = ''; /// by default - if (function_exists('iconv')) { - $charset = strtolower(get_string('thischarset')); + $charset = strtolower(current_charset()); - if ($charset != 'iso-8859-1' and $charset != 'utf-8') { - $this->parameter['lang_transcode'] = $charset; - } + if ($charset != 'iso-8859-1' and $charset != 'utf-8') { + $this->parameter['lang_transcode'] = $charset; } /// End Moodle mods