Next: Doc Comments, Previous: Font Locking Preliminaries, Up: Font Locking [Contents][Index]

### 5.2 Faces

CC Mode attempts to use the standard faces for programming languages in accordance with their intended purposes as far as possible. No extra faces are currently provided, with the exception of a replacement face `c-invalid-face` for emacsen that don’t provide `font-lock-warning-face`.

- Normal comments are fontified in `font-lock-comment-face`.
- Comments that are recognized as documentation (see Doc Comments) get `font-lock-doc-face` (Emacs) or `font-lock-doc-string-face` (XEmacs) if those faces exist. If they don’t then `font-lock-comment-face` is used.
- String and character literals are fontified in `font-lock-string-face`.
- Keywords are fontified with `font-lock-keyword-face`.
- `font-lock-function-name-face` is used for function names in declarations and definitions, and classes in those contexts. It’s also used for preprocessor defines with arguments.
- Variables in declarations and definitions, and other identifiers in such variable contexts, get `font-lock-variable-name-face`. It’s also used for preprocessor defines without arguments.
- Builtin constants are fontified in `font-lock-constant-face` if it exists, `font-lock-reference-face` otherwise. As opposed to the preceding two faces, this is used on the names in expressions, and it’s not used in declarations, even if there happen to be a ‘`const`’ in them somewhere.
- `font-lock-type-face` is put on types (both predefined and user defined) and classes in type contexts.
- Label identifiers get `font-lock-constant-face` if it exists, `font-lock-reference-face` otherwise.
- Name qualifiers and identifiers for scope constructs are fontified like labels.
- Special markup inside documentation comments are also fontified like labels.
- Preprocessor directives get `font-lock-preprocessor-face` if it exists (i.e., XEmacs). In Emacs they get `font-lock-builtin-face` or `font-lock-reference-face`, for lack of a closer equivalent.
- Some kinds of syntactic errors are fontified with `font-lock-warning-face` in Emacs. In older XEmacs versions there’s no corresponding standard face, so there a special `c-invalid-face` is used, which is defined to stand out sharply by default.

  Note that it’s not used for ‘`#error`’ or ‘`#warning`’ directives, since those aren’t syntactic errors in themselves.

Next: Doc Comments, Previous: Font Locking Preliminaries, Up: Font Locking [Contents][Index]