canvas-text.cpp revision 045dbd46344e3ca3c53f678c2d3b4087fbbcacb7
#define __SP_CANVASTEXT_C__
/*
* Canvas text
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Maximilian Albert <maximilian.albert@gmail.com>
*
* Copyright (C) 2000-2002 Lauris Kaplinski
* Copyright (C) 2008 Maximilian Albert
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "display-forward.h"
#include "sp-canvas-util.h"
#include "canvas-text.h"
#include "display/inkscape-cairo.h"
#include <sstream>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <color.h>
#include <libnr/nr-matrix-fns.h>
#include <libnr/nr-pixops.h>
static void sp_canvastext_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags);
static SPCanvasItemClass *parent_class_ct;
sp_canvastext_get_type (void)
{
if (!type) {
GtkTypeInfo info = {
"SPCanvasText",
sizeof (SPCanvasText),
sizeof (SPCanvasTextClass),
};
}
return type;
}
static void
{
}
static void
{
}
static void
{
}
// FIXME: remove this as soon as we know how to correctly determine the text extent
static const double arbitrary_factor = 0.7;
// these are set in sp_canvastext_update() and then re-used in sp_canvastext_render(), which is called afterwards
static double anchor_offset_x = 0;
static double anchor_offset_y = 0;
static void
{
return;
cairo_set_source_rgba(buf->ct, SP_RGBA32_B_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_R_F(rgba), SP_RGBA32_A_F(rgba));
}
static void
{
sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
if (parent_class_ct->update)
// set up a temporary cairo_t to measure the text extents; it would be better to compute this in the render()
// method but update() seems to be called before so we don't have the information available when we need it
/**
cairo_t tmp_buf;
cairo_text_extents_t bbox;
cairo_text_extents(&tmp_buf, cl->text, &bbox);
**/
// adjust update region according to anchor shift
// FIXME: use the correct text extent
sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
}
{
// TODO: anything else to do?
return item;
}
void
{
sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
}
}
#define EPSILON 1e-6
void
{
}
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
/*
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:encoding=utf-8:textwidth=99 :