// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Extensively rewritten and refactored by James L. Hammons
-// (C) 2010 Underground Software
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
//
// JLH = James L. Hammons <jlhamm@acm.org>
//
{
int c = 1;
- for(int i=0; i<(int)data.text.length(); ++i)
+ for(int i=0; i<(int)data.text.length(); i++)
{
if (data.text.at(i).unicode() == 0x0A)
- {
c++;
- }
}
return c;
*/
void RS_Text::update()
{
+#if 0
+printf("RS_Text::update(): ");
+#endif
RS_DEBUG->print("RS_Text::update");
-
clear();
+#if 0
+printf("isUndone=%s, ", (isUndone() ? "true" : "false"));
+#endif
if (isUndone())
return;
usedTextWidth = 0.0;
usedTextHeight = 0.0;
+#if 0
+printf("data.style=\"%s\", ", data.style.toAscii().data());
+#endif
RS_Font * font = RS_FONTLIST->requestFont(data.style);
- if (font == NULL)
+#if 0
+printf("font=%08X\n", (unsigned int)font);
+#endif
+ if (!font)
return;
Vector letterPos = Vector(0.0, -9.0);
// add texts:
RS_Text * upper = new RS_Text(oneLine,
- RS_TextData(letterPos + Vector(0.0, 9.0),
- 4.0, 100.0, RS2::VAlignTop,
- RS2::HAlignLeft,
- RS2::LeftToRight, RS2::Exact,
- 1.0, up, data.style,
- 0.0, RS2::Update));
+ RS_TextData(letterPos + Vector(0.0, 9.0), 4.0, 100.0,
+ RS2::VAlignTop, RS2::HAlignLeft, RS2::LeftToRight,
+ RS2::Exact, 1.0, up, data.style, 0.0, RS2::Update));
upper->setLayer(NULL);
upper->setPen(RS_Pen(RS2::FlagInvalid));
oneLine->addEntity(upper);
RS_Text * lower = new RS_Text(oneLine,
- RS_TextData(letterPos+Vector(0.0, 4.0),
- 4.0, 100.0, RS2::VAlignTop,
- RS2::HAlignLeft,
- RS2::LeftToRight, RS2::Exact,
- 1.0, dw, data.style,
- 0.0, RS2::Update));
+ RS_TextData(letterPos+Vector(0.0, 4.0), 4.0, 100.0,
+ RS2::VAlignTop, RS2::HAlignLeft, RS2::LeftToRight,
+ RS2::Exact, 1.0, dw, data.style, 0.0, RS2::Update));
lower->setLayer(NULL);
lower->setPen(RS_Pen(RS2::FlagInvalid));
oneLine->addEntity(lower);
default:
{
+// Regular text works because the .style is "normallatin1" while the dimensions are done
+// using "standard"... So that's why it doesn't work.
+// "standard" exists, but it seems that no characters are loaded from it...
+//count() == 0...
+//printf("--> default: pos=%d, char=%04X, font size=%d\n", i, data.text.at(i).unicode(), font->getLetterList()->count());
// One Letter:
- if (font->findLetter(QString(data.text.at(i))) != NULL)
+//#warning "!!! font->findLetter() not working correctly !!!"
+ if (font->findLetter(QString(data.text.at(i))))
{
- RS_DEBUG->print("RS_Text::update: insert a "
- "letter at pos: %f/%f", letterPos.x, letterPos.y);
-
+//We ain't getting here:
+/*
+About to draw TEXT entity... TEXT="107.25"
+RS_Dimension::updateCreateDimensionLine()...
+--> 107.25
+RS_Text::update(): isUndone=false, font=094C1020
+--> default: pos=0, char=0031
+--> default: pos=1, char=0030
+--> default: pos=2, char=0037
+--> default: pos=3, char=002E
+--> default: pos=4, char=0032
+--> default: pos=5, char=0035
+*/
+//printf(" char=%s\n", QString(data.text.at(i)).toAscii().data());
+ RS_DEBUG->print("RS_Text::update: insert a letter at pos: %f/%f", letterPos.x, letterPos.y);
RS_InsertData d(QString(data.text.at(i)), letterPos, Vector(1.0, 1.0),
- 0.0, 1,1, Vector(0.0, 0.0), font->getLetterList(), RS2::NoUpdate);
+ 0.0, 1, 1, Vector(0.0, 0.0), font->getLetterList(), RS2::NoUpdate);
RS_Insert * letter = new RS_Insert(this, d);
letter->setPen(RS_Pen(RS2::FlagInvalid));
//letterWidth = Vector(letter->getSize().x, 0.0);
// from 2.0.4.6:
Vector letterWidth = Vector(letter->getMax().x - letterPos.x, 0.0);
-
oneLine->addEntity(letter);
// next letter position:
Vector RS_Text::getNearestRef(const Vector & coord, double * dist)
{
- //return getRefPoints().getClosest(coord, dist);
return RS_Entity::getNearestRef(coord, dist);
}