/*
* Canvas text
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Maximilian Albert <maximilian.albert@gmail.com>
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2000-2002 Lauris Kaplinski
* Copyright (C) 2008 Maximilian Albert
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <sstream>
#include <string.h>
#include "sp-canvas-util.h"
#include "canvas-text.h"
#include "display/cairo-utils.h"
#include "desktop.h"
#include "color.h"
#include "display/sp-canvas.h"
static void sp_canvastext_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags);
{
}
static void
{
canvastext->anchor_offset_x = 0;
canvastext->anchor_offset_y = 0;
canvastext->background = false;
canvastext->outline = false;
canvastext->background = false;
canvastext->border = 3; // must be a constant, and not proportional to any width, height, or fontsize to allow alignment with other text boxes
}
{
}
static void
{
return;
if (cl->background){
}
}
}
static void
{
// Point s specifies the position of the anchor, which is at the bounding box of the text itself (i.e. not at the border of the filled background rectangle)
// The relative position of the anchor can be set using e.g. anchor_position = TEXT_ANCHOR_LEFT
// 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
- Glyph surfaces: In most font rendering systems, glyph surfaces
have an origin at (0,0) and a bounding box that is typically
represented as (x_bearing,y_bearing,width,height). Depending on
which way y progresses in the system, y_bearing may typically be
negative (for systems similar to cairo, with origin at top left),
or be positive (in systems like PDF with origin at bottom left).
No matter which is the case, it is important to note that
(x_bearing,y_bearing) is the coordinates of top-left of the glyph
relative to the glyph origin. That is, for example:
Scaled-glyph space:
(x_bearing,y_bearing) <-- negative numbers
+----------------+
| . |
| . |
|......(0,0) <---|-- glyph origin
| |
| |
+----------------+
(width+x_bearing,height+y_bearing)
Note the similarity of the origin to the device space. That is
exactly how we use the device_offset to represent scaled glyphs:
to use the device-space origin as the glyph origin.
*/
// adjust update region according to anchor shift
switch (cl->anchor_position){
case TEXT_ANCHOR_LEFT:
cl->anchor_offset_x = 0;
break;
case TEXT_ANCHOR_RIGHT:
break;
case TEXT_ANCHOR_BOTTOM:
cl->anchor_offset_y = 0;
break;
case TEXT_ANCHOR_TOP:
break;
case TEXT_ANCHOR_ZERO:
cl->anchor_offset_x = 0;
cl->anchor_offset_y = 0;
break;
case TEXT_ANCHOR_MANUAL:
break;
case TEXT_ANCHOR_CENTER:
default:
break;
}
}
SPCanvasText *sp_canvastext_new(SPCanvasGroup *parent, SPDesktop *desktop, Geom::Point pos, gchar const *new_text)
{
// Pos specifies the position of the anchor, which is at the bounding box of the text itself (i.e. not at the border of the filled background rectangle)
// The relative position of the anchor can be set using e.g. anchor_position = TEXT_ANCHOR_LEFT
return ct;
}
void
{
}
}
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:fileencoding=utf-8:textwidth=99 :