* @param owner true if the font owns the letters (blocks). Otherwise
* the letters will be deleted when the font is deleted.
*/
-RS_Font::RS_Font(const QString & fn, bool owner): letterList(owner), fileName(fn),
+Font::Font(const QString & fn, bool owner): letterList(owner), fileName(fn),
encoding(""), loaded(false), letterSpacing(3.0), wordSpacing(6.75),
lineSpacingFactor(1.0)
{
}
/** @return the fileName of this font. */
-QString RS_Font::getFileName() const
+QString Font::getFileName() const
{
return fileName;
}
/** @return the encoding of this font. */
-QString RS_Font::getEncoding() const
+QString Font::getEncoding() const
{
return encoding;
}
/** @return the alternative names of this font. */
-const QStringList & RS_Font::getNames() const
+const QStringList & Font::getNames() const
{
return names;
}
/** @return the author(s) of this font. */
-const QStringList & RS_Font::getAuthors() const
+const QStringList & Font::getAuthors() const
{
return authors;
}
/** @return Default letter spacing for this font */
-double RS_Font::getLetterSpacing()
+double Font::getLetterSpacing()
{
return letterSpacing;
}
/** @return Default word spacing for this font */
-double RS_Font::getWordSpacing()
+double Font::getWordSpacing()
{
return wordSpacing;
}
/** @return Default line spacing factor for this font */
-double RS_Font::getLineSpacingFactor()
+double Font::getLineSpacingFactor()
{
return lineSpacingFactor;
}
* @retval true font was already loaded or is loaded now.
* @retval false font could not be loaded.
*/
-bool RS_Font::loadFont()
+bool Font::loadFont()
{
- RS_DEBUG->print("RS_Font::loadFont");
+ DEBUG->print("Font::loadFont");
if (loaded)
return true;
// Search for the appropriate font if we have only the name of the font:
if (!fileName.toLower().contains(".cxf"))
{
- QStringList fonts = RS_SYSTEM->getFontList();
+ QStringList fonts = SYSTEM->getFontList();
QFileInfo file;
for(QStringList::Iterator it=fonts.begin(); it!=fonts.end(); it++)
// No font paths found:
if (path.isEmpty())
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Font::loadFont: No fonts available.");
+ DEBUG->print(Debug::D_WARNING, "Font::loadFont: No fonts available.");
return false;
}
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Font::loadFont: Cannot open font file: %s",
+ DEBUG->print(Debug::D_WARNING, "Font::loadFont: Cannot open font file: %s",
path.toAscii().data());
return false;
}
- RS_DEBUG->print("RS_Font::loadFont: Successfully opened font file: %s", path.toAscii().data());
+ DEBUG->print("Font::loadFont: Successfully opened font file: %s", path.toAscii().data());
QTextStream ts(&file);
file.close();
loaded = true;
- RS_DEBUG->print("RS_Font::loadFont OK");
+ DEBUG->print("Font::loadFont OK");
return true;
}
-void RS_Font::ParseIdentifier(QTextStream & ts, QString line)
+void Font::ParseIdentifier(QTextStream & ts, QString line)
{
QStringList list = line.mid(1).split(":");
QString identifier = "", value = "";
}
}
-void RS_Font::ParseCharacter(QTextStream & ts, QString line)
+void Font::ParseCharacter(QTextStream & ts, QString line)
{
// Unicode character:
QChar ch;
}
// Create new letter:
- RS_FontChar * letter = new RS_FontChar(NULL, ch, Vector(0.0, 0.0));
+ FontChar * letter = new FontChar(NULL, ch, Vector(0.0, 0.0));
// Read entities of this letter:
line = ts.readLine();
double x2 = (*it2++).toDouble();
double y2 = (*it2).toDouble();
- RS_LineData ld(Vector(x1, y1), Vector(x2, y2));
- RS_Line * line = new RS_Line(letter, ld);
- line->setPen(RS_Pen(RS2::FlagInvalid));
+ LineData ld(Vector(x1, y1), Vector(x2, y2));
+ Line * line = new Line(letter, ld);
+ line->setPen(Pen(RS2::FlagInvalid));
line->setLayer(NULL);
letter->addEntity(line);
}
double a2 = (*it2).toDouble() / ARAD;
bool reversed = (line.at(1) == 'R');
- RS_ArcData ad(Vector(cx, cy), r, a1, a2, reversed);
- RS_Arc * arc = new RS_Arc(letter, ad);
- arc->setPen(RS_Pen(RS2::FlagInvalid));
+ ArcData ad(Vector(cx, cy), r, a1, a2, reversed);
+ Arc * arc = new Arc(letter, ad);
+ arc->setPen(Pen(RS2::FlagInvalid));
arc->setLayer(NULL);
letter->addEntity(arc);
}
}
// Wrappers for block list (letters) functions
-RS_BlockList * RS_Font::getLetterList()
+BlockList * Font::getLetterList()
{
return &letterList;
}
-RS_Block * RS_Font::findLetter(const QString & name)
+Block * Font::findLetter(const QString & name)
{
return letterList.find(name);
}
-uint RS_Font::countLetters()
+uint Font::countLetters()
{
return letterList.count();
}
-RS_Block * RS_Font::letterAt(uint i)
+Block * Font::letterAt(uint i)
{
return letterList.at(i);
}
/**
* Dumps the fonts data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Font & f)
+std::ostream & operator<<(std::ostream & os, const Font & f)
{
os << " Font file name: " << f.getFileName().toLatin1().data() << "\n";
- //<< (RS_BlockList&)f << "\n";
+ //<< (BlockList&)f << "\n";
return os;
}