/*
vface.h
intended to provide virtual font
pierre marchand - 2006
*/
/* ALL THIS IS DUMMY IMPLEMENTATION
FOR TEST PURPOSE ONLY
I'm far to be an xml designer or however it has to be called, so I present the xml/ufr format quite simply (no schema inside).
.
.
.
.
... to say that you can have as many font elements as you want and other ones will come asap !
*/
#ifndef V_FACE_H
#define V_FACE_H
#include
#include
#include
#include
#include
#include "scribusapi.h"
#include "fonts/scface.h"
#include "fonts/scfontmetrics.h"
//#include "fpointarray.h"
#include
#include FT_FREETYPE_H
struct SCRIBUS_API VFace : public ScFace::ScFaceData
{
VFace(QString fam, QString sty, QString scname, QString path);
virtual ~VFace();
void load() const;
void unload() const;
void loadRessource() const;
void loadGlyphs() const;
struct Glyph
{
double width;
double ascent;
double descent;
FPointArray outline;
double x;
double y;
bool broken;
Glyph() : outline(), x(0), y(0), broken(true) {};
};
void updateGlyphNames(FT_Face face, uint gl, QChar ch) const;
// font metrics
double ascent(double sz=1.0) const { return v_ascent * sz; }
double descent(double sz=1.0) const { return v_descent * sz; }
double xHeight(double sz=1.0) const { return v_xHeight * sz; }
double capHeight(double sz=1.0) const { return v_capHeight * sz; }
double height(double sz=1.0) const { return v_height * sz; }
double strikeoutPos(double sz=1.0) const { return v_strikeoutPos * sz; }
double underlinePos(double sz=1.0) const { return v_underlinePos * sz; }
double strokeWidth(double sz=1.0) const { return v_strokeWidth; }
double maxAdvanceWidth(double sz=1.0) const { return v_maxAdvanceWidth * sz; }
// QString ascentAsString() const { return Ascent; }
// QString descentAsString() const { return Descender; }
// QString capHeightAsString() const { return CapHeight; }
// QString FontBBoxAsString() const { return FontBBox; }
// QString ItalicAngleAsString() const { return ItalicAngle; }
uint char2CMap(QChar ch)const{return v_char[ch];}
GlyphMetrics glyphBBox (uint gl, double sz) const;
double glyphWidth(uint gl, double sz) const;
FPointArray glyphOutline(uint gl, double sz) const;
FPoint glyphOrigin(uint gl, double sz) const;
double glyphKerning (uint gl1, uint gl2, double sz) const;
mutable double v_ascent;
mutable double v_descent;
mutable double v_height;
mutable double v_xHeight;
mutable double v_capHeight;
mutable double v_strikeoutPos;
mutable double v_underlinePos;
mutable double v_strokeWidth;
mutable double v_maxAdvanceWidth;
// Stock
mutable QMap v_font; // < codepoint, font name >
mutable QMap v_path; // < font name, font file path >
mutable QMap > v_name; // < glyph index < codepoint , name of glyph> >
mutable QMap v_char; // < codepoint, glyph index >
mutable QMap , double> v_kern;
mutable QMap v; // < glyph index, glyph >
};
#endif