Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Font 'defaults' option #319

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions lib/class-option-font.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ class TitanFrameworkOptionFont extends TitanFrameworkOption {

// The list of web safe fonts
public static $webSafeFonts = array(
'Arial, Helvetica, sans-serif' => 'Arial',
'"Arial Black", Gadget, sans-serif' => 'Arial Black',
'"Comic Sans MS", cursive, sans-serif' => 'Comic Sans',
'"Courier New", Courier, monospace' => 'Courier New',
'Georgia, serif' => 'Geogia',
'Impact, Charcoal, sans-serif' => 'Impact',
'"Lucida Console", Monaco, monospace' => 'Lucida Console',
'"Lucida Sans Unicode", "Lucida Grande", sans-serif' => 'Lucida Sans',
'"Palatino Linotype", "Book Antiqua", Palatino, serif' => 'Palatino',
'Tahoma, Geneva, sans-serif' => 'Tahoma',
'"Times New Roman", Times, serif' => 'Times New Roman',
'"Trebuchet MS", Helvetica, sans-serif' => 'Trebuchet',
'Verdana, Geneva, sans-serif' => 'Verdana',
);
'Arial, Helvetica, sans-serif' => 'Arial',
'"Arial Black", Gadget, sans-serif' => 'Arial Black',
'"Comic Sans MS", cursive, sans-serif' => 'Comic Sans',
'"Courier New", Courier, monospace' => 'Courier New',
'Georgia, serif' => 'Georgia',
'Impact, Charcoal, sans-serif' => 'Impact',
'"Lucida Console", Monaco, monospace' => 'Lucida Console',
'"Lucida Sans Unicode", "Lucida Grande", sans-serif' => 'Lucida Sans',
'"Palatino Linotype", "Book Antiqua", Palatino, serif' => 'Palatino',
'Tahoma, Geneva, sans-serif' => 'Tahoma',
'"Times New Roman", Times, serif' => 'Times New Roman',
'"Trebuchet MS", Helvetica, sans-serif' => 'Trebuchet',
'Verdana, Geneva, sans-serif' => 'Verdana',
);

// Holds all the options with Google Fonts for enqueuing.
// We need to do this since we want to gather all the fonts first then enqueue only the unique fonts
Expand Down Expand Up @@ -167,7 +167,7 @@ public function getGoogleFontURLs() {
if ( empty( $fontValue['font-family'] ) ) {
continue;
}
if ( $fontValue['font-family'] == 'inherit' ) {
if ( $fontValue['font-family'] == 'inherit' || $fontValue['font-family'] == 'default' ) {
continue;
}

Expand Down Expand Up @@ -262,7 +262,11 @@ public function generateCSS( $css, $option ) {
$value = array_merge( self::$defaultStyling, $value );

foreach ( $value as $key => $val ) {


//If value is set to default then skip
if($val == 'default'){
continue;
}
// Force skip other keys, those are processed under another key, e.g. text-shadow-distance is
// used by text-shadow-location
if ( in_array( $key, $skip ) ) {
Expand Down Expand Up @@ -552,6 +556,7 @@ public function display() {
<label <?php echo $visibilityAttrs ?>>
Font Family
<select class='tf-font-sel-family'>
<option value='default' <?= selected( $value['font-family'], 'default', false ); ?>>default</option>
<option value='inherit'>inherit</option>
<?php

Expand Down Expand Up @@ -659,6 +664,7 @@ public function display() {
<label <?php echo $visibilityAttrs ?>>
Font Weight
<select class='tf-font-sel-weight'>
<option value='default' <?= selected( $value['font-weight'], 'default', false ); ?>>default</option>
<option value='inherit'>inherit</option>
<?php
$options = array( 'normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900' );
Expand All @@ -683,7 +689,7 @@ public function display() {
Font Style
<select class='tf-font-sel-style'>
<?php
$options = array( 'normal', 'italic' );
$options = array( 'default','normal', 'italic' );
foreach ( $options as $option ) {
printf( "<option value='%s'%s>%s</option>",
esc_attr( $option ),
Expand Down Expand Up @@ -987,6 +993,7 @@ public function render_content() {
<label <?php echo $visibilityAttrs ?>>
Font Family
<select class='tf-font-sel-family'>
<option value='default' <?= selected( $value['font-family'], 'default', false ); ?>>default</option>
<option value='inherit'>inherit</option>
<optgroup label="Web Safe Fonts" class='safe'>
<?php
Expand Down Expand Up @@ -1034,6 +1041,7 @@ public function render_content() {
<label <?php echo $visibilityAttrs ?>>
Font Size
<select class='tf-font-sel-size'>
<option value='default' <?= selected( $value['font-size'], 'default', false ); ?>>default</option>
<option value='inherit'>inherit</option>
<?php
for ( $i = 1; $i <= 150; $i++ ) {
Expand All @@ -1056,6 +1064,7 @@ public function render_content() {
<label <?php echo $visibilityAttrs ?>>
Font Weight
<select class='tf-font-sel-weight'>
<option value='default' <?= selected( $value['font-weight'], 'default', false ); ?>>default</option>
<option value='inherit'>inherit</option>
<?php
$options = array( 'normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900' );
Expand Down