Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

get started

  • Loading branch information...
commit 120c47ad032de123682afd3abd341bf7e85a2c9e 0 parents
@rcarver rcarver authored
Showing with 328 additions and 0 deletions.
  1. +117 −0 README.md
  2. +129 −0 compact.yml
  3. +82 −0 expand.yml
117 README.md
@@ -0,0 +1,117 @@
+# Font Variation Description
+
+A way to unambiguously, compactly and clearly describe a set of
+[@font-face](http://www.w3.org/TR/css3-fonts/) properties. This is implemented
+as a simple string. For example
+
+ n4
+
+This specification is currently focused on describing an existing @font-face
+descriptor, rather than describing an intended descriptor. The latter becomes
+more complicated when considering unspecified properties and the existence or
+non-existence of a particular font face.
+
+
+## Properties
+
+The order of properties is well defined. Currently:
+
+ font-style
+ font-weight
+
+Forward compatibility is maintained by adding new properties to the end.
+Possible additions:
+
+ font-stretch
+ font-variant
+
+
+## Values
+
+The possible values for each property are well defined, and a value is
+required for each property. Values must be a single character. The Font Values
+Description value and its equivalent CSS value for each property are as
+follows.
+
+Each property must have a default value, but may have aliases for use when
+generating a Font Values Description. To maintain unambiguous output, there
+must be no alias return values.
+
+### [font-style](http://www.w3.org/TR/css3-fonts/#font-style0)
+
+ n: normal (default)
+ i: italic
+ o: oblique
+
+### [font-weight](http://www.w3.org/TR/css3-fonts/#font-weight0)
+
+ 1: 100
+ 2: 200
+ 3: 300
+ 4: 400 (default, also recognized as 'normal')
+ 5: 500
+ 6: 600
+ 7: 700 (also recognized as 'bold')
+ 8: 800
+ 9: 900
+
+### [font-stretch](http://www.w3.org/TR/css3-fonts/#font-stretch0)
+
+ a: ultra-condensed
+ b: extra-condensed
+ c: condensed
+ d: semi-condensed
+ n: normal (default)
+ e: semi-expanded
+ f: expanded
+ g: extra-expanded
+ h: ultra-expanded
+
+### font-variant (not currently in the CSS3 font spec)
+
+ n: normal
+ c: small-caps
+
+
+## Parsing Rules
+
+See [compaction test suite](compact.yml) and the
+[expansion test suite](expand.yml) for a complete set of rules.
+
+
+## Examples:
+
+ (no properties)
+ => n4
+
+ font-style: italic;
+ => i4
+
+ font-weight: normal;
+ => n4
+
+ font-weight: bold;
+ => n7
+
+ font-style: normal;
+ font-weight: 400;
+ => n4
+
+ font-style: italic;
+ font-weight: 500;
+ => i5
+
+A CSS class name for a single font
+
+ wf-droidserif-n7
+
+Describing an entire family of fonts. Here each variation is delimited by a
+comma.
+
+ "Droid Serif:n4,i4,n7,i7"
+
+ This string describes four fonts in the family 'Droid Serif':
+ - Normal
+ - Italic
+ - Bold
+ - Bold Italic
129 compact.yml
@@ -0,0 +1,129 @@
+# This file describes a set of test cases for creating a Font Variation
+# Description from @font-face descriptors.
+
+tests:
+ - description: An empty font-face description
+ fontface:
+ fvd: n4
+
+ # font-style
+
+ - description: font-style: normal becomes n
+ font: |
+ font-style: normal;
+ fvd: n4
+
+ - description: font-style: italic becomes i
+ font: |
+ font-style: italic;
+ fvd: i4
+
+ - description: font-style: oblique becomes o
+ font: |
+ font-style: oblique;
+ fvd: o4
+
+ - description: unknown font-style becomes n
+ font: |
+ font-style: other;
+ fvd: n4
+
+ # font-weight
+
+ - description: font-weight: normal becomes 4
+ font: |
+ font-weight: normal;
+ fvd: n4
+
+ - description: font-weight: bold becomes 7
+ font: |
+ font-weight: bold;
+ fvd: n7
+
+ - description: font-weight: 100 becomes 1
+ font: |
+ font-weight: 100;
+ fvd: n1
+
+ - description: font-weight: 200 becomes 2
+ font: |
+ font-weight: 200;
+ fvd: n2
+
+ - description: font-weight: 300 becomes 3
+ font: |
+ font-weight: 300;
+ fvd: n3
+
+ - description: font-weight: 400 becomes 4
+ font: |
+ font-weight: 400;
+ fvd: n4
+
+ - description: font-weight: 500 becomes 5
+ font: |
+ font-weight: 500;
+ fvd: n5
+
+ - description: font-weight: 600 becomes 6
+ font: |
+ font-weight: 600;
+ fvd: n6
+
+ - description: font-weight: 700 becomes 7
+ font: |
+ font-weight: 700;
+ fvd: n7
+
+ - description: font-weight: 800 becomes 8
+ font: |
+ font-weight: 800;
+ fvd: n8
+
+ - description: font-weight: 900 becomes 9
+ font: |
+ font-weight: 900;
+ fvd: n9
+
+ - description: font-weight: 1000 becomes 4
+ font: |
+ font-weight: 1000;
+ fvd: n4
+
+ - description: font-weight: 150 becomes 4
+ font: |
+ font-weight: 150;
+ fvd: n4
+
+ # combinations
+
+ - description: When all properties are defined
+ font: |
+ font-style: italic;
+ font-weight: bold;
+ fvd: i7
+
+ # string parsing
+
+ - description: When the font-face description has extraneous spaces
+ font: |
+
+ font-style: italic ;
+
+ font-weight : bold;
+
+ fvd: i4
+
+ - description: When the font-face description lacks whitespace
+ font: |
+ font-style:italic;font-weight:bold;
+ fvd: i6
+
+ - description: When the font-face description contains unhandled properties
+ font: |
+ src: url(/font.otf)
+ font-style:italic;
+ font-stretch:condensed
+ font-weight:bold;
+ fvd: i6
+
82 expand.yml
@@ -0,0 +1,82 @@
+# This file describes a set of test cases for expanding a Font Variation
+# Description into a set of @font-face descriptors.
+
+tests:
+
+ # font-style
+
+ - description: "n4"
+ fvd: "n4"
+ font: "font-style:normal;font-weight:normal;"
+
+ - description: "i4"
+ fvd: "i4"
+ font: "font-style:italic;font-weight:normal;"
+
+ - description: "o4"
+ fvd: "o4"
+ font: "font-style:oblique;font-weight:normal;"
+
+ # font-weight
+
+ - description: "n1"
+ fvd: "n1"
+ font: "font-style:normal;font-weight:100;"
+
+ - description: "n2"
+ fvd: "n2"
+ font: "font-style:normal;font-weight:200;"
+
+ - description: "n3"
+ fvd: "n3"
+ font: "font-style:normal;font-weight:300;"
+
+ - description: "n4"
+ fvd: "n4"
+ font: "font-style:normal;font-weight:400;"
+
+ - description: "n5"
+ fvd: "n5"
+ font: "font-style:normal;font-weight:500;"
+
+ - description: "n6"
+ fvd: "n6"
+ font: "font-style:normal;font-weight:600;"
+
+ - description: "n7"
+ fvd: "n7"
+ font: "font-style:normal;font-weight:700;"
+
+ - description: "n8"
+ fvd: "n8"
+ font: "font-style:normal;font-weight:800;"
+
+ - description: "n9"
+ fvd: "n9"
+ font: "font-style:normal;font-weight:900;"
+
+ # invalid description
+
+ - description: "'' is null because it's empty"
+ fvd: ""
+ font: ~
+
+ - description: "'x0' is null because the style is invalid"
+ fvd: "x0"
+ font: ~
+
+ - description: "'n0' is null because the weight is invalid"
+ fvd: "n0"
+ font: ~
+
+ - description: "'n' is null because there is only one input"
+ fvd: "n"
+ font: ~
+
+ - description: "'1' is null because there is only one input"
+ fvd: "1"
+ font: ~
+
+ - description: "'n1x' is null because there are more than two inputs"
+ fvd: "n1x"
+ font: ~
Please sign in to comment.
Something went wrong with that request. Please try again.