Subversion Repositories Scribus

Rev

Rev 6144 | Rev 6164 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
3878 cbradney 7
#ifndef SCTEXTSTRUCT_H
8
#define SCTEXTSTRUCT_H
9
 
10
#ifdef HAVE_CONFIG_H
11
#include "scconfig.h"
12
#endif
13
 
4689 mrdocs 14
#include "scribusapi.h"
5184 avox 15
#include "text/nlsconfig.h"
4689 mrdocs 16
 
4670 avox 17
#ifdef NLS_CONFORMANCE
18
#define NLS_PRIVATE private
19
#else
20
#define NLS_PRIVATE public
21
#endif
22
 
3878 cbradney 23
#include <qstring.h>
24
 
5559 avox 25
#include "scfonts.h"
5691 avox 26
#include "style.h"
5559 avox 27
 
3878 cbradney 28
class PageItem;
29
 
30
/* Struktur fuer Pageitem Text */
4670 avox 31
 
32
 
33
/*
34
 *  sctext.h
35
 *  Scribus
36
 *
37
 *  Created by Andreas Vox on 29.07.05.
38
 *  Copyright 2005 under GPL2. All rights reserved.
39
 *
40
 */
41
 
42
 
43
 
5691 avox 44
/**
45
 * This struct stores a positioned glyph. This is the result of the layout process.
46
 * If a char gets translated to more than one glyph, a linked list is built.
47
 */
48
struct SCRIBUS_API GlyphLayout {
49
        float xadvance;
50
        float yadvance;
51
        float xoffset;
52
        float yoffset;
53
        double scaleV;
54
        double scaleH;
55
        uint glyph;
56
        GlyphLayout* more;
6144 avox 57
 
5691 avox 58
        GlyphLayout() : xadvance(0.0f), yadvance(0.0f), xoffset(0.0f), yoffset(0.0f),
6144 avox 59
                scaleV(1.0), scaleH(1.0), glyph(0), more(NULL)
60
        { }
61
        double wide() const
62
        {
63
                double ret = 0;
64
                for(const GlyphLayout* p=this; p; p=p->more)
65
                        ret += p->xadvance;
66
                return ret;
67
        }
68
        GlyphLayout* last()
69
        {
70
                if (more)
71
                        return more->last();
72
                else
73
                        return this;
74
        }
75
        void shrink()
76
        {
77
                if (more) {
78
                        more->shrink();
79
                        delete more;
80
                        more = NULL;
81
                }
82
        }
83
        void grow()
84
        {
85
                if (!more) {
86
                        more = new GlyphLayout();
87
                }
88
        }
89
 
4670 avox 90
};
91
 
5184 avox 92
#ifndef NLS_PROTO
4689 mrdocs 93
class SCRIBUS_API ScText : public CharStyle
4670 avox 94
{
95
public:
5721 avox 96
//      bool cselect; // to go
97
//      short cab; // to go
5691 avox 98
        ParagraphStyle* parstyle; // only for parseps
99
        GlyphLayout glyph;
3878 cbradney 100
        float PtransX;
101
        float PtransY;
102
        float PRot;
103
        PageItem* cembedded;
104
        QString ch;
5721 avox 105
        ScText() : //cselect(false), cab(0), 
106
                parstyle(NULL), glyph(),
5691 avox 107
                PtransX(0.0f), PtransY(0.0f), PRot(0.0f), cembedded(NULL), ch() {}
6144 avox 108
        ScText(const ScText& other) :
109
                CharStyle(other),
110
                parstyle(NULL), glyph(other.glyph),
111
                PtransX(other.PtransX), PtransY(other.PtransY), PRot(other.PRot),
6163 avox 112
                cembedded(other.cembedded), ch(other.ch), Style(other)
6144 avox 113
        {
114
                if (other.parstyle)
115
                        parstyle = new ParagraphStyle(*other.parstyle);
116
        }
5691 avox 117
        ~ScText();
3878 cbradney 118
};
5184 avox 119
#endif
120
 
3878 cbradney 121
#endif // SCTEXTSTRUCT_H
122