[dw-free] Font properties in the wizard
[commit: http://hg.dwscoalition.org/dw-free/rev/bb1a861e7b6b]
http://bugs.dwscoalition.org/show_bug.cgi?id=1283
Font properties and fallbacks for Tabula Rasa, Drifting, Negatives.
Patch by
av8rmike.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1283
Font properties and fallbacks for Tabula Rasa, Drifting, Negatives.
Patch by
Files modified:
- bin/upgrading/s2layers/core2.s2
- bin/upgrading/s2layers/core2base/layout.s2
- bin/upgrading/s2layers/drifting/layout.s2
- bin/upgrading/s2layers/negatives/layout.s2
- cgi-bin/LJ/S2Theme.pm
--------------------------------------------------------------------------------
diff -r c2649312b8ae -r bb1a861e7b6b bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2 Mon Aug 10 01:18:58 2009 -0500
+++ b/bin/upgrading/s2layers/core2.s2 Mon Aug 10 15:34:51 2009 +0000
@@ -1429,43 +1429,115 @@ set layout_resources = [];
## Journal style - fonts
##===============================
-# FIXME: also need size and units
property string font_base {
des = "Preferred journal font";
maxlength = 25;
- "size" = 10;
- example = "Arial";
- note = "Leave blank if you don't care.";
+ size = 15;
+ note = "For example: Arial or \"Times New Roman\". Leave blank if you don't care.";
}
set font_base = ""; # In core, default is not to care. Layouts will probably specify fonts the author likes instead.
property string font_fallback {
des = "Alternative journal font";
- values = "sans-serif|Sans-serif|serif|Serif|cursive|Cursive|monospace|Monospaced|none|Use browser's default";
+ values = "sans-serif|Sans-serif|serif|Serif|cursive|Cursive|monospace|Monospaced||Use browser's default";
note = "This general style will serve as a fallback if your preferred font is unavailable.";
}
-set font_fallback = "none"; # Default in core is to let the browser handle it.
+set font_fallback = ""; # Default in core is to let the browser handle it.
+
+property string font_base_size {
+ des = "Size of base font";
+ size = 3;
+}
+
+property string font_base_units {
+ des = "Units for base font size";
+ values = "em|em|ex|ex|%|%|pt|pt|px|px";
+}
property string font_journal_title {
- des = "Journal titles";
- values = "|(default journal font)|sans-serif|Sans-serif|serif|Serif|cursive|Cursive|monospace|Monospaced|none|Use browser's default";
+ des = "Preferred font for journal titles";
+ maxlength = 25;
+ size = 15;
+ note = "For example: Arial or \"Times New Roman\". Leave blank if you don't care.";
+}
+
+property string font_journal_title_size {
+ des = "Size of title font";
+ size = 3;
+}
+
+property string font_journal_title_units {
+ des = "Units for title size";
+ values = "em|em|ex|ex|%|%|pt|pt|px|px";
+}
+
+property string font_journal_subtitle {
+ des = "Preferred font for journal subtitles";
+ maxlength = 25;
+ size = 15;
+ note = "For example: Arial or \"Times New Roman\". Leave blank if you don't care.";
+}
+
+property string font_journal_subtitle_size {
+ des = "Size of subtitle font";
+ size = 3;
+}
+
+property string font_journal_subtitle_units {
+ des = "Units for subtitle size";
+ values = "em|em|ex|ex|%|%|pt|pt|px|px";
}
property string font_entry_title {
- des = "Entry titles";
- values = "|(default journal font)|sans-serif|Sans-serif|serif|Serif|cursive|Cursive|monospace|Monospaced|none|Use browser's default";
+ des = "Preferred font for entry titles";
+ maxlength = 25;
+ size = 15;
+ note = "For example: Arial or \"Times New Roman\". Leave blank if you don't care.";
+}
+
+property string font_entry_title_size {
+ des = "Size of entry title font";
+ size = 3;
+}
+
+property string font_entry_title_units {
+ des = "Units for entry title size";
+ values = "em|em|ex|ex|%|%|pt|pt|px|px";
}
property string font_module_heading {
- des = "Module headings";
- values = "|(default journal font)|sans-serif|Sans-serif|serif|Serif|cursive|Cursive|monospace|Monospaced|none|Use browser's default";
+ des = "Preferred font for module headings";
+ maxlength = 25;
+ size = 15;
+ note = "For example: Arial or \"Times New Roman\". Leave blank if you don't care.";
+}
+
+property string font_module_heading_size {
+ des = "Size of module heading font";
+ size = 3;
+}
+
+property string font_module_heading_units {
+ des = "Units for module heading size";
+ values = "em|em|ex|ex|%|%|pt|pt|px|px";
}
property string font_module_text {
- des = "Module text";
- values = "|(default journal font)|sans-serif|Sans-serif|serif|Serif|cursive|Cursive|monospace|Monospaced|none|Use browser's default";
-}
-
+ des = "Preferred font for module text";
+ maxlength = 25;
+ size = 15;
+ note = "For example: Arial or \"Times New Roman\". Leave blank if you don't care.";
+}
+
+property string font_module_text_size {
+ des = "Size of module text font";
+ size = 3;
+}
+
+property string font_module_text_units {
+ des = "Units for module text size";
+ values = "em|em|ex|ex|%|%|pt|pt|px|px";
+}
##===============================
## Journal style - images
@@ -2885,6 +2957,27 @@ function generate_color_css (Color text_
$color_css = $color_css + "border: solid 1px $border_color;\n";
}
return $color_css;
+}
+
+function generate_font_css(string font_base, string font_fallback, string font_size, string font_unit) : string
+{
+ var string font_css = "";
+ if ($font_base != "" or $font_fallback != "") {
+ $font_css = "font-family: ";
+ if ($font_base != "") {
+ $font_css = $font_css + "$font_base";
+ if ($font_fallback != "") {
+ $font_css = $font_css + ", $font_fallback";
+ }
+ } else {
+ $font_css = $font_css + "$font_fallback";
+ }
+ $font_css = $font_css + "; ";
+ }
+ if ($font_size != "" and $font_unit != "") {
+ $font_css = $font_css + "font-size: $font_size$font_unit;";
+ }
+ return $font_css;
}
function Page::print_title()
diff -r c2649312b8ae -r bb1a861e7b6b bin/upgrading/s2layers/core2base/layout.s2
--- a/bin/upgrading/s2layers/core2base/layout.s2 Mon Aug 10 01:18:58 2009 -0500
+++ b/bin/upgrading/s2layers/core2base/layout.s2 Mon Aug 10 15:34:51 2009 +0000
@@ -130,6 +130,37 @@ set color_module_title = "";
set color_module_title = "";
set color_module_title_background = "";
set color_module_border = "";
+
+##===============================
+## Display settings - fonts
+##===============================
+
+propgroup fonts {
+ property use font_base;
+ property use font_fallback;
+ property use font_base_size;
+ property use font_base_units;
+ property use font_journal_title;
+ property use font_journal_title_size;
+ property use font_journal_title_units;
+ property use font_journal_subtitle;
+ property use font_journal_subtitle_size;
+ property use font_journal_subtitle_units;
+ property use font_entry_title;
+ property use font_entry_title_size;
+ property use font_entry_title_units;
+ property use font_module_heading;
+ property use font_module_heading_units;
+ property use font_module_heading_size;
+ property use font_module_text;
+ property use font_module_text_units;
+ property use font_module_text_size;
+}
+
+set font_base = "";
+set font_fallback = "";
+set font_base_size = "100";
+set font_base_units = "%";
##===============================
## Display settings - images
@@ -262,7 +293,13 @@ function Page::print_default_stylesheet(
var string module_link_hover_colors = generate_color_css($*color_module_link_hover, new Color, new Color);
var string module_link_visited_colors = generate_color_css($*color_module_link_visited, new Color, new Color);
-
+ var string page_font = generate_font_css($*font_base, $*font_fallback, $*font_base_size, $*font_base_units);
+ var string page_title_font = generate_font_css($*font_journal_title, $*font_fallback, $*font_journal_title_size, $*font_journal_title_units);
+ var string page_subtitle_font = generate_font_css($*font_journal_subtitle, $*font_fallback, $*font_journal_subtitle_size, $*font_journal_subtitle_units);
+ var string entry_title_font = generate_font_css($*font_entry_title, $*font_fallback, $*font_entry_title_size, $*font_entry_title_units);
+ var string module_font = generate_font_css($*font_module_text, $*font_fallback, $*font_module_text_size, $*font_module_text_units);
+ var string module_title_font = generate_font_css($*font_module_heading, $*font_fallback, $*font_module_heading_size, $*font_module_heading_units);
+
"""<style type="text/css">""";
start_css();
"""
@@ -286,8 +323,7 @@ hr {
}
body {
- font-family: ;
- font-size: 100%;
+ $page_font
padding: 0;
$page_background
$page_colors
@@ -323,6 +359,14 @@ a:visited { $page_link_visited_colors }
#header {
$header_background
$page_title_colors
+}
+
+h1#title {
+ $page_title_font
+}
+
+h2#subtitle {
+ $page_subtitle_font
}
#footer {
@@ -425,6 +469,7 @@ a:visited { $page_link_visited_colors }
.entry .entry-title, .entry .entry-title a {
$entry_title_colors
+ $entry_title_font
}
.entry a { $entry_link_colors }
@@ -559,6 +604,11 @@ table.month td p {
.module h2 {
$module_title_colors
+ $module_title_font
+}
+
+.module-content {
+ $module_font
}
.module-content ul {
diff -r c2649312b8ae -r bb1a861e7b6b bin/upgrading/s2layers/drifting/layout.s2
--- a/bin/upgrading/s2layers/drifting/layout.s2 Mon Aug 10 01:18:58 2009 -0500
+++ b/bin/upgrading/s2layers/drifting/layout.s2 Mon Aug 10 15:34:51 2009 +0000
@@ -119,13 +119,13 @@ propgroup fonts
{
property use font_base;
property use font_fallback;
+ property use font_base_size;
+ property use font_base_units;
+ property use font_journal_title;
+ property use font_journal_title_size;
+ property use font_journal_title_units;
- property string title_font_base
- {
- des = "Font for Subjects and Title";
- }
-
- property string title_font_fallback
+ property string font_title_fallback
{
des = "Alternative font for Subjects and Title";
values = "sans-serif|Sans-serif|serif|Serif|cursive|Cursive|monospace|Monospaced|none|Use browser's default";
@@ -134,8 +134,12 @@ propgroup fonts
set font_base = "Arial";
set font_fallback = "sans-serif";
-set title_font_base = "Times New Roman";
-set title_font_fallback = "serif";
+set font_base_size = "16";
+set font_base_units = "px";
+set font_journal_title = "Times New Roman";
+set font_title_fallback = "serif";
+set font_journal_title_size = "2.8";
+set font_journal_title_units = "em";
# PRESENTATION
################################################################################
@@ -256,22 +260,9 @@ function Page::print_default_stylesheet(
var string title_font_string = "";
# Determine the font strings to use in the CSS
- if ($*font_base != "")
- {
- $base_font_string = "\"$*font_base\",";
- }
- if ($*font_fallback != "")
- {
- $base_font_string = "$base_font_string $*font_fallback";
- }
- if ($*title_font_base != "")
- {
- $title_font_string = "\"$*title_font_base\",";
- }
- if ($*title_font_fallback != "")
- {
- $title_font_string = "$title_font_string $*title_font_fallback";
- }
+ var string page_font = generate_font_css($*font_base, $*font_fallback, $*font_base_size, $*font_base_units);
+ var string page_title_font = generate_font_css($*font_journal_title, $*font_title_fallback, $*font_journal_title_size, $*font_journal_title_units);
+ var string page_subtitle_font = generate_font_css($*font_journal_title, $*font_title_fallback, "", "");
"""<style type="text/css">""";
start_css();
@@ -279,8 +270,7 @@ function Page::print_default_stylesheet(
/* Main layout
***************************************************************************/
body {
- font-family: $base_font_string;
- font-size: 16px;
+ $page_font
color: $*color_page_text;
$page_background
}
@@ -380,8 +370,7 @@ function Page::print_default_stylesheet(
}
#header h1#title {
- font-family: $title_font_string;
- font-size: 2.8em;
+ $page_title_font
font-weight: bold;
font-style: italic;
color: $*color_page_title;
@@ -391,7 +380,7 @@ function Page::print_default_stylesheet(
}
#header h2#subtitle {
- font-family: $title_font_string;
+ $page_subtitle_font
margin: 5px 0px 0px 335px;
color: $*color_page_subtitle;
width: 100%;
diff -r c2649312b8ae -r bb1a861e7b6b bin/upgrading/s2layers/negatives/layout.s2
--- a/bin/upgrading/s2layers/negatives/layout.s2 Mon Aug 10 01:18:58 2009 -0500
+++ b/bin/upgrading/s2layers/negatives/layout.s2 Mon Aug 10 15:34:51 2009 +0000
@@ -72,6 +72,34 @@ set color_module_link = "#cccccc";
set color_module_link = "#cccccc";
set color_module_link_active = "#222222";
set color_module_link_hover = "#ffffff";
+
+##===============================
+## Journal style - images
+##===============================
+
+propgroup fonts {
+ property use font_base;
+ property use font_fallback;
+ property use font_base_size;
+ property use font_base_units;
+ property use font_module_heading;
+ property use font_module_heading_units;
+ property use font_module_heading_size;
+ property use font_entry_title;
+ property use font_entry_title_size;
+ property use font_entry_title_units;
+}
+
+set font_base = "Georgia";
+set font_fallback = "serif";
+set font_base_size = "1";
+set font_base_units = "em";
+set font_module_heading = "";
+set font_module_heading_size = "1.1";
+set font_module_heading_units = "em";
+set font_entry_title = "";
+set font_entry_title_size = "1.1";
+set font_entry_title_units = "em";
##===============================
## Journal style - images
@@ -184,8 +212,6 @@ propgroup text {
property use text_module_customtext_url;
}
-set font_base ="Georgia";
-set font_fallback = "serif";
set entry_management_links = "text";
set comment_management_links = "text";
@@ -204,6 +230,9 @@ function Page::print_default_stylesheet(
if ($*image_background_header_height > 0) {
$header_background = $header_background + "\n height: " + $*image_background_header_height + "px;";
}
+ var string page_font = generate_font_css($*font_base, $*font_fallback, $*font_base_size, $*font_base_units);
+ var string module_title_font = generate_font_css($*font_module_heading, $*font_fallback, $*font_module_heading_size, $*font_module_heading_units);
+ var string entry_title_font = generate_font_css($*font_entry_title, $*font_fallback, $*font_entry_title_size, $*font_entry_title_units);
"""<style type="text/css">""";
start_css();
@@ -211,8 +240,7 @@ function Page::print_default_stylesheet(
body {
margin: 0;
padding: 0;
- font-family: $*font_base, $*font_fallback;
- font-size: 1em;
+ $page_font
$page_background
color:$*color_page_text;
}
@@ -282,7 +310,7 @@ function Page::print_default_stylesheet(
border-bottom:1px solid $*color_module_border;
font-weight:bold;
letter-spacing:.3em;
- font-size: 1.1em;
+ $module_title_font
text-align: right;
}
#secondary .module-header a {
@@ -386,7 +414,7 @@ function Page::print_default_stylesheet(
}
.subject, .subject a, .subject a:visited, .subject a:hover, .subject a:active {
font-weight:bold;
- font-size:1.1em;
+ $entry_title_font
}
.module-section-two .module-calendar,
.module-section-three .module-calendar {
diff -r c2649312b8ae -r bb1a861e7b6b cgi-bin/LJ/S2Theme.pm
--- a/cgi-bin/LJ/S2Theme.pm Mon Aug 10 01:18:58 2009 -0500
+++ b/cgi-bin/LJ/S2Theme.pm Mon Aug 10 15:34:51 2009 +0000
@@ -705,6 +705,12 @@ sub module_props {
color_module_link_visited
color_module_title
color_module_title_background
+ font_module_heading
+ font_module_heading_size
+ font_module_heading_units
+ font_module_text
+ font_module_text_size
+ font_module_text_units
)
}
@@ -725,6 +731,12 @@ sub header_props {
qw (
text_tags_page_header
color_header_background
+ font_journal_title
+ font_journal_title_size
+ font_journal_title_units
+ font_journal_subtitle
+ font_journal_subtitle_size
+ font_journal_subtitle_units
)
}
@@ -769,6 +781,9 @@ sub entry_props {
color_entry_title
color_entry_title_background
color_entry_interaction_links
+ font_entry_title
+ font_entry_title_size
+ font_entry_title_units
)
}
@@ -806,6 +821,10 @@ sub page_props {
color_page_link_visited
color_page_title
color_page_border
+ font_base
+ font_fallback
+ font_base_size
+ font_base_units
)
}
--------------------------------------------------------------------------------

no subject
no subject