Add .clang-format file

This file can be used to reformat FreeType sources and commits
using one of these methods:

- Direct formatting of a whole file:

    clang-format -i path/to/file

  For example, to reformat all sources at once:

    echo builds/unix/ftconfig.h.in $(git ls-files *.[hc]) | xargs clang-format -i

- Only reformat the changed lines in the current work directoy:

    git clang-format

The style settings in this file are very close to the FreeType
formatting style, with the following exceptions which are not supported
here:

- Mminimal 2-space margin on each non-empty line.
  (no left margin instead).

- 2 empty lines between variable declarations and statements in C blocks.
  (only 1 is kept).

    {
      int  x = ...;

      foo(x);
    }

  becomes

    {
      int x = ...;

      foo(x);
    }

- Aignment of declarations uses 2 spaces to separate types and variable
  names (only 1 space is kept).

     int  x;    =>   int x;
     int  y;         int y;

- The start used for output parameters in function signature should be
  near the variable name (always near the type).

    void foo(int* input_ptr, int *output_ptr)
      => void foo(int* input_ptr, int* output_ptr)
This commit is contained in:
David Turner 2020-05-01 15:37:56 +02:00 committed by Werner Lemberg
parent b7c467b6ef
commit ee19a6cbbc

16
.clang-format Normal file
View File

@ -0,0 +1,16 @@
BasedOnStyle: Chromium
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: true
# AlignOperands: Align
AlignTrailingComments: true
AlwaysBreakAfterReturnType: AllDefinitions
BreakBeforeBraces: Allman
ColumnLimit: 80
DerivePointerAlignment: false
IndentCaseLabels: false
PointerAlignment: Left
SpaceBeforeParens: ControlStatements
SpacesInParentheses: true