From d95b36623902a004fb641fc04048f19532d59217 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Wed, 10 Feb 2016 15:28:03 -0500 Subject: [PATCH] Separate author and title font size settings. --- config/vufind/config.ini | 12 +++++++----- module/VuFind/src/VuFind/Cover/Generator.php | 13 +++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/config/vufind/config.ini b/config/vufind/config.ini index 97be2a9a8d9..c23260d7a5b 100644 --- a/config/vufind/config.ini +++ b/config/vufind/config.ini @@ -676,12 +676,14 @@ authors = Wikipedia ; everything by doing the following: break the title into lines, and if the title ; is too long (more than maxTitleLines lines), it will display ellipses at the last ; line. -; All text will be drawn at fontSize using the specified textAlign alignment value, -; except that author names will be reduced to the minAuthorFontSize option if -; needed, and if that doesn't make it fit, text will be aligned left and truncated. +; All text will be drawn using the specified textAlign alignment value using the +; relevant titleFontSize or authorFontSize setting, except that author names will +; be reduced to the minAuthorFontSize option if needed, and if that doesn't make +; it fit, text will be aligned left and truncated. ;textAlign = center -;fontSize = 9 -;minAuthorFontSize = 8 +;titleFontSize = 9 +;authorFontSize = 8 +;minAuthorFontSize = 7 ;maxTitleLines = 4 ; All color options support the same basic set of values: diff --git a/module/VuFind/src/VuFind/Cover/Generator.php b/module/VuFind/src/VuFind/Cover/Generator.php index b0012c40261..0dd2d293dfe 100644 --- a/module/VuFind/src/VuFind/Cover/Generator.php +++ b/module/VuFind/src/VuFind/Cover/Generator.php @@ -113,7 +113,8 @@ class Generator $default = [ 'mode' => 'grid', 'authorFont' => 'DroidSerif-Bold.ttf', - 'fontSize' => 7, + 'titleFontSize' => 7, + 'authorFontSize' => 6, 'lightness' => 220, 'maxTitleLines' => 5, 'minAuthorFontSize' => 5, @@ -431,7 +432,7 @@ class Generator $textWidth = $this->textWidth( rtrim($line, ' '), $this->settings->titleFont, - $this->settings->fontSize + $this->settings->titleFontSize ); if ($textWidth > $this->settings->wrapWidth) { // Print black with white border @@ -439,7 +440,7 @@ class Generator rtrim($pline, ' '), $this->settings->topPadding + $lineHeight * $lineCount, $this->settings->titleFont, - $this->settings->fontSize, + $this->settings->titleFontSize, $this->titleFillColor, $this->titleBorderColor ); @@ -453,7 +454,7 @@ class Generator rtrim($line, ' '), $this->settings->topPadding + $lineHeight * $lineCount, $this->settings->titleFont, - $this->settings->fontSize, + $this->settings->titleFontSize, $this->titleFillColor, $this->titleBorderColor ); @@ -464,7 +465,7 @@ class Generator $this->settings->topPadding + $this->settings->maxTitleLines * $lineHeight, $this->settings->titleFont, - $this->settings->fontSize + 1, + $this->settings->titleFontSize + 1, $this->titleFillColor, $this->titleBorderColor ); @@ -481,7 +482,7 @@ class Generator protected function drawAuthor($author) { // Scale author to fit by incrementing fontsizes down - $fontSize = $this->settings->fontSize; + $fontSize = $this->settings->authorFontSize + 1; do { $fontSize--; $textWidth = $this->textWidth( -- GitLab