Scribus
Open source desktop publishing at your fingertips
ftface.h
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 */
7 
8 #ifndef FT_FACE_H
9 #define FT_FACE_H
10 
11 #include <QString>
12 #include <QMap>
13 
14 #include "scribusapi.h"
15 
16 #include "fonts/scface.h"
17 
18 #include <ft2build.h>
19 #include FT_FREETYPE_H
20 
21 #include "fpointarray.h"
22 
23 FT_Error ftIOFunc( FT_Stream stream, unsigned long pos, unsigned char* buffer, unsigned long count);
24 
25 
53 struct SCRIBUS_API FtFace : public ScFace::ScFaceData
54 {
55 
56  FtFace(QString fam, QString sty, QString variant, QString scname,
57  QString psname, QString path, int face);
58 
59  FT_Face ftFace() const;
60 
61  virtual ~FtFace();
62 
63  // font metrics
64  qreal ascent(qreal sz=1.0) const { return m_ascent * sz; }
65  qreal descent(qreal sz=1.0) const { return m_descent * sz; }
66  qreal xHeight(qreal sz=1.0) const { return m_xHeight * sz; }
67  qreal capHeight(qreal sz=1.0) const { return m_capHeight * sz; }
68  qreal height(qreal sz=1.0) const { return m_height * sz; }
69  qreal strikeoutPos(qreal sz=1.0) const { return m_strikeoutPos * sz; }
70  qreal underlinePos(qreal sz=1.0) const { return m_underlinePos * sz; }
71  qreal strokeWidth(qreal /*sz*/) const { return m_strokeWidth; }
72  qreal maxAdvanceWidth(qreal sz=1.0) const { return m_maxAdvanceWidth * sz; }
73  QString pdfAscentAsString() const { return m_pdfAscent; }
74  QString pdfDescentAsString() const { return m_pdfDescender; }
75  QString pdfCapHeightAsString() const { return m_pdfCapHeight; }
76  QString pdfFontBBoxAsString() const { return m_pdfFontBBox; }
77  QString italicAngleAsString() const { return m_italicAngle; }
78 
79 
80 //FIXME QMap<QString,QString> fontDictionary(qreal sz=1.0) const;
81 
82  ScFace::gid_type char2CMap(QChar ch) const;
83 
84  qreal glyphKerning (ScFace::gid_type gl1, ScFace::gid_type gl2, qreal sz) const;
85 // GlyphMetrics glyphBBox (gid_type gl, qreal sz) const;
86 
87  void RawData (QByteArray & bb) const;
88 
89  static bool hasMicrosoftUnicodeCmap(FT_Face face);
90  static QString adobeGlyphName(FT_ULong charcode);
91  virtual bool glyphNames(ScFace::FaceEncoding& GList) const;
92 
93  void load () const;
94  void unload () const;
95  void loadGlyph (ScFace::gid_type gl) const;
96 
97 protected:
98  mutable FT_Face m_face;
99 
100  static FT_Library library;
101 
102  mutable QString m_pdfAscent;
103  mutable QString m_pdfCapHeight;
104  mutable QString m_pdfDescender;
105  mutable QString m_italicAngle;
106  mutable QString m_pdfFontBBox;
107 
108  mutable int m_encoding;
109 
110  mutable qreal m_uniEM;
111  mutable qreal m_ascent;
112  mutable qreal m_descent;
113  mutable qreal m_height;
114  mutable qreal m_xHeight;
115  mutable qreal m_capHeight;
116  mutable qreal m_maxAdvanceWidth;
117  mutable qreal m_underlinePos;
118  mutable qreal m_strikeoutPos;
119  mutable qreal m_strokeWidth;
120 
121 };
122 
123 #endif
Base Class FtFace provides an ScFace private implementation for Freetype based fonts. Subclasses are ScFace_ps and ScFace_ttf.
Definition: ftface.h:53
see accessors for ScFace for docs
Definition: scface.h:101
Binary buffer.
Definition: pdbim.h:93