font-instance.h revision ab91419e24a26d71df2738bbf7d95a05af5a079f
#ifndef SEEN_LIBNRTYPE_FONT_INSTANCE_H
#define SEEN_LIBNRTYPE_FONT_INSTANCE_H
#include <map>
#include <pango/pango-types.h>
#include <pango/pango-font.h>
#include <require-config.h>
#include "FontFactory.h"
#include <libnrtype/font-style.h>
struct font_glyph;
// the font_instance are the template of several raster_font; they provide metrics and outlines
// that are drawn by the raster_font, so the raster_font needs info relative to the way the
// font need to be drawn. note that fontsize is a scale factor in the transform matrix
// of the style
// the real source of the font
// depending on the rendering backend, different temporary data
// that's the font's fingerprint; this particular PangoFontDescription gives the entry at which this font_instance
// resides in the font_factory loadedFaces unordered_map
// refcount
int refCount;
// font_factory owning this font_instance
// common glyph definitions for all the rasterfonts
// Map of OpenType tables found in font (convert to std::set?)
font_instance(void);
virtual ~font_instance(void);
void Ref(void);
void Unref(void);
bool IsOutlineFont(void); // utility
// in case the PangoFont is a bitmap font, for example. that way, the calling function
// will be able to check the validity of the font before installing it in loadedFaces
void InitTheFace();
// loads the given glyph's info
// nota: all coordinates returned by these functions are on a [0..1] scale; you need to multiply
// by the fontsize to get the real sizes
// Return 2geom pathvector for glyph. Deallocated when font instance dies.
// Horizontal advance if 'vertical' is false, vertical advance if true.
double GetTypoAscent() { return _ascent; }
double GetTypoDescent() { return _descent; }
double GetXHeight() { return _xheight; }
double GetMaxAscent() { return _ascent_max; }
double GetMaxDescent() { return _descent_max; }
const double* GetBaselines() { return _baselines; }
double &linethrough_position, double &linethrough_thickness);
// for generating slanted cursors for oblique fonts
void FreeTheFace();
// Find ascent, descent, x-height, and baselines.
void FindFontMetrics();
// Temp: make public
#ifdef USE_PANGO_WIN32
#else
// as long as pFont is valid, theFace is too
#endif
// Font metrics in em-box units
double _ascent; // Typographic ascent.
double _descent; // Typographic descent.
double _xheight; // x-height of font.
double _ascent_max; // Maxiumum ascent of all glyphs in font.
double _descent_max; // Maxiumum descent of all glyphs in font.
// Baselines
double _baselines[SP_CSS_BASELINE_SIZE];
};
#endif /* !SEEN_LIBNRTYPE_FONT_INSTANCE_H */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :