1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship 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 *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
21 * @file KwTextStyle.cpp
22 * @brief Graphical text style information.
23 * @author James Hogan <james@albanarts.com>
26 #include "KwTextStyle.h"
27 #include "KwDisplayStyles.h"
30 * Constructors + destructor.
33 /// Default constructor.
34 KwTextStyle::KwTextStyle()
36 character
.outline
.enabled
= false;
37 character
.shadow
.enabled
= false;
38 character
.shadow
.offset
= 5;
39 layout
.margins
.left
= 0.05f
;
40 layout
.margins
.right
= 0.05f
;
41 layout
.margins
.top
= 0.05f
;
42 layout
.margins
.bottom
= 0.05f
;
46 KwTextStyle::~KwTextStyle()
51 * CSS Styles interface.
54 /// Load styles from scope.
55 void KwTextStyle::loadFrom(KwCssScope
* scope
)
57 #define GETSTYLE(A,B) A = KwDisplayStyles::text::B(scope)
58 #define GETSTYLE1(A1) GETSTYLE(A1, A1)
59 #define GETSTYLE2(A1,A2) GETSTYLE(A1.A2, A1::A2)
60 #define GETSTYLE3(A1,A2,A3) GETSTYLE(A1.A2.A3, A1::A2::A3)
62 GETSTYLE2(character
, font
);
63 GETSTYLE2(character
, brush
);
64 GETSTYLE3(character
, outline
, enabled
);
65 GETSTYLE3(character
, outline
, pen
);
66 GETSTYLE3(character
, shadow
, enabled
);
67 GETSTYLE3(character
, shadow
, brush
);
68 GETSTYLE3(character
, shadow
, offset
);
69 //GETSTYLE2(layout, alignment);
70 GETSTYLE3(layout
, margins
, left
);
71 GETSTYLE3(layout
, margins
, right
);
72 GETSTYLE3(layout
, margins
, top
);
73 GETSTYLE3(layout
, margins
, bottom
);