-rw-r--r-- | freetype/.cvsignore | 5 | ||||
-rw-r--r-- | freetype/fontfactoryttf_qws.cpp | 4 | ||||
-rw-r--r-- | freetype/fontfactoryttf_qws.h | 4 | ||||
-rw-r--r-- | freetype/freetype.pro | 25 | ||||
-rw-r--r-- | freetype/freetypefactoryimpl.cpp | 4 | ||||
-rw-r--r-- | freetype/freetypefactoryimpl.h | 6 | ||||
-rw-r--r-- | freetype/opie-freetype.control | 8 | ||||
-rw-r--r-- | freetype/qfontdata_p.h | 6 |
8 files changed, 29 insertions, 33 deletions
diff --git a/freetype/.cvsignore b/freetype/.cvsignore new file mode 100644 index 0000000..fccc477 --- a/dev/null +++ b/freetype/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | moc_* | ||
2 | *.moc | ||
3 | Makefile* | ||
4 | qimpenprefbase.h | ||
5 | qimpenprefbase.cpp | ||
diff --git a/freetype/fontfactoryttf_qws.cpp b/freetype/fontfactoryttf_qws.cpp index 66fd96a..5aa53fb 100644 --- a/freetype/fontfactoryttf_qws.cpp +++ b/freetype/fontfactoryttf_qws.cpp | |||
@@ -1,238 +1,238 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | #include "fontfactoryttf_qws.h" | 22 | #include "fontfactoryttf_qws.h" |
23 | 23 | ||
24 | #ifdef QT_NO_FREETYPE | 24 | #ifdef QT_NO_FREETYPE |
25 | 25 | ||
26 | #include "qfontdata_p.h" | 26 | #include "qfontdata_p.h" |
27 | #include <string.h> | 27 | #include <string.h> |
28 | #include <stdio.h> | 28 | #include <stdio.h> |
29 | 29 | ||
30 | #define FLOOR(x) ((x) & -64) | 30 | #define FLOOR(x) ((x) & -64) |
31 | #define CEIL(x) (((x)+63) & -64) | 31 | #define CEIL(x) (((x)+63) & -64) |
32 | #define TRUNC(x) ((x) >> 6) | 32 | #define TRUNC(x) ((x) >> 6) |
33 | 33 | ||
34 | 34 | ||
35 | extern "C" { | 35 | extern "C" { |
36 | #include <ft2build.h> | 36 | #include <ft2build.h> |
37 | #include FT_FREETYPE_H | 37 | #include FT_FREETYPE_H |
38 | #include FT_GLYPH_H | 38 | #include FT_GLYPH_H |
39 | #include FT_OUTLINE_H | 39 | #include FT_OUTLINE_H |
40 | #include FT_BBOX_H | 40 | #include FT_BBOX_H |
41 | } | 41 | } |
42 | 42 | ||
43 | class QDiskFontFT : public QDiskFontPrivate { | 43 | class QDiskFontFT : public QDiskFontPrivate { |
44 | public: | 44 | public: |
45 | FT_Face face; | 45 | FT_Face face; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | class QRenderedFontFT : public QRenderedFont { | 48 | class QRenderedFontFT : public QRenderedFont { |
49 | public: | 49 | public: |
50 | QRenderedFontFT(QDiskFont* f, const QFontDef &d) : | 50 | QRenderedFontFT(QDiskFont* f, const QFontDef &d) : |
51 | QRenderedFont(f,d) | 51 | QRenderedFont(f,d) |
52 | { | 52 | { |
53 | QDiskFontFT *df = (QDiskFontFT*)(f->p); | 53 | QDiskFontFT *df = (QDiskFontFT*)(f->p); |
54 | myface=df->face; | 54 | myface=df->face; |
55 | selectThisSize(); | 55 | selectThisSize(); |
56 | // A 1-pixel baseline is excluded in Qt/Windows/X11 fontmetrics | 56 | // A 1-pixel baseline is excluded in Qt/Windows/X11 fontmetrics |
57 | // (see QFontMetrics::height()) | 57 | // (see QFontMetrics::height()) |
58 | // | 58 | // |
59 | fascent=CEIL(myface->size->metrics.ascender)/64; | 59 | fascent=CEIL(myface->size->metrics.ascender)/64; |
60 | fdescent=-FLOOR(myface->size->metrics.descender)/64-1; | 60 | fdescent=-FLOOR(myface->size->metrics.descender)/64-1; |
61 | fmaxwidth=CEIL(myface->size->metrics.max_advance)/64; | 61 | fmaxwidth=CEIL(myface->size->metrics.max_advance)/64; |
62 | fleading=CEIL(myface->size->metrics.height)/64 | 62 | fleading=CEIL(myface->size->metrics.height)/64 |
63 | - fascent - fdescent + 1; | 63 | - fascent - fdescent + 1; |
64 | 64 | ||
65 | // FT has these in font units | 65 | // FT has these in font units |
66 | funderlinepos = ptsize/200+1; | 66 | funderlinepos = ptsize/200+1; |
67 | funderlinewidth = ptsize/200+1; | 67 | funderlinewidth = ptsize/200+1; |
68 | } | 68 | } |
69 | 69 | ||
70 | ~QRenderedFontFT() | 70 | ~QRenderedFontFT() |
71 | { | 71 | { |
72 | } | 72 | } |
73 | 73 | ||
74 | bool unicode(int & i) const | 74 | bool unicode(int & i) const |
75 | { | 75 | { |
76 | int ret; | 76 | int ret; |
77 | 77 | ||
78 | FT_Face theface=myface; | 78 | FT_Face theface=myface; |
79 | 79 | ||
80 | ret=FT_Get_Char_Index(theface,i); | 80 | ret=FT_Get_Char_Index(theface,i); |
81 | 81 | ||
82 | if (ret==0) { | 82 | if (ret==0) { |
83 | return FALSE; | 83 | return FALSE; |
84 | } else { | 84 | } else { |
85 | i=ret; | 85 | i=ret; |
86 | return TRUE; | 86 | return TRUE; |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | bool inFont(QChar ch) const | 90 | bool inFont(QChar ch) const |
91 | { | 91 | { |
92 | int index = ch.unicode(); | 92 | int index = ch.unicode(); |
93 | return unicode(index); | 93 | return unicode(index); |
94 | } | 94 | } |
95 | 95 | ||
96 | QGlyph render(QChar ch) | 96 | QGlyph render(QChar ch) |
97 | { | 97 | { |
98 | selectThisSize(); | 98 | selectThisSize(); |
99 | 99 | ||
100 | int index = ch.unicode(); | 100 | int index = ch.unicode(); |
101 | if ( !unicode(index) ) | 101 | if ( !unicode(index) ) |
102 | index = 0; | 102 | index = 0; |
103 | QGlyph result; | 103 | QGlyph result; |
104 | 104 | ||
105 | FT_Error err; | 105 | FT_Error err; |
106 | 106 | ||
107 | err=FT_Load_Glyph(myface,index,FT_LOAD_DEFAULT); | 107 | err=FT_Load_Glyph(myface,index,FT_LOAD_DEFAULT); |
108 | if(err) | 108 | if(err) |
109 | qFatal("Load glyph error %x",err); | 109 | qFatal("Load glyph error %x",err); |
110 | 110 | ||
111 | int width,height,pitch,size = 0; | 111 | int width,height,pitch,size = 0; |
112 | FT_Glyph glyph; | 112 | FT_Glyph glyph; |
113 | err=FT_Get_Glyph( myface->glyph, &glyph ); | 113 | err=FT_Get_Glyph( myface->glyph, &glyph ); |
114 | if(err) | 114 | if(err) |
115 | qFatal("Get glyph error %x",err); | 115 | qFatal("Get glyph error %x",err); |
116 | 116 | ||
117 | FT_BBox bbox; | 117 | FT_BBox bbox; |
118 | FT_Glyph_Get_CBox(glyph, ft_glyph_bbox_gridfit, &bbox); | 118 | FT_Glyph_Get_CBox(glyph, ft_glyph_bbox_gridfit, &bbox); |
119 | 119 | ||
120 | FT_Vector origin; | 120 | FT_Vector origin; |
121 | origin.x = -bbox.xMin; | 121 | origin.x = -bbox.xMin; |
122 | origin.y = -bbox.yMin; | 122 | origin.y = -bbox.yMin; |
123 | 123 | ||
124 | if ( FT_IS_SCALABLE(myface) ) { | 124 | if ( FT_IS_SCALABLE(myface) ) { |
125 | err=FT_Glyph_To_Bitmap(&glyph, | 125 | err=FT_Glyph_To_Bitmap(&glyph, |
126 | smooth ? ft_render_mode_normal : ft_render_mode_mono, | 126 | smooth ? ft_render_mode_normal : ft_render_mode_mono, |
127 | &origin, 1); // destroy original glyph | 127 | &origin, 1); // destroy original glyph |
128 | if(err) | 128 | if(err) |
129 | qWarning("Get bitmap error %d",err); | 129 | qWarning("Get bitmap error %d",err); |
130 | } | 130 | } |
131 | 131 | ||
132 | if ( !err ) { | 132 | if ( !err ) { |
133 | FT_Bitmap bm = ((FT_BitmapGlyph)glyph)->bitmap; | 133 | FT_Bitmap bm = ((FT_BitmapGlyph)glyph)->bitmap; |
134 | pitch = bm.pitch; | 134 | pitch = bm.pitch; |
135 | size=pitch*bm.rows; | 135 | size=pitch*bm.rows; |
136 | result.data = new uchar[size]; // XXX memory manage me | 136 | result.data = new uchar[size]; // XXX memory manage me |
137 | width=bm.width; | 137 | width=bm.width; |
138 | height=bm.rows; | 138 | height=bm.rows; |
139 | if ( size ) { | 139 | if ( size ) { |
140 | memcpy( result.data, bm.buffer, size ); | 140 | memcpy( result.data, bm.buffer, size ); |
141 | } else { | 141 | } else { |
142 | result.data = new uchar[0]; // XXX memory manage me | 142 | result.data = new uchar[0]; // XXX memory manage me |
143 | } | 143 | } |
144 | } else { | 144 | } else { |
145 | result.data = new uchar[0]; // XXX memory manage me | 145 | result.data = new uchar[0]; // XXX memory manage me |
146 | } | 146 | } |
147 | 147 | ||
148 | result.metrics = new QGlyphMetrics; | 148 | result.metrics = new QGlyphMetrics; |
149 | memset((char*)result.metrics, 0, sizeof(QGlyphMetrics)); | 149 | memset((char*)result.metrics, 0, sizeof(QGlyphMetrics)); |
150 | result.metrics->bearingx=myface->glyph->metrics.horiBearingX/64; | 150 | result.metrics->bearingx=myface->glyph->metrics.horiBearingX/64; |
151 | result.metrics->advance=myface->glyph->metrics.horiAdvance/64; | 151 | result.metrics->advance=myface->glyph->metrics.horiAdvance/64; |
152 | result.metrics->bearingy=myface->glyph->metrics.horiBearingY/64; | 152 | result.metrics->bearingy=myface->glyph->metrics.horiBearingY/64; |
153 | 153 | ||
154 | result.metrics->linestep=pitch; | 154 | result.metrics->linestep=pitch; |
155 | result.metrics->width=width; | 155 | result.metrics->width=width; |
156 | result.metrics->height=height; | 156 | result.metrics->height=height; |
157 | 157 | ||
158 | FT_Done_Glyph( glyph ); | 158 | FT_Done_Glyph( glyph ); |
159 | 159 | ||
160 | return result; | 160 | return result; |
161 | } | 161 | } |
162 | 162 | ||
163 | FT_Face myface; | 163 | FT_Face myface; |
164 | 164 | ||
165 | private: | 165 | private: |
166 | void selectThisSize() | 166 | void selectThisSize() |
167 | { | 167 | { |
168 | int psize=(ptsize<<6)/10; | 168 | int psize=(ptsize<<6)/10; |
169 | 169 | ||
170 | // Assume 72 dpi for now | 170 | // Assume 72 dpi for now |
171 | const int dpi=72; | 171 | const int dpi=72; |
172 | FT_Error err; | 172 | FT_Error err; |
173 | err=FT_Set_Char_Size(myface, psize,psize,dpi,dpi); | 173 | err=FT_Set_Char_Size(myface, psize,psize,dpi,dpi); |
174 | if (err) { | 174 | if (err) { |
175 | if (FT_IS_SCALABLE(myface) ) { | 175 | if (FT_IS_SCALABLE(myface) ) { |
176 | qWarning("Set char size error %x for size %d",err,ptsize); | 176 | qWarning("Set char size error %x for size %d",err,ptsize); |
177 | } else { | 177 | } else { |
178 | int best=-1; | 178 | int best=-1; |
179 | int bdh=99; | 179 | int bdh=99; |
180 | for (int i=0; i<myface->num_fixed_sizes; i++) { | 180 | for (int i=0; i<myface->num_fixed_sizes; i++) { |
181 | FT_Bitmap_Size& sz=myface->available_sizes[i]; | 181 | FT_Bitmap_Size& sz=myface->available_sizes[i]; |
182 | int dh = sz.height - ptsize*dpi/72/10; | 182 | int dh = sz.height - ptsize*dpi/72/10; |
183 | dh = QABS(dh); | 183 | dh = QABS(dh); |
184 | if ( dh < bdh ) { | 184 | if ( dh < bdh ) { |
185 | bdh=dh; | 185 | bdh=dh; |
186 | best=i; | 186 | best=i; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | if ( best >= 0 ) | 189 | if ( best >= 0 ) |
190 | err=FT_Set_Pixel_Sizes(myface, | 190 | err=FT_Set_Pixel_Sizes(myface, |
191 | myface->available_sizes[best].width, | 191 | myface->available_sizes[best].width, |
192 | myface->available_sizes[best].height); | 192 | myface->available_sizes[best].height); |
193 | if ( err ) | 193 | if ( err ) |
194 | qWarning("Set char size error %x for size %d",err,ptsize); | 194 | qWarning("Set char size error %x for size %d",err,ptsize); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | } | 197 | } |
198 | }; | 198 | }; |
199 | 199 | ||
200 | QFontFactoryFT::QFontFactoryFT() | 200 | QFontFactoryFT::QFontFactoryFT() |
201 | { | 201 | { |
202 | FT_Error err; | 202 | FT_Error err; |
203 | err=FT_Init_FreeType(&library); | 203 | err=FT_Init_FreeType(&library); |
204 | if(err) { | 204 | if(err) { |
205 | qFatal("Couldn't initialise Freetype library"); | 205 | qFatal("Couldn't initialise Freetype library"); |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | QFontFactoryFT::~QFontFactoryFT() | 209 | QFontFactoryFT::~QFontFactoryFT() |
210 | { | 210 | { |
211 | } | 211 | } |
212 | 212 | ||
213 | QString QFontFactoryFT::name() | 213 | QString QFontFactoryFT::name() |
214 | { | 214 | { |
215 | return "FT"; | 215 | return "FT"; |
216 | } | 216 | } |
217 | 217 | ||
218 | QRenderedFont * QFontFactoryFT::get(const QFontDef & f,QDiskFont * f2) | 218 | QRenderedFont * QFontFactoryFT::get(const QFontDef & f,QDiskFont * f2) |
219 | { | 219 | { |
220 | return new QRenderedFontFT(f2, f); | 220 | return new QRenderedFontFT(f2, f); |
221 | } | 221 | } |
222 | 222 | ||
223 | void QFontFactoryFT::load(QDiskFont * qdf) const | 223 | void QFontFactoryFT::load(QDiskFont * qdf) const |
224 | { | 224 | { |
225 | if(qdf->loaded) | 225 | if(qdf->loaded) |
226 | return; | 226 | return; |
227 | QDiskFontFT *f = new QDiskFontFT; | 227 | QDiskFontFT *f = new QDiskFontFT; |
228 | qdf->p=f; | 228 | qdf->p=f; |
229 | FT_Error err; | 229 | FT_Error err; |
230 | err=FT_New_Face(library,qdf->file.ascii(),0,&(f->face)); | 230 | err=FT_New_Face(library,qdf->file.ascii(),0,&(f->face)); |
231 | if(err) { | 231 | if(err) { |
232 | qFatal("Error %d opening face",err); | 232 | qFatal("Error %d opening face",err); |
233 | } | 233 | } |
234 | qdf->loaded=true; | 234 | qdf->loaded=true; |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | #endif // QT_NO_FREETYPE | 238 | #endif // QT_NO_FREETYPE |
diff --git a/freetype/fontfactoryttf_qws.h b/freetype/fontfactoryttf_qws.h index 82b7e49..4ba8ce5 100644 --- a/freetype/fontfactoryttf_qws.h +++ b/freetype/fontfactoryttf_qws.h | |||
@@ -1,64 +1,64 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | #ifndef FONTFACTORY_FT_H | 22 | #ifndef FONTFACTORY_FT_H |
23 | #define FONTFACTORY_FT_H | 23 | #define FONTFACTORY_FT_H |
24 | 24 | ||
25 | #include <qfontmanager_qws.h> | 25 | #include <qfontmanager_qws.h> |
26 | #if QT_VERSION >= 300 | 26 | #if QT_VERSION >= 300 |
27 | # include <private/qfontdata_p.h> | 27 | # include <private/qfontdata_p.h> |
28 | #else | 28 | #else |
29 | # include "qfontdata_p.h" | 29 | # include "qfontdata_p.h" |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | 32 | ||
33 | #ifdef QT_NO_FREETYPE | 33 | #ifdef QT_NO_FREETYPE |
34 | 34 | ||
35 | extern "C" { | 35 | extern "C" { |
36 | #include <ft2build.h> | 36 | #include <ft2build.h> |
37 | #include FT_FREETYPE_H | 37 | #include FT_FREETYPE_H |
38 | } | 38 | } |
39 | 39 | ||
40 | // ascent, descent, width(ch), width(string), maxwidth? | 40 | // ascent, descent, width(ch), width(string), maxwidth? |
41 | // leftbearing, rightbearing, minleftbearing,minrightbearing | 41 | // leftbearing, rightbearing, minleftbearing,minrightbearing |
42 | // leading | 42 | // leading |
43 | 43 | ||
44 | class QFontFactoryFT : public QFontFactory { | 44 | class QFontFactoryFT : public QFontFactory { |
45 | 45 | ||
46 | public: | 46 | public: |
47 | 47 | ||
48 | QFontFactoryFT(); | 48 | QFontFactoryFT(); |
49 | virtual ~QFontFactoryFT(); | 49 | virtual ~QFontFactoryFT(); |
50 | 50 | ||
51 | QRenderedFont * get(const QFontDef &,QDiskFont *); | 51 | QRenderedFont * get(const QFontDef &,QDiskFont *); |
52 | virtual void load(QDiskFont *) const; | 52 | virtual void load(QDiskFont *) const; |
53 | virtual QString name(); | 53 | virtual QString name(); |
54 | 54 | ||
55 | private: | 55 | private: |
56 | 56 | ||
57 | friend class QRenderedFontFT; | 57 | friend class QRenderedFontFT; |
58 | FT_Library library; | 58 | FT_Library library; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | #endif // QT_NO_FREETYPE | 61 | #endif // QT_NO_FREETYPE |
62 | 62 | ||
63 | #endif // QFONTFACTORY_FT_H | 63 | #endif // QFONTFACTORY_FT_H |
64 | 64 | ||
diff --git a/freetype/freetype.pro b/freetype/freetype.pro index 1196db9..5800b48 100644 --- a/freetype/freetype.pro +++ b/freetype/freetype.pro | |||
@@ -1,28 +1,11 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS =fontfactoryttf_qws.h freetypefactoryimpl.h | 3 | HEADERS = fontfactoryttf_qws.h freetypefactoryimpl.h |
4 | SOURCES =fontfactoryttf_qws.cpp freetypefactoryimpl.cpp | 4 | SOURCES = fontfactoryttf_qws.cpp freetypefactoryimpl.cpp |
5 | qt2:HEADERS+= qfontdata_p.h | 5 | qt2:HEADERS+= qfontdata_p.h |
6 | TARGET = freetypefactory | 6 | TARGET = freetypefactory |
7 | DESTDIR = ../plugins/fontfactories | 7 | DESTDIR = $(OPIEDIR)/plugins/fontfactories |
8 | INCLUDEPATH += $(OPIEDIR)/include | 8 | INCLUDEPATH+= $(OPIEDIR)/include |
9 | DEPENDPATH += $(OPIEDIR)/include | 9 | DEPENDPATH += $(OPIEDIR)/include |
10 | #INCLUDEPATH += $(OPIEDIR)/include | ||
11 | #DEPENDPATH+= /usr/local/include/freetype2 | ||
12 | LIBS += -lqpe -lfreetype | 10 | LIBS += -lqpe -lfreetype |
13 | VERSION = 1.0.0 | 11 | VERSION = 1.0.0 |
14 | |||
15 | TRANSLATIONS = ../i18n/de/libfreetypefactory.ts \ | ||
16 | ../i18n/en/libfreetypefactory.ts \ | ||
17 | ../i18n/es/libfreetypefactory.ts \ | ||
18 | ../i18n/fr/libfreetypefactory.ts \ | ||
19 | ../i18n/hu/libfreetypefactory.ts \ | ||
20 | ../i18n/ja/libfreetypefactory.ts \ | ||
21 | ../i18n/ko/libfreetypefactory.ts \ | ||
22 | ../i18n/no/libfreetypefactory.ts \ | ||
23 | ../i18n/pl/libfreetypefactory.ts \ | ||
24 | ../i18n/pt/libfreetypefactory.ts \ | ||
25 | ../i18n/pt_BR/libfreetypefactory.ts \ | ||
26 | ../i18n/sl/libfreetypefactory.ts \ | ||
27 | ../i18n/zh_CN/libfreetypefactory.ts \ | ||
28 | ../i18n/zh_TW/libfreetypefactory.ts | ||
diff --git a/freetype/freetypefactoryimpl.cpp b/freetype/freetypefactoryimpl.cpp index 8c1afab..71460b2 100644 --- a/freetype/freetypefactoryimpl.cpp +++ b/freetype/freetypefactoryimpl.cpp | |||
@@ -1,57 +1,57 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "fontfactoryttf_qws.h" | 20 | #include "fontfactoryttf_qws.h" |
21 | #include "freetypefactoryimpl.h" | 21 | #include "freetypefactoryimpl.h" |
22 | 22 | ||
23 | 23 | ||
24 | FreeTypeFactoryImpl::FreeTypeFactoryImpl() | 24 | FreeTypeFactoryImpl::FreeTypeFactoryImpl() |
25 | : factory(0), ref(0) | 25 | : factory(0), ref(0) |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | FreeTypeFactoryImpl::~FreeTypeFactoryImpl() | 29 | FreeTypeFactoryImpl::~FreeTypeFactoryImpl() |
30 | { | 30 | { |
31 | delete factory; | 31 | delete factory; |
32 | } | 32 | } |
33 | 33 | ||
34 | QFontFactory *FreeTypeFactoryImpl::fontFactory() | 34 | QFontFactory *FreeTypeFactoryImpl::fontFactory() |
35 | { | 35 | { |
36 | if ( !factory ) | 36 | if ( !factory ) |
37 | factory = new QFontFactoryFT(); | 37 | factory = new QFontFactoryFT(); |
38 | return factory; | 38 | return factory; |
39 | } | 39 | } |
40 | 40 | ||
41 | QRESULT FreeTypeFactoryImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 41 | QRESULT FreeTypeFactoryImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
42 | { | 42 | { |
43 | *iface = 0; | 43 | *iface = 0; |
44 | if ( uuid == IID_QUnknown ) | 44 | if ( uuid == IID_QUnknown ) |
45 | *iface = this; | 45 | *iface = this; |
46 | else if ( uuid == IID_FontFactory ) | 46 | else if ( uuid == IID_FontFactory ) |
47 | *iface = this; | 47 | *iface = this; |
48 | 48 | ||
49 | if ( *iface ) | 49 | if ( *iface ) |
50 | (*iface)->addRef(); | 50 | (*iface)->addRef(); |
51 | return QS_OK; | 51 | return QS_OK; |
52 | } | 52 | } |
53 | 53 | ||
54 | Q_EXPORT_INTERFACE() | 54 | Q_EXPORT_INTERFACE() |
55 | { | 55 | { |
56 | Q_CREATE_INSTANCE( FreeTypeFactoryImpl ) | 56 | Q_CREATE_INSTANCE( FreeTypeFactoryImpl ) |
57 | } | 57 | } |
diff --git a/freetype/freetypefactoryimpl.h b/freetype/freetypefactoryimpl.h index d7c376e..4c0d5f5 100644 --- a/freetype/freetypefactoryimpl.h +++ b/freetype/freetypefactoryimpl.h | |||
@@ -1,40 +1,40 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | #include <fontfactoryinterface.h> | 22 | #include <qpe/fontfactoryinterface.h> |
23 | 23 | ||
24 | class QFontFactoryFT; | 24 | class QFontFactoryFT; |
25 | 25 | ||
26 | class FreeTypeFactoryImpl : public FontFactoryInterface | 26 | class FreeTypeFactoryImpl : public FontFactoryInterface |
27 | { | 27 | { |
28 | public: | 28 | public: |
29 | FreeTypeFactoryImpl(); | 29 | FreeTypeFactoryImpl(); |
30 | virtual ~FreeTypeFactoryImpl(); | 30 | virtual ~FreeTypeFactoryImpl(); |
31 | 31 | ||
32 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | 32 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); |
33 | Q_REFCOUNT | 33 | Q_REFCOUNT |
34 | 34 | ||
35 | virtual QFontFactory *fontFactory(); | 35 | virtual QFontFactory *fontFactory(); |
36 | 36 | ||
37 | private: | 37 | private: |
38 | QFontFactoryFT *factory; | 38 | QFontFactoryFT *factory; |
39 | ulong ref; | 39 | ulong ref; |
40 | }; | 40 | }; |
diff --git a/freetype/opie-freetype.control b/freetype/opie-freetype.control new file mode 100644 index 0000000..f1ce408 --- a/dev/null +++ b/freetype/opie-freetype.control | |||
@@ -0,0 +1,8 @@ | |||
1 | Files: plugins/fontfactories/libfreetypefactory* | ||
2 | Priority: optional | ||
3 | Section: opie/plugins | ||
4 | Maintainer: Opie <opie@llornkcor.com> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-$SUB_VERSION | ||
7 | Depends: opie-base ($QPE_VERSION) | ||
8 | Description: Freetype fontfactory plugin | ||
diff --git a/freetype/qfontdata_p.h b/freetype/qfontdata_p.h index fc22c72..9da1d06 100644 --- a/freetype/qfontdata_p.h +++ b/freetype/qfontdata_p.h | |||
@@ -1,94 +1,94 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | #ifndef QFONTDATA_P_H | 22 | #ifndef QFONTDATA_P_H |
23 | #define QFONTDATA_P_H | 23 | #define QFONTDATA_P_H |
24 | 24 | ||
25 | 25 | ||
26 | // | 26 | // |
27 | // W A R N I N G | 27 | // W A R N I N G |
28 | // ------------- | 28 | // ------------- |
29 | // | 29 | // |
30 | // This file is not part of the Qt API. It exists for the convenience | 30 | // This file is not part of the Qt API. It exists for the convenience |
31 | // of qmenudata.cpp, qmenubar.cpp, qmenubar.cpp, qpopupmenu.cpp, | 31 | // of qmenudata.cpp, qmenubar.cpp, qmenubar.cpp, qpopupmenu.cpp, |
32 | // qmotifstyle.cpp and qwindowssstyle.cpp. This header file may change | 32 | // qmotifstyle.cpp and qwindowssstyle.cpp. This header file may change |
33 | // from version to version without notice, or even be removed. | 33 | // from version to version without notice, or even be removed. |
34 | // | 34 | // |
35 | // We mean it. | 35 | // We mean it. |
36 | // | 36 | // oh, we're really scared. |
37 | // | 37 | // |
38 | 38 | ||
39 | #ifndef QT_H | 39 | #ifndef QT_H |
40 | #endif // QT_H | 40 | #endif // QT_H |
41 | 41 | ||
42 | struct QFontDef { // font definition | 42 | struct QFontDef { // font definition |
43 | QStringfamily; | 43 | QStringfamily; |
44 | QStringaddStyle; | 44 | QStringaddStyle; |
45 | int pointSize; | 45 | int pointSize; |
46 | uint styleHint: 8; | 46 | uint styleHint: 8; |
47 | uint styleStrategy: 8; | 47 | uint styleStrategy: 8; |
48 | uint charSet : 8; | 48 | uint charSet : 8; |
49 | uint weight : 8; | 49 | uint weight : 8; |
50 | uint italic : 1; | 50 | uint italic : 1; |
51 | uint underline: 1; | 51 | uint underline: 1; |
52 | uint strikeOut: 1; | 52 | uint strikeOut: 1; |
53 | uint fixedPitch: 1; | 53 | uint fixedPitch: 1; |
54 | uint hintSetByUser: 1; | 54 | uint hintSetByUser: 1; |
55 | uint rawMode : 1; | 55 | uint rawMode : 1; |
56 | uint dirty : 1; | 56 | uint dirty : 1; |
57 | shortlbearing; | 57 | shortlbearing; |
58 | shortrbearing; | 58 | shortrbearing; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | 61 | ||
62 | class QFontInternal; | 62 | class QFontInternal; |
63 | class QTextCodec; | 63 | class QTextCodec; |
64 | 64 | ||
65 | struct QFontData : public QShared { | 65 | struct QFontData : public QShared { |
66 | QFontData() | 66 | QFontData() |
67 | : exactMatch(FALSE), fin(0), printerHackFont( 0 ) | 67 | : exactMatch(FALSE), fin(0), printerHackFont( 0 ) |
68 | {} | 68 | {} |
69 | QFontData( const QFontData &d ) | 69 | QFontData( const QFontData &d ) |
70 | : QShared(d), req(d.req), exactMatch(d.exactMatch), fin(d.fin), | 70 | : QShared(d), req(d.req), exactMatch(d.exactMatch), fin(d.fin), |
71 | printerHackFont(0) | 71 | printerHackFont(0) |
72 | // Copy the QShared count as well. The count may need to be | 72 | // Copy the QShared count as well. The count may need to be |
73 | // reset when using the QFontData class, see QFont::QFont(QFontData*) | 73 | // reset when using the QFontData class, see QFont::QFont(QFontData*) |
74 | {} | 74 | {} |
75 | ~QFontData() | 75 | ~QFontData() |
76 | {} | 76 | {} |
77 | QFontData &operator=( const QFontData &d ) | 77 | QFontData &operator=( const QFontData &d ) |
78 | { | 78 | { |
79 | req = d.req; | 79 | req = d.req; |
80 | exactMatch = d.exactMatch; | 80 | exactMatch = d.exactMatch; |
81 | fin = d.fin; | 81 | fin = d.fin; |
82 | printerHackFont=d.printerHackFont; | 82 | printerHackFont=d.printerHackFont; |
83 | return *this; | 83 | return *this; |
84 | } | 84 | } |
85 | QFontDef req; // requested font | 85 | QFontDef req; // requested font |
86 | bool exactMatch; | 86 | bool exactMatch; |
87 | QFontInternal *fin; | 87 | QFontInternal *fin; |
88 | QFont *printerHackFont; | 88 | QFont *printerHackFont; |
89 | const QTextCodec *mapper() const; | 89 | const QTextCodec *mapper() const; |
90 | void *fontSet() const; | 90 | void *fontSet() const; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | 93 | ||
94 | #endif // QFONTDATA_P_H | 94 | #endif // QFONTDATA_P_H |