Version 0.6.1.
[ttfautohint.git] / src / tasort.c
blobdfc7d7074080562f74e3c88f8ed7b94a5d15b7c3
1 /* tasort.c */
3 /*
4 * Copyright (C) 2011-2012 by Werner Lemberg.
6 * This file is part of the ttfautohint library, and may only be used,
7 * modified, and distributed under the terms given in `COPYING'. By
8 * continuing to use, modify, or distribute this file you indicate that you
9 * have read `COPYING' and understand and accept it fully.
11 * The file `COPYING' mentioned in the previous paragraph is distributed
12 * with the ttfautohint library.
16 /* originally file `afangles.c' (2011-Mar-28) from FreeType */
18 /* heavily modified 2011 by Werner Lemberg <wl@gnu.org> */
20 #include "tatypes.h"
21 #include "tasort.h"
24 /* two bubble sort routines */
26 void
27 ta_sort_pos(FT_UInt count,
28 FT_Pos* table)
30 FT_UInt i;
31 FT_UInt j;
32 FT_Pos swap;
35 for (i = 1; i < count; i++)
37 for (j = i; j > 0; j--)
39 if (table[j] > table[j - 1])
40 break;
42 swap = table[j];
43 table[j] = table[j - 1];
44 table[j - 1] = swap;
50 void
51 ta_sort_widths(FT_UInt count,
52 TA_Width table)
54 FT_UInt i;
55 FT_UInt j;
56 TA_WidthRec swap;
59 for (i = 1; i < count; i++)
61 for (j = i; j > 0; j--)
63 if (table[j].org > table[j - 1].org)
64 break;
66 swap = table[j];
67 table[j] = table[j - 1];
68 table[j - 1] = swap;
73 /* end of tasort.c */