Commit d61b9487 authored by Robert Lyon's avatar Robert Lyon

Bug 1843202: Allow theme fonts to be included in skin_fonts table

So that they can be
- used in skins
- viewed on the Admin -> Config -> Fonts page

behatnotneeded

Change-Id: I49aff91a7f56a003adbc9f3513aa9a094a3069e4
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 6f955958
......@@ -32,7 +32,12 @@ if (!empty($font)) {
$fontdata = get_record('skin_fonts', 'name', $font);
$fonttitle = $fontdata->title;
if (!empty($fontdata->licence) && !is_null($fontdata->licence)) {
$fontpath = get_config('wwwroot') . 'skins/fonts/' . $fontdata->name . '/';
if (preg_match('/^t_(.*)/', $fontdata->fonttype, $matches)) {
$fontpath = get_config('wwwroot') . 'theme/' . $matches[1] . '/fonts/' . strtolower($fontdata->name) . '/';
}
else {
$fontpath = get_config('wwwroot') . 'skins/fonts/' . $fontdata->name . '/';
}
$fontlicence = '<a href="' . $fontpath . $fontdata->licence . '">' . get_string('fontlicence', 'skin') . '</a>';
}
else {
......
......@@ -83,6 +83,7 @@ $previewform = pieform(array(
'all' => get_string('fonttypes.all', 'skin'),
'site' => get_string('fonttypes.site', 'skin'),
'google' => get_string('fonttypes.google', 'skin'),
'theme' => get_string('fonttypes.theme', 'skin'),
),
'defaultvalue' => $fonttype,
),
......@@ -105,7 +106,7 @@ $data = Skin::get_sitefonts_data($limit, $offset, $fonttype);
$sitefonts = '';
$googlefonts = '';
foreach ($data->data as $font) {
if ($font['fonttype'] == 'site') {
if ($font['fonttype'] == 'site' || preg_match('/^t_/', $font['fonttype'])) {
$sitefonts .= $font['title'] . '|';
}
if ($font['fonttype'] == 'google') {
......
......@@ -243,6 +243,11 @@ $string['fonttype.site'] = 'Local font';
$string['fonttypes.site'] = 'Local fonts';
$string['fonttype.google'] = 'Google web font';
$string['fonttypes.google'] = 'Google web fonts';
$string['fonttypes.theme'] = 'Theme fonts';
$string['fonttype.t_raw'] = 'Theme font: Raw';
$string['fonttype.t_ocean'] = 'Theme font: Ocean';
$string['fonttype.t_modern'] = 'Theme font: Modern';
$string['fonttype.t_primaryschool'] = 'Theme font: Primary school';
// For examples of pangrams, see: http://en.wikipedia.org/wiki/List_of_pangrams
$string['preview'] = 'Preview';
......
......@@ -1169,7 +1169,7 @@
<FIELD NAME="notice" TYPE="text" NOTNULL="false" />
<FIELD NAME="previewfont" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="variants" TYPE="text" LENGTH="big" NOTNULL="true" />
<FIELD NAME="fonttype" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="site" />
<FIELD NAME="fonttype" TYPE="char" LENGTH="30" NOTNULL="true" DEFAULT="site" />
<FIELD NAME="onlyheading" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="fontstack" TYPE="text" NOTNULL="true" />
<FIELD NAME="genericfont" TYPE="char" LENGTH="10" NOTNULL="true" ENUM="true" ENUMVALUES="'cursive', 'fantasy', 'monospace', 'sans-serif', 'serif'" />
......
......@@ -1447,5 +1447,17 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2019090900) {
log_debug('Update the skin_fonts to know about the theme fonts also');
require_once(get_config('libroot') . 'skin.php');
$table = new XMLDBTable('skin_fonts');
if (table_exists($table)) {
$field = new XMLDBField('fonttype');
$field->setAttributes(XMLDB_TYPE_CHAR, 30, null, XMLDB_NOTNULL, null, null, null, 'site');
change_field_precision($table, $field);
install_skins_default();
}
}
return $status;
}
This diff is collapsed.
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2019080802;
$config->version = 2019090900;
$config->series = '19.10';
$config->release = '19.10dev';
$config->minupgradefrom = 2017031605;
......
......@@ -3,11 +3,11 @@
font-family: 'Shadows Into Light Two';
font-style: normal;
font-weight: 400;
src: url('../fonts/ShadowsIntoLightTwo/shadows-into-light-two-v6-latin-ext_latin-regular.eot'); /* IE9 Compat Modes */
src: url('../fonts/ShadowsIntoLighttwo/shadows-into-light-two-v6-latin-ext_latin-regular.eot'); /* IE9 Compat Modes */
src: local('Shadows Into Light Two'), local('ShadowsIntoLightTwo-Regular'),
url('../fonts/ShadowsIntoLightTwo/shadows-into-light-two-v6-latin-ext_latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../fonts/ShadowsIntoLightTwo/shadows-into-light-two-v6-latin-ext_latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('../fonts/ShadowsIntoLightTwo/shadows-into-light-two-v6-latin-ext_latin-regular.woff') format('woff'), /* Modern Browsers */
url('../fonts/ShadowsIntoLightTwo/shadows-into-light-two-v6-latin-ext_latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('../fonts/ShadowsIntoLightTwo/shadows-into-light-two-v6-latin-ext_latin-regular.svg#ShadowsIntoLightTwo') format('svg'); /* Legacy iOS */
url('../fonts/shadowsintolighttwo/shadows-into-light-two-v6-latin-ext_latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../fonts/shadowsintolighttwo/shadows-into-light-two-v6-latin-ext_latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('../fonts/shadowsintolighttwo/shadows-into-light-two-v6-latin-ext_latin-regular.woff') format('woff'), /* Modern Browsers */
url('../fonts/shadowsintolighttwo/shadows-into-light-two-v6-latin-ext_latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('../fonts/shadowsintolighttwo/shadows-into-light-two-v6-latin-ext_latin-regular.svg#ShadowsIntoLightTwo') format('svg'); /* Legacy iOS */
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment