grammar CssFont;

import BasePrimitives, CssUnit;

fontCss
    : (fontStyle WS) (fontWeight WS)? fontSize WS fontFamily
    | (fontWeight WS) (fontStyle WS)? fontSize WS fontFamily
    | fontSize WS fontFamily
    ;

fontAttribute
    : fontStyle
    | fontWeight
    | CSS3_FONT_ATTR_NORMAL
    ;

fontFamily
    : fontFamilyName CS fontFamilyGeneric
    | fontFamilyName
    | fontFamilyGeneric
    ;

fontFamilyName
    : TEXT
    | word
    ;

fontFamilyGeneric
    : CSS3_FONT_GENERIC_SERIF
    | CSS3_FONT_GENERIC_SAN_SERIF
    | CSS3_FONT_GENERIC_MONOSPACE
    | CSS3_FONT_GENERIC_CURSIVE
    | CSS3_FONT_GENERIC_FANTASY
    | CSS3_FONT_GENERIC_SYSTEM_UI
    | CSS3_FONT_GENERIC_UI_SERIF
    | CSS3_FONT_GENERIC_UI_SANS_SERIF
    | CSS3_FONT_GENERIC_UI_MONOSPACE
    | CSS3_FONT_GENERIC_UI_ROUNDED
    | CSS3_FONT_GENERIC_MATH
    | CSS3_FONT_GENERIC_EMOJI
    | CSS3_FONT_GENERIC_FANGSONG
    ;

fontSize
    : length (FSLASH length)?
    ;

fontStyle
    : CSS3_FONT_STYLE_ITALIC
    | CSS3_FONT_STYLE_OBLIQUE (WS angle)?
    ;

fontWeight
    : CSS3_FONT_WEIGHT_BOLD
    | CSS3_FONT_WEIGHT_LIGHTER
    | CSS3_FONT_WEIGHT_BOLDER
    | numberInt
    ;

CSS3_FONT_GENERIC_SERIF         : 'serif';
CSS3_FONT_GENERIC_SAN_SERIF     : 'sans-serif';
CSS3_FONT_GENERIC_MONOSPACE     : 'monospace';
CSS3_FONT_GENERIC_CURSIVE       : 'cursive';
CSS3_FONT_GENERIC_FANTASY       : 'fantasy';
CSS3_FONT_GENERIC_SYSTEM_UI     : 'system-ui';
CSS3_FONT_GENERIC_UI_SERIF      : 'ui-serif';
CSS3_FONT_GENERIC_UI_SANS_SERIF : 'ui-sans-serif';
CSS3_FONT_GENERIC_UI_MONOSPACE  : 'ui-monospace';
CSS3_FONT_GENERIC_UI_ROUNDED    : 'ui-rounded';
CSS3_FONT_GENERIC_MATH          : 'math';
CSS3_FONT_GENERIC_EMOJI         : 'emoji';
CSS3_FONT_GENERIC_FANGSONG      : 'fangsong';

CSS3_FONT_ATTR_NORMAL           : 'normal';

CSS3_FONT_STYLE_ITALIC          : 'italic';
CSS3_FONT_STYLE_OBLIQUE         : 'oblique';

CSS3_FONT_WEIGHT_BOLD           : 'bold';
CSS3_FONT_WEIGHT_LIGHTER        : 'lighter';
CSS3_FONT_WEIGHT_BOLDER         : 'bolder';