2 * Copyright (C) 2007-2008 Benjamin Otte <otte@gnome.org>
3 * 2007 Pekka Lampila <pekka.lampila@iki.fi>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
21 #ifndef _SWFDEC_TEXT_ATTRIBUTES_H_
22 #define _SWFDEC_TEXT_ATTRIBUTES_H_
25 #include <swfdec/swfdec_color.h>
29 typedef struct _SwfdecTextAttributes SwfdecTextAttributes
;
30 typedef struct _SwfdecTextAttributesClass SwfdecTextAttributesClass
;
32 #define SWFDEC_TYPE_TEXT_ATTRIBUTES (swfdec_text_attributes_get_type())
33 #define SWFDEC_IS_TEXT_ATTRIBUTES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_TEXT_ATTRIBUTES))
34 #define SWFDEC_IS_TEXT_ATTRIBUTES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_TEXT_ATTRIBUTES))
35 #define SWFDEC_TEXT_ATTRIBUTES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_TEXT_ATTRIBUTES, SwfdecTextAttributes))
36 #define SWFDEC_TEXT_ATTRIBUTES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_TEXT_ATTRIBUTES, SwfdecTextAttributesClass))
37 #define SWFDEC_TEXT_ATTRIBUTES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_TEXT_ATTRIBUTES, SwfdecTextAttributesClass))
40 SWFDEC_TEXT_ALIGN_LEFT
,
41 SWFDEC_TEXT_ALIGN_RIGHT
,
42 SWFDEC_TEXT_ALIGN_CENTER
,
43 SWFDEC_TEXT_ALIGN_JUSTIFY
47 SWFDEC_TEXT_DISPLAY_NONE
,
48 SWFDEC_TEXT_DISPLAY_INLINE
,
49 SWFDEC_TEXT_DISPLAY_BLOCK
,
53 SWFDEC_TEXT_ATTRIBUTE_ALIGN
= 0,
54 SWFDEC_TEXT_ATTRIBUTE_BLOCK_INDENT
,
55 SWFDEC_TEXT_ATTRIBUTE_BOLD
,
56 SWFDEC_TEXT_ATTRIBUTE_BULLET
,
57 SWFDEC_TEXT_ATTRIBUTE_COLOR
,
58 SWFDEC_TEXT_ATTRIBUTE_DISPLAY
,
59 SWFDEC_TEXT_ATTRIBUTE_FONT
,
60 SWFDEC_TEXT_ATTRIBUTE_INDENT
,
61 SWFDEC_TEXT_ATTRIBUTE_ITALIC
,
62 SWFDEC_TEXT_ATTRIBUTE_KERNING
,
63 SWFDEC_TEXT_ATTRIBUTE_LEADING
,
64 SWFDEC_TEXT_ATTRIBUTE_LEFT_MARGIN
,
65 SWFDEC_TEXT_ATTRIBUTE_LETTER_SPACING
,
66 SWFDEC_TEXT_ATTRIBUTE_RIGHT_MARGIN
,
67 SWFDEC_TEXT_ATTRIBUTE_SIZE
,
68 SWFDEC_TEXT_ATTRIBUTE_TAB_STOPS
,
69 SWFDEC_TEXT_ATTRIBUTE_TARGET
,
70 SWFDEC_TEXT_ATTRIBUTE_UNDERLINE
,
71 SWFDEC_TEXT_ATTRIBUTE_URL
,
72 } SwfdecTextAttribute
;
74 #define SWFDEC_TEXT_ATTRIBUTES_MASK ((1 << (SWFDEC_TEXT_ATTRIBUTE_URL + 1)) - 1)
76 #define SWFDEC_TEXT_ATTRIBUTE_SET(flags, attribute) ((flags) |= (1 << (attribute)))
77 #define SWFDEC_TEXT_ATTRIBUTE_UNSET(flags, attribute) ((flags) &= ~(1 << (attribute)))
78 #define SWFDEC_TEXT_ATTRIBUTE_IS_SET(flags, attribute) (((flags) & (1 << (attribute))) ? TRUE : FALSE)
80 struct _SwfdecTextAttributes
{
81 SwfdecTextAlign align
;
86 SwfdecTextDisplay display
;
93 double letter_spacing
;
104 void swfdec_text_attributes_reset (SwfdecTextAttributes
* attr
);
105 void swfdec_text_attributes_copy (SwfdecTextAttributes
* attr
,
106 const SwfdecTextAttributes
* from
,
108 void swfdec_text_attributes_mark (SwfdecTextAttributes
* attr
);
110 guint
swfdec_text_attributes_diff (const SwfdecTextAttributes
* a
,
111 const SwfdecTextAttributes
* b
);