Adjust italic to non-italic style spacing
[libass.git] / libass / ass_types.h
blob20fd825ef1e9605d0855397bcc04a8b536f074f1
1 /*
2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
4 * This file is part of libass.
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #ifndef LIBASS_TYPES_H
20 #define LIBASS_TYPES_H
22 #include <stdint.h>
24 #define VALIGN_SUB 0
25 #define VALIGN_CENTER 8
26 #define VALIGN_TOP 4
27 #define HALIGN_LEFT 1
28 #define HALIGN_CENTER 2
29 #define HALIGN_RIGHT 3
31 /* Opaque objects internally used by libass. Contents are private. */
32 typedef struct ass_renderer ASS_Renderer;
33 typedef struct render_priv ASS_RenderPriv;
34 typedef struct parser_priv ASS_ParserPriv;
35 typedef struct ass_library ASS_Library;
37 /* ASS Style: line */
38 typedef struct ass_style {
39 char *Name;
40 char *FontName;
41 double FontSize;
42 uint32_t PrimaryColour;
43 uint32_t SecondaryColour;
44 uint32_t OutlineColour;
45 uint32_t BackColour;
46 int Bold;
47 int Italic;
48 int Underline;
49 int StrikeOut;
50 double ScaleX;
51 double ScaleY;
52 double Spacing;
53 int Angle;
54 int BorderStyle;
55 double Outline;
56 double Shadow;
57 int Alignment;
58 int MarginL;
59 int MarginR;
60 int MarginV;
61 int Encoding;
62 int treat_fontname_as_pattern;
63 } ASS_Style;
66 * ASS_Event corresponds to a single Dialogue line;
67 * text is stored as-is, style overrides will be parsed later.
69 typedef struct ass_event {
70 long long Start; // ms
71 long long Duration; // ms
73 int ReadOrder;
74 int Layer;
75 int Style;
76 char *Name;
77 int MarginL;
78 int MarginR;
79 int MarginV;
80 char *Effect;
81 char *Text;
83 ASS_RenderPriv *render_priv;
84 } ASS_Event;
87 * ass track represent either an external script or a matroska subtitle stream
88 * (no real difference between them); it can be used in rendering after the
89 * headers are parsed (i.e. events format line read).
91 typedef struct ass_track {
92 int n_styles; // amount used
93 int max_styles; // amount allocated
94 int n_events;
95 int max_events;
96 ASS_Style *styles; // array of styles, max_styles length, n_styles used
97 ASS_Event *events; // the same as styles
99 char *style_format; // style format line (everything after "Format: ")
100 char *event_format; // event format line
102 enum {
103 TRACK_TYPE_UNKNOWN = 0,
104 TRACK_TYPE_ASS,
105 TRACK_TYPE_SSA
106 } track_type;
108 // Script header fields
109 int PlayResX;
110 int PlayResY;
111 double Timer;
112 int WrapStyle;
113 int ScaledBorderAndShadow;
114 int Kerning;
115 char *Language;
117 int default_style; // index of default style
118 char *name; // file name in case of external subs, 0 for streams
120 ASS_Library *library;
121 ASS_ParserPriv *parser_priv;
122 } ASS_Track;
124 #endif /* LIBASS_TYPES_H */