summaryrefslogtreecommitdiffstats
path: root/src/display/nr-svgfonts.h
blob: ffc54f67d1f68a0709a594c53b6bf138734cc683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef NR_SVGFONTS_H_SEEN
#define NR_SVGFONTS_H_SEEN
/*
 * SVGFonts rendering headear
 *
 * Authors:
 *    Felipe C. da S. Sanches <juca@members.fsf.org>
 *
 * Copyright (C) 2008 Felipe C. da S. Sanches
 *
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 * Read the file 'COPYING' for more information.
 */

#include <cairo.h>
#include <sigc++/connection.h>
#include <2geom/pathvector.h>

class SvgFont;
class SPFont;
class SPGlyph;
class SPMissingGlyph;
class SPObject;

extern "C" { typedef struct _GdkEventExpose GdkEventExpose; }

namespace Gtk {
class Widget;
}

class UserFont {
public:
    UserFont(SvgFont* instance);
    cairo_font_face_t* face;
};

class SvgFont {
public:
    SvgFont(SPFont* spfont);
    void refresh();
    cairo_font_face_t* get_font_face();
    cairo_status_t scaled_font_init (cairo_scaled_font_t *scaled_font, cairo_font_extents_t *metrics);
    cairo_status_t scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font, const char *utf8, int utf8_len, cairo_glyph_t **glyphs, int *num_glyphs, cairo_text_cluster_t **clusters, int *num_clusters, cairo_text_cluster_flags_t *flags);
    cairo_status_t scaled_font_render_glyph (cairo_scaled_font_t *scaled_font, unsigned long glyph, cairo_t *cr, cairo_text_extents_t *metrics);

    Geom::PathVector flip_coordinate_system(SPFont* spfont, Geom::PathVector pathv);
    void render_glyph_path(cairo_t* cr, Geom::PathVector* pathv);
    void glyph_modified(SPObject *, unsigned int);

private:
    SPFont* font;
    UserFont* userfont;
    std::vector<SPGlyph*> glyphs;
    SPMissingGlyph* missingglyph;
    sigc::connection glyph_modified_connection;

    double units_per_em();
    //bool drawing_expose_cb (Gtk::Widget *widget, GdkEventExpose *event, void* data);
};

#endif //#ifndef NR_SVGFONTS_H_SEEN

/*
  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:fileencoding=utf-8 :