public final class FontFacePlugin extends Object implements Plugin
For the grammar rules see the spec.
Inside of the font-face block are font-descriptors. Grammar-wise these are pretty much exactly just like Declaration
s, however in the interpreted CSS they have different meanings. For example, a font-family
font-descriptor
means something different from a font-family
declaration. We could just treat and broadcast these as
declarations, and while there are reasons that would make that beneficial, there are also reasons that would make that
undesirable.
Whether a plugin author listening for a declaration wants to receive font-descriptors as well depends on what they are doing.
An example of where you wouldn't want to would be a plugin that counts the number of font-family declarations, or a plugin that
automatically changes all font-family declarations to something different for, say, a Japan-localised version of the site.
Also, quite honestly due to the nature of the AST objects (type-safe bi-traversal), putting Declaration
s directly
inside of an AtRuleBlock
would require more work.
FontDescriptor
,
FontFaceBlock
Constructor and Description |
---|
FontFacePlugin() |
Modifier and Type | Method and Description |
---|---|
void |
refine(AtRule atRule,
Grammar grammar,
Broadcaster broadcaster)
Refines the font-face at-rule.
|
public void refine(AtRule atRule, Grammar grammar, Broadcaster broadcaster)
If refinement is successful the new FontFaceBlock
will be broadcasted via the given Broadcaster
.
atRule
- The atRule to refine.grammar
- The grammar.broadcaster
- The broadcaster.Copyright (c) 2019, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE file in the repository.