diff --git a/account_prefs_inc.php b/account_prefs_inc.php index 7f74aec0a3..b9666c9a62 100644 --- a/account_prefs_inc.php +++ b/account_prefs_inc.php @@ -383,16 +383,16 @@ function edit_account_prefs( $p_user_id = null, $p_error_if_protected = true, $p - - - - - - - - + + + + + + + + diff --git a/account_prefs_update.php b/account_prefs_update.php index 7fe5893555..3116a35e9a 100644 --- a/account_prefs_update.php +++ b/account_prefs_update.php @@ -85,6 +85,10 @@ } $t_font = gpc_get_string( 'font_family' ); +if( config_get( 'font_family', null, $f_user_id, ALL_PROJECTS ) != $t_font ) { + config_set( 'font_family', $t_font, $f_user_id, ALL_PROJECTS ); +} + config_set ( 'font_family', $t_font, $f_user_id ); $t_prefs->email_on_new = gpc_get_bool( 'email_on_new' ); diff --git a/config_defaults_inc.php b/config_defaults_inc.php index 70280a61fa..a4033c88a7 100644 --- a/config_defaults_inc.php +++ b/config_defaults_inc.php @@ -948,8 +948,10 @@ /** * Name of one of google fonts available at https://fonts.google.com/ - * 'Open Sans' font files are part of MantisBT code. Selecting any other font will work if download from CDN - * option is enabled. + * Chosen family must be one of safe fonts listed in $g_safe_fonts_arr such that it works + * even if CDN option is disabled + * @see $g_safe_fonts_arr + * @see $g_cdn_enabled * @global string $g_font_family */ $g_font_family = 'Open Sans'; @@ -984,6 +986,17 @@ 'Vollkorn' ); +/** + * List of fonts that are installed as part of MantisBT + * This list is used when using CDN option is disabled + * @global array $g_font_choices_arr + */ +$g_safe_fonts_arr = array( + 'Montserrat', + 'Open Sans', + 'Poppins' +); + ############################# # MantisBT Display Settings # ############################# @@ -4496,6 +4509,8 @@ 'filter_by_custom_fields', 'filter_custom_fields_per_row', 'filter_position', + 'font_family', + 'font_choices_arr', 'forward_year_count', 'from_email', 'from_name', @@ -4631,6 +4646,7 @@ 'sponsor_threshold', 'sponsorship_currency', 'sponsorship_enum_string', + 'safe_fonts_arr', 'status_colors', 'status_enum_string', 'status_enum_workflow', diff --git a/core/layout_api.php b/core/layout_api.php index b83563119b..039c15e06c 100644 --- a/core/layout_api.php +++ b/core/layout_api.php @@ -259,7 +259,8 @@ function layout_head_css() { html_css_cdn_link( 'https://maxcdn.bootstrapcdn.com/font-awesome/' . FONT_AWESOME_VERSION . '/css/font-awesome.min.css' ); # theme text fonts - html_css_cdn_link( 'https://fonts.googleapis.com/css?family=' . urlencode( config_get( 'font_family' ) ) . ':300,400' ); + $t_font_family = config_get( 'font_family', null, null, ALL_PROJECTS ); + html_css_cdn_link( 'https://fonts.googleapis.com/css?family=' . urlencode( $t_font_family ) ); # datetimepicker html_css_cdn_link( 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/' . DATETIME_PICKER_VERSION . '/css/bootstrap-datetimepicker.min.css' ); @@ -268,7 +269,7 @@ function layout_head_css() { html_css_link( 'font-awesome-' . FONT_AWESOME_VERSION . '.min.css' ); # theme text fonts - html_css_link( 'open-sans.css' ); + html_css_link( 'fonts.css' ); # datetimepicker html_css_link( 'bootstrap-datetimepicker-' . DATETIME_PICKER_VERSION . '.min.css' ); @@ -293,9 +294,10 @@ function layout_head_css() { * @return void */ function layout_user_font_preference() { + $t_font_family = config_get( 'font_family', null, null, ALL_PROJECTS ); echo '', "\n"; } diff --git a/core/print_api.php b/core/print_api.php index cb6a16f989..934f40f538 100644 --- a/core/print_api.php +++ b/core/print_api.php @@ -1113,7 +1113,11 @@ function print_language_option_list( $p_language ) { * @return void */ function print_font_option_list( $p_font ) { - $t_arr = config_get( 'font_choices_arr' ); + if ( config_get_global( 'cdn_enabled' ) == ON ) { + $t_arr = config_get('font_choices_arr'); + } else { + $t_arr = config_get('safe_fonts_arr'); + } $t_enum_count = count( $t_arr ); for( $i = 0;$i < $t_enum_count;$i++ ) { $t_font = string_attribute( $t_arr[$i] ); diff --git a/css/fonts.css b/css/fonts.css new file mode 100644 index 0000000000..c4d5e985a0 --- /dev/null +++ b/css/fonts.css @@ -0,0 +1,142 @@ +/* +# MantisBT - A PHP based bugtracking system + +# MantisBT is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# MantisBT is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with MantisBT. If not, see . +*/ +/* included only when we don't want to use fonts from google server */ + +/* cyrillic-ext */ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans Regular'), local('OpenSans-Regular'), url(../fonts/K88pR3goAWT7BTt32Z01m4X0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); + unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; +} +/* cyrillic */ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans Regular'), local('OpenSans-Regular'), url(../fonts/RjgO7rYTmqiVp7vzi-Q5UYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); + unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; +} +/* greek-ext */ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans Regular'), local('OpenSans-Regular'), url(../fonts/LWCjsQkB6EMdfHrEVqA1KYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); + unicode-range: U+1F00-1FFF; +} +/* greek */ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans Regular'), local('OpenSans-Regular'), url(../fonts/xozscpT2726on7jbcb_pAoX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); + unicode-range: U+0370-03FF; +} +/* vietnamese */ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans Regular'), local('OpenSans-Regular'), url(../fonts/59ZRklaO5bWGqF5A9baEEYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); + unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB; +} +/* latin-ext */ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans Regular'), local('OpenSans-Regular'), url(../fonts/u-WUoqrET9fUeobQW7jkRYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); + unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; +} +/* latin */ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans Regular'), local('OpenSans-Regular'), url(../fonts/cJZKeOuBrn4kERxqtaUH3ZBw1xU1rKptJj_0jans920.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+2215; +} + + +/* cyrillic-ext */ +@font-face { + font-family: 'Montserrat'; + font-style: normal; + font-weight: 400; + src: local('Montserrat Regular'), local('Montserrat-Regular'), url(../fonts/rBHvpRWBkgyW99dXT88n7wsYbbCjybiHxArTLjt7FRU.woff2) format('woff2'); + unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; +} +/* cyrillic */ +@font-face { + font-family: 'Montserrat'; + font-style: normal; + font-weight: 400; + src: local('Montserrat Regular'), local('Montserrat-Regular'), url(../fonts/NX1NravqaXESu9fFv7KuqgsYbbCjybiHxArTLjt7FRU.woff2) format('woff2'); + unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; +} +/* vietnamese */ +@font-face { + font-family: 'Montserrat'; + font-style: normal; + font-weight: 400; + src: local('Montserrat Regular'), local('Montserrat-Regular'), url(../fonts/SKK6Nusyv8QPNMtI4j9J2wsYbbCjybiHxArTLjt7FRU.woff2) format('woff2'); + unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB; +} +/* latin-ext */ +@font-face { + font-family: 'Montserrat'; + font-style: normal; + font-weight: 400; + src: local('Montserrat Regular'), local('Montserrat-Regular'), url(../fonts/gFXtEMCp1m_YzxsBpKl68gsYbbCjybiHxArTLjt7FRU.woff2) format('woff2'); + unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; +} +/* latin */ +@font-face { + font-family: 'Montserrat'; + font-style: normal; + font-weight: 400; + src: local('Montserrat Regular'), local('Montserrat-Regular'), url(../fonts/zhcz-_WihjSQC0oHJ9TCYAzyDMXhdD8sAj6OAJTFsBI.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+2215; +} + + +/* devanagari */ +@font-face { + font-family: 'Poppins'; + font-style: normal; + font-weight: 400; + src: local('Poppins Regular'), local('Poppins-Regular'), url(../fonts/dDzx7Qrpf6EUDCpeO-RralKPGs1ZzpMvnHX-7fPOuAc.woff2) format('woff2'); + unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200B-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB; +} +/* latin-ext */ +@font-face { + font-family: 'Poppins'; + font-style: normal; + font-weight: 400; + src: local('Poppins Regular'), local('Poppins-Regular'), url(../fonts/w5uwZf-mdghB6LOAw_y9AFKPGs1ZzpMvnHX-7fPOuAc.woff2) format('woff2'); + unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; +} +/* latin */ +@font-face { + font-family: 'Poppins'; + font-style: normal; + font-weight: 400; + src: local('Poppins Regular'), local('Poppins-Regular'), url(../fonts/HUuNgGR31mqIHE6zs0BlBgLUuEpTyoUstqEm5AMlJo4.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+2215; +} \ No newline at end of file diff --git a/css/open-sans.css b/css/open-sans.css deleted file mode 100644 index 752b394a29..0000000000 --- a/css/open-sans.css +++ /dev/null @@ -1,29 +0,0 @@ -/* -# MantisBT - A PHP based bugtracking system - -# MantisBT is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# MantisBT is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with MantisBT. If not, see . -*/ -/* included only when we don't want to use fonts from google server */ -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 300; - src: local('Open Sans Light'), local('OpenSans-Light'), url(../fonts/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff) format('woff'); -} -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 400; - src: local('Open Sans'), local('OpenSans'), url(../fonts/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) format('woff'); -} \ No newline at end of file diff --git a/docbook/Admin_Guide/en-US/config/display.xml b/docbook/Admin_Guide/en-US/config/display.xml index 517fbc7a2f..fc2fe5cf09 100644 --- a/docbook/Admin_Guide/en-US/config/display.xml +++ b/docbook/Admin_Guide/en-US/config/display.xml @@ -16,6 +16,22 @@ + + $g_font_choices_arr + + Google font family list offered to the user to chose from. Font files are fetched from google + servers. + + + + + $g_safe_fonts_arr + + This is a small subset of $g_font_choices_arr in which font files are + part of MantisBT installation. + + + $g_window_title diff --git a/fonts/59ZRklaO5bWGqF5A9baEEYX0hVgzZQUfRDuZrPvH3D8.woff2 b/fonts/59ZRklaO5bWGqF5A9baEEYX0hVgzZQUfRDuZrPvH3D8.woff2 new file mode 100644 index 0000000000..ee0ee8a3bb Binary files /dev/null and b/fonts/59ZRklaO5bWGqF5A9baEEYX0hVgzZQUfRDuZrPvH3D8.woff2 differ diff --git a/fonts/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff b/fonts/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff deleted file mode 100644 index 99f335326a..0000000000 Binary files a/fonts/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff and /dev/null differ diff --git a/fonts/HUuNgGR31mqIHE6zs0BlBgLUuEpTyoUstqEm5AMlJo4.woff2 b/fonts/HUuNgGR31mqIHE6zs0BlBgLUuEpTyoUstqEm5AMlJo4.woff2 new file mode 100644 index 0000000000..19f70c6925 Binary files /dev/null and b/fonts/HUuNgGR31mqIHE6zs0BlBgLUuEpTyoUstqEm5AMlJo4.woff2 differ diff --git a/fonts/K88pR3goAWT7BTt32Z01m4X0hVgzZQUfRDuZrPvH3D8.woff2 b/fonts/K88pR3goAWT7BTt32Z01m4X0hVgzZQUfRDuZrPvH3D8.woff2 new file mode 100644 index 0000000000..e36f4aa6f1 Binary files /dev/null and b/fonts/K88pR3goAWT7BTt32Z01m4X0hVgzZQUfRDuZrPvH3D8.woff2 differ diff --git a/fonts/LWCjsQkB6EMdfHrEVqA1KYX0hVgzZQUfRDuZrPvH3D8.woff2 b/fonts/LWCjsQkB6EMdfHrEVqA1KYX0hVgzZQUfRDuZrPvH3D8.woff2 new file mode 100644 index 0000000000..0a1689682c Binary files /dev/null and b/fonts/LWCjsQkB6EMdfHrEVqA1KYX0hVgzZQUfRDuZrPvH3D8.woff2 differ diff --git a/fonts/NX1NravqaXESu9fFv7KuqgsYbbCjybiHxArTLjt7FRU.woff2 b/fonts/NX1NravqaXESu9fFv7KuqgsYbbCjybiHxArTLjt7FRU.woff2 new file mode 100644 index 0000000000..1db03c260e Binary files /dev/null and b/fonts/NX1NravqaXESu9fFv7KuqgsYbbCjybiHxArTLjt7FRU.woff2 differ diff --git a/fonts/RjgO7rYTmqiVp7vzi-Q5UYX0hVgzZQUfRDuZrPvH3D8.woff2 b/fonts/RjgO7rYTmqiVp7vzi-Q5UYX0hVgzZQUfRDuZrPvH3D8.woff2 new file mode 100644 index 0000000000..1cd3a404fd Binary files /dev/null and b/fonts/RjgO7rYTmqiVp7vzi-Q5UYX0hVgzZQUfRDuZrPvH3D8.woff2 differ diff --git a/fonts/SKK6Nusyv8QPNMtI4j9J2wsYbbCjybiHxArTLjt7FRU.woff2 b/fonts/SKK6Nusyv8QPNMtI4j9J2wsYbbCjybiHxArTLjt7FRU.woff2 new file mode 100644 index 0000000000..a9ca03517a Binary files /dev/null and b/fonts/SKK6Nusyv8QPNMtI4j9J2wsYbbCjybiHxArTLjt7FRU.woff2 differ diff --git a/fonts/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff b/fonts/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff deleted file mode 100644 index 55b25f8670..0000000000 Binary files a/fonts/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff and /dev/null differ diff --git a/fonts/cJZKeOuBrn4kERxqtaUH3ZBw1xU1rKptJj_0jans920.woff2 b/fonts/cJZKeOuBrn4kERxqtaUH3ZBw1xU1rKptJj_0jans920.woff2 new file mode 100644 index 0000000000..a4f55037f5 Binary files /dev/null and b/fonts/cJZKeOuBrn4kERxqtaUH3ZBw1xU1rKptJj_0jans920.woff2 differ diff --git a/fonts/dDzx7Qrpf6EUDCpeO-RralKPGs1ZzpMvnHX-7fPOuAc.woff2 b/fonts/dDzx7Qrpf6EUDCpeO-RralKPGs1ZzpMvnHX-7fPOuAc.woff2 new file mode 100644 index 0000000000..e07eaeb590 Binary files /dev/null and b/fonts/dDzx7Qrpf6EUDCpeO-RralKPGs1ZzpMvnHX-7fPOuAc.woff2 differ diff --git a/fonts/gFXtEMCp1m_YzxsBpKl68gsYbbCjybiHxArTLjt7FRU.woff2 b/fonts/gFXtEMCp1m_YzxsBpKl68gsYbbCjybiHxArTLjt7FRU.woff2 new file mode 100644 index 0000000000..876311c75a Binary files /dev/null and b/fonts/gFXtEMCp1m_YzxsBpKl68gsYbbCjybiHxArTLjt7FRU.woff2 differ diff --git a/fonts/rBHvpRWBkgyW99dXT88n7wsYbbCjybiHxArTLjt7FRU.woff2 b/fonts/rBHvpRWBkgyW99dXT88n7wsYbbCjybiHxArTLjt7FRU.woff2 new file mode 100644 index 0000000000..2bdb0712a8 Binary files /dev/null and b/fonts/rBHvpRWBkgyW99dXT88n7wsYbbCjybiHxArTLjt7FRU.woff2 differ diff --git a/fonts/u-WUoqrET9fUeobQW7jkRYX0hVgzZQUfRDuZrPvH3D8.woff2 b/fonts/u-WUoqrET9fUeobQW7jkRYX0hVgzZQUfRDuZrPvH3D8.woff2 new file mode 100644 index 0000000000..890123b269 Binary files /dev/null and b/fonts/u-WUoqrET9fUeobQW7jkRYX0hVgzZQUfRDuZrPvH3D8.woff2 differ diff --git a/fonts/w5uwZf-mdghB6LOAw_y9AFKPGs1ZzpMvnHX-7fPOuAc.woff2 b/fonts/w5uwZf-mdghB6LOAw_y9AFKPGs1ZzpMvnHX-7fPOuAc.woff2 new file mode 100644 index 0000000000..dca9001f7d Binary files /dev/null and b/fonts/w5uwZf-mdghB6LOAw_y9AFKPGs1ZzpMvnHX-7fPOuAc.woff2 differ diff --git a/fonts/xozscpT2726on7jbcb_pAoX0hVgzZQUfRDuZrPvH3D8.woff2 b/fonts/xozscpT2726on7jbcb_pAoX0hVgzZQUfRDuZrPvH3D8.woff2 new file mode 100644 index 0000000000..cb1733aa54 Binary files /dev/null and b/fonts/xozscpT2726on7jbcb_pAoX0hVgzZQUfRDuZrPvH3D8.woff2 differ diff --git a/fonts/zhcz-_WihjSQC0oHJ9TCYAzyDMXhdD8sAj6OAJTFsBI.woff2 b/fonts/zhcz-_WihjSQC0oHJ9TCYAzyDMXhdD8sAj6OAJTFsBI.woff2 new file mode 100644 index 0000000000..6936462265 Binary files /dev/null and b/fonts/zhcz-_WihjSQC0oHJ9TCYAzyDMXhdD8sAj6OAJTFsBI.woff2 differ