mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
Merge branch 'MDL-63439-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
89957b6c34
@ -583,6 +583,12 @@ $CFG->admin = 'admin';
|
||||
//
|
||||
// $CFG->conversionattemptlimit = 3;
|
||||
//
|
||||
// Font used in exported PDF files. When generating a PDF, Moodle embeds a subset of
|
||||
// the font in the PDF file so it will be readable on the widest range of devices.
|
||||
// The default font is 'freesans' which is part of the GNU FreeFont collection.
|
||||
//
|
||||
// $CFG->pdfexportfont = 'freesans';
|
||||
//
|
||||
//=========================================================================
|
||||
// 7. SETTINGS FOR DEVELOPMENT SERVERS - not intended for production use!!!
|
||||
//=========================================================================
|
||||
|
@ -71,6 +71,23 @@ class pdf extends \FPDI {
|
||||
/** Blank PDF file used during error. */
|
||||
const BLANK_PDF = '/mod/assign/feedback/editpdf/fixtures/blank.pdf';
|
||||
|
||||
/**
|
||||
* Get the name of the font to use in generated PDF files.
|
||||
* If $CFG->pdfexportfont is set - use it, otherwise use "freesans" as this
|
||||
* open licensed font has wide support for different language charsets.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function get_export_font_name() {
|
||||
global $CFG;
|
||||
|
||||
$fontname = 'freesans';
|
||||
if (!empty($CFG->pdfexportfont)) {
|
||||
$fontname = $CFG->pdfexportfont;
|
||||
}
|
||||
return $fontname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine the given PDF files into a single PDF. Optionally add a coversheet and coversheet fields.
|
||||
* @param string[] $pdflist the filenames of the files to combine
|
||||
@ -86,7 +103,8 @@ class pdf extends \FPDI {
|
||||
$this->setPrintHeader(false);
|
||||
$this->setPrintFooter(false);
|
||||
$this->scale = 72.0 / 100.0;
|
||||
$this->SetFont('helvetica', '', 16.0 * $this->scale);
|
||||
// Use font supporting the widest range of characters.
|
||||
$this->SetFont($this->get_export_font_name(), '', 16.0 * $this->scale, '', true);
|
||||
$this->SetTextColor(0, 0, 0);
|
||||
|
||||
$totalpagecount = 0;
|
||||
@ -133,7 +151,7 @@ class pdf extends \FPDI {
|
||||
|
||||
$this->setPageUnit('pt');
|
||||
$this->scale = 72.0 / 100.0;
|
||||
$this->SetFont('helvetica', '', 16.0 * $this->scale);
|
||||
$this->SetFont($this->get_export_font_name(), '', 16.0 * $this->scale, '', true);
|
||||
$this->SetFillColor(255, 255, 176);
|
||||
$this->SetDrawColor(0, 0, 0);
|
||||
$this->SetLineWidth(1.0 * $this->scale);
|
||||
@ -226,7 +244,7 @@ class pdf extends \FPDI {
|
||||
$this->SetFontSize(12 * $this->scale);
|
||||
$this->SetMargins(100 * $this->scale, 120 * $this->scale, -1, true);
|
||||
$this->SetAutoPageBreak(true, 100 * $this->scale);
|
||||
$this->setHeaderFont(array('helvetica', '', 24 * $this->scale));
|
||||
$this->setHeaderFont(array($this->get_export_font_name(), '', 24 * $this->scale, '', true));
|
||||
$this->setHeaderMargin(24 * $this->scale);
|
||||
$this->setHeaderData('', 0, '', get_string('commentindex', 'assignfeedback_editpdf'));
|
||||
|
||||
|
@ -258,7 +258,8 @@ class assignfeedback_editpdf_testcase extends advanced_testcase {
|
||||
|
||||
$comment = new comment();
|
||||
|
||||
$comment->rawtext = 'Comment text';
|
||||
// Use some different charset in the comment text.
|
||||
$comment->rawtext = 'Testing example: בקלות ואמנות';
|
||||
$comment->width = 100;
|
||||
$comment->x = 100;
|
||||
$comment->y = 100;
|
||||
|
Loading…
x
Reference in New Issue
Block a user