summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d7392a0)
raw | patch | inline | side by side (parent: d7392a0)
author | Johan Engelen <goejendaagh@zonnet.nl> | |
Mon, 22 Feb 2010 21:52:22 +0000 (22:52 +0100) | ||
committer | Johan Engelen <goejendaagh@zonnet.nl> | |
Mon, 22 Feb 2010 21:52:22 +0000 (22:52 +0100) |
src/extension/internal/latex-text-renderer.cpp | patch | blob | history |
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index 7290bda5685cf823b2b3715c35221ec10bd425c7..e07b17fb83b8ce8a431ff9bdf8d13f547f528fe0 100644 (file)
LaTeXTextRenderer::sp_text_render(SPItem *item)
{
SPText *textobj = SP_TEXT (item);
+ SPStyle *style = SP_OBJECT_STYLE (SP_OBJECT(item));
gchar *str = sp_te_get_string_multiline(item);
Geom::OptRect bbox = item->getBounds(transform());
Geom::Interval bbox_x = (*bbox)[Geom::X];
Geom::Interval bbox_y = (*bbox)[Geom::Y];
- SPStyle *style = SP_OBJECT_STYLE (SP_OBJECT(item));
switch (style->text_anchor.computed) {
case SP_CSS_TEXT_ANCHOR_START:
pos = Geom::Point( bbox_x.min() , bbox_y.middle() );
break;
}
+ // determine color (for now, use rgb color model as it is most native to Inkscape)
+ bool has_color = false; // if the item has no color set, don't force black color
+ // TODO: how to handle ICC colors?
+ // give priority to fill color
+ guint32 rgba = 0;
+ if (style->fill.set && style->fill.isColor()) {
+ has_color = true;
+ rgba = style->fill.value.color.toRGBA32(1.);
+ } else if (style->stroke.set && style->stroke.isColor()) {
+ has_color = true;
+ rgba = style->stroke.value.color.toRGBA32(1.);
+ }
+
+
// get rotation
Geom::Matrix i2doc = sp_item_i2doc_affine(item);
Geom::Matrix wotransl = i2doc.without_translation();
Inkscape::SVGOStringStream os;
os << " \\put(" << pos[Geom::X] << "," << pos[Geom::Y] << "){";
+ if (has_color) {
+ os << "\\color[rgb]{" << SP_RGBA32_R_F(rgba) << "," << SP_RGBA32_G_F(rgba) << "," << SP_RGBA32_B_F(rgba) << "}";
+ }
os << "\\makebox(0,0)" << alignment << "{";
if (has_rotation) {
os << "\\rotatebox{" << degrees << "}{";