summaryrefslogtreecommitdiff
path: root/freetype/fontfactoryttf_qws.cpp
Unidiff
Diffstat (limited to 'freetype/fontfactoryttf_qws.cpp') (more/less context) (show whitespace changes)
-rw-r--r--freetype/fontfactoryttf_qws.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/freetype/fontfactoryttf_qws.cpp b/freetype/fontfactoryttf_qws.cpp
index 1ed0d2c..6d41c33 100644
--- a/freetype/fontfactoryttf_qws.cpp
+++ b/freetype/fontfactoryttf_qws.cpp
@@ -1,85 +1,89 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the 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#include "fontfactoryttf_qws.h" 21#include "fontfactoryttf_qws.h"
22 22
23#include <opie2/odebug.h> 23#include <opie2/odebug.h>
24using namespace Opie::Core; 24using namespace Opie::Core;
25 25
26#ifdef QT_NO_FREETYPE 26#ifdef QT_NO_FREETYPE
27 27
28#include "qfontdata_p.h" 28#include "qfontdata_p.h"
29#include <string.h> 29#include <string.h>
30#include <stdio.h> 30#include <stdio.h>
31 31
32#define FLOOR(x) ((x) & -64) 32#define FLOOR(x) ((x) & -64)
33#define CEIL(x) (((x)+63) & -64) 33#define CEIL(x) (((x)+63) & -64)
34#define TRUNC(x) ((x) >> 6) 34#define TRUNC(x) ((x) >> 6)
35 35
36 36
37extern "C" { 37extern "C" {
38
39#include <ft2build.h>
40#include FT_FREETYPE_H
41
38#include <freetype/freetype.h> 42#include <freetype/freetype.h>
39#include <freetype/ftglyph.h> 43#include <freetype/ftglyph.h>
40#include <freetype/ftoutln.h> 44#include <freetype/ftoutln.h>
41#include <freetype/ftbbox.h> 45#include <freetype/ftbbox.h>
42} 46}
43 47
44class QDiskFontFT : public QDiskFontPrivate { 48class QDiskFontFT : public QDiskFontPrivate {
45public: 49public:
46 FT_Face face; 50 FT_Face face;
47}; 51};
48 52
49class QRenderedFontFT : public QRenderedFont { 53class QRenderedFontFT : public QRenderedFont {
50public: 54public:
51 QRenderedFontFT(QDiskFont* f, const QFontDef &d) : 55 QRenderedFontFT(QDiskFont* f, const QFontDef &d) :
52 QRenderedFont(f,d) 56 QRenderedFont(f,d)
53 { 57 {
54 QDiskFontFT *df = (QDiskFontFT*)(f->p); 58 QDiskFontFT *df = (QDiskFontFT*)(f->p);
55 myface=df->face; 59 myface=df->face;
56 selectThisSize(); 60 selectThisSize();
57 // A 1-pixel baseline is excluded in Qt/Windows/X11 fontmetrics 61 // A 1-pixel baseline is excluded in Qt/Windows/X11 fontmetrics
58 // (see QFontMetrics::height()) 62 // (see QFontMetrics::height())
59 // 63 //
60 fascent=CEIL(myface->size->metrics.ascender)/64; 64 fascent=CEIL(myface->size->metrics.ascender)/64;
61 fdescent=-FLOOR(myface->size->metrics.descender)/64-1; 65 fdescent=-FLOOR(myface->size->metrics.descender)/64-1;
62 fmaxwidth=CEIL(myface->size->metrics.max_advance)/64; 66 fmaxwidth=CEIL(myface->size->metrics.max_advance)/64;
63 fleading=CEIL(myface->size->metrics.height)/64 67 fleading=CEIL(myface->size->metrics.height)/64
64 - fascent - fdescent + 1; 68 - fascent - fdescent + 1;
65 69
66 // FT has these in font units 70 // FT has these in font units
67 funderlinepos = ptsize/200+1; 71 funderlinepos = ptsize/200+1;
68 funderlinewidth = ptsize/200+1; 72 funderlinewidth = ptsize/200+1;
69 } 73 }
70 74
71 ~QRenderedFontFT() 75 ~QRenderedFontFT()
72 { 76 {
73 // When inter-process glyph sharing is implemented, the glyph data 77 // When inter-process glyph sharing is implemented, the glyph data
74 // for this font can be dereferenced here. 78 // for this font can be dereferenced here.
75 } 79 }
76 80
77 bool unicode(int & i) const 81 bool unicode(int & i) const
78 { 82 {
79 int ret; 83 int ret;
80 84
81 FT_Face theface=myface; 85 FT_Face theface=myface;
82 86
83 ret=FT_Get_Char_Index(theface,i); 87 ret=FT_Get_Char_Index(theface,i);
84 88
85 if (ret==0) { 89 if (ret==0) {