font-stacks 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ # 0.1.4
2
+
3
+ * [NEW] Added vars for setting the default sans-serif, serif and monospace.
4
+ * [NEW] Added `@warn` for when the fail safe gets triggered, defaults to $default-sans-serif.
5
+ * [NEW] Can now access defaults by passing "sans-serif", "serif", or "monospace".
6
+ * [NEW] Cleaned up the tests and gave the test view some style.
7
+ * [NEW] Added support for Times New Roman.
8
+ * [CHANGED] Better documentation in the readme on the font stacks supported.
9
+ * [CHANGED] DRY'd up the mixin.
10
+
1
11
  # 0.1.3
2
12
 
3
13
  * [NEW] Added $default-monospace var to override the default monospace.
@@ -3,7 +3,7 @@ Compass::Frameworks.register("font-stacks", :path => "#{File.dirname(__FILE__)}/
3
3
 
4
4
  module FontStacks
5
5
 
6
- VERSION = "0.1.3"
7
- DATE = "2011-11-23"
6
+ VERSION = "0.1.4"
7
+ DATE = "2011-11-25"
8
8
 
9
9
  end
@@ -12,8 +12,15 @@
12
12
  // Avoid using Helvetica or Helvetica Neue for body text, especially below 14px.
13
13
  // Futura, Gill Sans and Franklin Gothic Medium should be carefully stacked and used because of their unusual weight.
14
14
 
15
- $default-font-family: "Helvetica" !default;
15
+ // Default fonts
16
+ $default-sans-serif: "Helvetica" !default;
17
+ $default-serif: "Georgia" !default;
16
18
  $default-monospace: false !default;
19
+
20
+ // Fail-safe
21
+ $default-font-family: $default-sans-serif !default;
22
+
23
+ // The 'family' var
17
24
  $family: $default-font-family !default;
18
25
 
19
26
  @import "font-stacks/function";
@@ -4,135 +4,128 @@
4
4
  // Serif
5
5
  //
6
6
 
7
- // BASKERVILLE ( 88.60% on Mac, 49.10% on Windows)
7
+ @if $family == "serif" {
8
+ @return font-family($default-serif);
9
+ }
10
+
8
11
  @if $family == "Baskerville" {
9
12
  @return Baskerville, "Baskerville Old Face", "Hoefler Text", Garamond, "Times New Roman", serif;
10
13
  }
11
14
 
12
- // BIG CASLON (85.10% on Mac)
13
15
  @else if $family == "Big Caslon" {
14
16
  @return "Big Caslon", "Book Antiqua", "Palatino Linotype", Georgia, serif;
15
17
  }
16
-
17
- // BODONI (47.89% on Windows)
18
+
18
19
  @else if $family == "Bodoni MT" {
19
20
  @return "Bodoni MT", Didot, "Didot LT STD", "Hoefler Text", Garamond, "Times New Roman", serif;
20
21
  }
21
22
 
22
- // BOOK ANTIQUA (86.09% on Mac)
23
23
  @else if $family == "Book Antiqua" {
24
24
  @return "Book Antiqua", Palatino, "Palatino Linotype", "Palatino LT STD", Georgia, serif;
25
25
  }
26
-
27
- // CAMBRIA (54.51% on Windows)
26
+
28
27
  @else if $family == "Cambria" {
29
28
  @return Cambria, Georgia, serif;
30
29
  }
31
30
 
32
- // CONSTANTIA (53.81% on Windows)
33
31
  @else if $family == "Constantia" {
34
32
  @return Constantia, Palatino, "Palatino Linotype", "Palatino LT STD", Georgia, serif;
35
33
  }
36
34
 
37
- // DIDOT (87.72% on Mac)
38
35
  @else if $family == "Didot" {
39
36
  @return Didot, "Didot LT STD", "Hoefler Text", Garamond, "Times New Roman", serif;
40
37
  }
41
38
 
42
- // GARAMOND (23.84% on Mac, 86.24% on Windows)
43
39
  @else if $family == "Garamond" {
44
40
  @return Garamond, Baskerville, "Baskerville Old Face", "Hoefler Text", "Times New Roman", serif;
45
41
  }
46
42
 
47
- // GOUDY OLD STYLE (51.30% on Windows)
48
43
  @else if $family == "Goudy Old Style" {
49
44
  @return "Goudy Old Style", Garamond, "Big Caslon", "Times New Roman", serif;
50
45
  }
51
46
 
52
- // HOEFLER TEXT (88.70% on Mac, 1.16% on Windows)
53
47
  @else if $family == "Hoefler Text" {
54
48
  @return "Hoefler Text", "Baskerville Old Face", Garamond, "Times New Roman", serif;
55
49
  }
56
50
 
57
- // LUCIDA BRIGHT (64.90% on Mac, 33.84% on Windows) - huge x-height
58
51
  @else if $family == "Lucida Bright" {
59
52
  @return "Lucida Bright", Georgia, serif;
60
53
  }
61
54
 
62
- // PALATINO (79.71% on Mac, 98.04% on Windows)
63
55
  @else if $family == "Palatino" {
64
56
  @return Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
65
57
  }
66
58
 
59
+ @else if $family == "Times New Roman" {
60
+ @return "Times New Roman", Times, serif;
61
+ }
62
+
63
+ // Alias to "Times New Roman"
64
+ @else if $family == "Times" {
65
+ @return font-family("Times New Roman");
66
+ }
67
+
67
68
  //
68
69
  // Sans-serif
69
70
  //
70
71
 
71
- // CALIBRI (54.76% on Windows)
72
+ @if $family == "sans-serif" {
73
+ @return font-family($default-sans-serif);
74
+ }
75
+
72
76
  @else if $family == "Calibri" {
73
77
  @return Calibri, Candara, Segoe, "Segoe UI", Optima, Arial, sans-serif;
74
78
  }
75
79
 
76
- // CANDARA (54.31% on Windows)
77
80
  @else if $family == "Candara" {
78
81
  @return Candara, Calibri, Segoe, "Segoe UI", Optima, Arial, sans-serif;
79
82
  }
80
83
 
81
- // FRANKLIN GOTHIC MEDIUM (97.89% on Windows)
82
84
  @else if $family == "Franklin Gothic Medium" {
83
85
  @return "Franklin Gothic Medium", Arial, sans-serif;
84
86
  }
85
87
 
86
- // FUTURA (91.01% on Mac)
87
88
  @else if $family == "Futura" {
88
89
  @return Futura, "Trebuchet MS", Arial, sans-serif;
89
90
  }
90
91
 
91
- // GENEVA (98.84% on Mac)
92
92
  @else if $family == "Geneva" {
93
93
  @return Geneva, Tahoma, Verdana, sans-serif;
94
94
  }
95
-
96
- // GILL SANS (91.52% on Mac, 51.74% on Windows)
95
+
97
96
  @else if $family == "Gill Sans" {
98
97
  @return "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
99
98
  }
100
99
 
101
- // HELVETICA NEUE (94.74% on Mac)
102
100
  @else if $family == "Helvetica Neue" {
103
101
  @return "Helvetica Neue", Helvetica, Arial, "Liberation Sans", FreeSans, sans-serif;
104
102
  }
105
- // Alias to "helvetica-neue"
103
+
104
+ // Alias to "Helvetica Neue"
106
105
  @else if $family == "Helvetica" {
107
106
  @return font-family("Helvetica Neue");
108
107
  }
109
-
110
- // LUCIDA GRANDE (99.13% on Mac, 98.25% on Windows)
108
+
111
109
  @else if $family == "Lucida Grande" {
112
110
  @return "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
113
111
  }
114
112
 
115
- // OPTIMA (90.14% on Mac)
116
113
  @else if $family == "Optima" {
117
114
  @return Optima, Segoe, "Segoe UI", Candara, Calibri, Arial, sans-serif;
118
115
  }
119
116
 
120
- // SEGOE (45.04% on Windows)
121
117
  @else if $family == "Segoe" {
122
118
  @return Segoe, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
123
119
  }
124
120
 
125
- // TAHOMA (99.30% on Windows)
126
121
  @else if $family == "Tahoma" {
127
122
  @return Tahoma, Geneva, Verdana, sans-serif;
128
123
  }
129
124
 
130
- // TREBUCHET (94.20% on Mac, 99% on Windows)
131
125
  @else if $family == "Trebuchet MS" {
132
126
  @return "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif;
133
127
  }
134
128
 
135
- // VERDANA (96.81% on Mac, 99.40% on Windows)
136
129
  @else if $family == "Verdana" {
137
130
  @return Verdana, Geneva, sans-serif;
138
131
  }
@@ -141,7 +134,7 @@
141
134
  // Monospace
142
135
  //
143
136
 
144
- @else if $family == "Monospace" {
137
+ @else if $family == "monospace" {
145
138
  @if $default-monospace {
146
139
  @return $default-monospace;
147
140
  }
@@ -149,17 +142,13 @@
149
142
  @return "DejaVu Sans Mono", Menlo, Monaco, Consolas, Courier, monospace;
150
143
  }
151
144
  }
152
-
153
- // Alias to "Monospace"
154
- @else if $family == "monospace" {
155
- @return font-family("Monospace");
156
- }
157
145
 
158
146
  //
159
147
  // Else, catch all, fail safe
160
148
  //
161
149
 
162
150
  @else {
151
+ @warn "The font-family you specified wasn't found. The $default-font-family has been returned instead.";
163
152
  @return font-family($default-font-family);
164
153
  }
165
154
 
@@ -1,167 +1,7 @@
1
1
  @mixin font-family($family) {
2
-
3
- //
4
- // Serif
5
- //
6
-
7
- // BASKERVILLE ( 88.60% on Mac, 49.10% on Windows)
8
- @if $family == "Baskerville" {
9
- font-family: font-family($family);
10
- }
11
-
12
- // BIG CASLON (85.10% on Mac)
13
- @else if $family == "Big Caslon" {
14
- font-family: font-family($family);
15
- }
16
-
17
- // BODONI (47.89% on Windows)
18
- @else if $family == "Bodoni MT" {
19
- font-family: font-family($family);
20
- }
21
-
22
- // BOOK ANTIQUA (86.09% on Mac)
23
- @else if $family == "Book Antiqua" {
24
- font-family: font-family($family);
25
- }
26
-
27
- // CAMBRIA (54.51% on Windows)
28
- @else if $family == "Cambria" {
29
- font-family: font-family($family);
30
- }
31
-
32
- // CONSTANTIA (53.81% on Windows)
33
- @else if $family == "Constantia" {
34
- font-family: font-family($family);
35
- }
36
-
37
- // DIDOT (87.72% on Mac)
38
- @else if $family == "Didot" {
39
- font-family: font-family($family);
40
- }
41
-
42
- // GARAMOND (23.84% on Mac, 86.24% on Windows)
43
- @else if $family == "Garamond" {
44
- font-family: font-family($family);
45
- }
46
-
47
- // GOUDY OLD STYLE (51.30% on Windows)
48
- @else if $family == "Goudy Old Style" {
49
- font-family: font-family($family);
50
- }
51
-
52
- // HOEFLER TEXT (88.70% on Mac, 1.16% on Windows)
53
- @else if $family == "Hoefler Text" {
54
- font-family: font-family($family);
55
- }
56
-
57
- // LUCIDA BRIGHT (64.90% on Mac, 33.84% on Windows) - huge x-height
58
- @else if $family == "Lucida Bright" {
59
- font-family: font-family($family);
60
- }
61
-
62
- // PALATINO (79.71% on Mac, 98.04% on Windows)
63
- @else if $family == "Palatino" {
64
- font-family: font-family($family);
65
- }
66
-
67
- //
68
- // Sans-serif
69
- //
70
-
71
- // CALIBRI (54.76% on Windows)
72
- @else if $family == "Calibri" {
73
- font-family: font-family($family);
74
- }
75
-
76
- // CANDARA (54.31% on Windows)
77
- @else if $family == "Candara" {
78
- font-family: font-family($family);
79
- }
80
-
81
- // FRANKLIN GOTHIC MEDIUM (97.89% on Windows)
82
- @else if $family == "Franklin Gothic Medium" {
83
- font-family: font-family($family);
84
- }
85
-
86
- // FUTURA (91.01% on Mac)
87
- @else if $family == "Futura" {
88
- font-family: font-family($family);
89
- }
90
-
91
- // GENEVA (98.84% on Mac)
92
- @else if $family == "Geneva" {
93
- font-family: font-family($family);
94
- }
95
-
96
- // GILL SANS (91.52% on Mac, 51.74% on Windows)
97
- @else if $family == "Gill Sans" {
98
- font-family: font-family($family);
99
- }
100
-
101
- // HELVETICA NEUE (94.74% on Mac)
102
- @else if $family == "Helvetica Neue" {
103
- font-family: font-family($family);
104
- }
105
-
106
- // Alias to "Helvetica Neue"
107
- @else if $family == "Helvetica" {
108
- font-family: font-family("Helvetica Neue");
109
- }
110
-
111
- // LUCIDA GRANDE (99.13% on Mac, 98.25% on Windows)
112
- @else if $family == "Lucida Grande" {
113
- font-family: font-family($family);
114
- }
115
-
116
- // OPTIMA (90.14% on Mac)
117
- @else if $family == "Optima" {
118
- font-family: font-family($family);
119
- }
120
-
121
- // SEGOE (45.04% on Windows)
122
- @else if $family == "Segoe" {
123
- font-family: font-family($family);
124
- }
125
-
126
- // TAHOMA (99.30% on Windows)
127
- @else if $family == "Tahoma" {
128
- font-family: font-family($family);
129
- }
130
-
131
- // TREBUCHET (94.20% on Mac, 99% on Windows)
132
- @else if $family == "Trebuchet MS" {
133
- font-family: font-family($family);
134
- }
135
-
136
- // VERDANA (96.81% on Mac, 99.40% on Windows)
137
- @else if $family == "Verdana" {
138
- font-family: font-family($family);
139
- }
140
-
141
- //
142
- // Monospace
143
- //
144
-
145
- @else if $family == "Monospace" {
146
- font-family: font-family($family);
147
- }
148
-
149
- // Alias to "Monospace"
150
- @else if $family == "monospace" {
151
- font-family: font-family("Monospace");
152
- }
153
-
154
- //
155
- // Else, catch all, fail safe
156
- //
157
-
158
- @else {
159
- font-family: font-family($default-font-family);
160
- }
161
-
2
+ font-family: font-family($family);
162
3
  }
163
4
 
164
- // Shorthand counterpart
165
5
  @mixin ff($family) {
166
6
  @include font-family($family);
167
7
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: font-stacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-23 00:00:00.000000000Z
12
+ date: 2011-11-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: compass
16
- requirement: &70134073545220 !ruby/object:Gem::Requirement
16
+ requirement: &70152259746140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,8 +21,8 @@ dependencies:
21
21
  version: 0.11.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70134073545220
25
- description: Sass/Compass extension for Sassy access to common web-friendly font-stacks
24
+ version_requirements: *70152259746140
25
+ description: A Sass and Compass font-family library of common web-friendly font stacks
26
26
  email:
27
27
  - adam@stacoviak.com
28
28
  executables: []
@@ -48,7 +48,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  segments:
50
50
  - 0
51
- hash: 2595218414718269859
51
+ hash: 2867448192045769992
52
52
  required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
@@ -60,6 +60,6 @@ rubyforge_project:
60
60
  rubygems_version: 1.8.10
61
61
  signing_key:
62
62
  specification_version: 3
63
- summary: Sass/Compass extension that provides Sass functions to easily use common
64
- web-friendly font-stacks
63
+ summary: Font Stacks is a Sass and Compass font-family library of common web-friendly
64
+ font stacks.
65
65
  test_files: []