~ubuntu-branches/ubuntu/precise/ipe/precise

« back to all changes in this revision

Viewing changes to src/ipelib/ipeobj.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2007-01-09 23:14:51 UTC
  • mfrom: (3.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20070109231451-3nd095g7ishc108l
Tags: 6.0pre27-3
* debian/gsfonts-fontmap.xml: New.  Fontmap for fonts from gsfonts package.
* debian/rules: Use gsfonts-fontmap.xml instead of tetex-fontmap.xml.
* debian/control: Add texlive-latex-base dependency as alternative to
  tetex-bin (for pdflatex) and replace tetex-extra by gsfonts (for font
  files).  Patch courtesy of Norbert Preining.  Closes: #378537.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
/*
5
5
 
6
6
    This file is part of the extensible drawing editor Ipe.
7
 
    Copyright (C) 1993-2004  Otfried Cheong
 
7
    Copyright (C) 1993-2005  Otfried Cheong
8
8
 
9
9
    Ipe is free software; you can redistribute it and/or modify it
10
10
    under the terms of the GNU General Public License as published by
79
79
 
80
80
// --------------------------------------------------------------------
81
81
 
 
82
// PDF doesn't support 1e-16 syntax
 
83
inline void CleanupMatrix(IpeMatrix &m)
 
84
{
 
85
  for (int i = 0; i < 6; ++i) {
 
86
    if (-1e-15 < m.iA[i] && m.iA[i] < 1e-15)
 
87
      m.iA[i] = 0;
 
88
  }
 
89
}
 
90
 
 
91
// --------------------------------------------------------------------
 
92
 
82
93
/*! \class IpeAllAttributes
83
94
  \ingroup attr
84
95
  \brief Collection of all object attributes.
117
128
  IpeString str;
118
129
  if (attr.Has("stroke", str))
119
130
    iStroke = rep->MakeColor(str);
120
 
  if (attr.Has("matrix", str))
 
131
  if (attr.Has("matrix", str)) {
121
132
    iMatrix = IpeMatrix(str);
 
133
    CleanupMatrix(iMatrix);
 
134
  }
122
135
}
123
136
 
124
137
/*! Create object by taking stroke color from \a attr and setting
155
168
  if (!layer.empty())
156
169
    stream << " layer=\"" << layer << "\"";
157
170
  // colors are not applied if they are already set in the painter
158
 
  // furthermore, void doesn't need to be saved
159
 
  if (painter.Stroke().IsNull() && !iStroke.IsNullOrVoid())
 
171
  if (painter.Stroke().IsNull() && !iStroke.IsNull())
160
172
    stream << " stroke=\"" << rep->String(iStroke) << "\"";
161
173
  if (!iMatrix.IsIdentity())
162
174
    stream << " matrix=\"" << iMatrix << "\"";
217
229
void IpeObject::SetMatrix(const IpeMatrix &matrix)
218
230
{
219
231
  iMatrix = matrix;
 
232
  CleanupMatrix(iMatrix);
220
233
}
221
234
 
222
235
//! Extend \a box to include the graphic representation of the object.
299
312
    iStrokeStyle.SetJoin(IpeLex(str).GetInt());
300
313
  if (attr.Has("fillrule", str))
301
314
    iStrokeStyle.SetWindRule(str == "wind");
 
315
  // convert void stroke color to void line style
 
316
  if (Stroke().IsVoid()) {
 
317
    SetStroke(IpeAttribute::Black());
 
318
    iDashStyle = IpeAttribute::Void();
 
319
  }
302
320
}
303
321
 
304
322
/*! Create object by taking attributes from \a attr and setting
335
353
  const IpeRepository *rep = painter.StyleSheet()->Repository();
336
354
 
337
355
  // colors are not applied if they are already set in the painter
338
 
  // furthermore, void doesn't need to be saved
 
356
  // void doesn't need to be saved for fill
339
357
  if (!painter.Fill() && !iFill.IsNullOrVoid())
340
358
    stream << " fill=\"" << rep->String(iFill) << "\"";
341
359
  if (!painter.DashStyle() && !iDashStyle.IsNullOrSolid())