summaryrefslogtreecommitdiff
path: root/fonts/utilities/woff2ot/woff2ot.cpp
blob: fca82e788753658618bad5c64eb591d57d81233d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "woff2ot.h"

int main(int argc, char *argv[])
{
    if (argc != 3)
    {
        puts(COPYRIGHT_NOTICE);

        puts("Usage 1: woff2ot input_font_filename.woff output_font_filename.[otf|ttf]\n");
        puts("Usage 2: woff2ot -type input_font_filename.woff\n");
        puts("         Use the latter to determine whether the actual font type is ");
        puts("         an OpenType PostScript (.OTF) or an OpenType TrueType (.TTF) font");
        return 1;
    }
    else if ('-' == argv[1][0])
    {
        if (strcmp(&argv[1][1], "type") == 0)
        {
            Woff2OT ot;
            uint32_t type;

            type = ot.write_font_type(argv[2]);

            // 0 == unknown type

            return (0 == type) ? 1 : 0;
        }
        else
        {
            printf("Unknown switch: %s\n", argv[1]);

            return 1;
        }
    }
    else
    {
        Woff2OT ot;

        if (ot.convert(argv[1], argv[2]))
        {
            puts("Success");

            return 0;
        }
        else
        {
            puts(ot.error().c_str());

            return 1;
        }
    }
}