X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Ffont.cpp;fp=src%2Fbase%2Ffont.cpp;h=33c37d536cc81638326ee30b73df816d9235929e;hb=16354e0421b316a62c6b9f7b0b4f3b8cf6f06284;hp=b5a13035fccabd6bba9d9b56109cc26ad21ebc9a;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/font.cpp b/src/base/font.cpp index b5a1303..33c37d5 100644 --- a/src/base/font.cpp +++ b/src/base/font.cpp @@ -27,50 +27,50 @@ * @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; } @@ -81,9 +81,9 @@ double RS_Font::getLineSpacingFactor() * @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; @@ -93,7 +93,7 @@ bool RS_Font::loadFont() // 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++) @@ -112,7 +112,7 @@ bool RS_Font::loadFont() // 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; } @@ -121,12 +121,12 @@ bool RS_Font::loadFont() 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); @@ -151,12 +151,12 @@ bool RS_Font::loadFont() 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 = ""; @@ -184,7 +184,7 @@ void RS_Font::ParseIdentifier(QTextStream & ts, QString line) } } -void RS_Font::ParseCharacter(QTextStream & ts, QString line) +void Font::ParseCharacter(QTextStream & ts, QString line) { // Unicode character: QChar ch; @@ -213,7 +213,7 @@ void RS_Font::ParseCharacter(QTextStream & ts, QString line) } // 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(); @@ -229,9 +229,9 @@ void RS_Font::ParseCharacter(QTextStream & ts, QString line) 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); } @@ -244,9 +244,9 @@ void RS_Font::ParseCharacter(QTextStream & ts, QString 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); } @@ -259,22 +259,22 @@ void RS_Font::ParseCharacter(QTextStream & ts, QString line) } // 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); } @@ -282,9 +282,9 @@ RS_Block * RS_Font::letterAt(uint 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; }