Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 5979 → Rev 5980

/branches/Version13x/Scribus/scribus/scfontmetrics.h
File deleted
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/scfontmetrics.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/scfontmetrics.cpp (revision 5979)
+++ branches/Version13x/Scribus/scribus/scfontmetrics.cpp (nonexistent)
@@ -1,608 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-#include <qpainter.h>
-#include <qcolor.h>
-#include <qwmatrix.h>
-#include <qpixmap.h>
-#include <qstringlist.h>
-#include <qmap.h>
-#include <qregexp.h>
-
-#include "scribusdoc.h"
-#include "scfontmetrics.h"
-#include "scfonts.h"
-#include "scpainter.h"
-#include "fpoint.h"
-#include "fpointarray.h"
-#include "page.h"
-#include "util.h"
-
-// this code contains a set of font related functions
-// that don't really fit within ScFonts.
-
-static FPoint firstP;
-static bool FirstM;
-static QMap<FT_ULong, QString> adobeGlyphNames;
-static const char* table[] = {
-//#include "glyphnames.txt.q"
- NULL};
-
-// private functions
-static void readAdobeGlyphNames();
-static QString adobeGlyphName(FT_ULong charcode);
-static int traceMoveto( FT_Vector *to, FPointArray *composite );
-static int traceLineto( FT_Vector *to, FPointArray *composite );
-static int traceQuadraticBezier( FT_Vector *control, FT_Vector *to, FPointArray *composite );
-static int traceCubicBezier( FT_Vector *p, FT_Vector *q, FT_Vector *to, FPointArray *composite );
-
-FT_Outline_Funcs OutlineMethods =
- {
- (FT_Outline_MoveTo_Func) traceMoveto,
- (FT_Outline_LineTo_Func) traceLineto,
- (FT_Outline_ConicTo_Func) traceQuadraticBezier,
- (FT_Outline_CubicTo_Func) traceCubicBezier,
- 0,
- 0
- };
-
-int setBestEncoding(FT_Face face)
-{
- FT_ULong charcode;
- FT_UInt gindex;
- bool foundEncoding = false;
- int countUniCode = 0;
- int chmapUniCode = -1;
- int chmapCustom = -1;
- int retVal = 0;
- //FT_CharMap defaultEncoding = face->charmap;
-// int defaultchmap=face->charmap ? FT_Get_Charmap_Index(face->charmap) : 0;
-// Since the above function is only available in FreeType 2.1.10 its replaced by
-// the following line, assuming that the default charmap has the index 0
- int defaultchmap = 0;
- for(int u = 0; u < face->num_charmaps; u++)
- {
- if (face->charmaps[u]->encoding == FT_ENCODING_UNICODE )
- {
- FT_Set_Charmap(face, face->charmaps[u]);
- chmapUniCode = u;
- gindex = 0;
- charcode = FT_Get_First_Char( face, &gindex );
- while ( gindex != 0 )
- {
- countUniCode++;
- charcode = FT_Get_Next_Char( face, charcode, &gindex );
- }
- }
- if (face->charmaps[u]->encoding == FT_ENCODING_ADOBE_CUSTOM)
- {
- chmapCustom = u;
- foundEncoding = true;
- retVal = 1;
- break;
- }
- else if (face->charmaps[u]->encoding == FT_ENCODING_MS_SYMBOL)
- {
- chmapCustom = u;
- foundEncoding = true;
- retVal = 2;
- break;
- }
- }
- int mapToSet=defaultchmap;
- if (chmapUniCode>0 && countUniCode >= face->num_glyphs-1)
- {
- mapToSet=chmapUniCode;
- //FT_Set_Charmap(face, face->charmaps[chmapUniCode]);
- retVal = 0;
- }
- else
- if (foundEncoding)
- {
- mapToSet=chmapCustom;
- //FT_Set_Charmap(face, face->charmaps[chmapCustom]);
- }
- else
- {
- mapToSet=defaultchmap;
- //FT_Set_Charmap(face, defaultEncoding);
- retVal = 0;
- }
-
- //Fixes #2199, missing glyphs from 1.2.1->1.2.2
- //If the currently wanted character map is not already Unicode...
- //if (FT_Get_Charmap_Index(face->charmap)!=chmapUniCode)
- if (mapToSet!=chmapUniCode)
- {
- //Change map so we can count the chars in it
- FT_Set_Charmap(face, face->charmaps[mapToSet]);
- //Count the characters in the current map
- gindex = 0;
- int countCurrMap=0;
- charcode = FT_Get_First_Char( face, &gindex );
- while ( gindex != 0 )
- {
- countCurrMap++;
- charcode = FT_Get_Next_Char( face, charcode, &gindex );
- }
- //If the last Unicode map we found before has more characters,
- //then set it to be the current map.
- if (countUniCode>countCurrMap)
- {
- mapToSet=chmapUniCode;
- //FT_Set_Charmap(face, face->charmaps[chmapUniCode]);
- retVal = 0;
- }
- }
-// if (face->charmap == NULL || mapToSet!=FT_Get_Charmap_Index(face->charmap))
- FT_Set_Charmap(face, face->charmaps[mapToSet]);
- return retVal;
-}
-
-FPointArray traceGlyph(FT_Face face, FT_UInt glyphIndex, int chs, double *x, double *y, bool *err)
-{
- bool error = false;
- //AV: not threadsave, but tracechar is only used in ReadMetrics() and fontSample()
- static FPointArray pts;
- FPointArray pts2;
- pts.resize(0);
- pts2.resize(0);
- firstP = FPoint(0,0);
- FirstM = true;
- error = FT_Set_Char_Size( face, 0, chs*64, 72, 72 );
- if (error)
- {
- *err = error;
- return pts2;
- }
- if (glyphIndex == 0)
- {
- *err = true;
- return pts2;
- }
- error = FT_Load_Glyph( face, glyphIndex, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP );
- if (error)
- {
- *err = error;
- return pts2;
- }
- error = FT_Outline_Decompose(&face->glyph->outline, &OutlineMethods, reinterpret_cast<void*>(&pts));
- if (error)
- {
- *err = error;
- return pts2;
- }
- *x = face->glyph->metrics.horiBearingX / 64.0;
- *y = face->glyph->metrics.horiBearingY / 64.0;
- QWMatrix ma;
- ma.scale(1, -1);
- pts.map(ma);
- pts.translate(0, chs);
- pts2.putPoints(0, pts.size()-2, pts, 0);
-
- return pts2;
-}
-
-
-FPointArray traceChar(FT_Face face, uint chr, int chs, double *x, double *y, bool *err)
-{
- bool error = false;
- FT_UInt glyphIndex;
- error = FT_Set_Char_Size( face, 0, chs*64, 72, 72 );
- if (error)
- {
- *err = error;
- return FPointArray();
- }
- glyphIndex = FT_Get_Char_Index(face, chr);
- return traceGlyph(face, glyphIndex, chs, x, y, err);
-}
-
-
-QPixmap FontSample(Foi * fnt, int s, QString ts, QColor back, bool force)
-{
- FT_Face face;
- FT_Library library;
- double x, y, ymax;
- bool error;
- int pen_x;
- FPoint gp;
- error = FT_Init_FreeType( &library );
- error = FT_New_Face( library, fnt->fontFilePath(), fnt->faceIndex(), &face );
- int encode = setBestEncoding(face);
- double uniEM = static_cast<double>(face->units_per_EM);
- int h = qRound(face->height / uniEM) * s + 1;
- double a = static_cast<double>(face->descender) / uniEM * s + 1;
- int w = qRound((face->bbox.xMax - face->bbox.xMin) / uniEM) * s * (ts.length()+1);
- if (w < 1)
- w = s * (ts.length()+1);
- if (h < 1)
- h = s;
- QPixmap pm(w, h);
- pm.fill();
- pen_x = 0;
- ymax = 0.0;
- ScPainter *p = new ScPainter(&pm, pm.width(), pm.height());
- p->setFillMode(1);
- p->setLineWidth(0.0);
- p->setBrush(back);
- p->drawRect(0.0, 0.0, static_cast<double>(w), static_cast<double>(h));
- p->setBrush(Qt::black);
- FPointArray gly;
- uint dv;
- dv = ts[0].unicode();
- error = false;
- gly = traceChar(face, dv, s, &x, &y, &error);
- if (((encode != 0) || (error)) && (!force))
- {
- error = false;
- FT_ULong charcode;
- FT_UInt gindex;
- gindex = 0;
- charcode = FT_Get_First_Char(face, &gindex );
- for (uint n = 0; n < ts.length(); ++n)
- {
- gly = traceChar(face, charcode, s, &x, &y, &error);
- if (error)
- break;
- if (gly.size() > 3)
- {
- gly.translate(static_cast<double>(pen_x) / 64.0, a);
- gp = getMaxClipF(&gly);
- ymax = QMAX(ymax, gp.y());
- p->setupPolygon(&gly);
- p->fillPath();
- }
- pen_x += face->glyph->advance.x;
- charcode = FT_Get_Next_Char(face, charcode, &gindex );
- if (gindex == 0)
- break;
- }
- }
- else
- {
- for (uint n = 0; n < ts.length(); ++n)
- {
- dv = ts[n].unicode();
- error = false;
- gly = traceChar(face, dv, s, &x, &y, &error);
- if (gly.size() > 3)
- {
- gly.translate(static_cast<double>(pen_x) / 64.0, a);
- gp = getMaxClipF(&gly);
- ymax = QMAX(ymax, gp.y());
- p->setupPolygon(&gly);
- p->fillPath();
- }
- pen_x += face->glyph->advance.x;
- }
- }
- p->end();
- pm.resize(QMIN(qRound(gp.x()), w), QMIN(qRound(ymax), h));
- delete p;
- FT_Done_FreeType( library );
- return pm;
-}
-
-/** Same as FontSample() with \n strings support added.
-09/26/2004 petr vanek
-
-QPixmap fontSamples(Foi * fnt, int s, QString ts, QColor back)
-{
- QStringList lines = QStringList::split("\n", ts);
- QPixmap ret(640, 480);
- QPixmap sample;
- QPainter *painter = new QPainter(&ret);
- int y = 0;
- int x = 0;
- ret.fill(back);
- for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it )
- {
- sample = FontSample(fnt, s, *it, back);
- if (!sample.isNull())
- painter->drawPixmap(0, y, sample, 0, 0);
- y = y + sample.height();
- if (x < sample.width())
- x = sample.width();
- } // for
- delete(painter);
- QPixmap final(x, y);
- if ((x != 0) && (y != 0))
- {
- QPainter *fpainter = new QPainter(&final);
- fpainter->drawPixmap(0, 0, ret, 0, 0, x, y);
- delete(fpainter);
- }
- return final;
-}
-*/
-
-bool GlyNames(Foi * fnt, QMap<uint, QString> *GList)
-{
- bool error;
- char buf[50];
- FT_Library library;
- FT_Face face;
- FT_ULong charcode;
- FT_UInt gindex;
- error = FT_Init_FreeType(&library);
- error = FT_New_Face(library, fnt->fontFilePath(), fnt->faceIndex(), &face);
- setBestEncoding(face);
- gindex = 0;
- charcode = FT_Get_First_Char(face, &gindex );
- const bool hasPSNames = FT_HAS_GLYPH_NAMES(face);
- if (adobeGlyphNames.empty())
- readAdobeGlyphNames();
- while (gindex != 0)
- {
- bool notfound = true;
- if (hasPSNames)
- notfound = FT_Get_Glyph_Name(face, gindex, &buf, 50);
-
- // just in case FT gives empty string or ".notdef"
- // no valid glyphname except ".notdef" starts with '.'
- if (notfound || buf[0] == '\0' || buf[0] == '.')
- GList->insert(charcode, adobeGlyphName(charcode));
- else
- GList->insert(charcode, QString(reinterpret_cast<char*>(buf)));
-
- charcode = FT_Get_Next_Char(face, charcode, &gindex );
- }
- FT_Done_FreeType( library );
- return true;
-}
-
-bool GlyIndex(Foi * fnt, QMap<uint, PDFlib::GlNamInd> *GListInd)
-{
- struct PDFlib::GlNamInd gln;
- bool error;
- char buf[50];
- FT_Library library;
- FT_Face face;
- FT_ULong charcode;
- FT_UInt gindex;
- uint counter1 = 32;
- uint counter2 = 0;
- error = FT_Init_FreeType(&library);
- error = FT_New_Face(library, fnt->fontFilePath(), fnt->faceIndex(), &face);
- setBestEncoding(face);
- gindex = 0;
- charcode = FT_Get_First_Char(face, &gindex );
- const bool hasPSNames = FT_HAS_GLYPH_NAMES(face);
- if (adobeGlyphNames.empty())
- readAdobeGlyphNames();
- while (gindex != 0)
- {
- bool notfound = true;
- if (hasPSNames)
- notfound = FT_Get_Glyph_Name(face, gindex, buf, 50);
-
- // just in case FT gives empty string or ".notdef"
- // no valid glyphname except ".notdef" starts with '.'
- if (notfound || buf[0] == '\0' || buf[0] == '.')
- gln.Name = "/" + adobeGlyphName(charcode);
- else
- gln.Name = "/" + QString(buf);
-
- gln.Code = counter1 + counter2;
- GListInd->insert(charcode, gln);
- charcode = FT_Get_Next_Char(face, charcode, &gindex );
- counter1++;
- if (counter1 > 255)
- {
- counter1 = 32;
- counter2 += 0x100;
- }
- }
- FT_Done_FreeType( library );
- return true;
-}
-
-static int traceMoveto( FT_Vector *to, FPointArray *composite )
-{
- double tox = ( to->x / 64.0 );
- double toy = ( to->y / 64.0 );
- if (!FirstM)
- {
- composite->addPoint(firstP);
- composite->addPoint(firstP);
- composite->setMarker();
- }
- else
- FirstM = false;
- composite->addPoint(tox, toy);
- composite->addPoint(tox, toy);
- firstP.setXY(tox, toy);
- return 0;
-}
-
-static int traceLineto( FT_Vector *to, FPointArray *composite )
-{
- double tox = ( to->x / 64.0 );
- double toy = ( to->y / 64.0 );
- if ( !composite->hasLastQuadPoint(tox, toy, tox, toy, tox, toy, tox, toy))
- composite->addQuadPoint(tox, toy, tox, toy, tox, toy, tox, toy);
- return 0;
-}
-
-static int traceQuadraticBezier( FT_Vector *control, FT_Vector *to, FPointArray *composite )
-{
- double x1 = ( control->x / 64.0 );
- double y1 = ( control->y / 64.0 );
- double x2 = ( to->x / 64.0 );
- double y2 = ( to->y / 64.0 );
- if ( !composite->hasLastQuadPoint(x2, y2, x1, y1, x2, y2, x2, y2))
- composite->addQuadPoint(x2, y2, x1, y1, x2, y2, x2, y2);
- return 0;
-}
-
-static int traceCubicBezier( FT_Vector *p, FT_Vector *q, FT_Vector *to, FPointArray *composite )
-{
- double x1 = ( p->x / 64.0 );
- double y1 = ( p->y / 64.0 );
- double x2 = ( q->x / 64.0 );
- double y2 = ( q->y / 64.0 );
- double x3 = ( to->x / 64.0 );
- double y3 = ( to->y / 64.0 );
- if ( !composite->hasLastQuadPoint(x3, y3, x2, y2, x3, y3, x3, y3) )
- {
- composite->setPoint(composite->size()-1, FPoint(x1, y1));
- composite->addQuadPoint(x3, y3, x2, y2, x3, y3, x3, y3);
- }
- return 0;
-}
-
-/// init the Adobe Glyph List
-void readAdobeGlyphNames() {
- adobeGlyphNames.clear();
- QRegExp pattern("(\\w*);([0-9A-Fa-f]{4})");
- for (uint i=0; table[i]; ++i) {
- if (pattern.search(table[i]) >= 0) {
- FT_ULong unicode = pattern.cap(2).toULong(0, 16);
- qDebug("%s", QString("reading glyph name %1 fo unicode %2(%3)").arg(pattern.cap(1)).arg(unicode).arg(pattern.cap(2)).ascii());
- adobeGlyphNames.insert(unicode, pattern.cap(1));
- }
- }
-}
-
-
-/// if in AGL, use that name, else use "uni1234" or "u12345"
-QString adobeGlyphName(FT_ULong charcode) {
- static const char HEX[] = "0123456789ABCDEF";
- QString result;
- if (adobeGlyphNames.contains(charcode))
- return adobeGlyphNames[charcode];
- else if (charcode < 0x10000) {
- result = QString("uni") + HEX[charcode>>12 & 0xF]
- + HEX[charcode>> 8 & 0xF]
- + HEX[charcode>> 4 & 0xF]
- + HEX[charcode & 0xF];
- }
- else {
- result = QString("u");
- for (int i= 28; i >= 0; i-=4) {
- if (charcode & (0xF << i))
- result += HEX[charcode >> i & 0xF];
- }
- }
- return result;
-}
-
-double Cwidth(ScribusDoc *, Foi* scFace, QString ch, int Size, QString ch2)
-{
- double width;
- FT_Vector delta;
- FT_Face face;
- uint c1 = ch.at(0).unicode();
- uint c2 = ch2.at(0).unicode();
- double size10=Size/10.0;
- if (scFace->canRender(ch[0]))
- {
- width = scFace->charWidth(ch[0])*size10;
- face = scFace->ftFace();
- /****
- Ok, this looks like a regression between Freetype 2.1.9 -> 2.1.10.
- Ignoring the value of FT_HAS_KERNING for now -- AV
- ****/
- if (true || FT_HAS_KERNING(face) )
- {
- uint cl = FT_Get_Char_Index(face, c1);
- uint cr = FT_Get_Char_Index(face, c2);
- FT_Error error = FT_Get_Kerning(face, cl, cr, FT_KERNING_UNSCALED, &delta);
- if (error) {
- qDebug(QString("Error %2 when accessing kerning pair for font %1").arg(scFace->scName()).arg(error));
- }
- else {
- double uniEM = static_cast<double>(face->units_per_EM);
- width += delta.x / uniEM * size10;
- }
- }
- else {
- qDebug(QString("Font %1 has no kerning pairs (according to Freetype)").arg(scFace->scName()));
- }
- return width;
- }
- else
- return size10;
-}
-
-double RealCWidth(ScribusDoc *, Foi* scFace, QString ch, int Size)
-{
- double w, ww;
- uint c1 = ch.at(0).unicode();
- FT_Face face;
- if (scFace->canRender(ch.at(0)))
- {
- face = scFace->ftFace();
- uint cl = FT_Get_Char_Index(face, c1);
- int error = FT_Load_Glyph(face, cl, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
- if (!error) {
- double uniEM = static_cast<double>(face->units_per_EM);
- w = (face->glyph->metrics.width + fabs((double)face->glyph->metrics.horiBearingX)) / uniEM * (Size / 10.0);
- ww = face->glyph->metrics.horiAdvance / uniEM * (Size / 10.0);
- return QMAX(ww, w);
- }
- else
- sDebug(QString("internal error: missing glyph: %1 (char %2) error=%3").arg(c1).arg(ch).arg(error));
-
- }
- return static_cast<double>(Size / 10.0);
-}
-
-double RealCHeight(ScribusDoc *, Foi* scFace, QString ch, int Size)
-{
- double w;
- uint c1 = ch.at(0).unicode();
- FT_Face face;
- if (scFace->canRender(ch.at(0)))
- {
- face = scFace->ftFace();
- uint cl = FT_Get_Char_Index(face, c1);
- int error = FT_Load_Glyph(face, cl, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
- if (!error) {
- double uniEM = static_cast<double>(face->units_per_EM);
- w = face->glyph->metrics.height / uniEM * (Size / 10.0);
- }
- else {
- sDebug(QString("internal error: missing glyph: %1 (char %2) error=%3").arg(c1).arg(ch).arg(error));
- w = Size / 10.0;
- }
- return w;
- }
- else
- return static_cast<double>(Size / 10.0);
-}
-
-double RealCAscent(ScribusDoc *, Foi* scFace, QString ch, int Size)
-{
- double w;
- uint c1 = ch.at(0).unicode();
- FT_Face face;
- if (scFace->canRender(ch.at(0)))
- {
- face = scFace->ftFace();
- uint cl = FT_Get_Char_Index(face, c1);
- int error = FT_Load_Glyph(face, cl, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
- if (! error) {
- double uniEM = static_cast<double>(face->units_per_EM);
- w = face->glyph->metrics.horiBearingY / uniEM * (Size / 10.0);
- }
- else {
- sDebug(QString("internal error: missing glyph: %1 (char %2) error=%3").arg(c1).arg(ch).arg(error));
- w = Size / 10.0;
- }
- return w;
- }
- else
- return static_cast<double>(Size / 10.0);
-}
-
-double RealFHeight(ScribusDoc *, Foi* scFace, int Size)
-{
- FT_Face face = scFace->ftFace();
- double uniEM = static_cast<double>(face->units_per_EM);
- return face->height / uniEM * (Size / 10.0);
-}
/branches/Version13x/Scribus/scribus/scfontmetrics.cpp
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/scfonts_ttf.h
===================================================================
--- branches/Version13x/Scribus/scribus/scfonts_ttf.h (revision 5979)
+++ branches/Version13x/Scribus/scribus/scfonts_ttf.h (nonexistent)
@@ -1,36 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-#ifndef SCFONTS_TTF_H
-#define SCFONTS_TTF_H
-
-#include "scribusapi.h"
-#include "scfonts.h"
-
-/*
- Class Foi_ttf
- Subclass of Foi, specifically for TrueType fonts.
- Implements: RealName() and EmbedFont().
-*/
-
-class SCRIBUS_API Foi_ttf : public Foi
-{
- public:
- Foi_ttf(QString fam, QString sty, QString alt, QString psname, QString path, int face, bool embedps) :
- Foi(fam,sty,alt,psname,path,face,embedps), metricsread(false)
- {
- HasMetrics = true;
- formatCode = SFNT;
- }
- QString RealName();
- bool ReadMetrics();
- virtual bool EmbedFont(QString &str);
- virtual void RawData(QByteArray & bb);
- private:
- bool metricsread;
-};
-
-#endif
/branches/Version13x/Scribus/scribus/scfonts_ttf.h
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/scfonts_ttf.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/scfonts_ttf.cpp (revision 5979)
+++ branches/Version13x/Scribus/scribus/scfonts_ttf.cpp (nonexistent)
@@ -1,298 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-
-#include <qfile.h>
-#include <qstring.h>
-#include <qobject.h>
-
-#include <sys/types.h>
-
-#include "scfonts_ttf.h"
-#include "scfontmetrics.h"
-#include "util.h"
-#include "scconfig.h"
-
-
-QString Foi_ttf::RealName()
-{
- return(Foi::RealName());
-}
-
-bool Foi_ttf::ReadMetrics()
-{
- Ascent = "0";
- CapHeight = "0";
- Descender = "0";
- ItalicAngle = "0";
- StdVW = "1";
- FontBBox = "0 0 0 0";
- IsFixedPitch = false;
- if(metricsread)
- return(true);
- CharWidth.clear();
- GlyphArray.clear();
- isStroked_ = false;
- QString tmp, tmp2, tmp3, tmp4;
- bool error;
- FT_ULong charcode;
- FT_UInt gindex;
- FPointArray outlines;
- double x, y;
- struct GlyphR GRec;
-
- FT_Face face = ftFace();
- if (!face) {
- return false;
- }
-
- uniEM = static_cast<double>(face->units_per_EM);
- HasKern = FT_HAS_KERNING(face);
- Ascent = tmp.setNum(face->ascender * 1000 / uniEM);
- Descender = tmp.setNum(face->descender * 1000 / uniEM);
- CapHeight = Ascent;
- numDescender = face->descender / uniEM;
- numAscent = face->ascender / uniEM;
- underline_pos = face->underline_position / uniEM;
- strikeout_pos = numAscent / 3;
- strokeWidth_ = face->underline_thickness / uniEM;
- ItalicAngle = "0";
- StdVW = "1";
- FontBBox = tmp.setNum(face->bbox.xMin * 1000 / uniEM)+" "+tmp2.setNum(face->bbox.yMin * 1000 / uniEM)+" "+tmp3.setNum(face->bbox.xMax * 1000 / uniEM)+" "+tmp4.setNum(face->bbox.yMax * 1000 / uniEM);
- IsFixedPitch = face->face_flags & 4;
- setBestEncoding(face);
- gindex = 0;
- charcode = FT_Get_First_Char( face, &gindex );
- int invalidGlyphs = 0;
- int goodGlyphs = 0;
- while ( gindex != 0 )
- {
- error = FT_Load_Glyph( face, gindex, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
- if (error)
- {
- ++invalidGlyphs;
- sDebug(QObject::tr("Font %1 has invalid glyph %2 (charcode %3), discarding it").arg(fontPath()).arg(gindex).arg(charcode));
- charcode = FT_Get_Next_Char( face, charcode, &gindex );
- continue;
- }
- ++goodGlyphs;
- double ww = face->glyph->metrics.horiAdvance / uniEM;
- if (face->glyph->format == FT_GLYPH_FORMAT_PLOTTER)
- isStroked_ = true;
- error = false;
- outlines = traceChar(face, charcode, 10, &x, &y, &error);
- if (!error)
- {
- CharWidth.insert(charcode, ww);
- GRec.Outlines = outlines.copy();
- GRec.x = x;
- GRec.y = y;
- GlyphArray.insert(charcode, GRec);
- }
- charcode = FT_Get_Next_Char( face, charcode, &gindex );
- }
- UseFont = (invalidGlyphs == 0);
-
- CharWidth[13] = 0;
- CharWidth[28] = 0;
- CharWidth[9] = 1;
-
- HasMetrics=UseFont;
- metricsread=UseFont;
- return(HasMetrics);
-}
-
-
-namespace {
-uint word(QByteArray const & bb, uint pos)
-{
- unsigned char * pp = reinterpret_cast<unsigned char*>(bb.data()) + pos;
- return pp[0] << 24 | pp[1] << 16 | pp[2] << 8 | pp[3];
-}
-uint word16(QByteArray const & bb, uint pos)
-{
- unsigned char * pp = reinterpret_cast<unsigned char*>(bb.data()) + pos;
- return pp[0] << 8 | pp[1];
-}
-QString tag(QByteArray const & bb, uint pos)
-{
- char buf[5] = "1234";
- buf[0] = bb.data()[pos];
- buf[1] = bb.data()[pos+1];
- buf[2] = bb.data()[pos+2];
- buf[3] = bb.data()[pos+3];
- return buf;
-}
-bool copy(QByteArray & dst, uint to, QByteArray & src, uint from, uint len)
-{
- if (!dst.data())
- return false;
- if (!src.data())
- return false;
- if (to + len > dst.size())
- return false;
- if (from + len > src.size())
- return false;
-
- memcpy(dst.data() + to, src.data() + from, len);
- return true;
-}
-} //namespace
-
-
-void Foi_ttf::RawData(QByteArray & bb) {
- if (formatCode == TTCF) {
- QByteArray coll;
- Foi::RawData(coll);
- // access table for faceIndex
- if (faceIndex() >= static_cast<int>(word(coll, 8)))
- {
- bb.resize(0);
- return;
- }
- static const uint OFFSET_TABLE_LEN = 12;
- static const uint TDIR_ENTRY_LEN = 16;
- uint faceOffset = word(coll, 12 + 4 * faceIndex());
- uint nTables = word16(coll, faceOffset + 4);
- sDebug(QObject::tr("extracting face %1 from font %2 (offset=%3, nTables=%4)").arg(faceIndex()).arg(fontPath()).arg(faceOffset).arg(nTables));
- uint headerLength = OFFSET_TABLE_LEN + TDIR_ENTRY_LEN * nTables;
- uint tableLengths = 0;
- // sum table lengths incl padding
- for (uint i=0; i < nTables; ++i)
- {
- tableLengths += word(coll, faceOffset + OFFSET_TABLE_LEN + TDIR_ENTRY_LEN * i + 12);
- tableLengths = (tableLengths+3) & ~3;
- }
- bb.resize(headerLength + tableLengths);
- if (! bb.data())
- return;
- // write header
- sDebug(QObject::tr("memcpy header: %1 %2 %3").arg(0).arg(faceOffset).arg(headerLength));
- if (!copy(bb, 0, coll, faceOffset, headerLength))
- return;
-
- uint pos = headerLength;
- for (uint i=0; i < nTables; ++i)
- {
- uint tableSize = word(coll, faceOffset + OFFSET_TABLE_LEN + TDIR_ENTRY_LEN * i + 12);
- uint tableStart = word(coll, faceOffset + OFFSET_TABLE_LEN + TDIR_ENTRY_LEN * i + 8);
- sDebug(QObject::tr("table '%1'").arg(tag(coll, tableStart)));
- sDebug(QObject::tr("memcpy table: %1 %2 %3").arg(pos).arg(tableStart).arg(tableSize));
- if (!copy(bb, pos, coll, tableStart, tableSize)) break;
- // write new offset to table entry
- sDebug(QObject::tr("memcpy offset: %1 %2 %3").arg(OFFSET_TABLE_LEN + TDIR_ENTRY_LEN*i + 8).arg(pos).arg(4));
- memcpy(bb.data() + OFFSET_TABLE_LEN + TDIR_ENTRY_LEN * i + 8, &pos, 4);
- pos += tableSize;
- // pad
- while ((pos & 3) != 0)
- bb.data()[pos++] = '\0';
- }
- }
- else if (formatCode == TYPE42) {
- Foi::RawData(bb);
- }
- else {
- Foi::RawData(bb);
- }
-}
-
-bool Foi_ttf::EmbedFont(QString &str)
-{
- if (formatCode == Foi::TYPE42) {
- //easy:
- QByteArray bb;
- Foi::RawData(bb);
- str += bb;
- return true;
- }
- QString tmp4;
- QString tmp2 = "";
- QString tmp3 = "";
- int counter = 0;
- char *buf[50];
- FT_ULong charcode;
- FT_UInt gindex;
- FT_Face face = ftFace();
- if (!face) {
- return false;
- }
- const FT_Stream fts = face->stream;
- if (ftIOFunc(fts, 0L, NULL, 0)) {
- return(false);
- }
- str+="%!PS-TrueTypeFont\n";
- str+="11 dict begin\n";
- str+="/FontName /" + RealName() + " def\n";
- str+="/Encoding /ISOLatin1Encoding where {pop ISOLatin1Encoding} {StandardEncoding} ifelse def\n";
- str+="/PaintType 0 def\n/FontMatrix [1 0 0 1 0 0] def\n";
- str+="/FontBBox ["+FontBBox+"] def\n";
- str+="/FontType 42 def\n";
- str+="/FontInfo 8 dict dup begin\n";
- str+="/FamilyName (" + RealName() + ") def\n";
- str+="end readonly def\n";
- unsigned char *tmp = new unsigned char[65535];
- int length;
- char linebuf[80];
- str += "/sfnts [";
- int poso=0;
- do {
- int posi=0;
- length= fts->size - fts->pos;
- if (length > 65534) {
- length = 65534;
- }
- if (!ftIOFunc(fts, 0L, tmp, length))
- {
- str+="\n<\n";
- for (int j = 0; j < length; j++)
- {
- unsigned char u=tmp[posi];
- linebuf[poso]=((u >> 4) & 15) + '0';
- if(u>0x9f) linebuf[poso]+='a'-':';
- ++poso;
- u&=15; linebuf[poso]=u + '0';
- if(u>0x9) linebuf[poso]+='a'-':';
- ++posi;
- ++poso;
- if (poso > 70)
- {
- linebuf[poso++]='\n';
- linebuf[poso++]=0;
- str += linebuf;
- poso = 0;
- }
- }
- linebuf[poso++]=0;
- str += linebuf;
- poso = 0;
- str += "00\n>";
- }
- else {
- sDebug(QObject::tr("Font %1 is broken (read stream), no embedding").arg(fontPath()).arg(gindex));
- str += "\n] def\n";
- return false;
- }
- }
- while (length==65534);
- str += "\n] def\n";
- delete tmp;
- setBestEncoding(face);
- gindex = 0;
- charcode = FT_Get_First_Char(face, &gindex );
- while (gindex != 0)
- {
- FT_Get_Glyph_Name(face, gindex, buf, 50);
- tmp2 += "/"+QString(reinterpret_cast<char*>(buf))+" "+tmp3.setNum(gindex)+" def\n";
- charcode = FT_Get_Next_Char(face, charcode, &gindex );
- counter++;
- }
- tmp4.setNum(counter);
- str += "/CharStrings " + tmp4 + " dict dup begin\n"+tmp2;
- str += "end readonly def\n";
- str += "FontName currentdict end definefont pop\n";
- return(true);
-}
-
/branches/Version13x/Scribus/scribus/scfonts_ttf.cpp
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/fileloader.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/fileloader.cpp (revision 5979)
+++ branches/Version13x/Scribus/scribus/fileloader.cpp (revision 5980)
@@ -69,7 +69,6 @@
formatODG(LoadSavePlugin::getFormatById(FORMATID_ODGIMPORT)),
prefsManager(PrefsManager::instance())
{
- dummyFois.setAutoDelete(true);
}
// FIXME: This static method is here as a temporary transitional
@@ -144,9 +143,9 @@
for (uint e = 0; e < it->itemText.nrOfRuns(); ++e)
{
int start = it->itemText.startOfRun(e);
- Foi* oldFont = it->itemText.charStyle(start).font();
- if (!UsedFonts.contains(oldFont->scName())) {
- newFontStyle.setFont((*currDoc->AllFonts)[ReplacedFonts[oldFont->scName()]]);
+ ScFace oldFont = it->itemText.charStyle(start).font();
+ if (!UsedFonts.contains(oldFont.scName())) {
+ newFontStyle.setFont((*currDoc->AllFonts)[ReplacedFonts[oldFont.scName()]]);
it->itemText.applyCharStyle(start, it->itemText.endOfRun(e) - start, newFontStyle );
}
}
@@ -159,8 +158,7 @@
bool ret = false;
newReplacement = false;
ReplacedFonts.clear();
- dummyFois.clear();
- dummyFois.setAutoDelete(true);
+ dummyScFaces.clear();
QValueList<FileFormat>::const_iterator it;
if (findFormat(FileType, it))
{
@@ -169,7 +167,7 @@
(*it).plug->setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
ret=(*it).plug->loadPage(FileName, PageToLoad, Mpage, renamedPageName);
if (ret)
- (*it).plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyFois);
+ (*it).plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
}
if (FileType==FORMATID_SLA13XIMPORT || FileType==FORMATID_SLA134IMPORT)
{
@@ -176,7 +174,7 @@
(*it).plug->setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
ret=(*it).plug->loadPage(FileName, PageToLoad, Mpage, renamedPageName);
if (ret)
- (*it).plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyFois);
+ (*it).plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
}
}
if (ReplacedFonts.count() != 0)
@@ -213,9 +211,9 @@
}
for (uint a = 0; a < currDoc->docParagraphStyles.count(); ++a)
{
- if ( currDoc->docParagraphStyles[a].charStyle().font() != &Foi::NONE && !currDoc->UsedFonts.contains(currDoc->docParagraphStyles[a].charStyle().font()->scName()))
+ if ( !currDoc->docParagraphStyles[a].charStyle().font().isNone() && !currDoc->UsedFonts.contains(currDoc->docParagraphStyles[a].charStyle().font().scName()))
currDoc->docParagraphStyles[a].charStyle().setFont
- ((*currDoc->AllFonts)[ReplacedFonts[currDoc->docParagraphStyles[a].charStyle().font()->scName()]]);
+ ((*currDoc->AllFonts)[ReplacedFonts[currDoc->docParagraphStyles[a].charStyle().font().scName()]]);
}
QMap<QString,QString>::Iterator itfsu;
for (itfsu = ReplacedFonts.begin(); itfsu != ReplacedFonts.end(); ++itfsu)
@@ -229,7 +227,7 @@
}
if (prefsManager->appPrefs.askBeforeSubstituite)
ReplacedFonts.clear();
- dummyFois.clear();
+ dummyScFaces.clear();
}
return ret;
}
@@ -260,8 +258,7 @@
currDoc->AutoSave = prefsManager->appPrefs.AutoSave;
currDoc->AutoSaveTime = prefsManager->appPrefs.AutoSaveTime;
ReplacedFonts.clear();
- dummyFois.clear();
- dummyFois.setAutoDelete(true);
+ dummyScFaces.clear();
bool ret = false;
QValueList<FileFormat>::const_iterator it;
if (findFormat(FileType, it))
@@ -272,7 +269,7 @@
(*it).setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
ret=(*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
if (ret)
- (*it).getReplacedFontData(newReplacement, ReplacedFonts, dummyFois);
+ (*it).getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
}
break;
case FORMATID_SLA13XIMPORT:
@@ -281,7 +278,7 @@
(*it).setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
ret=(*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
if (ret)
- (*it).getReplacedFontData(newReplacement, ReplacedFonts, dummyFois);
+ (*it).getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
}
break;
default:
@@ -313,7 +310,7 @@
return ret;
}
-bool FileLoader::ReadStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles)
+bool FileLoader::ReadStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles)
{
QValueList<FileFormat>::const_iterator it;
if (findFormat(FileType, it))
@@ -362,9 +359,9 @@
vg.setGapAfter(pg.attribute("NACH", "0").toDouble());
PrefsManager * prefsManager = PrefsManager::instance();
QString tmpf = pg.attribute("FONT", currDoc->toolSettings.defFont);
- if ((!avail.find(tmpf)) || (!avail[tmpf]->usable()))
+ if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
{
- if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
+ if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
@@ -511,12 +508,11 @@
}
for (uint a = 0; a < currDoc->docParagraphStyles.count(); ++a)
{
- if ( currDoc->docParagraphStyles[a].charStyle().font()
- && currDoc->docParagraphStyles[a].charStyle().font() != &Foi::NONE
- && !currDoc->UsedFonts.contains(currDoc->docParagraphStyles[a].charStyle().font()->scName()))
+ if ( !currDoc->docParagraphStyles[a].charStyle().font().isNone()
+ && !currDoc->UsedFonts.contains(currDoc->docParagraphStyles[a].charStyle().font().scName()))
{
currDoc->docParagraphStyles[a].charStyle().setFont
- ((*currDoc->AllFonts)[ReplacedFonts[currDoc->docParagraphStyles[a].charStyle().font()->scName()]]);
+ ((*currDoc->AllFonts)[ReplacedFonts[currDoc->docParagraphStyles[a].charStyle().font().scName()]]);
}
}
QValueList<QString> tmpList;
@@ -550,7 +546,7 @@
}
if (prefsManager->appPrefs.askBeforeSubstituite)
ReplacedFonts.clear();
- dummyFois.clear();
+ dummyScFaces.clear();
}
return true;
/branches/Version13x/Scribus/scribus/pageitem_polyline.h
42,7 → 42,6
class ScribusDoc;
class UndoManager;
class UndoState;
class Foi;
struct CopyPasteBuffer;
 
class SCRIBUS_API PageItem_PolyLine : public PageItem
/branches/Version13x/Scribus/scribus/scfonts.h
11,6 → 11,7
#include <qstrlist.h>
#include <qstringlist.h>
#include <qdict.h>
#include <qvector.h>
#include <qfont.h>
#include <qmap.h>
#include <qdatetime.h>
19,6 → 20,7
#include FT_OUTLINE_H
#include FT_GLYPH_H
 
 
FT_Error ftIOFunc( FT_Stream fts, unsigned long offset, unsigned char* buffer, unsigned long count);
 
// #include <qpixmap.h>
27,154 → 29,10
#include "fpointarray.h"
#include "scconfig.h"
 
/* Foi responsibilities:
#include "fonts/scface.h"
 
font storage: type, format, filepath, index, document-local, substitute, etc.
usage: use, embed, subset, ...
face info: family, effect, alternative, flags, charset
encoding: CMap2String, glyphnames,
metrics: cwidth, bearing, bbox, "real" widths, paths
opentype: apply features, script support
embedding: fontdictionary, rawdata, embedPS, embedPDF, subsetPS, subsetPDF
virtual: dispatch to constituents, handle embedding
*/
 
 
// #include "scfonts_encoding.h"
 
/*! \brief Base Class Foi : This is subclassed by a class to handle Type1 fonts, a class
to handle TrueType fonts, and potentially any other type that becomes appropriate in
the future.
Note the virtual destructor, needed to ensure that the correct destructor is called
for subclasses
 
The RealName field has been changed from a data member to a member function.
This is because the only place the PostScript real name of a font is required is
the printing code, so it's cheaper to extract this information only when it is
required, for just the used fonts, than for every one of potentially hundreds at
application startup! This also allows for the fact that truetype fonts will require
a different method of extracting their names.
 
One implication of using a base class/subclass model for fonts: It is no longer
possible to store the Foi structures in a QMap. This is because QMap allocates
its own structures, and copies the supplied data to them. A QMap<QString,Foi>
would demote all subclasses to Foi classes, and hence break the polymorphism.
QDict can be used instead, with very little change to the rest of the code, since
it stores references to the data instead of copying the data. With AutoDelete set
to true, it will automatically dispose of all data when its destructor is called,
so there are no extra cleaning-up chores to take care of.
*/
class SCRIBUS_API Foi
{
public:
enum FontType { TYPE0, TYPE1, TYPE3, TTF, CFF, OTF, UNKNOWN_TYPE };
enum FontFormat { PFA, PFB, TYPE2, TYPE42,
// handled by freetype: PFB_MAC, DFONT, HQX, MACBIN,
SFNT, TTCF, UNKNOWN_FORMAT };
Foi(QString fam, QString style, QString alt, QString psname, QString path, int face, bool embedps);
virtual ~Foi();
virtual QString RealName();
virtual bool EmbedFont(QString &str);
virtual void RawData(QByteArray & bb);
virtual bool ReadMetrics();
virtual bool GlNames(QMap<uint, QString> *GList);
private:
QString SCName;
QString fontFile;
int faceIndex_;
QString cached_RealName;
QString Family;
QString Effect;
QString Alternative;
int usage_;
public:
static const Foi NONE;
FT_Face ftFace() const;
void increaseUsage() const;
void decreaseUsage() const;
void unload() const;
QString scName() const { return SCName; }
QString fontPath() const { return faceIndex_ >= 0 ? QString("%1(%2)").arg(fontFile).arg(faceIndex_+1) : fontFile; }
QString fontFilePath() const { return fontFile; }
QString localForDocument() const { return PrivateFont; }
FontType type() const { return typeCode; }
FontFormat format()const { return formatCode; }
int faceIndex() const { return faceIndex_; }
bool usable() const { return UseFont; }
bool embedPs() const { return EmbedPS; }
bool subset() const { return Subset; }
void useFont(bool flag) { UseFont = flag; }
void embedPs(bool flag) { EmbedPS = flag; }
void subset(bool flag) { Subset = flag; }
bool hasNames() const { return HasNames; }
bool isOTF() const { return isOTF_; }
bool isStroked() const { return isStroked_; }
bool isFixedPitch()const { return IsFixedPitch; }
QString family() const { return Family; }
QString style() const { return Effect; }
double ascent() const { return numAscent; }
double descent() const { return numDescender; }
double capHeight() const { return numAscent; }
double height() const { return ftFace()->height; }
QString stemV() const { return StdVW; }
QString italicAngle() const { return ItalicAngle; }
QString fontBBox() const { return FontBBox; }
double strikeoutPos() const { return strikeout_pos; }
double underlinePos() const { return underline_pos; }
double strokeWidth() const { return strokeWidth_; }
double max_advance_width() const { return face->max_advance_width; }
double charWidth(QChar ch) const;
bool canRender(QChar ch) const;
FPointArray outline(QChar ch) const;
FPoint origin(QChar ch) const;
 
struct GlyphR { FPointArray Outlines;
double x;
double y;
};
// those should be private: -AV
protected:
bool EmbedPS;
bool HasMetrics;
bool isOTF_;
bool Subset;
bool isStroked_;
mutable QMap<uint,double> CharWidth;
mutable QMap<uint,GlyphR> GlyphArray;
QString Ascent;
QString CapHeight;
QString Descender;
QString ItalicAngle;
QString StdVW;
QString FontEnc;
bool IsFixedPitch;
QString FontBBox;
QString PrivateFont;
bool UseFont;
bool HasKern;
bool HasNames;
double uniEM;
double numAscent;
double numDescender;
double underline_pos;
double strikeout_pos;
double strokeWidth_;
Foi::FontType typeCode;
Foi::FontFormat formatCode;
// QPixmap Appearance;
private:
mutable FT_Face face;
static FT_Library library;
Foi();
friend class Foi_ttf;
friend class SCFonts;
};
 
 
/*! \brief Main class SCFonts.
Subclass of QDict<Foi>.
Subclass of QDict<ScFace>.
This class replaces the previous SCFonts typedef, and is nearly as convenient.
The chief difference from the application point of view is that while data can
still be retrieved with SCFonts[fontname], this cannot be used to add members.
181,7 → 39,7
Since the only piece of code that will generally add members is scfonts.h, this
is not a major problem.
*/
class SCRIBUS_API SCFonts : public QDict<Foi>
class SCRIBUS_API SCFonts : public QMap<QString,ScFace>
{
public:
SCFonts();
218,6 → 76,17
bool showFontInformation;
};
 
typedef QDictIterator<Foi> SCFontsIterator;
struct SCFontsIterator
{
SCFontsIterator(SCFonts& fonts): it(fonts.begin()), end_it(fonts.end())
{}
ScFace& current() { return *it; }
QString currentKey() const { return it.key(); }
bool hasNext() const { return it != end_it; }
ScFace& next() { ++it; return current(); }
 
private:
QMap<QString,ScFace>::Iterator it, end_it;
};
 
#endif
/branches/Version13x/Scribus/scribus/gtaction.cpp
136,10 → 136,10
paragraphStyle = ::findParagraphStyle(textFrame->doc(), textFrame->doc()->currentStyle);
 
gtFont* font = style->getFont();
QString fontName = validateFont(font)->scName();
QString fontName = validateFont(font).scName();
gtFont font2(*font);
font2.setName(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().font()->scName());
QString fontName2 = validateFont(&font2)->scName();
font2.setName(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().font().scName());
QString fontName2 = validateFont(&font2).scName();
CharStyle lastStyle;
int lastStyleStart = 0;
for (uint a = 0; a < text.length(); ++a)
152,7 → 152,7
ch = QChar(13);
if ((inPara) && (!overridePStyleFont))
{
if (textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().font() == &Foi::NONE)
if (textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().font().isNone())
newStyle.setFont((*textFrame->doc()->AllFonts)[fontName2]);
else
newStyle.setFont(textFrame->doc()->docParagraphStyles[paragraphStyle].charStyle().font());
213,7 → 213,7
int gtAction::findParagraphStyle(const QString& name)
{
int pstyleIndex = -1;
for (uint i = 0; i < textFrame->doc()->docParagraphStyles.size(); ++i)
for (uint i = 0; i < textFrame->doc()->docParagraphStyles.count(); ++i)
{
if (textFrame->doc()->docParagraphStyles[i].name() == name)
{
230,7 → 230,7
if (pstyleIndex == -1)
{
createParagraphStyle(pstyle);
pstyleIndex = textFrame->doc()->docParagraphStyles.size() - 1;
pstyleIndex = textFrame->doc()->docParagraphStyles.count() - 1;
}
else if (updateParagraphStyles)
{
262,7 → 262,7
textFrame->setLineSpacing(linesp);
textFrame->setLineSpacingMode(0);
gtFont* font = fstyle->getFont();
Foi* scfont = validateFont(font);
Scface* scfont = validateFont(font);
textFrame->setFont(scfont->scName());
textFrame->setFontSize(font->getSize());
textFrame->TxtFill = parseColor(font->getColor());
287,7 → 287,7
{
const CharStyle& style(textFrame->itemText.defaultStyle().charStyle());
font->setName(style.font()->scName());
font->setName(style.font().scName());
font->setSize(style.fontSize());
font->setColor(style.fillColor());
font->setShade(style.fillShade());
325,9 → 325,9
void gtAction::createParagraphStyle(gtParagraphStyle* pstyle)
{
ScribusDoc* currDoc=textFrame->doc();
if (currDoc->docParagraphStyles.size() > 5)
if (currDoc->docParagraphStyles.count() > 5)
{
for (uint i = 5; i < currDoc->docParagraphStyles.size(); ++i)
for (uint i = 5; i < currDoc->docParagraphStyles.count(); ++i)
{
if (currDoc->docParagraphStyles[i].name() == pstyle->getName())
return;
377,7 → 377,7
vg.charStyle().setUnderlineWidth(textFrame->doc()->typographicSettings.valueUnderlineWidth);
vg.charStyle().setStrikethruOffset(textFrame->doc()->typographicSettings.valueStrikeThruPos);
vg.charStyle().setStrikethruWidth(textFrame->doc()->typographicSettings.valueStrikeThruPos);
textFrame->doc()->docParagraphStyles.append(vg);
textFrame->doc()->docParagraphStyles.create(vg);
m_ScMW->propertiesPalette->Spal->updateFormatList();
}
 
390,8 → 390,7
 
void gtAction::removeParagraphStyle(int index)
{
QValueList<ParagraphStyle>::iterator it = textFrame->doc()->docParagraphStyles.at(index);
textFrame->doc()->docParagraphStyles.remove(it);
textFrame->doc()->docParagraphStyles.remove(index);
}
 
void gtAction::updateParagraphStyle(const QString&, gtParagraphStyle* pstyle)
450,7 → 449,7
textFrame->doc()->docParagraphStyles[pstyleIndex] = vg;
}
 
Foi* gtAction::validateFont(gtFont* font)
ScFace gtAction::validateFont(gtFont* font)
{
// Dirty hack for family Times New Roman
if (font->getFamily() == "Times New")
462,8 → 461,8
 
QString useFont = font->getName();
if ((useFont.isNull()) || (useFont.isEmpty()))
useFont = textFrame->itemText.defaultStyle().charStyle().font()->scName();
else if (prefsManager->appPrefs.AvailFonts[font->getName()] == 0)
useFont = textFrame->itemText.defaultStyle().charStyle().font().scName();
else if (prefsManager->appPrefs.AvailFonts[font->getName()].isNone())
{
bool found = false;
useFont = "";
526,7 → 525,7
for (uint i = 0; i < static_cast<uint>(gtFont::NAMECOUNT); ++i)
{
QString nname = font->getName(i);
if (prefsManager->appPrefs.AvailFonts[nname] != 0)
if (! prefsManager->appPrefs.AvailFonts[nname].isNone())
{
ret = nname;
break;
/branches/Version13x/Scribus/scribus/util.cpp
1501,7 → 1501,7
bool named = !parStyle.name().isEmpty();
//qDebug(QString("looking up %1/ %2").arg(parStyle.name()).arg(parStyle.alignment()));
if (named) {
for (uint i=0; i < doc->docParagraphStyles.size(); ++i)
for (uint i=0; i < doc->docParagraphStyles.count(); ++i)
{
//qDebug(QString("%1 %2").arg(i).arg(doc->docParagraphStyles[i].name()));
if (parStyle.name() == doc->docParagraphStyles[i].name()) {
/branches/Version13x/Scribus/scribus/fmitem.cpp
28,7 → 28,7
#include <qfontmetrics.h>
#include <qapplication.h>
 
FmItem::FmItem(const QString& s, const Foi * )
FmItem::FmItem(const QString& s, const ScFace&)
{
stringy = s;
// font = f;
/branches/Version13x/Scribus/scribus/loadsaveplugin.h
84,9 → 84,9
static const QValueList<FileFormat> & supportedFormats();
virtual void setupTargets(ScribusDoc *targetDoc, ScribusView* targetView, ScribusMainWindow* targetMW, QProgressBar* targetMWPRogressBar, SCFonts* targetAvailableFonts);
virtual void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois);
virtual void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces);
virtual bool loadPage(const QString & fileName, int pageNumber, bool Mpage, QString renamedPageName=QString::null);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles);
virtual bool readLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty);
virtual bool readColors(const QString& fileName, ColorList & colors);
virtual bool readPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames);
168,9 → 168,9
void setupTargets(ScribusDoc *targetDoc, ScribusView* targetView, ScribusMainWindow* targetMW, QProgressBar* targetMWPRogressBar, SCFonts* targetAvailableFonts) const;
void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois) const;
void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces) const;
bool loadPage(const QString & fileName, int pageNumber, bool Mpage, QString renamedPageName=QString::null) const;
bool readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles) const;
bool readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles) const;
bool readLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty) const;
bool readColors(const QString& fileName, ColorList & colors) const;
bool readPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames) const;
/branches/Version13x/Scribus/scribus/prefs.cpp
534,11 → 534,11
tabColorManagement->setValues();
uint a = 0;
SCFontsIterator it(prefsManager->appPrefs.AvailFonts);
for ( ; it.current() ; ++it)
for ( ; it.hasNext() ; it.next())
{
it.current()->embedPs(tabFonts->fontFlags[it.currentKey()].FlagPS);
it.current()->useFont(tabFonts->fontFlags[it.currentKey()].FlagUse);
it.current()->subset(tabFonts->fontFlags[it.currentKey()].FlagSub);
it.current().embedPs(tabFonts->fontFlags[it.currentKey()].FlagPS);
it.current().usable(tabFonts->fontFlags[it.currentKey()].FlagUse);
it.current().subset(tabFonts->fontFlags[it.currentKey()].FlagSub);
}
a = 0;
QMap<QString,QString>::Iterator itfsuend=tabFonts->RList.end();
/branches/Version13x/Scribus/scribus/scribuscore.cpp
62,8 → 62,9
#ifndef NDEBUG
static void abort_on_error(QtMsgType t, const char * m)
{
std::cerr << m << "\n";
if(t==QtFatalMsg) assert(false);
std::cerr << m << "\n";
// if(t!=QtDebugMsg) assert(false);
}
#endif
 
/branches/Version13x/Scribus/scribus/fmitem.h
40,7 → 40,7
class SCRIBUS_API FmItem : public QCustomMenuItem
{
public:
FmItem(const QString& s, const Foi * f);
FmItem(const QString& s, const ScFace& f);
~FmItem() {};
void paint(QPainter *p, const QColorGroup& cg, bool act, bool enabled, int x, int y, int w, int h);
QSize sizeHint();
/branches/Version13x/Scribus/scribus/serializer.cpp
95,7 → 95,7
QString txt = Objekt.remove(QChar(0)).remove(QChar(13));
txt = txt.replace(QChar(10), QChar(13)).replace(QChar(5), QChar(13));
CharStyle newstyle;
if (doku->docParagraphStyles[Absatz].charStyle().font() != &Foi::NONE)
if (!doku->docParagraphStyles[Absatz].charStyle().font().isNone())
{
newstyle = doku->docParagraphStyles[Absatz].charStyle();
}
/branches/Version13x/Scribus/scribus/fonts/ftface.cpp
0,0 → 1,296
 
#include "fonts/ftface.h"
 
#include FT_OUTLINE_H
#include FT_GLYPH_H
 
#include <qobject.h>
#include <qfile.h>
 
#include "scfonts.h"
#include "fonts/scfontmetrics.h"
 
// static:
FT_Library FtFace::library = NULL;
 
/*****
ScFace lifecycle: unchecked -> loaded -> glyphs checked
| \-> broken glyphs
\-> broken
usable() == ! broken
embeddable() == glyphs_checked
canRender(unicode) -> CharMap cache? -> loadChar/Glyph -> !broken
Glyphs: width status
-1000 unkown
-2000 broken
>= 0 ok, outline valid
CharMap: unicode -> glyph index
uint[256][256]
unicode ignores: < 32, ...
unicode emulate: spaces, hyphen, ligatures?, diacritics?
*****/
 
FtFace::FtFace(QString fam, QString sty, QString vari, QString scname,
QString psname, QString path, int face)
: ScFaceData(), m_face(NULL)
{
family = fam;
style = sty;
variant = vari;
scName = scname;
psName = psname;
fontFile = path;
faceIndex = face;
if (!library) {
if (FT_Init_FreeType( &library ))
qDebug(QObject::tr("Freetype2 library not available"));
}
}
 
 
FtFace::~FtFace() {
unload();
}
 
 
FT_Face FtFace::ftFace() const {
if (!m_face) {
if (FT_New_Face( library, QFile::encodeName(fontFile), faceIndex, & m_face )) {
status = ScFace::BROKEN;
m_face = NULL;
qDebug(QObject::tr("Font %1(%2) is broken").arg(fontFile).arg(faceIndex));
}
else {
load();
}
}
return m_face;
}
 
void FtFace::load() const
{
ScFaceData::load();
 
if (!m_face) {
if (FT_New_Face( library, QFile::encodeName(fontFile), faceIndex, & m_face )) {
status = ScFace::BROKEN;
m_face = NULL;
qDebug(QObject::tr("Font %1(%2) is broken").arg(fontFile).arg(faceIndex));
return;
}
}
const_cast<FtFace*>(this)->isStroked = false;
m_encoding = 0;
m_uniEM = static_cast<double>(m_face->units_per_EM);
 
m_descent = m_face->descender / m_uniEM;
m_ascent = m_face->ascender / m_uniEM;
m_height = m_face->height / m_uniEM;
m_xHeight = m_height;
m_capHeight = m_height;
m_maxAdvanceWidth = m_face->max_advance_width / m_uniEM;
m_underlinePos = m_face->underline_position / m_uniEM;
m_strikeoutPos = m_ascent / 3;
m_strokeWidth = m_face->underline_thickness / m_uniEM;
const_cast<FtFace*>(this)->isFixedPitch = m_face->face_flags & 4;
 
//FIXME: FT_Set_Charmap(m_face, m_face->charmaps[m_encoding]);
setBestEncoding(m_face);
FT_UInt gindex = 0;
FT_ULong charcode = FT_Get_First_Char( m_face, &gindex );
int goodGlyph = 0;
int invalidGlyph = 0;
bool error;
while ( gindex != 0 )
{
error = FT_Load_Glyph( m_face, gindex, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
if (error)
{
++invalidGlyph;
qDebug(QObject::tr("Font %1 has broken glyph %2 (charcode %3)").arg(fontFile).arg(gindex).arg(charcode));
charcode = FT_Get_Next_Char( m_face, charcode, &gindex );
continue;
}
if (gindex > maxGlyph)
const_cast<FtFace*>(this)->maxGlyph = gindex;
++goodGlyph;
if (m_face->glyph->format == FT_GLYPH_FORMAT_PLOTTER)
const_cast<FtFace*>(this)->isStroked = true;
charcode = FT_Get_Next_Char( m_face, charcode, &gindex );
}
if (invalidGlyph > 0) {
status = ScFace::BROKENGLYPHS;
}
}
 
 
void FtFace::unload() const
{
if (m_face) {
FT_Done_Face( m_face );
m_face = NULL;
}
// clear caches
ScFaceData::unload();
}
 
 
uint FtFace::char2CMap(QChar ch) const
{
// FIXME use cMap cache
FT_Face face = ftFace();
uint gl = FT_Get_Char_Index(face, ch.unicode());
return gl;
}
 
 
void FtFace::loadGlyph(uint gl) const
{
ScFace::GlyphData GRec;
FT_Face face = ftFace();
if (FT_Load_Glyph( face, gl, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ))
{
qDebug(QObject::tr("Font %1 has broken glyph %2").arg(fontFile).arg(gl));
m_glyphWidth[gl] = 1;
}
else {
double ww = face->glyph->metrics.horiAdvance / m_uniEM;
double x, y;
bool error = false;
FPointArray outlines = traceGlyph(face, gl, 10, &x, &y, &error);
if (!error)
{
m_glyphWidth[gl] = ww;
GRec.Outlines = outlines;
GRec.x = x;
GRec.y = y;
GRec.broken = false;
}
else {
m_glyphWidth[gl] = 1;
}
}
m_glyphOutline[gl] = GRec;
if (GRec.broken && status < ScFace::BROKENGLYPHS)
status = ScFace::BROKENGLYPHS;
}
 
 
double FtFace::glyphKerning(uint gl, uint gl2, double size) const
{
FT_Vector delta;
FT_Face face = ftFace();
double result = 0;
/****
Ok, this looks like a regression between Freetype 2.1.9 -> 2.1.10.
Ignoring the value of FT_HAS_KERNING for now -- AV
****/
if (true || FT_HAS_KERNING(face) )
{
FT_Error error = FT_Get_Kerning(face, gl, gl2, FT_KERNING_UNSCALED, &delta);
if (error) {
qDebug(QString("Error %2 when accessing kerning pair for font %1").arg(scName).arg(error));
}
else {
result = delta.x / m_uniEM * size;
}
}
else {
qDebug(QString("Font %1 has no kerning pairs (according to Freetype)").arg(scName));
}
return result;
}
 
 
GlyphMetrics FtFace::glyphBBox (uint gl, double sz) const
{
FT_Face face = ftFace();
GlyphMetrics result;
FT_Error error = FT_Load_Glyph( face, gl, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
if (!error) {
double w = (face->glyph->metrics.width + QABS((double)face->glyph->metrics.horiBearingX)) / m_uniEM * sz;
result.width = QMAX(w, face->glyph->metrics.horiAdvance / m_uniEM * sz);
double height = face->glyph->metrics.height / m_uniEM * sz;
result.ascent = face->glyph->metrics.horiBearingY / m_uniEM * sz;
result.descent = result.ascent - height;
}
else {
result.width = result.ascent = sz;
result.descent = 0;
}
return result;
}
 
/// copied from Freetype's FT_Stream_ReadAt()
FT_Error ftIOFunc( FT_Stream stream, unsigned long pos, unsigned char* buffer, unsigned long count)
{
FT_Error error = FT_Err_Ok;
FT_ULong read_bytes;
if ( pos >= stream->size )
{
qDebug( "ftIOFunc: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
pos, stream->size );
return FT_Err_Invalid_Stream_Operation;
}
if ( stream->read )
read_bytes = stream->read( stream, pos, buffer, count );
else
{
read_bytes = stream->size - pos;
if ( read_bytes > count )
read_bytes = count;
memcpy( buffer, stream->base + pos, read_bytes );
}
stream->pos = pos + read_bytes;
if ( read_bytes < count )
{
qDebug( "ftIOFunc: invalid read; expected %lu bytes, got %lu\n",
count, read_bytes );
error = FT_Err_Invalid_Stream_Operation;
}
return error;
}
 
 
bool FtFace::glyphNames(QMap<QChar, std::pair<uint, QString> >& GList) const
{
return GlyNames(ftFace(), GList);
}
 
 
void FtFace::RawData(QByteArray & bb) const
{
FT_Stream fts = ftFace()->stream;
bb.resize(fts->size);
bool error = ftIOFunc(fts, 0L, reinterpret_cast<FT_Byte *>(bb.data()), fts->size);
if (error)
{
qDebug(QObject::tr("Font %1 is broken (read stream), no embedding").arg(fontFile));
bb.resize(0);
status = QMAX(status, ScFace::BROKENGLYPHS);
}
/*
if (showFontInformation)
{
QFile f(fontFile);
qDebug(QObject::tr("RawData for Font %1(%2): size=%3 filesize=%4").arg(fontFile).arg(faceIndex_).arg(bb.size()).arg(f.size()));
}
*/
}
 
 
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/fonts/ftface.h
===================================================================
--- branches/Version13x/Scribus/scribus/fonts/ftface.h (nonexistent)
+++ branches/Version13x/Scribus/scribus/fonts/ftface.h (revision 5980)
@@ -0,0 +1,112 @@
+#ifndef FT_FACE_H
+#define FT_FACE_H
+
+
+#include <qstring.h>
+#include <qvector.h>
+#include <qmap.h>
+#include <qarray.h>
+
+#include "scribusapi.h"
+
+#include "fonts/scface.h"
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#include "fpointarray.h"
+
+FT_Error ftIOFunc( FT_Stream stream, unsigned long pos, unsigned char* buffer, unsigned long count);
+
+
+/*! \brief Base Class FtFace provides an ScFace private implementation
+ for Freetype based fonts. Subclasses are ScFace_ps and ScFace_ttf.
+
+Below is the old docs for class Foi:
+
+This is subclassed by a class to handle Type1 fonts, a class
+to handle TrueType fonts, and potentially any other type that becomes appropriate in
+the future.
+Note the virtual destructor, needed to ensure that the correct destructor is called
+for subclasses
+
+The RealName field has been changed from a data member to a member function.
+This is because the only place the PostScript real name of a font is required is
+the printing code, so it's cheaper to extract this information only when it is
+required, for just the used fonts, than for every one of potentially hundreds at
+application startup! This also allows for the fact that truetype fonts will require
+a different method of extracting their names.
+
+One implication of using a base class/subclass model for fonts: It is no longer
+possible to store the ScFace structures in a QMap. This is because QMap allocates
+its own structures, and copies the supplied data to them. A QMap<QString,ScFace>
+would demote all subclasses to ScFace classes, and hence break the polymorphism.
+QDict can be used instead, with very little change to the rest of the code, since
+it stores references to the data instead of copying the data. With AutoDelete set
+to true, it will automatically dispose of all data when its destructor is called,
+so there are no extra cleaning-up chores to take care of.
+*/
+struct SCRIBUS_API FtFace : public ScFace::ScFaceData
+{
+
+ FtFace(QString fam, QString sty, QString variant, QString scname,
+ QString psname, QString path, int face);
+
+ FT_Face ftFace() const;
+
+ virtual ~FtFace();
+
+ // font metrics
+ double ascent(double sz=1.0) const { return m_ascent * sz; }
+ double descent(double sz=1.0) const { return m_descent * sz; }
+ double xHeight(double sz=1.0) const { return m_xHeight * sz; }
+ double capHeight(double sz=1.0) const { return m_capHeight * sz; }
+ double height(double sz=1.0) const { return m_height * sz; }
+ double strikeoutPos(double sz=1.0) const { return m_strikeoutPos * sz; }
+ double underlinePos(double sz=1.0) const { return m_underlinePos * sz; }
+ double strokeWidth(double sz=1.0) const { return m_strokeWidth; }
+ double maxAdvanceWidth(double sz=1.0) const { return m_maxAdvanceWidth * sz; }
+
+
+//FIXME QMap<QString,QString> fontDictionary(double sz=1.0) const;
+
+ uint char2CMap(QChar ch) const;
+
+ double glyphKerning (uint gl1, uint gl2, double sz) const;
+ GlyphMetrics glyphBBox (uint gl, double sz) const;
+
+ void RawData (QByteArray & bb) const;
+ bool glyphNames(QMap<QChar, std::pair<uint, QString> >& GList) const;
+ void load () const;
+ void unload () const;
+ void loadGlyph (uint ch) const;
+
+protected:
+ mutable FT_Face m_face;
+
+ static FT_Library library;
+
+ QString Ascent;
+ QString CapHeight;
+ QString Descender;
+ QString ItalicAngle;
+ QString StdVW;
+ QString FontEnc;
+ QString FontBBox;
+
+ mutable int m_encoding;
+
+ mutable double m_uniEM;
+ mutable double m_ascent;
+ mutable double m_descent;
+ mutable double m_height;
+ mutable double m_xHeight;
+ mutable double m_capHeight;
+ mutable double m_maxAdvanceWidth;
+ mutable double m_underlinePos;
+ mutable double m_strikeoutPos;
+ mutable double m_strokeWidth;
+
+};
+
+#endif
/branches/Version13x/Scribus/scribus/fonts/ftface.h
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/prefsmanager.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/prefsmanager.cpp (revision 5979)
+++ branches/Version13x/Scribus/scribus/prefsmanager.cpp (revision 5980)
@@ -116,7 +116,7 @@
/** Default font and size **/
SCFontsIterator it(appPrefs.AvailFonts);
bool goodFont = false;
- for ( SCFontsIterator itf(appPrefs.AvailFonts); itf.current(); ++itf)
+ for ( SCFontsIterator itf(appPrefs.AvailFonts); itf.hasNext(); itf.next())
{
if ((itf.currentKey() == "Arial Regular") || (itf.currentKey() == "Times New Roman Regular"))
{
@@ -1166,13 +1166,13 @@
co.setAttribute("Register",static_cast<int>(appPrefs.DColors[itc.key()].isRegistrationColor()));
elem.appendChild(co);
}
- for ( SCFontsIterator itf(appPrefs.AvailFonts); itf.current(); ++itf)
+ for ( SCFontsIterator itf(appPrefs.AvailFonts); itf.hasNext(); itf.next())
{
QDomElement fn=docu.createElement("FONT");
fn.setAttribute("NAME",itf.currentKey());
- fn.setAttribute("EMBED",static_cast<int>(itf.current()->embedPs()));
- fn.setAttribute("USE", static_cast<int>(itf.current()->usable()));
- fn.setAttribute("SUBSET", static_cast<int>(itf.current()->subset()));
+ fn.setAttribute("EMBED",static_cast<int>(itf.current().embedPs()));
+ fn.setAttribute("USE", static_cast<int>(itf.current().usable()));
+ fn.setAttribute("SUBSET", static_cast<int>(itf.current().subset()));
elem.appendChild(fn);
}
for (uint rd=0; rd<appPrefs.RecentDocs.count(); ++rd)
@@ -1702,7 +1702,7 @@
{
QString tmpf = dc.attribute("FACE");
QString newFont = "";
- if (!appPrefs.AvailFonts.find(tmpf))
+ if (!appPrefs.AvailFonts.contains(tmpf))
{
ScCore->showSplash(false);
MissingFont *dia = new MissingFont(0, tmpf, 0);
@@ -1719,11 +1719,11 @@
}
if (dc.tagName()=="FONT")
{
- if (appPrefs.AvailFonts.find(dc.attribute("NAME")))
+ if (appPrefs.AvailFonts.contains(dc.attribute("NAME")))
{
- appPrefs.AvailFonts[dc.attribute("NAME")]->embedPs(static_cast<bool>(dc.attribute("EMBED").toInt()));
- appPrefs.AvailFonts[dc.attribute("NAME")]->useFont(appPrefs.AvailFonts[dc.attribute("NAME")]->usable() && static_cast<bool>(dc.attribute("USE", "1").toInt()));
- appPrefs.AvailFonts[dc.attribute("NAME")]->subset(static_cast<bool>(dc.attribute("SUBSET", "0").toInt()));
+ appPrefs.AvailFonts[dc.attribute("NAME")].embedPs(static_cast<bool>(dc.attribute("EMBED").toInt()));
+ appPrefs.AvailFonts[dc.attribute("NAME")].usable(appPrefs.AvailFonts[dc.attribute("NAME")].usable() && static_cast<bool>(dc.attribute("USE", "1").toInt()));
+ appPrefs.AvailFonts[dc.attribute("NAME")].subset(static_cast<bool>(dc.attribute("SUBSET", "0").toInt()));
}
}
if (dc.tagName()=="COLOR")
Index: branches/Version13x/Scribus/scribus/fpointarray.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/fpointarray.cpp (revision 5979)
+++ branches/Version13x/Scribus/scribus/fpointarray.cpp (revision 5980)
@@ -169,11 +169,24 @@
pend += count;
for (Iterator p = begin(); p != pend; p++)
{
- if (p->xp < 900000)
+ if (p->x() < 900000)
*p += pt;
}
}
+void FPointArray::scale( double sx, double sy )
+{
+ Iterator pend = begin();
+ pend += count;
+ for (Iterator p = begin(); p != pend; p++)
+ {
+ if (p->x() < 900000) {
+ p->setXY(p->x() * sx, p->y() * sy);
+ }
+ }
+}
+
+
FPoint FPointArray::WidthHeight()
{
if ( count == 0 )
/branches/Version13x/Scribus/scribus/style.cpp
86,7 → 86,7
cstrikewidth = other.cstrikewidth;
if (other.cextra != NOVALUE)
cextra = other.cextra;
if (other.cfont != &Foi::NONE)
if (!other.cfont.isNone())
cfont = other.cfont;
if (other.ccolor != NOCOLOR)
ccolor = other.ccolor;
132,7 → 132,7
if (other.cextra == cextra)
cextra = NOVALUE;
if (other.cfont == cfont)
cfont = const_cast<Foi*>(&Foi::NONE);
cfont = ScFace::none();
if (other.ccolor == ccolor)
ccolor = NOCOLOR;
if (other.cstroke == cstroke)
141,8 → 141,79
language_ = NOLANG;
}
 
bool CharStyle::equiv(const Style & other) const
{
const CharStyle * oth = dynamic_cast<const CharStyle*> ( & other );
return (oth &&
csize == oth->csize &&
cshade == oth->cshade &&
cshade2 == oth->cshade2 &&
cstyle == oth->cstyle &&
cscale == oth->cscale &&
cscalev == oth->cscalev &&
cbase == oth->cbase &&
cshadowx == oth->cshadowx &&
cshadowy == oth->cshadowy &&
coutline == oth->coutline &&
cunderpos == oth->cunderpos &&
cunderwidth == oth->cunderwidth &&
cstrikepos == oth->cstrikepos &&
cstrikewidth == oth->cstrikewidth &&
cextra == oth->cextra &&
cfont == oth->cfont &&
ccolor == oth->ccolor &&
cstroke == oth->cstroke &&
language_ == oth->language_ );
}
 
 
QString CharStyle::displayName() const
{
if ( hasName() || !hasParent() )
return name();
// else if ( inheritsAll() )
// return parent()->displayName();
else
return parent()->displayName() + "+";
}
 
/*
bool CharStyle::definesAll() const
{
return definesLineSpacing() &&
definesLeftMargin() &&
definesRightMargin() &&
definesFirstIndent() &&
definesAlignment() &&
definesGapBefore() &&
definesLineSpacingMode() &&
definesGapAfter() &&
definesHasDropCap() &&
definesDropCapOffset() &&
definesDropCapLines() &&
definesUseBaselineGrid() &&
charStyle().definesAll() ;
}
 
bool CharStyle::inheritsAll() const
{
return inheritsLineSpacing() &&
inheritsLeftMargin() &&
inheritsRightMargin() &&
inheritsFirstIndent() &&
inheritsAlignment() &&
inheritsGapBefore() &&
inheritsLineSpacingMode() &&
inheritsGapAfter() &&
inheritsHasDropCap() &&
inheritsDropCapOffset() &&
inheritsDropCapLines() &&
inheritsUseBaselineGrid() &&
charStyle().inheritsAll() ;
}
*/
 
ParagraphStyle::ParagraphStyle() : Style(), cstyle(),
LineSpaMode(static_cast<LineSpacingMode>(NOVALUE)),
LineSpa(NOVALUE - 0.1),
178,6 → 249,15
BaseAdj(other.BaseAdj)
{}
 
QString ParagraphStyle::displayName() const
{
if ( hasName() || !hasParent() )
return name();
// else if ( inheritsAll() )
// return parent()->displayName();
else
return parent()->displayName() + "+";
}
 
static bool sameTabs(const QValueList<ParagraphStyle::TabRecord>& tabs, const QValueList<ParagraphStyle::TabRecord>& other)
{
212,22 → 292,24
}
 
 
bool ParagraphStyle::equiv(const ParagraphStyle& other) const
bool ParagraphStyle::equiv(const Style& other) const
{
return sameTabs(tabValues(), other.tabValues()) &&
(lineSpacing() == other.lineSpacing()) &&
(leftMargin() == other.leftMargin()) &&
(rightMargin() == other.rightMargin()) &&
(firstIndent() == other.firstIndent()) &&
(alignment() == other.alignment()) &&
(gapBefore() == other.gapBefore()) &&
(lineSpacingMode() == other.lineSpacingMode()) &&
(gapAfter() == other.gapAfter()) &&
(hasDropCap() == other.hasDropCap()) &&
(dropCapOffset() == other.dropCapOffset()) &&
(dropCapLines() == other.dropCapLines()) &&
(useBaselineGrid() == other.useBaselineGrid()) &&
(charStyle() == other.charStyle());
const ParagraphStyle* oth = dynamic_cast<const ParagraphStyle*> ( & other );
return oth &&
sameTabs(tabValues(), oth->tabValues()) &&
(lineSpacing() == oth->lineSpacing()) &&
(leftMargin() == oth->leftMargin()) &&
(rightMargin() == oth->rightMargin()) &&
(firstIndent() == oth->firstIndent()) &&
(alignment() == oth->alignment()) &&
(gapBefore() == oth->gapBefore()) &&
(lineSpacingMode() == oth->lineSpacingMode()) &&
(gapAfter() == oth->gapAfter()) &&
(hasDropCap() == oth->hasDropCap()) &&
(dropCapOffset() == oth->dropCapOffset()) &&
(dropCapLines() == oth->dropCapLines()) &&
(useBaselineGrid() == oth->useBaselineGrid()) &&
(charStyle() == oth->charStyle());
}
 
 
305,8 → 387,8
Indent = NOVALUE - 0.1;
if (other.rightMargin_ == rightMargin_)
rightMargin_ = NOVALUE - 0.1;
if (other.First == gapBefore_)
gapBefore_ = NOVALUE - 0.1;
if (other.First == First)
First = NOVALUE - 0.1;
if (other.gapBefore_ == gapBefore_)
gapBefore_ = NOVALUE - 0.1;
if (other.gapAfter_ == gapAfter_)
/branches/Version13x/Scribus/scribus/scribusXml.cpp
50,7 → 50,6
ScriXmlDoc::ScriXmlDoc()
{
prefsManager=PrefsManager::instance();
dummyFois.setAutoDelete(true);
}
 
// bool ScriXmlDoc::IsScribus(QString fileName)
70,26 → 69,26
tmp2.replace(QRegExp("\t"), QChar(4));
tmpf = it->attribute("CFONT", doc->toolSettings.defFont);
bool unknown = false;
Foi* dummy = NULL;
if ((!prefsManager->appPrefs.AvailFonts.find(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf]->usable()))
ScFace dummy = ScFace::none();
if ((!prefsManager->appPrefs.AvailFonts.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf].usable()))
{
bool isThere = false;
for (uint dl = 0; dl < dummyFois.count(); ++dl)
for (uint dl = 0; dl < dummyScFaces.count(); ++dl)
{
if (dummyFois.at(dl)->scName() == tmpf)
if ((*dummyScFaces.at(dl)).scName() == tmpf)
{
isThere = true;
dummy = dummyFois.at(dl);
dummy = *dummyScFaces.at(dl);
break;
}
}
if (!isThere)
{
dummy = new Foi(tmpf, "", tmpf, "", "", 1, false);
dummyFois.append(dummy);
//FIXME dummy = new ScFace(tmpf, "", tmpf, "", "", 1, false);
dummyScFaces.append(dummy);
}
unknown = true;
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
236,9 → 235,9
PrefsManager *prefsManager=PrefsManager::instance();
// QFont fo;
QString tmpf = fStr;
if ((!avail.find(tmpf)) || (!avail[tmpf]->usable()))
if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
qApp->setOverrideCursor(QCursor(arrowCursor), true);
MissingFont *dia = new MissingFont(0, tmpf, doc);
318,7 → 317,7
ob->setAttribute("FLIPPEDV", item->imageFlippedV());
/* ob->setAttribute("BBOXX",item->BBoxX);
ob->setAttribute("BBOXH",item->BBoxH); */
ob->setAttribute("IFONT",item->itemText.defaultStyle().charStyle().font()->scName());
ob->setAttribute("IFONT",item->itemText.defaultStyle().charStyle().font().scName());
ob->setAttribute("ISIZE",item->itemText.defaultStyle().charStyle().fontSize() / 10.0 );
ob->setAttribute("SCALETYPE", item->ScaleType ? 1 : 0);
ob->setAttribute("RATIO", item->AspectRatio ? 1 : 0);
461,7 → 460,7
}
 
//CB: Private only now
void ScriXmlDoc::GetStyle(QDomElement *pg, ParagraphStyle *vg, QValueList<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl)
void ScriXmlDoc::GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl)
{
bool fou;
QString tmpf, tmf, tmV;
586,7 → 585,7
}
if (!fou)
{
docParagraphStyles.append(*vg);
docParagraphStyles.append(vg);
if (fl)
{
DoVorl[VorlC] = tmV.setNum(docParagraphStyles.count()-1);
728,9 → 727,9
if(pg.tagName()=="FONT")
{
tmpf = pg.attribute("NAME");
if ((!avail.find(tmpf)) || (!avail[tmpf]->usable()))
if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
{
if (!FontSub.contains(tmpf) || (!avail[FontSub[tmpf]]->usable()))
if (!FontSub.contains(tmpf) || (!avail[FontSub[tmpf]].usable()))
{
MissingFont *dia = new MissingFont(0, tmpf, doc);
dia->exec();
1041,7 → 1040,7
fo.setAttribute("FIRST",UsedStyles[actSt].firstIndent());
fo.setAttribute("VOR",UsedStyles[actSt].gapBefore());
fo.setAttribute("NACH",UsedStyles[actSt].gapAfter());
fo.setAttribute("FONT",UsedStyles[actSt].charStyle().font()->scName());
fo.setAttribute("FONT",UsedStyles[actSt].charStyle().font().scName());
fo.setAttribute("FONTSIZE",UsedStyles[actSt].charStyle().fontSize() / 10.0);
fo.setAttribute("DROP", static_cast<int>(UsedStyles[actSt].hasDropCap()));
fo.setAttribute("DROPLIN", UsedStyles[actSt].dropCapLines());
1223,7 → 1222,7
QChar ch = item->itemText.text(k);
QDomElement it=docu.createElement("ITEXT");
ts = style4.fontSize() / 10.0;
tf = style4.font()->scName();
tf = style4.font().scName();
tc = style4.fillColor();
te = style4.tracking();
tsh = style4.fillShade();
1283,7 → 1282,7
const CharStyle& style5(item->itemText.charStyle(k));
ch = item->itemText.text(k);
ts2 = style5.fontSize() / 10.0;
tf2 = style5.font()->scName();
tf2 = style5.font().scName();
tc2 = style5.fillColor();
te2 = style5.tracking();
tsh2 = style5.fillShade();
1340,7 → 1339,7
const CharStyle& style6(item->itemText.charStyle(k));
ch = item->itemText.text(k);
ts2 = style6.fontSize() / 10.0;
tf2 = style6.font()->scName();
tf2 = style6.font().scName();
tc2 = style6.fillColor();
te2 = style6.tracking();
tsh2 = style6.fillShade();
/branches/Version13x/Scribus/scribus/pageitem_pathtext.cpp
71,7 → 71,6
double wide;
QString chstr, chstr2, chstr3;
ScText *hl;
struct ZZ *Zli;
double dx;
double sp = 0;
double oldSp = 0;
107,7 → 106,7
if ((chstr == QChar(30)) || (chstr == QChar(13)) || (chstr == QChar(9)) || (chstr == QChar(28)))
continue;
chs = hl->fontSize();
SetZeichAttr(*hl, &chs, &chstr);
// SetZeichAttr(*hl, &chs, &chstr); //FIXME: layoutglyphs
if (chstr == QChar(29))
chstr2 = " ";
else if (chstr == QChar(24))
122,10 → 121,10
chstr3 = "-";
else
chstr3 = itemText.text(a+1, 1);
wide = Cwidth(m_Doc, hl->font(), chstr2, chs, chstr3);
wide = hl->font().charWidth(chstr2[0], chs, chstr3[0]);
}
else
wide = Cwidth(m_Doc, hl->font(), chstr2, chs);
wide = hl->font().charWidth(chstr2[0], chs);
wide = wide * (hl->scaleH() / 1000.0);
dx = wide / 2.0;
CurX += dx;
193,7 → 192,7
p->save();
QWMatrix savWM = p->worldMatrix();
p->setWorldMatrix(trafo);
Zli = new ZZ;
/* Zli = new ZZ;
Zli->Zeich = chstr;
if (hl->fillColor() != CommonStrings::None)
{
232,9 → 231,9
Zli->strikewidth = hl->strikethruWidth();
Zli->embedded = 0;
if (!m_Doc->RePos)
DrawZeichenS(p, Zli);
DrawZeichenS(p, Zli); // FIXME: drawglyphs
delete Zli;
p->setWorldMatrix(savWM);
*/ p->setWorldMatrix(savWM);
p->restore();
p->setZoomFactor(sc);
MaxChars = a+1;
/branches/Version13x/Scribus/scribus/edit1format.cpp
64,7 → 64,7
GroupFontLayout = new QVBoxLayout( GroupFont->layout() );
GroupFontLayout->setAlignment( Qt::AlignLeft );
FontC = new FontComboH(GroupFont);
FontC->setCurrentFont(vor->charStyle().font()->scName());
FontC->setCurrentFont(vor->charStyle().font().scName());
GroupFontLayout->addWidget( FontC );
layout7 = new QHBoxLayout( 0, 0, 5, "layout7");
SizeC = new MSpinBox( 1, 2048, GroupFont, 1 );
/branches/Version13x/Scribus/scribus/pageitem.cpp
616,7 → 616,7
int PageItem::lastInFrame() const
{
#ifndef NLS_PROTO
return QMIN(MaxChars, itemText.length()) - 1;
return QMIN(signed(MaxChars), itemText.length()) - 1;
#else
return itemText.length() - 1;
#endif
989,28 → 989,28
p->restore();
}
 
void PageItem::DrawObj_Embedded(ScPainter *p, QRect e, struct ZZ *hl)
void PageItem::DrawObj_Embedded(ScPainter *p, QRect e, const CharStyle& style, PageItem* cembedded)
{
QPtrList<PageItem> emG;
emG.clear();
if (hl->embedded != 0)
if (cembedded != 0)
{
if (!m_Doc->DoDrawing)
{
hl->embedded->Tinput = false;
hl->embedded->FrameOnly = false;
cembedded->Tinput = false;
cembedded->FrameOnly = false;
return;
}
emG.append(hl->embedded);
if (hl->embedded->Groups.count() != 0)
emG.append(cembedded);
if (cembedded->Groups.count() != 0)
{
for (uint ga=0; ga<m_Doc->FrameItems.count(); ++ga)
{
if (m_Doc->FrameItems.at(ga)->Groups.count() != 0)
{
if (m_Doc->FrameItems.at(ga)->Groups.top() == hl->embedded->Groups.top())
if (m_Doc->FrameItems.at(ga)->Groups.top() == cembedded->Groups.top())
{
if (m_Doc->FrameItems.at(ga)->ItemNr != hl->embedded->ItemNr)
if (m_Doc->FrameItems.at(ga)->ItemNr != cembedded->ItemNr)
{
if (emG.find(m_Doc->FrameItems.at(ga)) == -1)
emG.append(m_Doc->FrameItems.at(ga));
1039,7 → 1039,9
}
*/
p->save();
embedded->Xpos = Xpos + hl->xco + embedded->gXpos;
double pws=0;
/* FIXME
embedded->Xpos = Xpos + hl->xco + embedded->gXpos;
embedded->Ypos = Ypos + (hl->yco - (embedded->gHeight * (hl->scalev / 1000.0))) + embedded->gYpos;
p->translate((hl->xco + embedded->gXpos * (hl->scale / 1000.0)) * p->zoomFactor(), (hl->yco - (embedded->gHeight * (hl->scalev / 1000.0)) + embedded->gYpos * (hl->scalev / 1000.0)) * p->zoomFactor());
if (hl->base != 0)
1071,6 → 1073,7
}
embedded->m_lineWidth = pws * QMIN(hl->scale / 1000.0, hl->scalev / 1000.0);
embedded->DrawObj_Post(p);
*/
p->restore();
embedded->m_lineWidth = pws;
/*
1284,78 → 1287,88
*tmp = m_Doc->PageColors[farbe].getShadeColorProof(shad);
}
 
double PageItem::SetZeichAttr(const CharStyle& style, int *chs, QString *chstr)
double PageItem::layoutGlyphs(const CharStyle& style, const QString chars, GlyphLayout& layout)
{
double retval = 0.0;
double asce = style.font()->ascent() * (style.fontSize() / 10.0);
double asce = style.font().ascent(style.fontSize() / 10.0);
int chst = style.effects() & 1919;
layout.glyph = chars[0].unicode(); // FIXME: should char2Cmap here
if (chst != ScStyle_Default)
{
if (chst & ScStyle_Superscript)
{
retval -= asce * m_Doc->typographicSettings.valueSuperScript / 100;
*chs = QMAX(static_cast<int>(style.fontSize() * m_Doc->typographicSettings.scalingSuperScript / 100), 1);
layout.scaleV = layout.scaleH = QMAX(m_Doc->typographicSettings.scalingSuperScript / 100, 10 / style.fontSize());
}
if (chst & ScStyle_Subscript)
else if (chst & ScStyle_Subscript)
{
retval += asce * m_Doc->typographicSettings.valueSubScript / 100;
*chs = QMAX(static_cast<int>(style.fontSize() * m_Doc->typographicSettings.scalingSubScript / 100), 1);
layout.scaleV = layout.scaleH = QMAX(m_Doc->typographicSettings.scalingSubScript / 100, 10 / style.fontSize());
}
else {
layout.scaleV = layout.scaleH = 1;
}
layout.scaleH *= style.scaleH() / 1000.0;
layout.scaleV *= style.scaleV() / 1000.0;
if (chst & ScStyle_AllCaps)
{
if (chstr->upper() != *chstr)
*chstr = chstr->upper();
layout.glyph = QChar(layout.glyph).upper().unicode();
}
if (chst & ScStyle_SmallCaps)
{
if (chstr->upper() != *chstr)
double smallcapsScale = m_Doc->typographicSettings.valueSmallCaps / 100.0;
uint uc = QChar(layout.glyph).upper().unicode();
if (uc != layout.glyph)
{
*chs = QMAX(static_cast<int>(style.fontSize() * m_Doc->typographicSettings.valueSmallCaps / 100), 1);
*chstr = chstr->upper();
layout.glyph = uc;
layout.scaleV *= smallcapsScale;
layout.scaleH *= smallcapsScale;
}
}
}
else {
layout.scaleH = style.scaleH() / 1000.0;
layout.scaleV = style.scaleV() / 1000.0;
}
return retval;
}
 
void PageItem::DrawZeichenS(ScPainter *p, struct ZZ *hl)
void PageItem::drawGlyphs(ScPainter *p, const CharStyle& style, GlyphLayout& glyphs)
{
double csi = static_cast<double>(hl->Siz) / 100.0;
QString ccx = hl->Zeich;
if ((m_Doc->guidesSettings.showControls) && ((ccx == QChar(9)) || (ccx == QChar(29)) || ((ccx == QChar(26)) && (Cols > 1))|| (ccx == QChar(27)) || (ccx == QChar(32))))
uint ccx = glyphs.glyph;
if ((m_Doc->guidesSettings.showControls) && (ccx == 9 || ccx == 29 || (ccx == 26 && Cols > 1) || ccx == 27 || ccx == 32))
{
QWMatrix chma, chma2, chma4, chma5;
QWMatrix chma, chma4, chma5;
FPointArray points;
if (ccx == QChar(9))
if (ccx == (9))
{
points = m_Doc->symTab.copy();
chma4.translate(hl->xco-((hl->Siz / 100.0) * 7.0), hl->yco-((hl->Siz / 10.0) * 0.5));
chma4.translate(glyphs.xoffset - ((style.fontSize() / 10.0) * glyphs.scaleH * 0.7), glyphs.yoffset - ((style.fontSize() / 10.0) * glyphs.scaleV * 0.5));
}
else if (ccx == QChar(26))
else if (ccx == (26))
{
points = m_Doc->symNewCol.copy();
chma4.translate(hl->xco, hl->yco-((hl->Siz / 10.0) * 0.6));
chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV * 0.6));
}
else if (ccx == QChar(27))
else if (ccx == (27))
{
points = m_Doc->symNewFrame.copy();
chma4.translate(hl->xco, hl->yco-((hl->Siz / 10.0) * 0.6));
chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV * 0.6));
}
else
{
points = m_Doc->symNonBreak.copy();
chma4.translate(hl->xco, hl->yco-((hl->Siz / 10.0) * 0.4));
chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV * 0.4));
}
chma.scale(csi, csi);
chma2.scale(hl->scale / 1000.0, hl->scalev / 1000.0);
chma.scale(glyphs.scaleH * style.fontSize() / 100.0, glyphs.scaleV * style.fontSize() / 100.0);
chma5.scale(p->zoomFactor(), p->zoomFactor());
points.map(chma * chma2 * chma4 * chma5);
points.map(chma * chma4 * chma5);
p->setupTextPolygon(&points);
if (ccx == QChar(32))
if (ccx == (32))
{
QColor tmp = p->pen();
p->setPen(p->brush(), 1, SolidLine, FlatCap, MiterJoin);
p->setLineWidth(hl->Siz / 200.0);
p->setLineWidth(style.fontSize() * glyphs.scaleV / 200.0);
p->strokePath();
p->setPen(tmp, 1, SolidLine, FlatCap, MiterJoin);
}
1365,59 → 1378,59
p->fillPath();
}
}
if ((ccx == QChar(13)) || (ccx == QChar(9)) || (ccx == QChar(28)) || (ccx == QChar(27)) || (ccx == QChar(26)))
if ((ccx == (13)) || (ccx == (9)) || (ccx == (28)) || (ccx == (27)) || (ccx == (26)))
return;
if (ccx == QChar(29))
ccx = " ";
if (ccx == QChar(24))
ccx = "-";
if (hl->ZFo->canRender(ccx[0]))
if (ccx == (29))
ccx = 32;
if (ccx == (24))
ccx = QChar('-').unicode();
if (style.font().canRender(QChar(ccx)))
{
QWMatrix chma, chma2, chma3, chma4, chma5, chma6;
chma.scale(csi, csi);
chma.scale(glyphs.scaleH * style.fontSize() / 100.00, glyphs.scaleV * style.fontSize() / 100.0);
// qDebug(QString("glyphscale: %1 %2").arg(glyphs.scaleH).arg(glyphs.scaleV));
chma5.scale(p->zoomFactor(), p->zoomFactor());
FPointArray gly = hl->ZFo->outline(ccx[0]).copy();
uint gl = style.font().char2CMap(QChar(ccx));
FPointArray gly = style.font().glyphOutline(gl);
// Do underlining first so you can get typographically correct
// underlines when drawing a white outline
if ((hl->Style & ScStyle_Underline) || ((hl->Style & ScStyle_UnderlineWords) && (!ccx[0].isSpace())))
if ((style.effects() & ScStyle_Underline) || ((style.effects() & ScStyle_UnderlineWords) && (!QChar(ccx).isSpace())))
{
double st, lw;
if ((hl->underpos != -1) || (hl->underwidth != -1))
if ((style.font().underlinePos() != -1) || (style.underlineWidth() != -1))
{
if (hl->underpos != -1)
st = (hl->underpos / 1000.0) * (hl->ZFo->descent() * (hl->realSiz / 10.0));
if (style.font().underlinePos() != -1)
st = (style.font().underlinePos() / 1000.0) * (style.font().descent(style.fontSize() / 10.0));
else
st = hl->ZFo->underlinePos() * (hl->realSiz / 10.0);
if (hl->underwidth != -1)
lw = (hl->underwidth / 1000.0) * (hl->realSiz / 10.0);
st = style.font().underlinePos(style.fontSize() / 10.0);
if (style.underlineWidth() != -1)
lw = (style.underlineWidth() / 1000.0) * (style.fontSize() / 10.0);
else
lw = QMAX(hl->ZFo->strokeWidth() * (hl->realSiz / 10.0), 1);
lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1);
}
else
{
st = hl->ZFo->underlinePos() * (hl->realSiz / 10.0);
lw = QMAX(hl->ZFo->strokeWidth() * (hl->realSiz / 10.0), 1);
st = style.font().underlinePos(style.fontSize() / 10.0);
lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1);
}
if (hl->base != 0)
st += (hl->Siz / 10.0) * (hl->base / 1000.0);
if (style.baselineOffset() != 0)
st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0);
p->setPen(p->brush());
p->setLineWidth(lw);
p->drawLine(FPoint(hl->xco-hl->kern, hl->yco-st), FPoint(hl->xco+hl->wide, hl->yco-st));
p->drawLine(FPoint(glyphs.xoffset, glyphs.yoffset - st), FPoint(glyphs.xoffset + glyphs.xadvance, glyphs.yoffset - st));
}
if (gly.size() > 3)
{
chma2.scale(hl->scale / 1000.0, hl->scalev / 1000.0);
if (Reverse)
{
chma3.scale(-1, 1);
chma3.translate(-hl->wide, 0);
chma4.translate(hl->xco, hl->yco-((hl->Siz / 10.0) * (hl->scalev / 1000.0)));
chma3.translate(-glyphs.xadvance, 0);
}
else
chma4.translate(hl->xco, hl->yco-((hl->Siz / 10.0) * (hl->scalev / 1000.0)));
if (hl->base != 0)
chma6.translate(0, -(hl->Siz / 10.0) * (hl->base / 1000.0) * p->zoomFactor());
gly.map(chma * chma2 * chma3 * chma4 * chma5 * chma6);
chma4.translate(glyphs.xoffset, glyphs.yoffset - ((style.fontSize() / 10.0) * glyphs.scaleV));
if (style.baselineOffset() != 0)
chma6.translate(0, -(style.fontSize() / 10.0) * (style.baselineOffset() / 1000.0) * p->zoomFactor());
gly.map(chma * chma3 * chma4 * chma5 * chma6);
p->setFillMode(1);
bool fr = p->fillRule();
p->setFillRule(false);
1434,19 → 1447,19
p->setFillRule(fr);
return;
}
if ((hl->ZFo->isStroked()) && ((hl->Siz * hl->outline / 10000.0) != 0))
if ((style.font().isStroked()) && ((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) != 0))
{
QColor tmp = p->brush();
p->setPen(tmp, 1, SolidLine, FlatCap, MiterJoin);
p->setLineWidth(hl->Siz * hl->outline / 10000.0);
p->setLineWidth(style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0);
p->strokePath();
}
else
{
if ((hl->Style & ScStyle_Shadowed) && (hl->Farb2 != CommonStrings::None))
if ((style.effects() & ScStyle_Shadowed) && (style.strokeColor() != CommonStrings::None))
{
p->save();
p->translate((hl->Siz * hl->shadowX / 10000.0) * p->zoomFactor(), -(hl->Siz * hl->shadowY / 10000.0) * p->zoomFactor());
p->translate((style.fontSize() * glyphs.scaleH * style.shadowXOffset() / 10000.0) * p->zoomFactor(), -(style.fontSize() * glyphs.scaleV * style.shadowYOffset() / 10000.0) * p->zoomFactor());
QColor tmp = p->brush();
p->setBrush(p->pen());
#ifdef HAVE_CAIRO
1459,40 → 1472,40
p->setupTextPolygon(&gly);
#endif
}
if (hl->Farb != CommonStrings::None)
if (style.fillColor() != CommonStrings::None)
p->fillPath();
if ((hl->Style & ScStyle_Outline) && (hl->Farb2 != CommonStrings::None) && ((hl->Siz * hl->outline / 10000.0) != 0))
if ((style.effects() & ScStyle_Outline) && (style.strokeColor() != CommonStrings::None) && ((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) != 0))
{
p->setLineWidth(hl->Siz * hl->outline / 10000.0);
p->setLineWidth(style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0);
p->strokePath();
}
}
p->setFillRule(fr);
}
if (hl->Style & ScStyle_Strikethrough)
if (style.effects() & ScStyle_Strikethrough)
{
double st, lw;
if ((hl->strikepos != -1) || (hl->strikewidth != -1))
if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
{
if (hl->strikepos != -1)
st = (hl->strikepos / 1000.0) * (hl->ZFo->ascent() * (hl->realSiz / 10.0));
if (style.strikethruOffset() != -1)
st = (style.strikethruOffset() / 1000.0) * (style.font().ascent(style.fontSize() / 10.0));
else
st = hl->ZFo->strikeoutPos() * (hl->realSiz / 10.0);
if (hl->strikewidth != -1)
lw = (hl->strikewidth / 1000.0) * (hl->realSiz / 10.0);
st = style.font().strikeoutPos(style.fontSize() / 10.0);
if (style.strikethruWidth() != -1)
lw = (style.strikethruWidth() / 1000.0) * (style.fontSize() / 10.0);
else
lw = QMAX(hl->ZFo->strokeWidth() * (hl->realSiz / 10.0), 1);
lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1);
}
else
{
st = hl->ZFo->strikeoutPos() * (hl->realSiz / 10.0);
lw = QMAX(hl->ZFo->strokeWidth() * (hl->realSiz / 10.0), 1);
st = style.font().strikeoutPos(style.fontSize() / 10.0);
lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1);
}
if (hl->base != 0)
st += (hl->Siz / 10.0) * (hl->base / 1000.0);
if (style.baselineOffset() != 0)
st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0);
p->setPen(p->brush());
p->setLineWidth(lw);
p->drawLine(FPoint(hl->xco-hl->kern, hl->yco-st), FPoint(hl->xco+hl->wide, hl->yco-st));
p->drawLine(FPoint(glyphs.xoffset, glyphs.yoffset - st), FPoint(glyphs.xoffset + glyphs.xadvance, glyphs.yoffset - st));
}
}
else
1501,8 → 1514,10
p->setPen(red);
p->setBrush(red);
p->setFillMode(1);
p->drawRect(hl->xco, hl->yco-(hl->Siz / 10.0), (hl->Siz / 10.0)*(hl->scale / 1000.0), (hl->Siz / 10.0));
p->drawRect(glyphs.xoffset, glyphs.yoffset - (style.fontSize() / 10.0) * glyphs.scaleV , (style.fontSize() / 10.0) * glyphs.scaleH, (style.fontSize() / 10.0) * glyphs.scaleV);
}
if (glyphs.more)
drawGlyphs(p, style, *glyphs.more);
}
 
void PageItem::DrawPolyL(QPainter *p, QPointArray pts)
2886,7 → 2901,7
Text += QString(QChar(4))+"\t";
else
Text += itemText.text(a,1)+"\t";
Text += itemText.charStyle(a).font()->scName()+"\t";
Text += itemText.charStyle(a).font().scName()+"\t";
Text += QString::number(itemText.charStyle(a).fontSize() / 10.0)+"\t";
Text += itemText.charStyle(a).fillColor()+"\t";
Text += QString::number(itemText.charStyle(a).tracking())+"\t";
3397,8 → 3412,8
for (uint a = 0; a < itemTextCount; ++a)
{
const CharStyle& hl (itemText.charStyle(a));
int des = static_cast<int>(hl.font()->descent() * (-hl.fontSize() / 10.0));
int asc = static_cast<int>(hl.font()->ascent() * (hl.fontSize() / 10.0));
int des = -static_cast<int>(hl.font().descent(hl.fontSize() / 10.0));
int asc = static_cast<int>(hl.font().ascent(hl.fontSize() / 10.0));
if (asc > asce)
asce = asc;
if (des > desc)
3520,7 → 3535,7
emit lineSpacing(itemText.defaultStyle().lineSpacing());
emit textKerning(itemText.defaultStyle().charStyle().tracking());
emit textStyle(itemText.defaultStyle().charStyle().effects());
emit textFont(itemText.defaultStyle().charStyle().font()->scName());
emit textFont(itemText.defaultStyle().charStyle().font().scName());
emit textSize(itemText.defaultStyle().charStyle().fontSize());
// emit textFormatting(itemText.defaultStyle().alignment());
}
/branches/Version13x/Scribus/scribus/scribusview.cpp
5135,9 → 5135,9
ss->Objekt = cc;
int st = findParagraphStyle(Doc, Doc->currentStyle);
if (st > 5)
ss->GetText(currItem, st, Doc->docParagraphStyles[st].charStyle().font()->scName(), Doc->docParagraphStyles[st].charStyle().fontSize(), true);
ss->GetText(currItem, st, Doc->docParagraphStyles[st].charStyle().font().scName(), Doc->docParagraphStyles[st].charStyle().fontSize(), true);
else
ss->GetText(currItem, st, currItem->itemText.defaultStyle().charStyle().font()->scName(), currItem->itemText.defaultStyle().charStyle().fontSize(), true);
ss->GetText(currItem, st, currItem->itemText.defaultStyle().charStyle().font().scName(), currItem->itemText.defaultStyle().charStyle().fontSize(), true);
delete ss;
ss=NULL;
if (Doc->docHyphenator->AutoCheck)
7379,7 → 7379,7
emit ItemTextBase(currItem->itemText.charStyle(a).baselineOffset());
emit ItemTextSca(currItem->itemText.charStyle(a).scaleH());
emit ItemTextScaV(currItem->itemText.charStyle(a).scaleV());
emit ItemTextFont(currItem->itemText.charStyle(a).font()->scName());
emit ItemTextFont(currItem->itemText.charStyle(a).font().scName());
emit ItemTextSize(currItem->itemText.charStyle(a).fontSize());
emit ItemTextUSval(currItem->itemText.charStyle(a).tracking());
emit ItemTextStil(currItem->itemText.charStyle(a).effects());
7439,7 → 7439,7
if (currItem->itemText.length() != 0)
{
a=currItem->lastInFrame();
int w = qRound(Cwidth(Doc, currItem->itemText.charStyle(a).font(), currItem->itemText.text(a,1), currItem->itemText.charStyle(a).fontSize())*(currItem->itemText.charStyle(a).scaleH() / 1000.0));
int w = qRound(currItem->itemText.charStyle(a).font().charWidth(currItem->itemText.text(a), currItem->itemText.charStyle(a).fontSize())*(currItem->itemText.charStyle(a).scaleH() / 1000.0));
if (xp+currItem->xPos()+w<xP || yp+currItem->yPos()<yP)
currItem->CPos = a+1;
else
7462,7 → 7462,7
emit ItemTextSca(Doc->currentStyle.charStyle().scaleH());
emit ItemTextScaV(Doc->currentStyle.charStyle().scaleV());
emit ItemTextFarben(Doc->currentStyle.charStyle().strokeColor(), Doc->currentStyle.charStyle().fillColor(), Doc->currentStyle.charStyle().strokeShade(), Doc->currentStyle.charStyle().fillShade());
emit ItemTextFont(Doc->currentStyle.charStyle().font()->scName());
emit ItemTextFont(Doc->currentStyle.charStyle().font().scName());
emit ItemTextSize(Doc->currentStyle.charStyle().fontSize());
emit ItemTextUSval(Doc->currentStyle.charStyle().tracking());
emit ItemTextStil(Doc->currentStyle.charStyle().effects());
7480,7 → 7480,7
emit ItemTextSca(currItem->itemText.defaultStyle().charStyle().scaleH());
emit ItemTextScaV(currItem->itemText.defaultStyle().charStyle().scaleV());
emit ItemTextFarben(currItem->itemText.defaultStyle().charStyle().strokeColor(), currItem->itemText.defaultStyle().charStyle().fillColor(), currItem->itemText.defaultStyle().charStyle().strokeShade(), currItem->itemText.defaultStyle().charStyle().fillShade());
emit ItemTextFont(currItem->itemText.defaultStyle().charStyle().font()->scName());
emit ItemTextFont(currItem->itemText.defaultStyle().charStyle().font().scName());
emit ItemTextSize(currItem->itemText.defaultStyle().charStyle().fontSize());
emit ItemTextUSval(currItem->itemText.defaultStyle().charStyle().tracking());
emit ItemTextStil(currItem->itemText.defaultStyle().charStyle().effects());
7607,7 → 7607,9
if (chstr == QChar(29))
chstr = " ";
int chs = currItem->itemText.charStyle(offs).fontSize();
currItem->SetZeichAttr(currItem->itemText.charStyle(offs), &chs, &chstr);
//FIXME GlyphLayout glayout;
// currItem->layoutGlyphs(currItem->itemText.charStyle(offs), currItem->itemText.text(off,1), glayout);
// chs = ??
if (currItem->CPos != currItem->lastInFrame())
{
if (currItem->itemText.text(currItem->CPos) == SpecialChars::TAB)
7615,7 → 7617,7
xp = static_cast<int>(currItem->itemText.item(currItem->CPos-1)->glyph.xoffset);
chs = currItem->itemText.charStyle(currItem->CPos-1).fontSize();
chstr = currItem->itemText.text(currItem->CPos-1, 1);
xp += qRound(Cwidth(Doc, currItem->itemText.charStyle(currItem->CPos-1).font(), chstr, chs)*(currItem->itemText.charStyle(currItem->CPos-1).scaleH() / 1000.0));
xp += qRound(currItem->itemText.charStyle(currItem->CPos-1).font().charWidth(chstr[0], chs)*(currItem->itemText.charStyle(currItem->CPos-1).scaleH() / 1000.0));
}
else
xp = static_cast<int>(currItem->itemText.item(offs+1)->glyph.xoffset);
7628,7 → 7630,7
{
chs = currItem->itemText.charStyle(offs).fontSize();
chstr = currItem->itemText.text(offs,1);
xp += qRound(Cwidth(Doc, currItem->itemText.charStyle(offs).font(), chstr, chs)*(currItem->itemText.charStyle(offs).scaleH() / 1000.0));
xp += qRound(currItem->itemText.charStyle(offs).font().charWidth(chstr[0], chs)*(currItem->itemText.charStyle(offs).scaleH() / 1000.0));
}
}
if (currItem->CPos <= currItem->lastInFrame())
7642,7 → 7644,7
xp = static_cast<int>(currItem->itemText.item(offs)->glyph.xoffset);
chs = currItem->itemText.charStyle(offs).fontSize();
chstr = currItem->itemText.text(offs,1);
xp += qRound(Cwidth(Doc, currItem->itemText.charStyle(offs).font(), chstr, chs)*(currItem->itemText.charStyle(offs).scaleH() / 1000.0));
xp += qRound(currItem->itemText.charStyle(offs).font().charWidth(chstr[0], chs)*(currItem->itemText.charStyle(offs).scaleH() / 1000.0));
}
else
xp = static_cast<int>(currItem->itemText.item(offs)->glyph.xoffset);
7649,8 → 7651,8
}
}
yp = static_cast<int>(currItem->itemText.item(offs)->glyph.yoffset);
desc = static_cast<int>(currItem->itemText.charStyle(offs).font()->descent() * (-currItem->itemText.charStyle(offs).fontSize() / 10.0));
asce = static_cast<int>(currItem->itemText.charStyle(offs).font()->ascent() * (currItem->itemText.charStyle(offs).fontSize() / 10.0));
desc = static_cast<int>(currItem->itemText.charStyle(offs).font().descent() * (-currItem->itemText.charStyle(offs).fontSize() / 10.0));
asce = static_cast<int>(currItem->itemText.charStyle(offs).font().ascent() * (currItem->itemText.charStyle(offs).fontSize() / 10.0));
}
else
{
7663,8 → 7665,8
lineCorr = 0;
xp = static_cast<int>(currItem->textToFrameDistLeft() + lineCorr);
yp = static_cast<int>(currItem->textToFrameDistTop() + lineCorr + currItem->itemText.defaultStyle().lineSpacing());
desc = static_cast<int>(currItem->itemText.defaultStyle().charStyle().font()->descent() * (-currItem->itemText.defaultStyle().charStyle().fontSize() / 10.0));
asce = static_cast<int>(currItem->itemText.defaultStyle().charStyle().font()->ascent() * (currItem->itemText.defaultStyle().charStyle().fontSize() / 10.0));
desc = static_cast<int>(currItem->itemText.defaultStyle().charStyle().font().descent() * (-currItem->itemText.defaultStyle().charStyle().fontSize() / 10.0));
asce = static_cast<int>(currItem->itemText.defaultStyle().charStyle().font().ascent() * (currItem->itemText.defaultStyle().charStyle().fontSize() / 10.0));
}
else if ( currItem->frameDisplays(currItem->CPos) )
{
7677,15 → 7679,15
lineCorr = 0;
xp = static_cast<int>(currItem->textToFrameDistLeft() + lineCorr);
yp = static_cast<int>(currItem->textToFrameDistTop() + lineCorr + currItem->itemText.paragraphStyle(currItem->CPos).lineSpacing());
desc = static_cast<int>(currItem->itemText.charStyle(currItem->CPos).font()->descent() * (-currItem->itemText.charStyle(currItem->CPos).fontSize() / 10.0));
asce = static_cast<int>(currItem->itemText.charStyle(currItem->CPos).font()->ascent() * (currItem->itemText.charStyle(currItem->CPos).fontSize() / 10.0));
desc = static_cast<int>(currItem->itemText.charStyle(currItem->CPos).font().descent() * (-currItem->itemText.charStyle(currItem->CPos).fontSize() / 10.0));
asce = static_cast<int>(currItem->itemText.charStyle(currItem->CPos).font().ascent() * (currItem->itemText.charStyle(currItem->CPos).fontSize() / 10.0));
}
else
{
xp = static_cast<int>(currItem->itemText.item(currItem->CPos)->glyph.xoffset);
yp = static_cast<int>(currItem->itemText.item(currItem->CPos)->glyph.yoffset);
desc = static_cast<int>(currItem->itemText.charStyle(currItem->CPos).font()->descent() * (-currItem->itemText.charStyle(currItem->CPos).fontSize() / 10.0));
asce = static_cast<int>(currItem->itemText.charStyle(currItem->CPos).font()->ascent() * (currItem->itemText.charStyle(currItem->CPos).fontSize() / 10.0));
desc = static_cast<int>(currItem->itemText.charStyle(currItem->CPos).font().descent() * (-currItem->itemText.charStyle(currItem->CPos).fontSize() / 10.0));
asce = static_cast<int>(currItem->itemText.charStyle(currItem->CPos).font().ascent() * (currItem->itemText.charStyle(currItem->CPos).fontSize() / 10.0));
}
}
else {
10101,9 → 10103,9
if (currItem->reversed())
{
if (a < currItem->itemText.length()-1)
wide = Cwidth(Doc, hl->font(), chstr, hl->fontSize(), currItem->itemText.text(a+1,1));
wide = hl->font().charWidth(chstr[0], hl->fontSize(), currItem->itemText.text(a+1));
else
wide = Cwidth(Doc, hl->font(), chstr, hl->fontSize());
wide = hl->font().charWidth(chstr[0], hl->fontSize());
chma3.scale(-1, 1);
chma3.translate(-wide, 0);
chma4.translate(0, currItem->BaseOffs-((hl->fontSize() / 10.0) * (hl->scaleV() / 1000.0)));
10112,7 → 10114,8
chma4.translate(0, currItem->BaseOffs-((hl->fontSize() / 10.0) * (hl->scaleV() / 1000.0)));
if (hl->baselineOffset() != 0)
chma6.translate(0, -(hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0));
pts = currItem->itemText.charStyle(a).font()->outline(chr);
uint gl = currItem->itemText.charStyle(a).font().char2CMap(chr);
pts = currItem->itemText.charStyle(a).font().glyphOutline(gl);
if (pts.size() < 4)
continue;
pts.map(chma * chma2 * chma3 * chma4 * chma6);
10127,10 → 10130,11
else
{
chma.scale(csi, csi);
pts = hl->font()->outline(chr);
uint gl = hl->font().char2CMap(chr);
pts = hl->font().glyphOutline(gl);
if (pts.size() < 4)
continue;
FPoint origin = hl->font()->origin(chr);
FPoint origin = hl->font().glyphOrigin(gl);
x = origin.x() * csi;
y = origin.y() * csi;
pts.map(chma);
10185,9 → 10189,9
if (hl->baselineOffset() != 0)
textY -= (hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0);
if (a < currItem->itemText.length()-1)
wide = Cwidth(Doc, hl->font(), chstr, hl->fontSize(), currItem->itemText.text(a+1,1));
wide = hl->font().charWidth(chstr[0], hl->fontSize(), currItem->itemText.text(a+1));
else
wide = Cwidth(Doc, hl->font(), chstr, hl->fontSize());
wide = hl->font().charWidth(chstr[0], hl->fontSize());
if (currItem->imageFlippedH())
textX = currItem->width() - textX - wide;
if (currItem->imageFlippedV())
/branches/Version13x/Scribus/scribus/pageitem_textframe.cpp
205,8 → 205,6
QString chstr, chstr2, chstr3;
ScText *hl;
ParagraphStyle style;
struct ZZ *Zli;
struct ZZ *Zli2;
bool outs = false;
bool fBorder = false;
213,7 → 211,7
bool RTab = false;
bool goNoRoom = false;
bool goNextColumn = false;
uint StartRT, StartRT2;
uint StartRT;
int TabCode = 0;
int HyphenCount = 0;
QValueList<ParagraphStyle::TabRecord> tTabValues;
224,6 → 222,9
bool StartOfCol = true;
tTabValues.clear();
lines.clear();
LineSpec curLine;
/*
for (int xxx=0; xxx<5; ++xxx)
{
250,9 → 251,6
dumpIt(itemText.defaultStyle());
*/
QPtrList<ZZ> LiList;
LiList.setAutoDelete(true);
 
pf2.begin(view->viewport());
pf2.translate(Xpos, Ypos);
pf2.rotate(Rot);
323,16 → 321,18
}
else
chs = hl->fontSize();
desc2 = -hl->font()->descent() * (chs / 10.0);
desc2 = -hl->font().descent(chs / 10.0);
CurY = TExtra+lineCorr;
}
else // no dropcap:
{
desc2 = -m_Doc->currentStyle.charStyle().font()->descent() * (m_Doc->currentStyle.charStyle().fontSize() / 10.0);
desc2 = -m_Doc->currentStyle.charStyle().font().descent(m_Doc->currentStyle.charStyle().fontSize() / 10.0);
CurY = itemText.paragraphStyle(0).lineSpacing() + TExtra+lineCorr-desc2;
}
firstDes = desc2;
LiList.clear();
//! LiList.clear();
int itemsInLine = 0;
curLine.firstItem = firstInFrame();
BuPos = 0;
LastSP = 0;
LastXp = 0;
361,7 → 361,7
if (hl->ch == QChar(30)) // pagenumber
chstr = ExpandToken(a);
if (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
style.setLineSpacing(RealFHeight(m_Doc, hl->font(), hl->fontSize()));
style.setLineSpacing(hl->font().height(hl->fontSize() / 10.0));
// find out about par gap and dropcap
if (a == firstInFrame())
{
412,7 → 412,7
}
// No space at begin of line
if ( //((m_Doc->docParagraphStyles[absa].alignment() == 3) || (m_Doc->docParagraphStyles[absa].alignment() == 4)) &&
(LiList.count() == 0) && (hl->ch == " "))
(itemsInLine == 0) && (hl->ch == " "))
{
hl->setEffects(hl->effects() | ScStyle_SuppressSpace);
continue;
420,7 → 420,7
else
hl->setEffects(hl->effects() & ~ScStyle_SuppressSpace);
 
if (LiList.count() == 0)
if (itemsInLine == 0)
{
// qDebug(QString("textframe(%1,%2): len=%3, linespacing %4: %5").arg(Xpos).arg(Ypos).arg(itemText.length())
// .arg(style.lineSpacingMode()).arg(style.lineSpacing()));
442,7 → 442,7
if (style.lineSpacingMode() == ParagraphStyle::FixedLineSpacing)
CurY += style.lineSpacing() * (DropLines-1);
else
CurY += RealFHeight(m_Doc, hl->font(), style.charStyle().fontSize()) * (DropLines-1);
CurY += hl->font().height(style.charStyle().fontSize() / 10.0) * (DropLines-1);
}
}
}
453,21 → 453,21
// dropcap active?
if (style.useBaselineGrid())
{
chsd = qRound(10 * ((m_Doc->typographicSettings.valueBaseGrid * (DropLines-1)+(hl->font()->ascent() * (style.charStyle().fontSize() / 10.0))) / (RealCHeight(m_Doc, hl->font(), chstr, 10))));
chs = qRound(10 * ((m_Doc->typographicSettings.valueBaseGrid * (DropLines-1)+(hl->font()->ascent() * (style.charStyle().fontSize() / 10.0))) / RealCAscent(m_Doc, hl->font(), chstr, 10)));
chsd = qRound(10 * ((m_Doc->typographicSettings.valueBaseGrid * (DropLines-1)+(hl->font().ascent(style.charStyle().fontSize() / 10.0))) / (hl->font().realCharHeight(chstr[0], 10))));
chs = qRound(10 * ((m_Doc->typographicSettings.valueBaseGrid * (DropLines-1)+(hl->font().ascent(style.charStyle().fontSize() / 10.0))) / hl->font().realCharAscent(chstr[0], 10)));
}
else
{
if (style.lineSpacingMode() == ParagraphStyle::FixedLineSpacing)
{
chsd = qRound(10 * ((style.lineSpacing() * (DropLines-1)+(hl->font()->ascent() * (style.charStyle().fontSize() / 10.0))) / (RealCHeight(m_Doc, hl->font(), chstr, 10))));
chs = qRound(10 * ((style.lineSpacing() * (DropLines-1)+(hl->font()->ascent() * (style.charStyle().fontSize() / 10.0))) / RealCAscent(m_Doc, hl->font(), chstr, 10)));
chsd = qRound(10 * ((style.lineSpacing() * (DropLines-1)+(hl->font().ascent(style.charStyle().fontSize() / 10.0))) / (hl->font().realCharHeight(chstr[0], 10))));
chs = qRound(10 * ((style.lineSpacing() * (DropLines-1)+(hl->font().ascent(style.charStyle().fontSize() / 10.0))) / hl->font().realCharAscent(chstr[0], 10)));
}
else
{
double currasce = RealFHeight(m_Doc, hl->font(), style.charStyle().fontSize());
chsd = qRound(10 * ((currasce * (DropLines-1)+(hl->font()->ascent() * (style.charStyle().fontSize() / 10.0))) / (RealCHeight(m_Doc, hl->font(), chstr, 10))));
chs = qRound(10 * ((currasce * (DropLines-1)+(hl->font()->ascent() * (style.charStyle().fontSize() / 10.0))) / RealCAscent(m_Doc, hl->font(), chstr, 10)));
double currasce = hl->font().height(style.charStyle().fontSize() / 10.0);
chsd = qRound(10 * ((currasce * (DropLines-1)+(hl->font().ascent(style.charStyle().fontSize() / 10.0))) / (hl->font().realCharHeight(chstr[0], 10))));
chs = qRound(10 * ((currasce * (DropLines-1)+(hl->font().ascent(style.charStyle().fontSize() / 10.0))) / hl->font().realCharAscent(chstr[0], 10)));
}
}
hl->setEffects(hl->effects() | ScStyle_DropCap);
480,7 → 480,7
chs = hl->fontSize();
}
// Smallcaps and such
oldCurY = SetZeichAttr(*hl, &chs, &chstr);
oldCurY = layoutGlyphs(*hl, chstr, hl->glyph);
// some special cases TODO: move to ScFace
if (chstr == SpecialChars::NBSPACE)
chstr2 = " ";
493,7 → 493,7
wide = hl->cembedded->gWidth + hl->cembedded->lineWidth();
else
{
if (a < lastInFrame())
if (a+1 < itemText.length())
{
// apply kerning
if (itemText.text(a+1) == SpecialChars::NBSPACE)
502,10 → 502,10
chstr3 = "-";
else
chstr3 = itemText.text(a+1);
wide = Cwidth(m_Doc, hl->font(), chstr2, chs, chstr3);
wide = hl->font().charWidth(chstr2[0], chs / 10.0, chstr3[0]);
}
else
wide = Cwidth(m_Doc, hl->font(), chstr2, chs);
wide = hl->font().charWidth(chstr2[0], chs / 10.0);
}
if (DropCmode)
{
520,7 → 520,7
if (style.lineSpacingMode() == ParagraphStyle::FixedLineSpacing)
asce = style.lineSpacing() * DropLines;
else
asce = RealFHeight(m_Doc, hl->font(), style.charStyle().fontSize()) * DropLines;
asce = hl->font().height(style.charStyle().fontSize() / 10.0) * DropLines;
}
hl->setScaleV(qRound(asce / (hl->cembedded->gHeight + hl->cembedded->lineWidth()) * 1000.0));
hl->setScaleH(hl->scaleV());
527,8 → 527,10
}
else
{
wide = RealCWidth(m_Doc, hl->font(), chstr2, chsd);
asce = RealCHeight(m_Doc, hl->font(), chstr2, chsd);
wide = hl->font().realCharWidth(chstr2[0], chsd / 10.0);
asce = hl->font().realCharHeight(chstr2[0], chsd / 10.0);
hl->setScaleV(qRound(asce / hl->font().ascent(hl->fontSize() / 10.0)) * 1000.0);
hl->setScaleH(hl->scaleV());
}
desc2 = 0;
desc = 0;
543,11 → 545,11
}
else
{
desc = desc2 = -hl->font()->descent() * hlcsize10;
desc = desc2 = -hl->font().descent(hlcsize10);
}
asce = hl->font()->ascent() * hlcsize10;
asce = hl->font().ascent(hlcsize10);
wide = wide * (hl->scaleH() / 1000.0);
}
wide = wide * (hl->scaleH() / 1000.0);
fBorder = false;
// end of col reached?
if (CurY+BExtra+lineCorr > Height)
572,9 → 574,9
if (DropCmode)
{
if (style.useBaselineGrid())
desc2 = -hl->font()->descent() * m_Doc->typographicSettings.valueBaseGrid * style.dropCapLines();
desc2 = -hl->font().descent() * m_Doc->typographicSettings.valueBaseGrid * style.dropCapLines();
else
desc2 = -hl->font()->descent() * style.lineSpacing() * style.dropCapLines();
desc2 = -hl->font().descent() * style.lineSpacing() * style.dropCapLines();
}
if (DropCmode)
DropLines = style.dropCapLines();
596,7 → 598,7
}
}
// ok, there's more room in col
if (LiList.isEmpty())
if (itemsInLine == 0)
{
// start a new line
startLin = a;
682,9 → 684,9
if (DropCmode)
{
if (style.useBaselineGrid())
desc2 = -hl->font()->descent() * m_Doc->typographicSettings.valueBaseGrid * style.dropCapLines();
desc2 = -hl->font().descent() * m_Doc->typographicSettings.valueBaseGrid * style.dropCapLines();
else
desc2 = -hl->font()->descent() * style.lineSpacing() * style.dropCapLines();
desc2 = -hl->font().descent() * style.lineSpacing() * style.dropCapLines();
}
if (DropCmode)
DropLines = style.dropCapLines();
737,8 → 739,8
if (!AbsHasDrop)
CurX += style.leftMargin();
if (opticalMargins) {
int chs = static_cast<int>(itemText.charStyle(a).fontSize() * (itemText.charStyle(a).scaleH() / 1000.0));
double leftCorr = RealCWidth(m_Doc, itemText.charStyle(a).font(), itemText.text(a), chs);
double chs = itemText.charStyle(a).fontSize() * (itemText.charStyle(a).scaleH() / 1000.0);
double leftCorr = itemText.charStyle(a).font().realCharWidth(itemText.text(a), chs / 10.0);
if (QString("'´`").find(itemText.text(a)) >= 0
|| itemText.text(a) == QChar(0x2018)
|| itemText.text(a) == QChar(0x2019)
759,8 → 761,8
leftCorr *= -0.5;
else {
leftCorr = 0;
// leftCorr = Cwidth(m_Doc, itemText.charStyle(a).font(), QChar('o'), chs, itemText.text(a));
// leftCorr -= Cwidth(m_Doc, itemText.charStyle(a).font(), QChar('o'), chs);
// leftCorr = Cwidth(m_Doc, itemText.charStyle(a).font(), QChar('o'), chs / 10.0, itemText.text(a));
// leftCorr -= Cwidth(m_Doc, itemText.charStyle(a).font(), QChar('o'), chs / 10.0);
}
CurX += leftCorr;
}
821,8 → 823,7
CurX = ColBound.x() + tCurX;
}
CurX -= 1;
StartRT = LiList.count();
StartRT2 = a;
StartRT = a;
}
}
829,9 → 830,9
// remember y pos
hl->glyph.yoffset = CurY + oldCurY;
if (DropCmode)
hl->glyph.yoffset -= RealCHeight(m_Doc, hl->font(), chstr2, chsd) - RealCAscent(m_Doc, hl->font(), chstr2, chsd);
hl->glyph.yoffset -= hl->font().realCharHeight(chstr2[0], chsd / 10.0) - hl->font().realCharAscent(chstr2[0], chsd / 10.0);
// find tracking
if (LiList.count() == 0)
if (itemsInLine == 0)
{
itemText.item(a)->setEffects(itemText.item(a)->effects() | ScStyle_StartOfLine);
kernVal = 0;
865,8 → 866,8
{
if (hl->effects() & ScStyle_HyphenationPossible)
{
pt1 = QPoint(qRound(ceil(CurX+RExtra+Cwidth(m_Doc, hl->font(), "-", hl->fontSize()) * (hl->scaleH() / 1000.0))), qRound(CurY+desc));
pt2 = QPoint(qRound(ceil(CurX+RExtra+Cwidth(m_Doc, hl->font(), "-", hl->fontSize()) * (hl->scaleH() / 1000.0))), qRound(ceil(CurY-asce)));
pt1 = QPoint(qRound(ceil(CurX+RExtra+ hl->font().charWidth('-', hl->fontSize() / 10.0) * (hl->scaleH() / 1000.0))), qRound(CurY+desc));
pt2 = QPoint(qRound(ceil(CurX+RExtra+ hl->font().charWidth('-', hl->fontSize() / 10.0) * (hl->scaleH() / 1000.0))), qRound(ceil(CurY-asce)));
}
else
{
890,7 → 891,7
if ((hl->ch == QChar(26)) && (Cols > 1))
goNextColumn = true;
//Hm.
/* /Hm.
Zli = new ZZ;
Zli->Zeich = chstr;
Zli->Farb = hl->fillColor();
900,21 → 901,19
Zli->xco = hl->glyph.xoffset;
Zli->yco = hl->glyph.yoffset;
Zli->Sele = itemText.selected(a);
if (DropCmode)
*/ if (DropCmode)
{
Zli->Siz = chsd;
Zli->realSiz = style.charStyle().fontSize();
hl->glyph.scaleH *= chsd / style.charStyle().fontSize();
hl->glyph.scaleV *= chsd / style.charStyle().fontSize();
qDebug(QString("dropcaps: scale= %1/%2, chsd= %3, wide= %4, kern= %5")
.arg(hl->glyph.scaleH).arg(hl->glyph.scaleV)
.arg(chsd).arg(wide).arg(kernVal));
}
else
{
Zli->Siz = chs;
Zli->realSiz = hl->fontSize();
}
Zli->Style = hl->effects();
Zli->ZFo = hl->font();
Zli->wide = wide;
Zli->kern = kernVal;
Zli->scale = hl->scaleH();
// Zli->Style = hl->effects();
// Zli->ZFo = hl->font();
hl->glyph.xadvance = wide + kernVal;
//!! Zli->kern = kernVal;
/* Zli->scale = hl->scaleH();
Zli->scalev = hl->scaleV();
Zli->base = hl->baselineOffset();
Zli->shadowX = hl->shadowXOffset();
925,6 → 924,7
Zli->strikepos = hl->strikethruOffset();
Zli->strikewidth = hl->strikethruWidth();
Zli->embedded = hl->cembedded;
*/
if (((hl->ch == " ") || (hl->ch == SpecialChars::TAB)) && (!outs))
{
if ( a == firstInFrame() || itemText.text(a-1) != ' ')
940,27 → 940,26
if (hl->ch == "-")
LastXp = CurX;
else
LastXp = CurX + Cwidth(m_Doc, hl->font(), "-", hl->fontSize()) * (hl->scaleH() / 1000.0);
LastXp = CurX + hl->font().charWidth('-', hl->fontSize() / 10.0) * (hl->scaleH() / 1000.0);
LastSP = BuPos + 1;
}
}
LiList.append(Zli);
//! LiList.append(Zli);
++itemsInLine;
if (RTab)
{
uint rtx2 = 0;
double cen = 1;
if (TabCode == 4)
cen = 2;
for (uint rtx = StartRT; rtx < LiList.count(); ++rtx)
for (uint rtx = StartRT; rtx < StartRT + itemsInLine; ++rtx)
{
LiList.at(rtx)->xco = QMAX(LiList.at(rtx)->xco-(wide+kernVal) / cen, 0.0);
itemText.item(StartRT2+rtx2)->glyph.xoffset = QMAX(itemText.item(StartRT2+rtx2)->glyph.xoffset-(wide+kernVal) / cen, 0.0);
if (itemText.item(StartRT2+rtx2)->glyph.xoffset < RTabX)
// LiList.at(rtx)->xco = QMAX(LiList.at(rtx)->xco-(wide+kernVal) / cen, 0.0);
itemText.item(rtx)->glyph.xoffset = QMAX(itemText.item(rtx)->glyph.xoffset-(wide+kernVal) / cen, 0.0);
if (itemText.item(rtx)->glyph.xoffset < RTabX)
{
RTab = false;
TabCode = 0;
}
rtx2++;
}
}
BuPos++;
995,7 → 994,7
}
else
{
double currasce = RealFHeight(m_Doc, hl->font(), style.charStyle().fontSize());
double currasce = hl->font().height(style.charStyle().fontSize() / 10.0);
CurY -= currasce * (DropLines-1);
tcli.setPoint(0, QPoint(qRound(hl->glyph.xoffset), qRound(maxDY-DropLines*currasce)));
tcli.setPoint(1, QPoint(qRound(maxDX), qRound(maxDY-DropLines*currasce)));
1047,10 → 1046,11
{
// count the available spaces
aSpa = 0;
for (uint sof = 0; sof<LiList.count(); ++sof)
for (int sof = 0; sof < itemsInLine; ++sof)
{
if ((LiList.at(sof)->Zeich == QChar(32))
|| (LiList.at(sof)->Zeich == SpecialChars::NBSPACE)
if ((itemText.text(curLine.firstItem + sof) == QChar(32)
|| itemText.text(curLine.firstItem + sof) == SpecialChars::NBSPACE)
&& ! (itemText.item(curLine.firstItem + sof)->effects() & ScStyle_SuppressSpace)
)
aSpa++;
}
1060,11 → 1060,13
OFs2 = 0;
OFs = 0;
// distribute whitespace on spaces
for (uint yof = 0; yof < LiList.count(); ++yof)
for (int yof = 0; yof < itemsInLine; ++yof)
{
LiList.at(yof)->xco += OFs;
if ((LiList.at(yof)->Zeich == QChar(32))
|| (LiList.at(yof)->Zeich == SpecialChars::NBSPACE)
for (GlyphLayout* gp = &itemText.item(curLine.firstItem + yof)->glyph; gp; gp = gp->more)
gp->xoffset += OFs;
if ((itemText.text(curLine.firstItem + yof) == QChar(32)
|| itemText.text(curLine.firstItem + yof) == SpecialChars::NBSPACE)
&& ! (itemText.item(curLine.firstItem + yof)->effects() & ScStyle_SuppressSpace)
)
OFs += OFs2;
}
1072,9 → 1074,9
else
{
// simple offset
for (uint xof = 0; xof<LiList.count(); ++xof)
for (int xof = 0; xof < itemsInLine; ++xof)
{
LiList.at(xof)->xco += OFs;
itemText.item(curLine.firstItem + xof)->glyph.xoffset += OFs;
}
}
CurX = EndX;
1087,6 → 1089,8
// go back to last break position
// qDebug(QString("new break pos a=%1 BuPos=%2 LastSP=%3").arg(a).arg(BuPos).arg(LastSP));
a -= BuPos - LastSP;
assert( a >= 0 );
assert( a < itemText.length() );
hl = itemText.item(a);
style = itemText.paragraphStyle(a);
if (style.rightMargin() < 0) {
1098,19 → 1102,24
// .arg(a));
//not needed any more: a++;
// Fix incorrect right flush for full lines: ? -AV
LastXp = hl->glyph.xoffset + Cwidth(m_Doc, hl->font(), hl->ch, hl->fontSize()) * (hl->scaleH() / 1000.0);
LastXp = hl->glyph.xoffset + hl->font().charWidth(hl->ch[0], hl->fontSize() / 10.0) * (hl->scaleH() / 1000.0);
if (hl->effects() & ScStyle_HyphenationPossible)
{
// insert hyphen
HyphenCount++;
hl->setEffects(hl->effects() | ScStyle_SmartHyphenVisible);
Zli = new ZZ;
hl->glyph.more = new GlyphLayout();
hl->glyph.more->glyph = QChar('-').unicode();
hl->glyph.more->xoffset = LastXp;
hl->glyph.more->yoffset = hl->glyph.yoffset;
hl->glyph.more->xadvance = itemText.charStyle(a).font().charWidth('-', itemText.charStyle(a).fontSize() / 10.0) * (itemText.charStyle(a).scaleH() / 1000.0);
/* Zli = new ZZ;
Zli->Zeich = "-";
Zli->Farb = itemText.charStyle(a).fillColor();
Zli->Farb2 = itemText.charStyle(a).strokeColor();
Zli->shade = itemText.charStyle(a).fillShade();
Zli->shade2 = itemText.charStyle(a).strokeShade();
Zli->xco = LastXp - Cwidth(m_Doc, itemText.charStyle(a).font(), "-", itemText.charStyle(a).fontSize()) * (itemText.charStyle(a).scaleH() / 1000.0);
Zli->xco = LastXp - itemText.charStyle(a).font().charWidth('-', itemText.charStyle(a).fontSize() / 10.0) * (itemText.charStyle(a).scaleH() / 1000.0);
Zli->yco = itemText.item(a)->glyph.yoffset;
Zli->Sele = itemText.selected(a);
Zli->Siz = itemText.charStyle(a).fontSize();
1117,7 → 1126,7
Zli->realSiz = itemText.charStyle(a).fontSize();
Zli->Style = itemText.charStyle(a).effects();
Zli->ZFo = itemText.charStyle(a).font();
Zli->wide = Cwidth(m_Doc, itemText.charStyle(a).font(), "-", itemText.charStyle(a).fontSize()) * (itemText.charStyle(a).scaleH() / 1000.0);
Zli->wide = itemText.charStyle(a).font().charWidth('-', itemText.charStyle(a).fontSize() / 10.0) * (itemText.charStyle(a).scaleH() / 1000.0);
Zli->kern = itemText.charStyle(a).fontSize() * itemText.charStyle(a).tracking() / 10000.0;
Zli->scale = itemText.charStyle(a).scaleH();
Zli->scalev = itemText.charStyle(a).scaleV();
1130,14 → 1139,19
Zli->strikepos = itemText.charStyle(a).strikethruOffset();
Zli->strikewidth = itemText.charStyle(a).strikethruWidth();
Zli->embedded = 0;
LiList.insert(LastSP+1, Zli);
// LiList.insert(LastSP+1, Zli);
*/
LastSP += 2;
LastXp += Zli->wide;
LastXp += hl->glyph.more->xadvance;
}
else
{
HyphenCount = 0;
hl->setEffects(hl->effects() & ~ScStyle_SmartHyphenVisible);
if (hl->glyph.more) {
delete hl->glyph.more;
hl->glyph.more = 0;
}
}
BuPos = LastSP;
// Justification
1158,10 → 1172,10
// end do
// qDebug(QString("endx @ %1").arg(EndX));
 
if (opticalMargins && BuPos > 0) {
int chs = static_cast<int>(LiList.at(BuPos-1)->Siz * (LiList.at(BuPos-1)->scale / 1000.0));
QString chr = LiList.at(BuPos-1)->Zeich;
double rightCorr = RealCWidth(m_Doc, LiList.at(BuPos-1)->ZFo, chr, chs);
if (opticalMargins && a >= curLine.firstItem) {
double chs = itemText.charStyle(a).fontSize() * (itemText.charStyle(a).scaleH() / 1000.0);
QString chr = itemText.item(a)->glyph.more ? "-" : itemText.text(a,1);
double rightCorr = itemText.charStyle(a).font().realCharWidth(chr[0], chs / 10.0);
if (QString("-,.`´'~").find(chr) >= 0
|| chr[0] == QChar(0x2018)
|| chr[0] == QChar(0x2019)
1184,11 → 1198,11
)
rightCorr *= 0.5;
else {
rightCorr = Cwidth(m_Doc, LiList.at(BuPos-1)->ZFo, chr, chs);
rightCorr -= Cwidth(m_Doc, LiList.at(BuPos-1)->ZFo, chr, chs, QChar('.'));
rightCorr = itemText.charStyle(a).font().charWidth(chr[0], chs / 10.0);
rightCorr -= itemText.charStyle(a).font().charWidth(chr[0], chs / 10.0, QChar('.'));
}
EndX += rightCorr;
// qDebug(QString("orm %1 @ %2: %3 %4").arg(rightCorr).arg(a).arg(chr).arg(LiList.at(BuPos-1)->Style&ScStyle_HyphenationPossible? "smart" : ""));
// qDebug(QString("orm %1 @ %2: %3 %4").arg(rightCorr).arg(a).arg(chr).arg(itemText.charStyle(a).effects() & ScStyle_HyphenationPossible? "smart" : ""));
}
if (style.alignment() == 2)
OFs = EndX - LastXp;
1201,8 → 1215,9
aSpa = 0;
for (uint sof = 0; sof<LastSP; ++sof)
{
if ( LiList.at(sof)->Zeich == QChar(32)
|| LiList.at(sof)->Zeich == SpecialChars::NBSPACE
if ((itemText.item(curLine.firstItem + sof)->ch == QChar(32)
|| itemText.item(curLine.firstItem + sof)->ch == SpecialChars::NBSPACE)
&& ! (itemText.item(curLine.firstItem + sof)->effects() & ScStyle_SuppressSpace)
)
aSpa++;
}
1213,11 → 1228,13
OFs = 0;
// qDebug(QString("just %1").arg(OFs2));
for (uint yof = 0; yof < LiList.count(); ++yof)
for (int yof = 0; yof < itemsInLine; ++yof)
{
LiList.at(yof)->xco += OFs;
if ( LiList.at(yof)->Zeich == QChar(32)
|| (LiList.at(yof)->Zeich == SpecialChars::NBSPACE)
for (GlyphLayout* gp = &itemText.item(curLine.firstItem + yof)->glyph; gp; gp = gp->more)
gp->xoffset += OFs;
if ( (itemText.item(curLine.firstItem + yof)->ch == QChar(32)
|| itemText.item(curLine.firstItem + yof)->ch == SpecialChars::NBSPACE)
&& ! (itemText.item(curLine.firstItem + yof)->effects() & ScStyle_SuppressSpace)
)
OFs += OFs2;
}
1224,9 → 1241,9
}
else
{
for (uint xof = 0; xof<LiList.count(); ++xof)
for (int xof = 0; xof < itemsInLine; ++xof)
{
LiList.at(xof)->xco += OFs;
itemText.item(curLine.firstItem + xof)->glyph.xoffset += OFs;
}
}
// qDebug(QString("line: endx=%1 lastchar=%2").arg(EndX).arg(LiList.at(BuPos-1)->xco + LiList.at(BuPos-1)->wide));
1233,9 → 1250,11
CurX = EndX;
}
}
else // no break position
else if (a > 0) // no break position
{
a--;
assert( a >= 0 );
assert( a < itemText.length() );
hl = itemText.item(a);
style = itemText.paragraphStyle(a);
if (style.rightMargin() < 0) {
1369,70 → 1388,68
}
}
hl->glyph.xoffset = CurX;
hl->glyph.yoffset = CurY;
LiList.at(LiList.count()-1)->xco = hl->glyph.xoffset;
LiList.at(LiList.count()-1)->yco = hl->glyph.yoffset;
// hl->glyph.xoffset = CurX;
// hl->glyph.yoffset = CurY;
 
if (LiList.count() != 0)
if (itemsInLine != 0)
{
if ((!AbsHasDrop) && (StartOfCol) && (!style.useBaselineGrid()))
{
Zli2 = LiList.at(0);
double firstasce = Zli2->ZFo->ascent() * (Zli2->realSiz / 10.0);
double firstasce = itemText.charStyle(curLine.firstItem).font().ascent(itemText.charStyle(curLine.firstItem).fontSize() / 10.0);
double currasce;
if ((Zli2->Zeich == QChar(13)) || (Zli2->Zeich == QChar(28)))
currasce = Zli2->ZFo->ascent() * (Zli2->realSiz / 10.0);
else if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, (Zli2->embedded->gHeight + Zli2->embedded->lineWidth()) * (Zli2->scalev / 1000.0));
if ((itemText.text(curLine.firstItem) == QChar(13)) || (itemText.text(curLine.firstItem) == QChar(28)))
currasce = itemText.charStyle(curLine.firstItem).font().ascent(itemText.charStyle(curLine.firstItem).fontSize() / 10.0);
else if (itemText.object(curLine.firstItem) != 0)
currasce = QMAX(currasce, (itemText.object(curLine.firstItem)->gHeight + itemText.object(curLine.firstItem)->lineWidth()) * (itemText.charStyle(curLine.firstItem).scaleV() / 1000.0));
else
currasce = RealCAscent(m_Doc, Zli2->ZFo, Zli2->Zeich, Zli2->realSiz);
for (uint zc = 0; zc < LiList.count(); ++zc)
currasce = itemText.charStyle(curLine.firstItem).font().realCharAscent(itemText.text(curLine.firstItem), itemText.charStyle(curLine.firstItem).fontSize() / 10.0);
for (int zc = 0; zc < itemsInLine; ++zc)
{
Zli2 = LiList.at(zc);
if ((Zli2->Zeich == SpecialChars::TAB) || (Zli2->Zeich == QChar(10))
|| (Zli2->Zeich == SpecialChars::PARSEP) || (Zli2->Zeich == SpecialChars::NBHYPHEN)
|| (Zli2->Zeich == SpecialChars::COLBREAK) || (Zli2->Zeich == SpecialChars::LINEBREAK)
|| (Zli2->Zeich == SpecialChars::FRAMEBREAK) || (Zli2->Zeich == SpecialChars::NBSPACE))
QChar ch = itemText.text(curLine.firstItem + zc);
const CharStyle& cStyle(itemText.charStyle(curLine.firstItem + zc));
if ((ch == SpecialChars::TAB) || (ch == QChar(10))
|| (ch == SpecialChars::PARSEP) || (ch == SpecialChars::NBHYPHEN)
|| (ch == SpecialChars::COLBREAK) || (ch == SpecialChars::LINEBREAK)
|| (ch == SpecialChars::FRAMEBREAK) || (ch == SpecialChars::NBSPACE))
continue;
if ((Zli2->Zeich == SpecialChars::OBJECT) && (Zli2->embedded != 0))
currasce = QMAX(currasce, (Zli2->embedded->gHeight + Zli2->embedded->lineWidth()) * (Zli2->scalev / 1000.0));
if (itemText.object(curLine.firstItem) != 0)
currasce = QMAX(currasce, (itemText.object(curLine.firstItem)->gHeight + itemText.object(curLine.firstItem)->lineWidth()) * (cStyle.scaleV() / 1000.0));
else
currasce = QMAX(currasce, RealCAscent(m_Doc, Zli2->ZFo, Zli2->Zeich, Zli2->realSiz));
currasce = QMAX(currasce, cStyle.font().realCharAscent(ch, cStyle.fontSize() / 10.0));
}
double adj = firstasce - currasce;
for (uint zc = 0; zc < LiList.count(); ++zc)
for (int zc = 0; zc < itemsInLine; ++zc)
{
LiList.at(zc)->yco -= adj;
itemText.item(curLine.firstItem + zc)->glyph.yoffset -= adj;
}
CurY -= adj;
}
if ((!StartOfCol) && (!style.useBaselineGrid()) && (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing))
{
Zli2 = LiList.at(0);
QChar ch = itemText.text(curLine.firstItem);
double firstasce = style.lineSpacing();
double currasce = 0;
if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, (Zli2->embedded->gHeight + Zli2->embedded->lineWidth()) * (Zli2->scalev / 1000.0));
if (itemText.object(curLine.firstItem) != 0)
currasce = QMAX(currasce, (itemText.object(curLine.firstItem)->gHeight + itemText.object(curLine.firstItem)->lineWidth()) * (itemText.charStyle(curLine.firstItem).scaleV() / 1000.0));
else
currasce = RealFHeight(m_Doc, Zli2->ZFo, Zli2->realSiz);
for (uint zc = 0; zc < LiList.count(); ++zc)
currasce = itemText.charStyle(curLine.firstItem).font().height(itemText.charStyle(curLine.firstItem).fontSize() / 10.0);
for (int zc = 0; zc < itemsInLine; ++zc)
{
Zli2 = LiList.at(zc);
if ((Zli2->Zeich == SpecialChars::TAB) || (Zli2->Zeich == QChar(10))
|| (Zli2->Zeich == SpecialChars::PARSEP) || (Zli2->Zeich == QChar(24))
|| (Zli2->Zeich == QChar(26)) || (Zli2->Zeich == QChar(27))
|| (Zli2->Zeich == QChar(28)) || (Zli2->Zeich == QChar(29)))
QChar ch = itemText.text(curLine.firstItem + zc);
if ((ch == SpecialChars::TAB) || (ch == QChar(10))
|| (ch == SpecialChars::PARSEP) || (ch == QChar(24))
|| (ch == QChar(26)) || (ch == QChar(27))
|| (ch == QChar(28)) || (ch == QChar(29)))
continue;
if ((Zli2->Zeich == SpecialChars::OBJECT) && (Zli2->embedded != 0))
currasce = QMAX(currasce, (Zli2->embedded->gHeight + Zli2->embedded->lineWidth()) * (Zli2->scalev / 1000.0));
if (itemText.object(curLine.firstItem) != 0)
currasce = QMAX(currasce, (itemText.object(curLine.firstItem)->gHeight + itemText.object(curLine.firstItem)->lineWidth()) * (itemText.charStyle(curLine.firstItem).scaleV() / 1000.0));
else
currasce = QMAX(currasce, RealFHeight(m_Doc, Zli2->ZFo, Zli2->realSiz));
currasce = QMAX(currasce, itemText.charStyle(curLine.firstItem).font().height(itemText.charStyle(curLine.firstItem).fontSize() / 10.0));
}
double adj = firstasce - currasce;
for (uint zc = 0; zc < LiList.count(); ++zc)
for (int zc = 0; zc < itemsInLine; ++zc)
{
LiList.at(zc)->yco -= adj;
itemText.item(curLine.firstItem + zc)->glyph.yoffset -= adj;
}
CurY -= adj;
}
1442,13 → 1459,13
uint loopC = BuPos3;
if (m_Doc->guidesSettings.showControls)
loopC++; // ??? AV
for (uint zc = 0; zc < loopC; ++zc)
for (int zc = 0; zc < loopC; ++zc)
{
if ( zc >= LiList.count()) {
qDebug("layout: zc too large %d / %d", zc, LiList.count());
if ( zc >= itemsInLine) {
qDebug("layout: zc too large %d / %d", zc, itemsInLine);
continue;
}
if ( startLin+zc >= itemText.length()) {
if ( startLin + zc >= itemText.length()) {
qDebug("layout: startLin+zc too large %d+%d / %d", startLin, zc, itemText.length());
continue;
}
1455,26 → 1472,28
// else
// qDebug("layout: startLin, zc ok. %d, %d, %d", startLin, zc, LiList.count());
double wide2 = 0;
Zli2 = LiList.at(zc);
double xcoZli = Zli2->xco;
itemText.item(startLin+zc)->glyph.xoffset = Zli2->xco;
itemText.item(startLin+zc)->glyph.yoffset = Zli2->yco;
double xcoZli = itemText.item(curLine.firstItem + zc)->glyph.xoffset;
// itemText.item(startLin+zc)->glyph.xoffset = Zli2->xco;
/// itemText.item(startLin+zc)->glyph.yoffset = Zli2->yco;
tTabValues = itemText.paragraphStyle(startLin+zc).tabValues();
desc = Zli2->ZFo->descent() * (-Zli2->Siz / 10.0);
asce = Zli2->ZFo->ascent() * (Zli2->Siz / 10.0);
if ((((Zli2->Sele) && (Select)) || (((NextBox != 0) || (BackBox != 0)) && (Zli2->Sele))) && (m_Doc->appMode == modeEdit))
desc = - itemText.charStyle(startLin+zc).font().descent(itemText.charStyle(startLin+zc).fontSize() / 10.0);
asce = itemText.charStyle(startLin+zc).font().ascent(itemText.charStyle(startLin+zc).fontSize() / 10.0);
bool Sele = itemText.selected(startLin+zc);
if (((Sele && (Select)) || (((NextBox != 0) || (BackBox != 0)) && Sele)) && (m_Doc->appMode == modeEdit))
{
wide = Zli2->wide;
if ((zc > 0) && (Zli2->Zeich == SpecialChars::TAB))
wide = itemText.item(startLin+zc)->glyph.xadvance;
if ((zc > 0) && (itemText.text(startLin+zc) == SpecialChars::TAB))
{
wide2 = LiList.at(zc-1)->wide;
xcoZli = LiList.at(zc-1)->xco+wide2;
wide = Zli2->xco - xcoZli + Zli2->wide;
wide2 = itemText.item(startLin+zc-1)->glyph.xadvance;
xcoZli = itemText.item(startLin+zc-1)->glyph.xoffset + wide2;
wide = itemText.item(startLin+zc)->glyph.xoffset - xcoZli + itemText.item(startLin+zc)->glyph.xadvance;
}
}
tabDist = Zli2->xco+Zli2->wide;
tabDist = itemText.item(startLin+zc)->glyph.xoffset + itemText.item(startLin+zc)->glyph.xadvance;
}
LiList.clear();
// LiList.clear();
itemsInLine = 0;
curLine.firstItem = a+1;
BuPos = 0;
LastSP = 0;
LastXp = 0;
1505,6 → 1524,8
}
}
}
// end of itemText
uint a = itemText.length()-1;
if (style.alignment() != 0)
{
EndX = floor(CurX);
1518,10 → 1539,10
&& (cl.contains(pf2.xForm(pt2)))
&& (EndX+RExtra+lineCorr < ColBound.y() - style.rightMargin()));
if (opticalMargins && LiList.count() > 0) {
int chs = static_cast<int>(LiList.at(LiList.count()-1)->Siz * (LiList.at(LiList.count()-1)->scale / 1000.0));
QString chr = LiList.at(LiList.count()-1)->Zeich;
double rightCorr = RealCWidth(m_Doc, LiList.at(LiList.count()-1)->ZFo, chr, chs);
if (opticalMargins && itemsInLine > 0) {
double chs = itemText.charStyle(a).fontSize() * (itemText.charStyle(a).scaleH() / 1000.0);
QString chr = itemText.item(a)->glyph.more ? "-" : itemText.text(a,1);
double rightCorr = itemText.charStyle(a).font().realCharWidth(chr[0], chs / 10.0);
if (QString("-,.`´'~").find(chr) >= 0
|| chr[0] == QChar(0x2018)
|| chr[0] == QChar(0x2019)
1544,11 → 1565,11
)
rightCorr *= 0.5;
else {
rightCorr = Cwidth(m_Doc, LiList.at(BuPos-1)->ZFo, chr, chs);
rightCorr -= Cwidth(m_Doc, LiList.at(BuPos-1)->ZFo, chr, chs, QChar('.'));
rightCorr = itemText.charStyle(a).font().charWidth(chr[0], chs / 10.0);
rightCorr -= itemText.charStyle(a).font().charWidth(chr[0], chs / 10.0, QChar('.'));
}
EndX += rightCorr;
// qDebug(QString("orm %1 @ %2: %3 par").arg(rightCorr).arg(a).arg(chr));
// qDebug(QString("orm %1 @ %2: %3 par").arg(rightCorr).arg(a).arg(chr));
}
 
if (style.alignment() == 2)
1560,11 → 1581,12
if (style.alignment() == 4)
{
aSpa = 0;
for (uint sof = 0; sof<LiList.count(); ++sof)
for (int sof = 0; sof < itemsInLine; ++sof)
{
if ((LiList.at(sof)->Zeich == QChar(32))
|| (LiList.at(sof)->Zeich == SpecialChars::NBSPACE)
)
if ((itemText.item(curLine.firstItem + sof)->ch[0] == QChar(32)
|| itemText.item(curLine.firstItem + sof)->ch[0] == SpecialChars::NBSPACE)
&& ! (itemText.item(curLine.firstItem + sof)->effects() & ScStyle_SuppressSpace)
)
aSpa++;
}
if (aSpa != 0)
1572,80 → 1594,80
else
OFs2 = 0;
OFs = 0;
for (uint yof = 0; yof < LiList.count(); ++yof)
for (int yof = 0; yof < itemsInLine; ++yof)
{
LiList.at(yof)->xco += OFs;
if ((LiList.at(yof)->Zeich == QChar(32)) || (LiList.at(yof)->Zeich == QChar(29)))
for (GlyphLayout* gp = &itemText.item(curLine.firstItem + yof)->glyph; gp; gp = gp->more)
gp->xoffset += OFs;
if ((itemText.item(curLine.firstItem + yof)->ch[0] == QChar(32) ||
itemText.item(curLine.firstItem + yof)->ch[0] == QChar(29))
&& ! (itemText.item(curLine.firstItem + yof)->effects() & ScStyle_SuppressSpace)
)
OFs += OFs2;
}
}
else
{
for (uint xof = 0; xof<LiList.count(); ++xof)
for (int xof = 0; xof < itemsInLine; ++xof)
{
LiList.at(xof)->xco += OFs;
itemText.item(curLine.firstItem + xof)->glyph.xoffset += OFs;
}
}
}
if (LiList.count() != 0)
if (itemsInLine != 0)
{
if ((!AbsHasDrop) && (StartOfCol) && (!style.useBaselineGrid()))
{
Zli2 = LiList.at(0);
double firstasce = Zli2->ZFo->ascent() * (Zli2->realSiz / 10.0);
double firstasce = itemText.charStyle(curLine.firstItem).font().ascent(itemText.charStyle(curLine.firstItem).fontSize() / 10.0);
double currasce = 0;
if ((Zli2->Zeich == QChar(13)) || (Zli2->Zeich == QChar(28)))
currasce = Zli2->ZFo->ascent() * (Zli2->realSiz / 10.0);
else if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, (Zli2->embedded->gHeight + Zli2->embedded->lineWidth()) * (Zli2->scalev / 1000.0));
if ((itemText.text(curLine.firstItem) == QChar(13)) || (itemText.text(curLine.firstItem) == QChar(28)))
currasce = itemText.charStyle(curLine.firstItem).font().ascent(itemText.charStyle(curLine.firstItem).fontSize() / 10.0);
else if (itemText.object(curLine.firstItem) != 0)
currasce = QMAX(currasce, (itemText.object(curLine.firstItem)->gHeight + itemText.object(curLine.firstItem)->lineWidth()) * (itemText.charStyle(curLine.firstItem).scaleV() / 1000.0));
else
currasce = RealCAscent(m_Doc, Zli2->ZFo, Zli2->Zeich, Zli2->realSiz);
for (uint zc = 0; zc < LiList.count(); ++zc)
currasce = itemText.charStyle(curLine.firstItem).font().realCharAscent(itemText.text(curLine.firstItem), itemText.charStyle(curLine.firstItem).fontSize() / 10.0);
for (int zc = 0; zc < itemsInLine; ++zc)
{
Zli2 = LiList.at(zc);
if ((Zli2->Zeich == SpecialChars::TAB) || (Zli2->Zeich == QChar(10))
|| (Zli2->Zeich == SpecialChars::PARSEP) || (Zli2->Zeich == SpecialChars::NBHYPHEN)
|| (Zli2->Zeich == SpecialChars::FRAMEBREAK) || (Zli2->Zeich == SpecialChars::COLBREAK)
|| (Zli2->Zeich == SpecialChars::LINEBREAK) || (Zli2->Zeich == SpecialChars::NBSPACE))
if ((itemText.text(curLine.firstItem+zc) == SpecialChars::TAB) || (itemText.text(curLine.firstItem+zc) == QChar(10))
|| (itemText.text(curLine.firstItem+zc) == SpecialChars::PARSEP) || (itemText.text(curLine.firstItem+zc) == SpecialChars::NBHYPHEN)
|| (itemText.text(curLine.firstItem+zc) == SpecialChars::FRAMEBREAK) || (itemText.text(curLine.firstItem+zc) == SpecialChars::COLBREAK)
|| (itemText.text(curLine.firstItem+zc) == SpecialChars::LINEBREAK) || (itemText.text(curLine.firstItem+zc) == SpecialChars::NBSPACE))
continue;
if ((Zli2->Zeich == SpecialChars::OBJECT) && (Zli2->embedded != 0))
currasce = QMAX(currasce, (Zli2->embedded->gHeight + Zli2->embedded->lineWidth()) * (Zli2->scalev / 1000.0));
if (itemText.object(curLine.firstItem+zc) != 0)
currasce = QMAX(currasce, (itemText.object(curLine.firstItem+zc)->gHeight + itemText.object(curLine.firstItem+zc)->lineWidth()) * itemText.charStyle(curLine.firstItem+zc).scaleV() / 1000.0);
else
currasce = QMAX(currasce, RealCAscent(m_Doc, Zli2->ZFo, Zli2->Zeich, Zli2->realSiz));
currasce = QMAX(currasce, itemText.charStyle(curLine.firstItem+zc).font().realCharAscent(itemText.text(curLine.firstItem+zc), itemText.charStyle(curLine.firstItem+zc).fontSize() / 10.0));
}
double adj = firstasce - currasce;
for (uint zc = 0; zc < LiList.count(); ++zc)
for (int zc = 0; zc < itemsInLine; ++zc)
{
LiList.at(zc)->yco -= adj;
itemText.item(curLine.firstItem+zc)->glyph.yoffset -= adj;
}
CurY -= adj;
}
if ((!StartOfCol) && (!style.useBaselineGrid()) && (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing))
{
Zli2 = LiList.at(0);
double firstasce = style.lineSpacing();
double currasce = 0;
if ((Zli2->Zeich == SpecialChars::OBJECT) && (Zli2->embedded != 0))
currasce = QMAX(currasce, (Zli2->embedded->gHeight + Zli2->embedded->lineWidth()) * (Zli2->scalev / 1000.0));
if (itemText.object(curLine.firstItem) != 0)
currasce = QMAX(currasce, (itemText.object(curLine.firstItem)->gHeight + itemText.object(curLine.firstItem)->lineWidth()) * (itemText.charStyle(curLine.firstItem).scaleV() / 1000.0));
else
currasce = RealFHeight(m_Doc, Zli2->ZFo, Zli2->realSiz);
for (uint zc = 0; zc < LiList.count(); ++zc)
currasce = itemText.charStyle(curLine.firstItem).font().height(itemText.charStyle(curLine.firstItem).fontSize() / 10.0);
for (int zc = 0; zc < itemsInLine; ++zc)
{
Zli2 = LiList.at(zc);
if ((Zli2->Zeich == SpecialChars::TAB) || (Zli2->Zeich == QChar(10))
|| (Zli2->Zeich == QChar(13)) || (Zli2->Zeich == QChar(24))
|| (Zli2->Zeich == QChar(26)) || (Zli2->Zeich == QChar(27))
|| (Zli2->Zeich == QChar(28)) || (Zli2->Zeich == QChar(29)))
if ((itemText.text(curLine.firstItem+zc) == SpecialChars::TAB) || (itemText.text(curLine.firstItem+zc) == QChar(10))
|| (itemText.text(curLine.firstItem+zc) == QChar(13)) || (itemText.text(curLine.firstItem+zc) == QChar(24))
|| (itemText.text(curLine.firstItem+zc) == QChar(26)) || (itemText.text(curLine.firstItem+zc) == QChar(27))
|| (itemText.text(curLine.firstItem+zc) == QChar(28)) || (itemText.text(curLine.firstItem+zc) == QChar(29)))
continue;
if ((Zli2->Zeich == SpecialChars::OBJECT) && (Zli2->embedded != 0))
currasce = QMAX(currasce, (Zli2->embedded->gHeight + Zli2->embedded->lineWidth()) * (Zli2->scalev / 1000.0));
if (itemText.object(curLine.firstItem+zc) != 0)
currasce = QMAX(currasce, (itemText.object(curLine.firstItem+zc)->gHeight + itemText.object(curLine.firstItem+zc)->lineWidth()) * (itemText.charStyle(curLine.firstItem+zc).scaleV() / 1000.0));
else
currasce = QMAX(currasce, RealFHeight(m_Doc, Zli2->ZFo, Zli2->realSiz));
currasce = QMAX(currasce, itemText.charStyle(curLine.firstItem+zc).font().height(itemText.charStyle(curLine.firstItem+zc).fontSize() / 10.0));
}
double adj = firstasce - currasce;
for (uint zc = 0; zc < LiList.count(); ++zc)
for (int zc = 0; zc < itemsInLine; ++zc)
{
LiList.at(zc)->yco -= adj;
itemText.item(curLine.firstItem+zc)->glyph.yoffset -= adj;
}
CurY -= adj;
}
1652,32 → 1674,31
}
StartOfCol = false;
tabDist = ColBound.x();
for (uint zc = 0; zc<LiList.count(); ++zc)
for (int zc = 0; zc < itemsInLine; ++zc)
{
double wide2 = 0;
Zli2 = LiList.at(zc);
double xcoZli = Zli2->xco;
double xcoZli = itemText.item(curLine.firstItem+zc)->glyph.xoffset;
itemText.item(startLin+zc)->glyph.xoffset = Zli2->xco;
itemText.item(startLin+zc)->glyph.yoffset = Zli2->yco;
tTabValues = itemText.paragraphStyle(startLin+zc).tabValues();
desc = Zli2->ZFo->descent() * (-Zli2->Siz / 10.0);
asce = Zli2->ZFo->ascent() * (Zli2->Siz / 10.0);
if ((((Zli2->Sele) && (Select)) || (((NextBox != 0) || (BackBox != 0)) && (Zli2->Sele))) && (m_Doc->appMode == modeEdit))
desc = - itemText.charStyle(curLine.firstItem+zc).font().descent(itemText.charStyle(curLine.firstItem+zc).fontSize() / 10.0);
asce = itemText.charStyle(curLine.firstItem+zc).font().ascent(itemText.charStyle(curLine.firstItem+zc).fontSize() / 10.0);
if ((((itemText.selected(curLine.firstItem+zc)) && (Select)) || (((NextBox != 0) || (BackBox != 0)) && (itemText.selected(curLine.firstItem+zc)))) && (m_Doc->appMode == modeEdit))
{
wide = Zli2->wide;
if ((zc > 0) && (Zli2->Zeich == SpecialChars::TAB))
wide = itemText.item(curLine.firstItem+zc)->glyph.xadvance;
if ((zc > 0) && (itemText.text(curLine.firstItem+zc) == SpecialChars::TAB))
{
wide2 = LiList.at(zc-1)->wide;
xcoZli = LiList.at(zc-1)->xco+wide2;
wide = Zli2->xco - xcoZli + Zli2->wide;
wide2 = itemText.item(curLine.firstItem+zc-1)->glyph.xadvance;
xcoZli = itemText.item(curLine.firstItem+zc-1)->glyph.xoffset + wide2;
wide = itemText.item(curLine.firstItem+zc)->glyph.xoffset - xcoZli + itemText.item(curLine.firstItem+zc)->glyph.xadvance;
}
}
tabDist = Zli2->xco+Zli2->wide;
tabDist = itemText.item(curLine.firstItem+zc-1)->glyph.xoffset + itemText.item(curLine.firstItem+zc-1)->glyph.xadvance;
}
goNextColumn = false;
LiList.clear();
// LiList.clear();
itemsInLine = 0;
curLine.firstItem = a + 1;
BuPos = 0;
LastSP = 0;
outs = false;
1734,8 → 1755,8
QPoint pt1, pt2;
FPoint ColBound;
QRegion cm;
int chs, CurrCol;
double oldCurY, wide, lineCorr, ColWidth;
int CurrCol;
double wide, lineCorr, ColWidth;
QString chstr;
ScText *hl;
 
1743,8 → 1764,6
double desc, asce, maxDY, tabDist;
tTabValues.clear();
QPtrList<ZZ> LiList;
LiList.setAutoDelete(true);
QRect e2 = QRect(qRound(e.x() / sc + m_Doc->minCanvasCoordinate.x()), qRound(e.y() / sc + m_Doc->minCanvasCoordinate.y()), qRound(e.width() / sc), qRound(e.height() / sc));
 
p->save();
1789,7 → 1808,6
p->translate(0, Height * sc);
p->scale(1, -1);
}
struct ZZ Zli3;
CurrCol = 0;
ColWidth = columnWidth();
ColBound = FPoint((ColWidth + ColGap) * CurrCol+Extra + lineCorr, ColWidth * (CurrCol+1) + ColGap * CurrCol + Extra+lineCorr);
1796,6 → 1814,8
ColBound = FPoint(ColBound.x(), ColBound.y()+RExtra+lineCorr);
tabDist = ColBound.x();
uint tabCc = 0;
assert( firstInFrame() >= 0 );
assert( lastInFrame() < itemText.length() );
for (int a = firstInFrame(); a <= lastInFrame(); ++a)
{
hl = itemText.item(a);
1802,6 → 1822,8
const CharStyle& charStyle(itemText.charStyle(a));
const ParagraphStyle& style(itemText.paragraphStyle(a));
tTabValues = style.tabValues();
double chs = charStyle.fontSize() * hl->glyph.scaleV;
bool selected = itemText.selected(a);
if (charStyle.effects() & ScStyle_StartOfLine)
tabCc = 0;
chstr = hl->ch;
1821,152 → 1843,102
SetFarbe(&tmp, charStyle.strokeColor(), charStyle.strokeShade());
p->setPen(tmp, 1, SolidLine, FlatCap, MiterJoin);
}
chs = charStyle.fontSize();
if (charStyle.effects() & ScStyle_DropCap)
{
if (style.useBaselineGrid())
chs = qRound(10 * ((m_Doc->typographicSettings.valueBaseGrid * (style.dropCapLines()-1)+(charStyle.font()->ascent() * (style.charStyle().fontSize() / 10.0))) / (RealCHeight(m_Doc, charStyle.font(), chstr, 10))));
chs = qRound(10 * ((m_Doc->typographicSettings.valueBaseGrid * (style.dropCapLines()-1) + (charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
else
{
if (style.lineSpacingMode() == ParagraphStyle::FixedLineSpacing)
chs = qRound(10 * ((style.lineSpacing() * (style.dropCapLines()-1)+(charStyle.font()->ascent() * (style.charStyle().fontSize() / 10.0))) / (RealCHeight(m_Doc, charStyle.font(), chstr, 10))));
chs = qRound(10 * ((style.lineSpacing() * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
else
{
double currasce = RealFHeight(m_Doc, charStyle.font(), style.charStyle().fontSize());
chs = qRound(10 * ((currasce * (style.dropCapLines()-1)+(charStyle.font()->ascent() * (style.charStyle().fontSize() / 10.0))) / RealCHeight(m_Doc, charStyle.font(), chstr, 10)));
double currasce = charStyle.font().height(style.charStyle().fontSize() / 10.0);
chs = qRound(10 * ((currasce * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
}
}
}
oldCurY = SetZeichAttr(*hl, &chs, &chstr);
if ((chstr == SpecialChars::TAB) && (tTabValues.count() != 0) && (tabCc < tTabValues.count()) && (!tTabValues[tabCc].tabFillChar.isNull()))
{
QString tabFillCharQStr(tTabValues[tabCc].tabFillChar);
double wt = Cwidth(m_Doc, charStyle.font(), tabFillCharQStr, chs);
QChar tabFillChar(tTabValues[tabCc].tabFillChar);
double wt = charStyle.font().charWidth(tabFillChar, chs / 10.0);
int coun = static_cast<int>((hl->glyph.xoffset - tabDist) / wt);
double sPos = hl->glyph.xoffset - (hl->glyph.xoffset - tabDist) + 1;
desc = charStyle.font()->descent() * (-chs / 10.0);
asce = charStyle.font()->ascent() * (chs / 10.0);
Zli3.Zeich = tabFillCharQStr;
Zli3.Farb = charStyle.fillColor();
Zli3.Farb2 = charStyle.strokeColor();
Zli3.shade = charStyle.fillShade();
Zli3.shade2 = charStyle.strokeShade();
Zli3.yco = hl->glyph.yoffset;
Zli3.Sele = itemText.selected(a);
Zli3.Siz = chs;
Zli3.realSiz = charStyle.fontSize();
Zli3.Style = charStyle.effects();
Zli3.ZFo = charStyle.font();
Zli3.wide = wt;
Zli3.kern = 0;
Zli3.scale = 1000;
Zli3.scalev = 1000;
Zli3.shadowX = charStyle.shadowXOffset();
Zli3.shadowY = charStyle.shadowYOffset();
Zli3.outline = charStyle.outlineWidth();
Zli3.base = charStyle.baselineOffset();
Zli3.underpos = charStyle.underlineOffset();
Zli3.underwidth = charStyle.underlineWidth();
Zli3.strikepos = charStyle.strikethruOffset();
Zli3.strikewidth = charStyle.strikethruWidth();
desc = -charStyle.font().descent(chs / 10.0);
asce = charStyle.font().ascent(chs / 10.0);
GlyphLayout tglyph;
tglyph.glyph = tabFillChar.unicode();
tglyph.yoffset = hl->glyph.yoffset;
tglyph.scaleV = tglyph.scaleH = chs / charStyle.fontSize();
tglyph.xadvance = wt;
for (int cx = 0; cx < coun; ++cx)
{
Zli3.xco = sPos + wt * cx;
if (e2.intersects(pf2.xForm(QRect(qRound(Zli3.xco),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc)))))
DrawZeichenS(p, &Zli3);
tglyph.xoffset = sPos + wt * cx;
if (e2.intersects(pf2.xForm(QRect(qRound(tglyph.xoffset),qRound(tglyph.yoffset-asce), qRound(tglyph.xadvance+1), qRound(asce+desc)))))
drawGlyphs(p, charStyle, tglyph);
}
}
if (chstr == SpecialChars::TAB)
if (chstr[0] == SpecialChars::TAB)
tabCc++;
Zli3.Zeich = chstr;
Zli3.Farb = charStyle.fillColor();
Zli3.Farb2 = charStyle.strokeColor();
Zli3.shade = charStyle.fillShade();
Zli3.shade2 = charStyle.strokeShade();
Zli3.xco = hl->glyph.xoffset;
Zli3.yco = hl->glyph.yoffset;
Zli3.Sele = itemText.selected(a);
Zli3.Siz = chs;
Zli3.realSiz = charStyle.fontSize();
Zli3.Style = charStyle.effects();
Zli3.ZFo = charStyle.font();
if ((hl->ch == SpecialChars::OBJECT) && (hl->cembedded != 0))
Zli3.wide = (hl->cembedded->gWidth + hl->cembedded->lineWidth()) * (charStyle.scaleH() / 1000.0);
else
Zli3.wide = Cwidth(m_Doc, charStyle.font(), chstr, charStyle.fontSize()) * (charStyle.scaleH() / 1000.0);
if (charStyle.effects() & ScStyle_StartOfLine)
Zli3.kern = 0;
else
Zli3.kern = chs * charStyle.tracking() / 10000.0;
Zli3.scale = charStyle.scaleH();
Zli3.scalev = charStyle.scaleV();
Zli3.base = charStyle.baselineOffset();
Zli3.shadowX = charStyle.shadowXOffset();
Zli3.shadowY = charStyle.shadowYOffset();
Zli3.outline = charStyle.outlineWidth();
Zli3.underpos = charStyle.underlineOffset();
Zli3.underwidth = charStyle.underlineWidth();
Zli3.strikepos = charStyle.strikethruOffset();
Zli3.strikewidth = charStyle.strikethruWidth();
Zli3.embedded = hl->cembedded;
if (!m_Doc->RePos)
{
double xcoZli = Zli3.xco;
desc = Zli3.ZFo->descent() * (-Zli3.Siz / 10.0);
asce = Zli3.ZFo->ascent() * (Zli3.Siz / 10.0);
if ((((Zli3.Sele) && (Select)) || (((NextBox != 0) || (BackBox != 0)) && (Zli3.Sele))) && (m_Doc->appMode == modeEdit))
double xcoZli = hl->glyph.xoffset;
desc = - charStyle.font().descent(charStyle.fontSize() / 10.0);
asce = charStyle.font().ascent(charStyle.fontSize() / 10.0);
if ((selected && Select) || ((NextBox != 0 || BackBox != 0) && selected) && (m_Doc->appMode == modeEdit))
{
wide = Zli3.wide;
wide = hl->glyph.xadvance;
p->setFillMode(1);
// p->setBrush(darkBlue);
p->setBrush(qApp->palette().color(QPalette::Active, QColorGroup::Highlight));
p->setLineWidth(0);
if ((a > 0) && (Zli3.Zeich == SpecialChars::TAB))
if ((a > 0) && (QChar(hl->glyph.glyph) == SpecialChars::TAB))
{
xcoZli = itemText.item(a-1)->glyph.xoffset+Cwidth(m_Doc, itemText.charStyle(a-1).font(), itemText.text(a-1), itemText.charStyle(a-1).fontSize());
wide = Zli3.xco - xcoZli + Zli3.wide;
xcoZli = itemText.item(a-1)->glyph.xoffset + itemText.charStyle(a-1).font().charWidth(itemText.text(a-1), itemText.charStyle(a-1).fontSize() / 10.0);
wide = hl->glyph.xoffset - xcoZli + hl->glyph.xadvance;
}
if (!m_Doc->RePos)
p->drawRect(xcoZli, qRound(Zli3.yco-asce * (Zli3.scalev / 1000.0)), wide+1, qRound((asce+desc) * (Zli3.scalev / 1000.0)));
p->drawRect(xcoZli, qRound(hl->glyph.yoffset - asce * hl->glyph.scaleV), wide+1, qRound((asce+desc) * (hl->glyph.scaleV)));
p->setBrush(qApp->palette().color(QPalette::Active, QColorGroup::HighlightedText));
// p->setBrush(white);
}
if (Zli3.Farb2 != CommonStrings::None)
if (charStyle.strokeColor() != CommonStrings::None)
{
QColor tmp;
SetFarbe(&tmp, Zli3.Farb2, Zli3.shade2);
SetFarbe(&tmp, charStyle.strokeColor(), charStyle.strokeShade());
p->setPen(tmp, 1, SolidLine, FlatCap, MiterJoin);
}
if (((chstr == QChar(13)) || (chstr == QChar(28))) && (m_Doc->guidesSettings.showControls))
/* see drawGlyphs()
if (((chstr[0] == QChar(13)) || (chstr[0] == QChar(28))) && (m_Doc->guidesSettings.showControls))
{
if (e2.intersects(pf2.xForm(QRect(qRound(Zli3.xco+Zli3.wide),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc)))))
if (e2.intersects(pf2.xForm(QRect(qRound(hl->glyph.xoffset + hl->glyph.xadvance),qRound(hl->glyph.yoffset - asce), qRound(hl->glyph.xadvance+1), qRound(asce+desc)))))
{
FPointArray points;
double ytrans, xtrans;
if (chstr == QChar(13))
if (chstr[0] == QChar(13))
{
points = m_Doc->symReturn.copy();
if (a > 0)
ytrans = itemText.item(a-1)->glyph.yoffset-((Zli3.Siz / 10.0) * 0.8);
ytrans = itemText.item(a-1)->glyph.yoffset-((charStyle.fontSize() / 10.0) * 0.8);
else
ytrans = Zli3.yco - style.lineSpacing()-((Zli3.Siz / 10.0) * 0.8);
ytrans = Zli3.yco - style.lineSpacing()-((charStyle.fontSize() / 10.0) * 0.8);
}
else
{
points = m_Doc->symNewLine.copy();
if (a > 0)
ytrans = itemText.item(a-1)->glyph.yoffset-((Zli3.Siz / 10.0) * 0.4);
ytrans = itemText.item(a-1)->glyph.yoffset-((charStyle.fontSize() / 10.0) * 0.4);
else
ytrans = Zli3.yco - style.lineSpacing()-((Zli3.Siz / 10.0) * 0.4);
ytrans = hl->glyph.yoffset - style.lineSpacing()-((charStyle.fontSize() / 10.0) * 0.4);
}
if (charStyle.effects() & ScStyle_StartOfLine)
xtrans = Zli3.xco;
xtrans = hl->glyph.xoffset;
else
{
if (a > 0)
xtrans = itemText.item(a-1)->glyph.xoffset+ Cwidth(m_Doc, itemText.charStyle(a-1).font(), itemText.text(a-1), itemText.charStyle(a-1).fontSize());
xtrans = itemText.item(a-1)->glyph.xoffset+ itemText.charStyle(a-1).font().charWidth(itemText.text(a-1), itemText.charStyle(a-1).fontSize() / 10.0);
else
xtrans = Zli3.xco;
xtrans = hl->glyph.xoffset;
}
QWMatrix chma, chma2, chma4, chma5;
chma4.translate(xtrans, ytrans);
1979,14 → 1951,16
p->fillPath();
}
}
if (e2.intersects(pf2.xForm(QRect(qRound(Zli3.xco),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc)))))
*/
if (e2.intersects(pf2.xForm(QRect(qRound(hl->glyph.xoffset),qRound(hl->glyph.yoffset-asce), qRound(hl->glyph.xadvance+1), qRound(asce+desc)))))
{
if (Zli3.Zeich == QChar(25))
DrawObj_Embedded(p, e, &Zli3);
if (hl->ch[0] == QChar(25))
DrawObj_Embedded(p, e, charStyle, hl->cembedded);
else
DrawZeichenS(p, &Zli3);
drawGlyphs(p, charStyle, hl->glyph);
}
if (charStyle.effects() & ScStyle_SmartHyphenVisible)
/*
see layout() if (charStyle.effects() & ScStyle_SmartHyphenVisible)
{
Zli3.Zeich = "-";
Zli3.xco = Zli3.xco + Zli3.wide;
1993,8 → 1967,8
if (e2.intersects(pf2.xForm(QRect(qRound(Zli3.xco),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc)))))
DrawZeichenS(p, &Zli3);
}
}
tabDist = Zli3.xco+Zli3.wide;
*/ }
tabDist = hl->glyph.xoffset + hl->glyph.xadvance;
}
/*
if (itemText.count() > MaxChars)
3668,7 → 3642,6
void PageItem_TextFrame::handleModeEditKey(QKeyEvent *k, bool& keyRepeat)
{
int oldPos = CPos; // 15-mar-2004 jjsa for cursor movement with Shift + Arrow key
ScText *hg;
int kk = k->key();
int as = k->ascii();
double altx, alty;
3828,13 → 3801,15
}
QString nextCh = itemText.text(CPos,1);
int nextChs = itemText.charStyle(CPos).fontSize();
alty = itemText.item(CPos)->glyph.yoffset - SetZeichAttr(itemText.charStyle(CPos), &nextChs, &nextCh);
GlyphLayout dummy;
alty = itemText.item(CPos)->glyph.yoffset - layoutGlyphs(itemText.charStyle(CPos), nextCh, dummy);
double nextY;
while (CPos < len-1)
{
nextCh = itemText.text(CPos+1, 1);
nextChs = itemText.charStyle(CPos+1).fontSize();
nextY = itemText.item(CPos+1)->glyph.yoffset - SetZeichAttr(itemText.charStyle(CPos+1), &nextChs, &nextCh);
GlyphLayout dummy;
nextY = itemText.item(CPos+1)->glyph.yoffset - layoutGlyphs(itemText.charStyle(CPos+1), nextCh, dummy);
if (fabs(nextY - alty) > 1.0)
break;
CPos++;
4234,7 → 4209,7
view->RefreshItem(this);
break;
}
if (((uc[0] > QChar(31)) || (as == 13) || (as == 30)) && (m_Doc->currentStyle.charStyle().font()->canRender(uc[0])))
if (((uc[0] > QChar(31)) || (as == 13) || (as == 30)) && (m_Doc->currentStyle.charStyle().font().canRender(uc[0])))
{
// should go when hyphenator respects charstyle settings
QString Language = CPos < itemText.length()?
/branches/Version13x/Scribus/scribus/fontcombo.cpp
79,13 → 79,13
QMap<QString, QString> rlist;
rlist.clear();
SCFontsIterator it(prefsManager->appPrefs.AvailFonts);
for ( ; it.current(); ++it)
for ( ; it.hasNext(); it.next())
{
if (it.current()->usable())
if (it.current().usable())
{
if (currentDoc != NULL)
{
if ((currentDoc->DocName == it.current()->localForDocument()) || (it.current()->localForDocument().isEmpty()))
if (currentDoc->DocName == it.current().localForDocument() || it.current().localForDocument().isEmpty())
rlist.insert(it.currentKey().lower(), it.currentKey());
}
else
94,15 → 94,15
}
for (QMap<QString,QString>::Iterator it2 = rlist.begin(); it2 != rlist.end(); ++it2)
{
Foi* fon = prefsManager->appPrefs.AvailFonts[it2.data()];
if (!fon)
ScFace fon = prefsManager->appPrefs.AvailFonts[it2.data()];
if (! fon.usable() )
continue;
Foi::FontType type = fon->type();
if (type == Foi::OTF)
ScFace::FontType type = fon.type();
if (type == ScFace::OTF)
insertItem(otfFont, it2.data());
else if (type == Foi::TYPE1)
else if (type == ScFace::TYPE1)
insertItem(psFont, it2.data());
else if (type == Foi::TTF)
else if (type == ScFace::TTF)
insertItem(ttfFont, it2.data());
}
listBox()->setMinimumWidth(listBox()->maxItemWidth()+24);
157,8 → 157,8
{
disconnect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
disconnect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
QString family = prefsManager->appPrefs.AvailFonts[f]->family();
QString style = prefsManager->appPrefs.AvailFonts[f]->style();
QString family = prefsManager->appPrefs.AvailFonts[f].family();
QString style = prefsManager->appPrefs.AvailFonts[f].style();
fontFamily->setCurrentText(family);
fontStyle->clear();
QStringList slist = prefsManager->appPrefs.AvailFonts.fontMap[family];
169,7 → 169,7
{
for (QStringList::ConstIterator it3 = slist.begin(); it3 != slist.end(); ++it3)
{
if ((currDoc->DocName == prefsManager->appPrefs.AvailFonts[family + " " + *it3]->localForDocument()) || (prefsManager->appPrefs.AvailFonts[family + " " + *it3]->localForDocument().isEmpty()))
if ((currDoc->DocName == prefsManager->appPrefs.AvailFonts[family + " " + *it3].localForDocument()) || (prefsManager->appPrefs.AvailFonts[family + " " + *it3].localForDocument().isEmpty()))
ilist.append(*it3);
}
fontStyle->insertStringList(ilist);
201,7 → 201,7
ilist.clear();
for (QStringList::ConstIterator it3 = slist.begin(); it3 != slist.end(); ++it3)
{
if ((prefsManager->appPrefs.AvailFonts.find(*it2 + " " + *it3) && currentDoc->DocName == prefsManager->appPrefs.AvailFonts[*it2 + " " + *it3]->localForDocument()) || (prefsManager->appPrefs.AvailFonts[*it2 + " " + *it3]->localForDocument().isEmpty()))
if ( prefsManager->appPrefs.AvailFonts.contains(*it2 + " " + *it3) && (currentDoc->DocName == prefsManager->appPrefs.AvailFonts[*it2 + " " + *it3].localForDocument() || prefsManager->appPrefs.AvailFonts[*it2 + " " + *it3].localForDocument().isEmpty()))
ilist.append(*it3);
}
if (!ilist.isEmpty())
212,13 → 212,16
}
for (QMap<QString,QString>::Iterator it2a = flist.begin(); it2a != flist.end(); ++it2a)
{
Foi::FontType type = prefsManager->appPrefs.AvailFonts[it2a.data()+" "+prefsManager->appPrefs.AvailFonts.fontMap[it2a.data()][0]]->type();
if (type == Foi::OTF)
fontFamily->insertItem(otfFont, it2a.data());
else if (type == Foi::TYPE1)
fontFamily->insertItem(psFont, it2a.data());
else if (type == Foi::TTF)
fontFamily->insertItem(ttfFont, it2a.data());
ScFace fon = prefsManager->appPrefs.AvailFonts[it2a.data()+" "+prefsManager->appPrefs.AvailFonts.fontMap[it2a.data()][0]];
if (! fon.usable() )
continue;
ScFace::FontType type = fon.type();
if (type == ScFace::OTF)
fontFamily->insertItem(otfFont, it2a.data());
else if (type == ScFace::TYPE1)
fontFamily->insertItem(psFont, it2a.data());
else if (type == ScFace::TTF)
fontFamily->insertItem(ttfFont, it2a.data());
}
QString family = fontFamily->currentText();
QStringList slist = prefsManager->appPrefs.AvailFonts.fontMap[family];
229,7 → 232,7
{
for (QStringList::ConstIterator it3 = slist.begin(); it3 != slist.end(); ++it3)
{
if ((prefsManager->appPrefs.AvailFonts.find(family + " " + *it3) && currentDoc->DocName == prefsManager->appPrefs.AvailFonts[family + " " + *it3]->localForDocument()) || (prefsManager->appPrefs.AvailFonts[family + " " + *it3]->localForDocument().isEmpty()))
if (prefsManager->appPrefs.AvailFonts.contains(family + " " + *it3) && (currentDoc->DocName == prefsManager->appPrefs.AvailFonts[family + " " + *it3].localForDocument() || prefsManager->appPrefs.AvailFonts[family + " " + *it3].localForDocument().isEmpty()))
ilist.append(*it3);
}
fontStyle->insertStringList(ilist);
/branches/Version13x/Scribus/scribus/text/storytext.cpp
2,10 → 2,10
#include <qvaluelist.h>
#include <cassert> //added to make Fedora-5 happy
#include "fpoint.h"
#include "sctextstruct.h"
#include "scfonts.h"
//#include "sctextstruct.h"
#include "storytext.h"
#include "scribus.h"
#include "scfonts.h"
#include "util.h"
 
 
120,7 → 120,7
delete it->cembedded;
it->cembedded = 0;
}
else if ((it->ch[0] == SpecialChars::PARSEP)) {
else if ((it->ch[0] == SpecialChars::PARSEP) && it->parstyle) {
delete it->parstyle;
it->parstyle = 0;
}
209,6 → 209,7
const CharStyle* newP = & that->paragraphStyle(pos+1).charStyle();
replaceParentStyle(that, pos, oldP, newP);
delete it->parstyle;
it->parstyle = 0;
}
}
 
253,7 → 254,7
return;
const CharStyle style = pos == 0 ? defaultStyle().charStyle() : charStyle(pos - 1);
assert(style.font() != NULL);
assert( !style.font().isNone() );
// const int paraStyle = pos == 0 ? 0 : at(pos - 1)->cab;
413,7 → 414,9
}
else if ( !that->d->current()->parstyle ) {
qDebug(QString("inserting default parstyle at %1").arg(pos));
that->d->current()->parstyle = new ParagraphStyle(defaultStyle());
that->d->current()->parstyle = new ParagraphStyle();
that->d->current()->parstyle->setParent( & that->d->defaultStyle);
that->d->current()->parstyle->charStyle().setParent( & that->d->defaultStyle.charStyle() );
}
else {
// qDebug(QString("using parstyle at %1").arg(pos));
512,7 → 515,7
if (i < length()) {
if (!d->at(i)->parstyle) {
qDebug(QString("PARSEP without style at pos %1").arg(i));
d->at(i)->parstyle = new ParagraphStyle(defaultStyle());
d->at(i)->parstyle = new ParagraphStyle();
}
// qDebug(QString("applying parstyle %2 at %1 for %3").arg(i).arg(paragraphStyle(pos).name()).arg(pos));
d->at(i)->parstyle->applyStyle(style);
545,7 → 548,7
if (i < length()) {
if (!d->at(i)->parstyle) {
qDebug(QString("PARSEP without style at pos %1").arg(i));
d->at(i)->parstyle = new ParagraphStyle(defaultStyle());
d->at(i)->parstyle = new ParagraphStyle();
}
// qDebug(QString("applying parstyle %2 at %1 for %3").arg(i).arg(paragraphStyle(pos).name()).arg(pos));
d->at(i)->parstyle->eraseStyle(style);
/branches/Version13x/Scribus/scribus/text/storytext.h
37,6 → 37,7
//class ScTextEngine;
//class ScScriptItem;
class ScText_Shared;
class ScText;
class ScribusDoc;
 
/**
/branches/Version13x/Scribus/scribus/style.h
44,9 → 44,17
QString name() const { return name_; }
void setName(QString n) { name_ = n; }
bool hasName() const { return ! name_.isEmpty(); }
const Style* parent() const { return parent_; }
void setParent(const Style* p) { parent_ = p; }
bool hasParent() const { return parent_ != NULL; }
virtual ~Style() {}
virtual QString displayName() const { return name(); }
// virtual bool definesAll() const = 0;
// virtual bool inheritsAll() const = 0;
virtual bool equiv(const Style& other) const = 0;
virtual bool operator==(const Style& other) const { return name() == other.name() && equiv(other); }
virtual bool operator!=(const Style& other) const { return ! ( (*this) == other ); }
// applyStyle(const SubStyle& other)
// eraseStyle(const SubStyle& other)
// assign(const SubStyle& other)
96,7 → 104,7
static const QString NOCOLOR;
static const QString NOLANG;
CharStyle() : Style() {
CharStyle() : Style(), cfont(ScFace::none()) {
csize = NOVALUE;
cshade = NOVALUE;
cshade2 = NOVALUE;
113,13 → 121,12
cstrikewidth = NOVALUE;
cextra = NOVALUE;
cfont = const_cast<Foi*>(&Foi::NONE);
ccolor = NOCOLOR;
cstroke = NOCOLOR;
language_ = NOLANG;
};
CharStyle(Foi * font, int size, StyleFlag style = ScStyle_Default) : Style() {
CharStyle(const ScFace& font, int size, StyleFlag style = ScStyle_Default) : Style(), cfont(font) {
csize = size;
cshade = 1;
cshade2 = 1;
136,7 → 143,6
cstrikewidth = 0;
cextra = 0;
cfont = font;
ccolor = "Black";
cstroke = "Black";
language_ = "";
144,12 → 150,14
CharStyle(const CharStyle & other);
bool operator==(const CharStyle & other) const;
bool operator!=(const CharStyle & other) const { return ! (*this==other); }
CharStyle & operator=(const CharStyle & other);
void applyCharStyle(const CharStyle & other);
void eraseCharStyle(const CharStyle & other);
QString displayName() const;
// bool definesAll() const;
// bool inheritsAll() const;
bool equiv(const Style& other) const;
QString asString() const;
173,7 → 181,7
QString strokeColor() const { return cstroke==NOCOLOR && parent()? inh().strokeColor() : cstroke; }
QString language() const { return language_==NOLANG && parent()? inh().language() : language_; }
Foi* font() const { return cfont==&Foi::NONE && parent()? inh().font() : cfont; }
const ScFace& font() const { return cfont.isNone() && parent()? inh().font() : cfont; }
void setFontSize(int s) { csize = s; }
void setFillShade(int s) { cshade = s; }
195,7 → 203,7
void setStrokeColor(QString c) { cstroke = c; }
void setLanguage(QString l) { language_ = l; }
void setFont(Foi* f) { cfont = f; }
void setFont(const ScFace& f) { cfont = f; }
218,7 → 226,7
short cstrikewidth;
short cextra;
Foi* cfont;
ScFace cfont;
QString ccolor;
QString cstroke;
QString language_;
225,28 → 233,6
};
 
inline bool CharStyle::operator==(const CharStyle & other) const
{
return (csize == other.csize &&
cshade == other.cshade &&
cshade2 == other.cshade2 &&
cstyle == other.cstyle &&
cscale == other.cscale &&
cscalev == other.cscalev &&
cbase == other.cbase &&
cshadowx == other.cshadowx &&
cshadowy == other.cshadowy &&
coutline == other.coutline &&
cunderpos == other.cunderpos &&
cunderwidth == other.cunderwidth &&
cstrikepos == other.cstrikepos &&
cstrikewidth == other.cstrikewidth &&
cextra == other.cextra &&
cfont == other.cfont &&
ccolor == other.ccolor &&
cstroke == other.cstroke &&
language_ == other.language_ );
}
 
inline CharStyle & CharStyle::operator=(const CharStyle & other)
{
273,7 → 259,7
return *this;
}
 
inline CharStyle::CharStyle(const CharStyle & other) : Style(other)
inline CharStyle::CharStyle(const CharStyle & other) : Style(other), cfont(other.cfont)
{
csize = other.csize;
cshade = other.cshade;
290,7 → 276,6
cstrikepos = other.cstrikepos;
cstrikewidth = other.cstrikewidth;
cextra = other.cextra;
cfont = other.cfont;
ccolor = other.ccolor;
cstroke = other.cstroke;
language_ = other.language_;
394,14 → 379,13
void applyStyle(const ParagraphStyle& other);
void eraseStyle(const ParagraphStyle& other);
QString displayName() const;
// bool definesAll() const;
// bool inheritsAll() const;
 
ParagraphStyle& operator=(const ParagraphStyle& other);
 
bool equiv(const ParagraphStyle& other) const;
bool operator==(const ParagraphStyle& other) const
{
return name()==other.name() && equiv(other);
}
bool equiv(const Style& other) const;
};
 
#endif
/branches/Version13x/Scribus/scribus/scribus.cpp
986,7 → 986,7
{
// int ChPos = QMIN(currItem->CPos, static_cast<int>(currItem->itemText.length()-1));
const ParagraphStyle currPStyle(currItem->currentStyle());
int currentParaStyle = findParagraphStyle(doc, *dynamic_cast<const ParagraphStyle*>(currPStyle.parent()));
int currentParaStyle = currPStyle.parent()? findParagraphStyle(doc, *dynamic_cast<const ParagraphStyle*>(currPStyle.parent())) : 0;
setAbsValue(currPStyle.alignment());
propertiesPalette->setParStyle(currentParaStyle);
doc->currentStyle.charStyle() = currItem->currentCharStyle();
997,7 → 997,7
doc->currentStyle.charStyle().fillColor(),
doc->currentStyle.charStyle().strokeShade(),
doc->currentStyle.charStyle().fillShade());
emit TextIFont(doc->currentStyle.charStyle().font()->scName());
emit TextIFont(doc->currentStyle.charStyle().font().scName());
emit TextISize(doc->currentStyle.charStyle().fontSize());
emit TextUSval(doc->currentStyle.charStyle().tracking());
emit TextStil(doc->currentStyle.charStyle().effects());
2600,7 → 2600,7
scrActions["editSelectAll"]->setEnabled(true);
scrActions["insertGlyph"]->setEnabled(true);
if (currItem->asTextFrame())
actionManager->enableUnicodeActions(&scrActions, true, doc->currentStyle.charStyle().font()->scName());
actionManager->enableUnicodeActions(&scrActions, true, doc->currentStyle.charStyle().font().scName());
view->horizRuler->setItem(currItem);
if (currItem->lineColor() != CommonStrings::None)
view->horizRuler->lineCorr = currItem->lineWidth() / 2.0;
3589,30 → 3589,17
// TODO fix that for Groups on Masterpages
// if (ite->Groups.count() != 0)
// view->GroupOnPage(ite);
if ((ite->asTextFrame()) || (ite->asPathText()))
if (ite->asPathText())
{
if (ite->asPathText())
{
ite->Frame = true;
ite->updatePolyClip();
}
else
{
if ((ite->BackBox != 0) || (ite->NextBox != 0))
{
PageItem *nextItem = ite;
while (nextItem != 0)
{
if (nextItem->BackBox != 0)
nextItem = nextItem->BackBox;
else
break;
}
ite = nextItem;
}
}
ite->Frame = true;
ite->updatePolyClip();
ite->DrawObj(painter, rd);
}
else
{
if ( ite->BackBox == 0 )
ite->asTextFrame()->layout();
}
}
// RestoreBookMarks();
doc->setMasterPageMode(false);
3628,33 → 3615,17
ite->OwnPage = doc->OnPage(ite);
*/
//view->setRedrawBounding(ite);
if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText)) // && (!ite->Redrawn))
if (ite->itemType() == PageItem::PathText)
{
if (ite->itemType() == PageItem::PathText)
{
ite->Frame = true;
ite->updatePolyClip();
ite->DrawObj(painter, rd);
}
else
{
if ((ite->BackBox != 0) || (ite->NextBox != 0))
{
PageItem *nextItem = ite;
while (nextItem != 0)
{
if (nextItem->BackBox != 0)
nextItem = nextItem->BackBox;
else
break;
}
ite = nextItem;
ite->DrawObj(painter, rd);
}
else
ite->DrawObj(painter, rd);
}
ite->Frame = true;
ite->updatePolyClip();
ite->DrawObj(painter, rd);
}
else if (ite->itemType() == PageItem::TextFrame)
{
if ( ite->BackBox == 0 )
ite->asTextFrame()->layout();
}
/* if (doc->OldBM)
{
if ((ite->itemType() == PageItem::TextFrame) && (ite->isBookmark))
3669,15 → 3640,16
for (uint azz=0; azz<doc->FrameItems.count(); ++azz)
{
PageItem *ite = doc->FrameItems.at(azz);
if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText))
if ( ite->itemType() == PageItem::PathText )
{
if (ite->itemType() == PageItem::PathText)
{
ite->Frame = true;
ite->updatePolyClip();
}
ite->Frame = true;
ite->updatePolyClip();
ite->DrawObj(painter, rd);
}
else if ( ite->itemType() == PageItem::TextFrame )
{
ite->asTextFrame()->layout();
}
}
painter->end();
delete painter;
4490,7 → 4462,7
BufferI += nextItem->itemText.text(a);
}
Buffer2 += "\t";
Buffer2 += nextItem->itemText.charStyle(a).font()->scName()+"\t";
Buffer2 += nextItem->itemText.charStyle(a).font().scName()+"\t";
Buffer2 += QString::number(nextItem->itemText.charStyle(a).fontSize())+"\t";
Buffer2 += nextItem->itemText.charStyle(a).fillColor()+"\t";
Buffer2 += QString::number(nextItem->itemText.charStyle(a).tracking())+"\t";
4583,7 → 4555,7
BufferI += nextItem->itemText.text(a);
}
Buffer2 += "\t";
Buffer2 += nextItem->itemText.charStyle(a).font()->scName()+"\t";
Buffer2 += nextItem->itemText.charStyle(a).font().scName()+"\t";
Buffer2 += QString::number(nextItem->itemText.charStyle(a).fontSize())+"\t";
Buffer2 += nextItem->itemText.charStyle(a).fillColor()+"\t";
Buffer2 += QString::number(nextItem->itemText.charStyle(a).tracking())+"\t";
4863,9 → 4835,9
//FIXME: that st business doesn't look right
int st = findParagraphStyle(doc, doc->currentStyle);
if (st > 5)
ss->GetText(currItem, st, doc->docParagraphStyles[st].charStyle().font()->scName(), doc->docParagraphStyles[st].charStyle().fontSize(), true);
ss->GetText(currItem, st, doc->docParagraphStyles[st].charStyle().font().scName(), doc->docParagraphStyles[st].charStyle().fontSize(), true);
else
ss->GetText(currItem, st, currItem->currentCharStyle().font()->scName(), currItem->currentCharStyle().fontSize(), true);
ss->GetText(currItem, st, currItem->currentCharStyle().font().scName(), currItem->currentCharStyle().fontSize(), true);
delete ss;
}
view->RefreshItem(currItem);
5714,7 → 5686,7
scrActions["editPaste"]->setEnabled(false);
scrActions["insertGlyph"]->setEnabled(true);
if (currItem!=NULL && currItem->asTextFrame())
actionManager->enableUnicodeActions(&scrActions, true, doc->currentStyle.charStyle().font()->scName());
actionManager->enableUnicodeActions(&scrActions, true, doc->currentStyle.charStyle().font().scName());
if (!Buffer2.isNull())
{
// if (!Buffer2.startsWith("<SCRIBUSELEM"))
6195,7 → 6167,7
if (doc->AddFont(nf)) //, prefsManager->appPrefs.AvailFonts[nf]->Font))
{
int a = FontMenu->insertItem(new FmItem(nf, prefsManager->appPrefs.AvailFonts[nf]));
FontID.insert(a, prefsManager->appPrefs.AvailFonts[nf]->scName());
FontID.insert(a, prefsManager->appPrefs.AvailFonts[nf].scName());
}
else
{//CB FIXME: to doc?
6202,7 → 6174,7
if (doc->m_Selection->count() != 0)
{
PageItem *currItem = doc->m_Selection->itemAt(0);
nf2 = currItem->currentCharStyle().font()->scName();
nf2 = currItem->currentCharStyle().font().scName();
}
propertiesPalette->Fonts->RebuildList(doc);
buildFontMenu();
6478,6 → 6450,7
}
}
uint counter = 0;
/*
for (uint lc = 0; lc < 3; ++lc)
{
switch (lc)
6515,7 → 6488,9
{
const ParagraphStyle origStyle(ite->itemText.paragraphStyle(e));
int cabori = findParagraphStyle(doc, origStyle);
assert (cabori >= 0 && cabori < doc->docParagraphStyles.count() );
int cabneu = ers[cabori];
assert (cabneu >= 0 && cabneu < dia->TempVorl.count() );
CharStyle newStyle;
if (cabori > 4)
{
6575,7 → 6550,7
lastParaStyle = cabneu;
}
if (ite->itemText.text(e) == SpecialChars::PARSEP && cabneu >= 0) {
ite->itemText.applyStyle(e, doc->docParagraphStyles[cabneu]);
ite->itemText.applyStyle(e, dia->TempVorl[cabneu]);
}
}
else if (lastParaStyle >= 0) {
6588,11 → 6563,12
if (ite->itemText.length() > 0) {
ite->itemText.applyCharStyle(lastStyleStart, ite->itemText.length()-lastStyleStart, lastStyle);
if (lastParaStyle >=0 )
ite->itemText.applyStyle(ite->itemText.length()-1, doc->docParagraphStyles[lastParaStyle]);
ite->itemText.applyStyle(ite->itemText.length()-1, dia->TempVorl[lastParaStyle]);
}
}
}
}
*/
if (CurrStED != NULL)
{
if (CurrStED->Editor->StyledText.count() != 0)
6602,16 → 6578,19
SEditor::ChList *chars;
chars = CurrStED->Editor->StyledText.at(pa);
(*CurrStED->Editor->ParagStyles.at(pa)) = ers[CurrStED->Editor->ParagStyles[pa]];
/*
int cabneu = 0;
for (uint e = 0; e < chars->count(); ++e)
{
int cabori = chars->at(e)->cab;
assert (cabore >= 0 && cabori < doc->docParagraphStyles.count());
cabneu = ers[cabori];
assert (cabneu >= 0 && cabneu < dia->TempVorl.count() );
if (cabori > 4)
{
if (cabneu > 0)
{
if (chars->at(e)->charStyle.font()->scName() == doc->docParagraphStyles[cabori].charStyle().font()->scName())
if (chars->at(e)->charStyle.font().scName() == doc->docParagraphStyles[cabori].charStyle().font().scName())
chars->at(e)->charStyle.setFont(dia->TempVorl[cabneu].charStyle().font());
if (chars->at(e)->charStyle.fontSize() == doc->docParagraphStyles[cabori].charStyle().fontSize())
chars->at(e)->charStyle.setFontSize(dia->TempVorl[cabneu].charStyle().fontSize());
6660,11 → 6639,12
chars->at(e)->cab = cabneu;
}
}
*/
}
CurrStED->Editor->currentParaStyle = ers[CurrStED->Editor->currentParaStyle];
}
}
doc->docParagraphStyles = dia->TempVorl;
doc->docParagraphStyles.redefine(dia->TempVorl);
if (CurrStED != NULL)
{
if (CurrStED->Editor->StyledText.count() != 0)
6672,15 → 6652,15
}
for (uint a=0; a<doc->docParagraphStyles.count(); ++a)
{
if (doc->docParagraphStyles[a].charStyle().font() != &Foi::NONE)
if (!doc->docParagraphStyles[a].charStyle().font().isNone())
{
QString nf = doc->docParagraphStyles[a].charStyle().font()->scName();
QString nf = doc->docParagraphStyles[a].charStyle().font().scName();
if (!doc->UsedFonts.contains(nf))
{
if (doc->AddFont(nf)) //, prefsManager->appPrefs.AvailFonts[nf]->Font))
{
int ff = FontMenu->insertItem(new FmItem(nf, prefsManager->appPrefs.AvailFonts[nf]));
FontID.insert(ff, prefsManager->appPrefs.AvailFonts[nf]->scName());
FontID.insert(ff, prefsManager->appPrefs.AvailFonts[nf].scName());
}
else
doc->docParagraphStyles[a].charStyle().setFont((prefsManager->appPrefs.AvailFonts[doc->toolSettings.defFont]));
6687,6 → 6667,7
}
}
}
 
propertiesPalette->Spal->updateFormatList();
propertiesPalette->updateColorList();
propertiesPalette->updateCList();
7121,10 → 7102,10
FontMenu->insertSeparator();
if (!HaveDoc)
{
it.toFirst();
// it.toFirst();
a = FontMenu->insertItem(new FmItem(it.currentKey(), it.current()));
FontMenu->setItemChecked(a, true);
FontID.insert(a, it.current()->scName());
FontID.insert(a, it.current().scName());
}
else
{
/branches/Version13x/Scribus/scribus/fpointarray.h
51,6 → 51,7
const FPoint & point(uint i) { ConstIterator p = begin(); p+=i; return *p; };
QPoint pointQ(uint i);
void translate( double dx, double dy );
void scale( double sx, double sy );
FPoint WidthHeight();
void map(QWMatrix m);
FPointArray &operator=( const FPointArray &a );
/branches/Version13x/Scribus/scribus/documentchecker.cpp
143,7 → 143,7
chstr = chstr.upper();
}
chr = chstr[0].unicode();
if ((!currItem->itemText.charStyle(e).font()->canRender(chr)) && (checkerSettings.checkGlyphs))
if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
itemError.insert(MissingGlyph, 0);
}
for (uint t1 = 0; t1 < currItem->TabValues.count(); t1++)
157,7 → 157,7
chstr = chstr.upper();
}
chr = chstr[0].unicode();
if ((!currItem->itemText.charStyle(e).font()->canRender(chr)) && (checkerSettings.checkGlyphs))
if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
itemError.insert(MissingGlyph, 0);
}
continue;
166,12 → 166,12
{
for (uint numco = 0x30; numco < 0x3A; ++numco)
{
if ((!currItem->itemText.charStyle(e).font()->canRender(numco)) && (checkerSettings.checkGlyphs))
if ((!currItem->itemText.charStyle(e).font().canRender(numco)) && (checkerSettings.checkGlyphs))
itemError.insert(MissingGlyph, 0);
}
continue;
}
if ((!currItem->itemText.charStyle(e).font()->canRender(chr)) && (checkerSettings.checkGlyphs))
if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
itemError.insert(MissingGlyph, 0);
}
#endif
253,7 → 253,7
chstr = chstr.upper();
}
chr = chstr[0].unicode();
if ((!currItem->itemText.charStyle(e).font()->canRender(chr)) && (checkerSettings.checkGlyphs))
if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
itemError.insert(MissingGlyph, 0);
}
for (uint t1 = 0; t1 < currItem->TabValues.count(); t1++)
267,7 → 267,7
chstr = chstr.upper();
}
chr = chstr[0].unicode();
if ((!currItem->itemText.charStyle(e).font()->canRender(chr)) && (checkerSettings.checkGlyphs))
if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
itemError.insert(MissingGlyph, 0);
}
continue;
276,12 → 276,12
{
for (uint numco = 0x30; numco < 0x3A; ++numco)
{
if ((!currItem->itemText.charStyle(e).font()->canRender(numco)) && (checkerSettings.checkGlyphs))
if ((!currItem->itemText.charStyle(e).font().canRender(numco)) && (checkerSettings.checkGlyphs))
itemError.insert(MissingGlyph, 0);
}
continue;
}
if ((!currItem->itemText.charStyle(e).font()->canRender(chr)) && (checkerSettings.checkGlyphs))
if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
itemError.insert(MissingGlyph, 0);
}
#endif
/branches/Version13x/Scribus/scribus/pageitem_imageframe.h
42,7 → 42,6
class ScribusDoc;
class UndoManager;
class UndoState;
class Foi;
struct CopyPasteBuffer;
 
class SCRIBUS_API PageItem_ImageFrame : public PageItem
/branches/Version13x/Scribus/scribus/pslib.h
28,6 → 28,7
#include <qpen.h>
#include <qfile.h>
#include <vector>
#include <utility>
class ScribusDoc;
//class ScribusView;
#include "scribusapi.h"
136,7 → 137,7
QString Fonts;
QString FontDesc;
QMap<QString, QString> UsedFonts;
typedef QMap<uint, QString> GListe;
typedef QMap<QChar, std::pair<uint, QString> > GListe;
QMap<QString, GListe> GlyphsOfFont;
bool isPDF;
QFile Spool;
/branches/Version13x/Scribus/scribus/loremipsum.cpp
237,9 → 237,9
ss->Objekt = lp->createLorem(paraCount);
int st = findParagraphStyle(m_Doc, m_Doc->currentStyle);
if (st > 5)
ss->GetText(currItem, st, m_Doc->docParagraphStyles[st].charStyle().font()->scName(), m_Doc->docParagraphStyles[st].charStyle().fontSize(), true);
ss->GetText(currItem, st, m_Doc->docParagraphStyles[st].charStyle().font().scName(), m_Doc->docParagraphStyles[st].charStyle().fontSize(), true);
else
ss->GetText(currItem, st, currItem->currentCharStyle().font()->scName(), currItem->currentCharStyle().fontSize(), true);
ss->GetText(currItem, st, currItem->currentCharStyle().font().scName(), currItem->currentCharStyle().fontSize(), true);
delete ss;
}
delete lp;
/branches/Version13x/Scribus/scribus/sctextstruct.cpp
14,8 → 14,8
QString CharStyle::asString() const
{
QString result;
if (cfont != &Foi::NONE)
result += QObject::tr("font %1 ").arg(cfont->scName());
if (!cfont.isNone())
result += QObject::tr("font %1 ").arg(cfont.scName());
if (csize != NOVALUE)
result += QObject::tr("size %1 ").arg(csize);
if (cstyle != NOVALUE)
/branches/Version13x/Scribus/scribus/search.cpp
106,7 → 106,7
SearchLayout->addWidget( SStyleVal, 1, 1 );
SFontVal = new FontCombo(Search);
SFontVal->setMaximumSize(190, 30);
SFontVal->setCurrentText(doc->currentStyle.charStyle().font()->scName());
SFontVal->setCurrentText(doc->currentStyle.charStyle().font().scName());
SFontVal->setEnabled(false);
SearchLayout->addWidget( SFontVal, 2, 1 );
SSizeVal = new MSpinBox( Search, 1 );
202,7 → 202,7
ReplaceLayout->addWidget( RStyleVal, 1, 1 );
RFontVal = new FontCombo(Replace);
RFontVal->setMaximumSize(190, 30);
RFontVal->setCurrentText(doc->currentStyle.charStyle().font()->scName());
RFontVal->setCurrentText(doc->currentStyle.charStyle().font().scName());
RFontVal->setEnabled(false);
ReplaceLayout->addWidget( RFontVal, 2, 1 );
RSizeVal = new MSpinBox( Replace, 1 );
426,7 → 426,7
}
if (SFont->isChecked())
{
if (Item->itemText.charStyle(a).font()->scName() != sFont)
if (Item->itemText.charStyle(a).font().scName() != sFont)
found = false;
}
#ifndef NLS_PROTO
567,7 → 567,7
hg = chars->at(as+ap);
if ((SSize->isChecked()) && (hg->charStyle.fontSize() != sSize))
found = false;
if ((SFont->isChecked()) && (hg->charStyle.font()->scName() != sFont))
if ((SFont->isChecked()) && (hg->charStyle.font().scName() != sFont))
found = false;
// if ((SStyle->isChecked()) && (hg->cab != sStyle))
// found = false;
603,7 → 603,7
hg = chars->at(e);
if ((SSize->isChecked()) && (hg->charStyle.fontSize() != sSize))
found = false;
if ((SFont->isChecked()) && (hg->charStyle.font()->scName() != sFont))
if ((SFont->isChecked()) && (hg->charStyle.font().scName() != sFont))
found = false;
// if ((SStyle->isChecked()) && (hg->cab != sStyle))
// found = false;
726,7 → 726,7
hg->cab = RStyleVal->currentItem();
else
hg->cab = findParagraphStyle(Doc, Doc->currentStyle);
if (Doc->docParagraphStyles[hg->cab].charStyle().font() != &Foi::NONE)
if (!Doc->docParagraphStyles[hg->cab].charStyle().font()->isNone())
{
hg->setFont((*Doc->AllFonts)[Doc->docParagraphStyles[hg->cab].charStyle().font()->scName()]);
hg->setFontSize(Doc->docParagraphStyles[hg->cab].charStyle().fontSize());
963,7 → 963,7
STextVal->setText("");
int currentParaStyle = findParagraphStyle(Doc, Doc->currentStyle);
SStyleVal->setCurrentItem(currentParaStyle);
SFontVal->setCurrentText(Doc->currentStyle.charStyle().font()->scName());
SFontVal->setCurrentText(Doc->currentStyle.charStyle().font().scName());
SSizeVal->setValue(Doc->currentStyle.charStyle().fontSize() / 10.0);
SFillVal->setCurrentText(Doc->currentStyle.charStyle().fillColor());
SStrokeVal->setCurrentText(Doc->currentStyle.charStyle().strokeColor());
977,7 → 977,7
RText->setChecked(false);
RTextVal->setText("");
RStyleVal->setCurrentItem(currentParaStyle);
RFontVal->setCurrentText(Doc->currentStyle.charStyle().font()->scName());
RFontVal->setCurrentText(Doc->currentStyle.charStyle().font().scName());
RSizeVal->setValue(Doc->currentStyle.charStyle().fontSize() / 10.0);
RFillVal->setCurrentText(Doc->currentStyle.charStyle().fillColor());
RStrokeVal->setCurrentText(Doc->currentStyle.charStyle().strokeColor());
1022,7 → 1022,7
else
SStyleVal->setCurrentItem(tmp);
 
SFontVal->setCurrentText(prefs->get("SFontVal", Doc->currentStyle.charStyle().font()->scName()));
SFontVal->setCurrentText(prefs->get("SFontVal", Doc->currentStyle.charStyle().font().scName()));
SSizeVal->setValue(prefs->getDouble("SSizeVal", Doc->currentStyle.charStyle().fontSize() / 10.0));
SFillVal->setCurrentText(prefs->get("SFillVal", Doc->currentStyle.charStyle().fillColor()));
SStrokeVal->setCurrentText(prefs->get("SStrokeVal", Doc->currentStyle.charStyle().strokeColor()));
1040,7 → 1040,7
RStyleVal->setCurrentItem(0);
else
RStyleVal->setCurrentItem(tmp);
RFontVal->setCurrentText(prefs->get("RFontVal", Doc->currentStyle.charStyle().font()->scName()));
RFontVal->setCurrentText(prefs->get("RFontVal", Doc->currentStyle.charStyle().font().scName()));
RSizeVal->setValue(prefs->getDouble("RSizeVal", Doc->currentStyle.charStyle().fontSize() / 10.0));
RFillVal->setCurrentText(prefs->get("RFillVal", Doc->currentStyle.charStyle().fillColor()));
RStrokeVal->setCurrentText(prefs->get("RStrokeVal", Doc->currentStyle.charStyle().strokeColor()));
/branches/Version13x/Scribus/scribus/pageitem_line.h
42,7 → 42,6
class ScribusDoc;
class UndoManager;
class UndoState;
class Foi;
struct CopyPasteBuffer;
 
class SCRIBUS_API PageItem_Line : public PageItem
/branches/Version13x/Scribus/scribus/smtextstyles.h
11,6 → 11,7
#include "styleitem.h"
#include "smpstylewbase.h"
#include "smcstylewbase.h"
#include "styles/styleset.h"
 
class QGridLayout;
class QPopupMenu;
90,7 → 91,7
 
private:
SMPStyleWidget *pwidget_;
QValueList<ParagraphStyle> tmpPStyles_;
StyleSet<ParagraphStyle> tmpPStyles_;
ScribusDoc *doc_;
};
 
/branches/Version13x/Scribus/scribus/tabpdfoptions.cpp
425,11 → 425,11
// QMap<QString,int>::const_iterator it;
// for (it = DocFonts.constBegin(); it != DocFonts.constEnd(); ++it)
// {
// if (AllFonts[it.key()]->type() == Foi::TYPE1)
// if (AllFonts[it.key()]->type() == ScFace::TYPE1)
// AvailFlist->insertItem(loadIcon("font_type1_16.png"), it.key());
// else if (AllFonts[it.key()]->type() == Foi::TTF)
// else if (AllFonts[it.key()]->type() == ScFace::TTF)
// AvailFlist->insertItem(loadIcon("font_truetype16.png"), it.key());
// else if (AllFonts[it.key()]->type() == Foi::OTF)
// else if (AllFonts[it.key()]->type() == ScFace::OTF)
// AvailFlist->insertItem(loadIcon("font_otf16.png"), it.key());
// }
AvailFlist->setMinimumSize(QSize(150, 140));
1270,11 → 1270,11
AvailFlist->clear();
for (it = DocFonts.constBegin(); it != DocFonts.constEnd(); ++it)
{
if (AllFonts[it.key()]->type() == Foi::TYPE1)
if (AllFonts[it.key()].type() == ScFace::TYPE1)
AvailFlist->insertItem(loadIcon("font_type1_16.png"), it.key());
else if (AllFonts[it.key()]->type() == Foi::TTF)
else if (AllFonts[it.key()].type() == ScFace::TTF)
AvailFlist->insertItem(loadIcon("font_truetype16.png"), it.key());
else if (AllFonts[it.key()]->type() == Foi::OTF)
else if (AllFonts[it.key()].type() == ScFace::OTF)
AvailFlist->insertItem(loadIcon("font_otf16.png"), it.key());
}
ToEmbed->setEnabled(false);
1979,7 → 1979,7
{
if (EmbedList->count() != 0)
{
if (!AllFonts[AvailFlist->currentText()]->subset())
if (!AllFonts[AvailFlist->currentText()].subset())
{
if (EmbedList->findItem(AvailFlist->currentText()) == NULL)
{
2006,7 → 2006,7
}
else
{
if (!AllFonts[AvailFlist->currentText()]->subset())
if (!AllFonts[AvailFlist->currentText()].subset())
{
FontsToEmbed.append(AvailFlist->currentText());
EmbedList->insertItem(AvailFlist->currentText());
2032,7 → 2032,7
 
void TabPDFOptions::RemoveSubset()
{
if (!AllFonts[SubsetList->currentText()]->subset())
if (!AllFonts[SubsetList->currentText()].subset())
{
FontsToSubset.remove(SubsetList->currentText());
FontsToEmbed.append(SubsetList->currentText());
2127,7 → 2127,7
{
if (AvailFlist->item(a)->isSelectable())
{
if (!AllFonts[AvailFlist->item(a)->text()]->subset())
if (!AllFonts[AvailFlist->item(a)->text()].subset())
{
FontsToEmbed.append(AvailFlist->item(a)->text());
EmbedList->insertItem(AvailFlist->item(a)->text());
/branches/Version13x/Scribus/scribus/reformdoc.cpp
522,11 → 522,11
}
PrefsManager* prefsManager=PrefsManager::instance();
SCFontsIterator it(prefsManager->appPrefs.AvailFonts);
for ( ; it.current() ; ++it)
for ( ; it.hasNext() ; it.next())
{
it.current()->embedPs(tabFonts->fontFlags[it.currentKey()].FlagPS);
it.current()->useFont(tabFonts->fontFlags[it.currentKey()].FlagUse);
it.current()->subset(tabFonts->fontFlags[it.currentKey()].FlagSub);
it.current().embedPs(tabFonts->fontFlags[it.currentKey()].FlagPS);
it.current().usable(tabFonts->fontFlags[it.currentKey()].FlagUse);
it.current().subset(tabFonts->fontFlags[it.currentKey()].FlagSub);
}
uint a = 0;
prefsManager->appPrefs.GFontSub.clear();
/branches/Version13x/Scribus/scribus/collect4output.cpp
236,8 → 236,8
QMap<QString,int>::Iterator it3end = m_Doc->UsedFonts.end();
for (it3 = m_Doc->UsedFonts.begin(); it3 != it3end; ++it3)
{
QFileInfo itf = QFileInfo(prefsManager->appPrefs.AvailFonts[it3.key()]->fontFilePath());
copyFile(prefsManager->appPrefs.AvailFonts[it3.key()]->fontFilePath(), outputDirectory + itf.fileName());
QFileInfo itf = QFileInfo(prefsManager->appPrefs.AvailFonts[it3.key()].fontFilePath());
copyFile(prefsManager->appPrefs.AvailFonts[it3.key()].fontFilePath(), outputDirectory + itf.fileName());
}
return true;
}
/branches/Version13x/Scribus/scribus/scribusdoc.cpp
128,6 → 128,7
ElemToLink(0),
DragElements(),
docParagraphStyles(),
docCharStyles(),
Layers(),
marginColored(prefsData.marginColored),
GroupCounter(1),
226,6 → 227,7
ElemToLink(0),
DragElements(),
docParagraphStyles(),
docCharStyles(),
Layers(),
marginColored(prefsData.marginColored),
GroupCounter(1),
355,22 → 357,22
vg.charStyle().setScaleH(1000);
vg.charStyle().setScaleV(1000);
vg.charStyle().setTracking(0);
docParagraphStyles.append(vg);
docParagraphStyles.create(vg);
currentStyle = vg;
vg.setName("Center Internal");
vg.setAlignment(1);
docParagraphStyles.append(vg);
docParagraphStyles.create(vg);
vg.setName("Rechts Internal");
vg.setAlignment(2);
docParagraphStyles.append(vg);
docParagraphStyles.create(vg);
vg.setName("Block Internal");
vg.setAlignment(3);
docParagraphStyles.append(vg);
docParagraphStyles.create(vg);
vg.setName("EBlock Internal");
vg.setAlignment(4);
docParagraphStyles.append(vg);
docParagraphStyles.create(vg);
struct Layer ll;
ll.LNr = 0;
ll.Level = 0;
410,10 → 412,10
QMap<QString,int>::Iterator it3;
for (it3 = UsedFonts.begin(); it3 != UsedFonts.end(); ++it3)
{
if (!(*AllFonts)[it3.key()]->localForDocument().isEmpty())
if (!(*AllFonts)[it3.key()].localForDocument().isEmpty())
(*AllFonts).removeFont(it3.key());
else
(*AllFonts)[it3.key()]->decreaseUsage();
(*AllFonts)[it3.key()].decreaseUsage();
}
}
 
707,8 → 709,7
*/
void ScribusDoc::loadStylesFromFile(QString fileName, QValueList<ParagraphStyle> *tempStyles)
{
// This won't create the QValueList<ParagraphStyle> will it?
QValueList<ParagraphStyle> *wrkStyles = NULL;
StyleSet<ParagraphStyle> *wrkStyles = NULL;
/*
* Use the working styles struct if passed, or work directly
* on the document styles otherwise. Note that tempStyles,
715,10 → 716,10
* if passed, MUST have the first five styles initialised already
* or this function will segfault.
*/
if (tempStyles != NULL)
wrkStyles = tempStyles;
else
wrkStyles = &docParagraphStyles;
// if (tempStyles != NULL)
// wrkStyles = tempStyles;
// else
wrkStyles = &docParagraphStyles;
if (!fileName.isEmpty())
{
FileLoader fl(fileName);
726,7 → 727,8
//TODO put in nice user warning
return;
for (uint x = 5; x < wrkStyles->count(); ++x)
docParagraphStyles.append((*wrkStyles)[x]);
docParagraphStyles.create((*wrkStyles)[x]);//FIXME: this looks bogus, AV
 
uint old = wrkStyles->count()-5;
if (fl.ReadStyles(fileName, this, docParagraphStyles))
{
767,7 → 769,7
sty.charStyle().setScaleV(docParagraphStyles[xx].charStyle().scaleV());
sty.charStyle().setBaselineOffset(docParagraphStyles[xx].charStyle().baselineOffset());
sty.charStyle().setTracking(docParagraphStyles[xx].charStyle().tracking());
wrkStyles->append(sty);
wrkStyles->create(sty);
}
}
}
938,20 → 940,20
if (UsedFonts.contains(name))
return true;
 
if (! AllFonts->find(name) || name == "" )
if (! AllFonts->contains(name) || name == "" )
return false;
 
face = (*AllFonts)[name]->ftFace();
if ( !face )
return false;
// face = (*AllFonts)[name]->ftFace();
// if ( !face )
// return false;
 
if ((*AllFonts)[name]->ReadMetrics())
/* if ((*AllFonts)[name].ReadMetrics()) FIXME: needed?
{
// (*AllFonts)[name]->CharWidth[13] = 0;
// (*AllFonts)[name]->CharWidth[28] = 0;
// (*AllFonts)[name]->CharWidth[26] = 0;
// (*AllFonts)[name]->CharWidth[9] = 1;
QString afnm = (*AllFonts)[name]->fontFilePath().left((*AllFonts)[name]->fontFilePath().length()-3);
QString afnm = (*AllFonts)[name].fontFilePath().left((*AllFonts)[name].fontFilePath().length()-3);
QFile afm(afnm+"afm");
if(!(afm.exists()))
{
974,10 → 976,11
}
if (afm.exists())
FT_Attach_File(face, afm.name());
UsedFonts[name] = fsize;
(*AllFonts)[name]->increaseUsage();
ret = true;
}
*/
UsedFonts[name] = fsize;
(*AllFonts)[name].increaseUsage();
ret = true;
return ret;
}
 
2144,8 → 2147,8
{
for (int e = 0; e < it->itemText.length(); ++e)
{
if (! Really.contains(it->itemText.charStyle(e).font()->scName()) ) {
Really.insert(it->itemText.charStyle(e).font()->scName(), QMap<uint, FPointArray>());
if (! Really.contains(it->itemText.charStyle(e).font().scName()) ) {
Really.insert(it->itemText.charStyle(e).font().scName(), QMap<uint, FPointArray>());
}
uint chr = it->itemText.text(e).unicode();
if ((chr == 13) || (chr == 32) || (chr == 29))
2163,8 → 2166,9
chstr = chstr.upper();
}
chr = chstr[0].unicode();
gly = it->itemText.charStyle(e).font()->outline(chstr[0]);
Really[it->itemText.charStyle(e).font()->scName()].insert(chr, gly);
uint gl = it->itemText.charStyle(e).font().char2CMap(chstr[0]);
gly = it->itemText.charStyle(e).font().glyphOutline(gl);
Really[it->itemText.charStyle(e).font().scName()].insert(chr, gly);
}
for (uint t1 = 0; t1 < it->TabValues.count(); t1++)
{
2177,8 → 2181,9
chstr = chstr.upper();
}
chr = chstr[0].unicode();
gly = it->itemText.charStyle(e).font()->outline(chstr[0]);
Really[it->itemText.charStyle(e).font()->scName()].insert(chr, gly);
uint gl = it->itemText.charStyle(e).font().char2CMap(chstr[0]);
gly = it->itemText.charStyle(e).font().glyphOutline(gl);
Really[it->itemText.charStyle(e).font().scName()].insert(chr, gly);
}
continue;
}
2221,10 → 2226,11
for (uint pnti=0;pnti<pageNumberText.length(); ++pnti)
{
uint chr = pageNumberText[pnti].unicode();
if (it->itemText.charStyle(e).font()->canRender(chr))
if (it->itemText.charStyle(e).font().canRender(chr))
{
FPointArray gly(it->itemText.charStyle(e).font()->outline(chr));
Really[it->itemText.charStyle(e).font()->scName()].insert(chr, gly);
uint gl = it->itemText.charStyle(e).font().char2CMap(pageNumberText[pnti]);
FPointArray gly(it->itemText.charStyle(e).font().glyphOutline(gl));
Really[it->itemText.charStyle(e).font().scName()].insert(chr, gly);
}
}
continue;
2236,10 → 2242,11
chstr = chstr.upper();
chr = chstr[0].unicode();
}
if (it->itemText.charStyle(e).font()->canRender(chr))
if (it->itemText.charStyle(e).font().canRender(chr))
{
gly = it->itemText.charStyle(e).font()->outline(chr);
Really[it->itemText.charStyle(e).font()->scName()].insert(chr, gly);
uint gl = it->itemText.charStyle(e).font().char2CMap(chr);
gly = it->itemText.charStyle(e).font().glyphOutline(gl);
Really[it->itemText.charStyle(e).font().scName()].insert(chr, gly);
}
}
}
2334,7 → 2341,7
it = FrameItems.at(d);
break;
}
QString fontName(it->itemText.defaultStyle().charStyle().font()->scName());
QString fontName(it->itemText.defaultStyle().charStyle().font().scName());
Really.insert(fontName, UsedFonts[fontName]);
if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
{
2341,7 → 2348,7
uint itemTextCount=it->itemText.length();
for (uint e = 0; e < itemTextCount; ++e)
{
Really.insert(it->itemText.charStyle(e).font()->scName(), UsedFonts[it->itemText.charStyle(e).font()->scName()]);
Really.insert(it->itemText.charStyle(e).font().scName(), UsedFonts[it->itemText.charStyle(e).font().scName()]);
}
}
}
2353,7 → 2360,7
++itnext;
if (!Really.contains(itfo.key()))
{
(*AllFonts)[itfo.key()]->decreaseUsage();
(*AllFonts)[itfo.key()].decreaseUsage();
UsedFonts.remove(itfo);
}
}
4781,7 → 4788,7
// to user defined style
if (s > 4)
{
if (docParagraphStyles[s].charStyle().font() != &Foi::NONE
if ( !docParagraphStyles[s].charStyle().font().isNone()
&& (!nextItem->HasSel || nextItem->itemText.selected(a)))
{
// set default charstyle
4840,7 → 4847,7
{
if (s > 4)
{
if (docParagraphStyles[s].charStyle().font() != &Foi::NONE
if ( !docParagraphStyles[s].charStyle().font().isNone()
&& (!nextItem->HasSel || nextItem->itemText.selected(a)))
{
nextItem->itemText.item(a)->setFont(docParagraphStyles[s].charStyle().font());
4926,7 → 4933,7
{
if (s > 4)
{
if (docParagraphStyles[s].charStyle().font() != &Foi::NONE)
if ( !docParagraphStyles[s].charStyle().font().isNone())
{
currItem->itemText.item(a)->setFont(docParagraphStyles[s].charStyle().font());
currItem->itemText.item(a)->setFontSize(docParagraphStyles[s].charStyle().fontSize());
/branches/Version13x/Scribus/scribus/pdflib.cpp
625,7 → 625,7
StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
{
ReallyUsed.insert(pgit->itemText.charStyle(e).font()->scName(), DocFonts[pgit->itemText.charStyle(e).font()->scName()]);
ReallyUsed.insert(pgit->itemText.charStyle(e).font().scName(), DocFonts[pgit->itemText.charStyle(e).font().scName()]);
}
}
}
638,7 → 638,7
StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
{
ReallyUsed.insert(pgit->itemText.charStyle(e).font()->scName(), DocFonts[pgit->itemText.charStyle(e).font()->scName()]);
ReallyUsed.insert(pgit->itemText.charStyle(e).font().scName(), DocFonts[pgit->itemText.charStyle(e).font().scName()]);
}
}
}
651,7 → 651,7
StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
{
ReallyUsed.insert(pgit->itemText.charStyle(e).font()->scName(), DocFonts[pgit->itemText.charStyle(e).font()->scName()]);
ReallyUsed.insert(pgit->itemText.charStyle(e).font().scName(), DocFonts[pgit->itemText.charStyle(e).font().scName()]);
}
}
}
672,8 → 672,8
a = 0;
for (it = ReallyUsed.begin(); it != ReallyUsed.end(); ++it)
{
Foi::FontFormat fformat = AllFonts[it.key()]->format();
if ((AllFonts[it.key()]->isOTF()) || (!AllFonts[it.key()]->hasNames()) || (AllFonts[it.key()]->subset()) || (Options.SubsetList.contains(it.key())))
ScFace::FontFormat fformat = AllFonts[it.key()].format();
if ((AllFonts[it.key()].isOTF()) || (!AllFonts[it.key()].hasNames()) || (AllFonts[it.key()].subset()) || (Options.SubsetList.contains(it.key())))
{
QString fon("");
QMap<uint,FPointArray>& RealGlyphs(it.data());
732,18 → 732,18
if ((Options.Compress) && (CompAvail))
PutDoc("\n/Filter /FlateDecode");
PutDoc(" >>\nstream\n"+EncStream(fon, ObjCounter-1)+"\nendstream\nendobj\n");
Seite.XObjects[AllFonts[it.key()]->RealName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+QString::number(ig.key())] = ObjCounter-1;
Seite.XObjects[AllFonts[it.key()].psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+QString::number(ig.key())] = ObjCounter-1;
}
}
else
{
UsedFontsP.insert(it.key(), "/Fo"+QString::number(a));
if ((fformat == Foi::PFB) && (Options.EmbedList.contains(it.key())))
if ((fformat == ScFace::PFB) && (Options.EmbedList.contains(it.key())))
{
QString fon("");
StartObj(ObjCounter);
QByteArray bb;
AllFonts[it.key()]->RawData(bb);
AllFonts[it.key()].RawData(bb);
uint posi;
for (posi = 6; posi < bb.size(); ++posi)
{
785,7 → 785,7
PutDoc(">>\nstream\n"+EncStream(fon,ObjCounter)+"\nendstream\nendobj\n");
ObjCounter++;
}
if ((fformat == Foi::PFA) && (Options.EmbedList.contains(it.key())))
if ((fformat == ScFace::PFA) && (Options.EmbedList.contains(it.key())))
{
QString fon("");
QString fon2("");
793,7 → 793,7
uint value;
bool ok = true;
StartObj(ObjCounter);
AllFonts[it.key()]->EmbedFont(fon);
AllFonts[it.key()].EmbedFont(fon);
int len1 = fon.find("eexec")+5;
fon2 = fon.left(len1)+"\n";
int len2 = fon.find("0000000000000000000000000");
823,12 → 823,12
PutDoc(">>\nstream\n"+EncStream(fon2, ObjCounter)+"\nendstream\nendobj\n");
ObjCounter++;
}
if ((fformat == Foi::SFNT || fformat == Foi::TTCF) && (Options.EmbedList.contains(it.key())))
if ((fformat == ScFace::SFNT || fformat == ScFace::TTCF) && (Options.EmbedList.contains(it.key())))
{
QString fon("");
StartObj(ObjCounter);
QByteArray bb;
AllFonts[it.key()]->RawData(bb);
AllFonts[it.key()].RawData(bb);
//AV: += and append() dont't work because they stop at '\0' :-(
for (unsigned int i=0; i < bb.size(); i++)
fon += QChar(bb[i]);
846,30 → 846,30
StartObj(ObjCounter);
// TODO: think about QByteArray ScFace::getFontDescriptor() -- AV
PutDoc("<<\n/Type /FontDescriptor\n");
PutDoc("/FontName /"+AllFonts[it.key()]->RealName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+"\n");
PutDoc("/FontBBox [ "+AllFonts[it.key()]->fontBBox()+" ]\n");
PutDoc("/FontName /"+AllFonts[it.key()].psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+"\n");
PutDoc("/FontBBox [ "+AllFonts[it.key()].fontBBox()+" ]\n");
PutDoc("/Flags ");
//FIXME: isItalic() should be queried from Foi, not from Qt -- AV
//FIXME: isItalic() should be queried from ScFace, not from Qt -- AV
//QFontInfo fo = QFontInfo(it.data());
int pfl = 0;
if (AllFonts[it.key()]->isFixedPitch())
if (AllFonts[it.key()].isFixedPitch())
pfl = pfl ^ 1;
//if (fo.italic())
if (AllFonts[it.key()]->italicAngle() != "0")
if (AllFonts[it.key()].italicAngle() != "0")
pfl = pfl ^ 64;
// pfl = pfl ^ 4;
pfl = pfl ^ 32;
PutDoc(QString::number(pfl)+"\n");
PutDoc("/Ascent "+QString::number(static_cast<int>(AllFonts[it.key()]->ascent()))+"\n");
PutDoc("/Descent "+QString::number(static_cast<int>(AllFonts[it.key()]->descent()))+"\n");
PutDoc("/CapHeight "+QString::number(static_cast<int>(AllFonts[it.key()]->capHeight()))+"\n");
PutDoc("/ItalicAngle "+AllFonts[it.key()]->italicAngle()+"\n");
PutDoc("/StemV "+ AllFonts[it.key()]->stemV() + "\n");
if ((fformat == Foi::SFNT || fformat == Foi::TTCF) && (Options.EmbedList.contains(it.key())))
PutDoc("/Ascent "+QString::number(static_cast<int>(AllFonts[it.key()].ascent()))+"\n");
PutDoc("/Descent "+QString::number(static_cast<int>(AllFonts[it.key()].descent()))+"\n");
PutDoc("/CapHeight "+QString::number(static_cast<int>(AllFonts[it.key()].capHeight()))+"\n");
PutDoc("/ItalicAngle "+AllFonts[it.key()].italicAngle()+"\n");
PutDoc("/StemV "+ AllFonts[it.key()].stemV() + "\n");
if ((fformat == ScFace::SFNT || fformat == ScFace::TTCF) && (Options.EmbedList.contains(it.key())))
PutDoc("/FontFile2 "+QString::number(ObjCounter-1)+" 0 R\n");
if ((fformat == Foi::PFB) && (Options.EmbedList.contains(it.key())))
if ((fformat == ScFace::PFB) && (Options.EmbedList.contains(it.key())))
PutDoc("/FontFile "+QString::number(ObjCounter-1)+" 0 R\n");
if ((fformat == Foi::PFA) && (Options.EmbedList.contains(it.key())))
if ((fformat == ScFace::PFA) && (Options.EmbedList.contains(it.key())))
PutDoc("/FontFile "+QString::number(ObjCounter-1)+" 0 R\n");
PutDoc(">>\nendobj\n");
ObjCounter++;
893,9 → 893,9
// encoding dictionary w/ base encoding w/o differences
StartObj(ObjCounter);
PutDoc("<<\n/Type /Font\n/Subtype ");
PutDoc((fformat == Foi::SFNT || fformat == Foi::TTCF) ? "/TrueType\n" : "/Type1\n");
PutDoc((fformat == ScFace::SFNT || fformat == ScFace::TTCF) ? "/TrueType\n" : "/Type1\n");
PutDoc("/Name /Fo"+QString::number(a)+"\n");
PutDoc("/BaseFont /"+AllFonts[it.key()]->RealName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "" )+"\n");
PutDoc("/BaseFont /"+AllFonts[it.key()]->psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "" )+"\n");
//cf. widths:
PutDoc("/FirstChar 0\n");
PutDoc("/LastChar "+QString::number(chCount-1)+"\n");
907,13 → 907,13
}
else */
// {
GListeInd gl;
GlyIndex(AllFonts[it.key()], &gl);
GListe gl;
AllFonts[it.key()].glyphNames(gl);
GlyphsIdxOfFont.insert(it.key(), gl);
uint FontDes = ObjCounter - 1;
GListeInd::Iterator itg;
GListe::Iterator itg;
itg = gl.begin();
GListeInd::Iterator itg2;
GListe::Iterator itg2;
itg2 = gl.begin();
uint Fcc = gl.count() / 224;
if ((gl.count() % 224) != 0)
925,7 → 925,7
PutDoc("[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ");
for (int ww = 31; ww < 256; ++ww)
{
PutDoc(QString::number(static_cast<int>(AllFonts[it.key()]->charWidth(itg.key())* 1000))+" ");
PutDoc(QString::number(static_cast<int>(AllFonts[it.key()].charWidth(itg.key())* 1000))+" ");
if (itg == gl.end())
break;
++itg;
941,7 → 941,7
int crc = 0;
for (int ww2 = 32; ww2 < 256; ++ww2)
{
PutDoc(itg2.data().Name+" ");
PutDoc(itg2.data().second+" ");
if (itg2 == gl.end())
break;
++itg2;
957,9 → 957,9
PutDoc(">>\nendobj\n");
StartObj(ObjCounter);
PutDoc("<<\n/Type /Font\n/Subtype ");
PutDoc((fformat == Foi::SFNT || fformat == Foi::TTCF) ? "/TrueType\n" : "/Type1\n");
PutDoc((fformat == ScFace::SFNT || fformat == ScFace::TTCF) ? "/TrueType\n" : "/Type1\n");
PutDoc("/Name /Fo"+QString::number(a)+"S"+QString::number(Fc)+"\n");
PutDoc("/BaseFont /"+AllFonts[it.key()]->RealName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+"\n");
PutDoc("/BaseFont /"+AllFonts[it.key()].psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+"\n");
PutDoc("/FirstChar 0\n");
PutDoc("/LastChar "+QString::number(chCount-1)+"\n");
PutDoc("/Widths "+QString::number(ObjCounter-2)+" 0 R\n");
3004,7 → 3004,7
static_cast<CharStyle&>(hl2) = static_cast<const CharStyle&>(*hl);
// hl2.cselect = hl->cselect;
 
double wt = Cwidth(&doc, chstyle.font(), QString(tTabValues[tabCc].tabFillChar), chstyle.fontSize());
double wt = chstyle.font().charWidth(tTabValues[tabCc].tabFillChar, chstyle.fontSize());
int coun = static_cast<int>((hl->glyph.xoffset - tabDist) / wt);
double sPos = hl->glyph.xoffset - (hl->glyph.xoffset - tabDist) + 1;
hl2.ch = QString(tTabValues[tabCc].tabFillChar);
3054,7 → 3054,7
setTextCh(ite, PNr, d, tmp, tmp2, &hl2, pstyle, pag);
}
setTextCh(ite, PNr, d, tmp, tmp2, hl, pstyle, pag);
tabDist = hl->glyph.xoffset + Cwidth(&doc, chstyle.font(), ch, chstyle.fontSize()) * (chstyle.scaleH() / 1000.0);
tabDist = hl->glyph.xoffset + chstyle.font().charWidth(ch[0], chstyle.fontSize()) * (chstyle.scaleH() / 1000.0);
}
#endif
if (ite->itemType() == PageItem::TextFrame)
3082,15 → 3082,15
if (hl->effects() & ScStyle_DropCap)
{
if (pstyle.useBaselineGrid())
tsz = qRound(10 * ((doc.typographicSettings.valueBaseGrid * (pstyle.dropCapLines()-1)+(hl->font()->ascent() * (pstyle.charStyle().fontSize() / 10.0))) / (RealCHeight(&doc, hl->font(), chstr, 10))));
tsz = qRound(10 * ((doc.typographicSettings.valueBaseGrid * (pstyle.dropCapLines()-1)+(hl->font().ascent(pstyle.charStyle().fontSize() / 10.0))) / (hl->font().realCharHeight(chstr[0], 10))));
else
{
if (pstyle.lineSpacingMode() == ParagraphStyle::FixedLineSpacing)
tsz = qRound(10 * ((pstyle.lineSpacing() * (pstyle.dropCapLines()-1)+(hl->font()->ascent() * (pstyle.charStyle().fontSize() / 10.0))) / (RealCHeight(&doc, hl->font(), chstr, 10))));
tsz = qRound(10 * ((pstyle.lineSpacing() * (pstyle.dropCapLines()-1)+(hl->font().ascent(pstyle.charStyle().fontSize() / 10.0))) / (hl->font().realCharHeight(chstr[0], 10))));
else
{
double currasce = RealFHeight(&doc, hl->font(), pstyle.charStyle().fontSize());
tsz = qRound(10 * ((currasce * (pstyle.dropCapLines()-1)+(hl->font()->ascent() * (pstyle.charStyle().fontSize() / 10.0))) / RealCHeight(&doc, hl->font(), chstr, 10)));
double currasce = hl->font().height(pstyle.charStyle().fontSize());
tsz = qRound(10 * ((currasce * (pstyle.dropCapLines()-1)+(hl->font().ascent(pstyle.charStyle().fontSize() / 10.0))) / hl->font().realCharHeight(chstr[0], 10)));
}
}
}
3161,8 → 3161,8
}
uint cc = chstr[0].unicode();
uint idx = 0;
if (GlyphsIdxOfFont[hl->font()->scName()].contains(cc))
idx = GlyphsIdxOfFont[hl->font()->scName()][cc].Code;
if (GlyphsIdxOfFont[hl->font().scName()].contains(cc))
idx = GlyphsIdxOfFont[hl->font().scName()][cc].first;
uint idx1 = (idx >> 8) & 0xFF;
if (hl->effects() & ScStyle_AllCaps)
{
3191,10 → 3191,10
FillColor = "";
FillColor += putColor(hl->fillColor(), hl->fillShade(), true);
}
if ((hl->font()->isOTF()) || (!hl->font()->hasNames()) || (hl->font()->subset()) || (Options.SubsetList.contains(hl->font()->scName())))
if ((hl->font().isOTF()) || (!hl->font().hasNames()) || (hl->font().subset()) || (Options.SubsetList.contains(hl->font().scName())))
{
uint chr = chstr[0].unicode();
if ((hl->font()->canRender(chstr[0])) && (chr != 32))
if ((hl->font().canRender(chstr[0])) && (chr != 32))
{
if ((hl->strokeColor() != CommonStrings::None) && (hl->effects() & ScStyle_Outline))
{
3214,7 → 3214,7
{
if (ite->reversed())
{
double wid = Cwidth(&doc, hl->font(), chstr, hl->fontSize()) * (hl->scaleH() / 1000.0);
double wid = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->scaleH() / 1000.0);
tmp2 += "1 0 0 1 "+FToStr(hl->glyph.xoffset)+" "+FToStr((hl->glyph.yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (hl->baselineOffset() / 1000.0)))+" cm\n";
tmp2 += "-1 0 0 1 0 0 cm\n";
tmp2 += "1 0 0 1 "+FToStr(-wid)+" 0 cm\n";
3235,10 → 3235,11
tmp2 += "1 0 0 1 0 "+FToStr( (((tsz / 10.0) - (tsz / 10.0) * (hl->scaleV() / 1000.0)) / (tsz / 10.0)) * -1)+" cm\n";
tmp2 += FToStr(QMIN(QMAX(hl->scaleH(), 100), 4000) / 1000.0)+" 0 0 "+FToStr(QMIN(QMAX(hl->scaleV(), 100), 4000) / 1000.0)+" 0 0 cm\n";
if (hl->fillColor() != CommonStrings::None)
tmp2 += "/"+hl->font()->RealName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+QString::number(chr)+" Do\n";
tmp2 += "/"+hl->font().psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+QString::number(chr)+" Do\n";
if (hl->effects() & ScStyle_Outline)
{
FPointArray gly = hl->font()->outline(chr).copy();
uint gl = hl->font().char2CMap(chstr[0]);
FPointArray gly = hl->font().glyphOutline(gl);
QWMatrix mat;
mat.scale(0.1, 0.1);
gly.map(mat);
3273,11 → 3274,12
if (hl->effects() & ScStyle_SmartHyphenVisible)
{
int chs = hl->fontSize();
double wtr = Cwidth(&doc, hl->font(), chstr, chs) * (hl->scaleH() / 1000.0);
double wtr = hl->font().charWidth(chstr[0], chs) * (hl->scaleH() / 1000.0);
tmp2 += "1 0 0 1 "+FToStr(wtr / (tsz / 10.0))+" 0 cm\n";
chstr = "-";
chr = chstr[0].unicode();
FPointArray gly = hl->font()->outline(chr).copy();
uint gl = hl->font().char2CMap(chstr[0]);
FPointArray gly = hl->font().glyphOutline(gl);
QWMatrix mat;
mat.scale(0.1, 0.1);
gly.map(mat);
3316,10 → 3318,10
{
cc = chstr[0].unicode();
idx = 0;
if (GlyphsIdxOfFont[hl->font()->scName()].contains(cc))
idx = GlyphsIdxOfFont[hl->font()->scName()][cc].Code;
if (GlyphsIdxOfFont[hl->font().scName()].contains(cc))
idx = GlyphsIdxOfFont[hl->font().scName()][cc].first;
idx1 = (idx >> 8) & 0xFF;
tmp += UsedFontsP[hl->font()->scName()]+"S"+QString::number(idx1)+" "+FToStr(tsz / 10.0)+" Tf\n";
tmp += UsedFontsP[hl->font().scName()]+"S"+QString::number(idx1)+" "+FToStr(tsz / 10.0)+" Tf\n";
if (hl->strokeColor() != CommonStrings::None)
{
tmp += StrokeColor;
3349,10 → 3351,10
ctx = " ";
if (ctx == QChar(0xA0))
ctx = " ";
wtr = Cwidth(&doc, hl->font(), chstr, chs, ctx) * (hl->scaleH() / 1000.0);
wtr = hl->font().charWidth(chstr[0], chs, ctx[0]) * (hl->scaleH() / 1000.0);
}
else
wtr = Cwidth(&doc, hl->font(), chstr, chs) * (hl->scaleH() / 1000.0);
wtr = hl->font().charWidth(chstr[0], chs) * (hl->scaleH() / 1000.0);
tmp += FToStr(-QMIN(QMAX(hl->scaleH(), 100), 4000) / 1000.0)+" 0 0 "+FToStr(QMIN(QMAX(hl->scaleV(), 100), 4000) / 1000.0)+" "+FToStr(hl->glyph.xoffset+wtr)+" "+FToStr(-hl->glyph.yoffset+(hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0))+" Tm\n";
// tmp += "-1 0 0 1 "+FToStr(wtr)+" "+FToStr(0)+" Tm\n";
}
3368,15 → 3370,15
if (hl->effects() & ScStyle_SmartHyphenVisible)
{
int chs = hl->fontSize();
double wtr = Cwidth(&doc, hl->font(), chstr, chs) * (hl->scaleH() / 1000.0);
double wtr = hl->font().charWidth(chstr[0], chs) * (hl->scaleH() / 1000.0);
tmp += "1 0 0 1 "+FToStr(hl->glyph.xoffset+wtr)+" "+FToStr(-hl->glyph.yoffset)+" Tm\n";
chstr = "-";
cc = chstr[0].unicode();
idx = 0;
if (GlyphsIdxOfFont[hl->font()->scName()].contains(cc))
idx = GlyphsIdxOfFont[hl->font()->scName()][cc].Code;
if (GlyphsIdxOfFont[hl->font().scName()].contains(cc))
idx = GlyphsIdxOfFont[hl->font().scName()][cc].first;
idx1 = (idx >> 8) & 0xFF;
tmp += UsedFontsP[hl->font()->scName()]+"S"+QString::number(idx1)+" "+FToStr(tsz / 10.0)+" Tf\n";
tmp += UsedFontsP[hl->font().scName()]+"S"+QString::number(idx1)+" "+FToStr(tsz / 10.0)+" Tf\n";
idx2 = idx & 0xFF;
tmp += "<"+QString(toHex(idx2))+"> Tj\n";
}
3384,7 → 3386,7
}
if (((hl->effects() & ScStyle_Underline) && (chstr != SpecialChars::PARSEP)) || ((hl->effects() & ScStyle_UnderlineWords) && (!chstr[0].isSpace())))
{
double Ulen = Cwidth(&doc, hl->font(), chstr, hl->fontSize()) * (hl->scaleH() / 1000.0);
double Ulen = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->scaleH() / 1000.0);
double Upos, Uwid, kern;
if (hl->effects() & ScStyle_StartOfLine)
kern = 0;
3393,18 → 3395,18
if ((hl->underlineOffset() != -1) || (hl->underlineWidth() != -1))
{
if (hl->underlineOffset() != -1)
Upos = (hl->underlineOffset() / 1000.0) * (hl->font()->descent() * (hl->fontSize() / 10.0));
Upos = (hl->underlineOffset() / 1000.0) * (hl->font().descent(hl->fontSize() / 10.0));
else
Upos = hl->font()->underlinePos() * (hl->fontSize() / 10.0);
Upos = hl->font().underlinePos(hl->fontSize() / 10.0);
if (hl->underlineWidth() != -1)
Uwid = (hl->underlineWidth() / 1000.0) * (hl->fontSize() / 10.0);
else
Uwid = QMAX(hl->font()->strokeWidth() * (hl->fontSize() / 10.0), 1);
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
else
{
Upos = hl->font()->underlinePos() * (hl->fontSize() / 10.0);
Uwid = QMAX(hl->font()->strokeWidth() * (hl->fontSize() / 10.0), 1);
Upos = hl->font().underlinePos(hl->fontSize() / 10.0);
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
if (hl->baselineOffset() != 0)
Upos += (hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0);
3417,7 → 3419,7
}
if ((hl->effects() & ScStyle_Strikethrough) && (chstr != SpecialChars::PARSEP))
{
double Ulen = Cwidth(&doc, hl->font(), chstr, hl->fontSize()) * (hl->scaleH() / 1000.0);
double Ulen = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->scaleH() / 1000.0);
double Upos, Uwid, kern;
if (hl->effects() & ScStyle_StartOfLine)
kern = 0;
3426,18 → 3428,18
if ((hl->strikethruOffset() != -1) || (hl->strikethruWidth() != -1))
{
if (hl->strikethruOffset() != -1)
Upos = (hl->strikethruOffset() / 1000.0) * (hl->font()->ascent() * (hl->fontSize() / 10.0));
Upos = (hl->strikethruOffset() / 1000.0) * (hl->font().ascent(hl->fontSize() / 10.0));
else
Upos = hl->font()->strikeoutPos() * (hl->fontSize() / 10.0);
Upos = hl->font().strikeoutPos(hl->fontSize() / 10.0);
if (hl->strikethruWidth() != -1)
Uwid = (hl->strikethruWidth() / 1000.0) * (hl->fontSize() / 10.0);
else
Uwid = QMAX(hl->font()->strokeWidth() * (hl->fontSize() / 10.0), 1);
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
else
{
Upos = hl->font()->strikeoutPos() * (hl->fontSize() / 10.0);
Uwid = QMAX(hl->font()->strokeWidth() * (hl->fontSize() / 10.0), 1);
Upos = hl->font().strikeoutPos(hl->fontSize() / 10.0);
Uwid = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
if (hl->baselineOffset() != 0)
Upos += (hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0);
4199,7 → 4201,7
if (Options.Version < 14)
cnx += ind2PDFabr[ite->annotation().Font()];
else
cnx += UsedFontsP[ite->itemText.defaultStyle().charStyle().font()->scName()]+"S0";
cnx += UsedFontsP[ite->itemText.defaultStyle().charStyle().font().scName()]+"S0";
cnx += " "+FToStr(ite->itemText.defaultStyle().charStyle().fontSize() / 10.0)+" Tf";
if (ite->itemText.defaultStyle().charStyle().fillColor() != CommonStrings::None)
cnx += " "+ putColor(ite->itemText.defaultStyle().charStyle().fillColor(), ite->itemText.defaultStyle().charStyle().fillShade(), true);
4483,7 → 4485,7
if (Options.Version < 14)
cc += "/"+StdFonts[ind2PDFabr2[ite->annotation().Font()]];
else
cc += UsedFontsP[ite->itemText.defaultStyle().charStyle().font()->scName()]+"S0";
cc += UsedFontsP[ite->itemText.defaultStyle().charStyle().font().scName()]+"S0";
cc += " "+FToStr(ite->itemText.defaultStyle().charStyle().fontSize() / 10.0)+" Tf\n";
if (bmst.count() > 1)
{
4526,7 → 4528,7
if (Options.Version < 14)
cc += "/"+StdFonts[ind2PDFabr2[ite->annotation().Font()]];
else
cc += UsedFontsP[ite->itemText.defaultStyle().charStyle().font()->scName()]+"S0";
cc += UsedFontsP[ite->itemText.defaultStyle().charStyle().font().scName()]+"S0";
// cc += "/"+StdFonts[ind2PDFabr2[ite->annotation().Font()]];
// cc += ind2PDFabr[ite->AnFont];
cc += " "+FToStr(ite->itemText.defaultStyle().charStyle().fontSize() / 10.0)+" Tf\n";
/branches/Version13x/Scribus/scribus/charselect.cpp
83,7 → 83,7
 
QRect ChTable::cellGeometry ( int /*row*/, int /*col*/ ) const
{
int widthHeight = QMAX(18 + qRound(-(*m_Item->doc()->AllFonts)[par->fontInUse]->descent() * 18) + 5, 18);
int widthHeight = QMAX(18 + qRound(-(*m_Item->doc()->AllFonts)[par->fontInUse].descent() * 18) + 5, 18);
return QRect(0, 0, widthHeight, widthHeight+20);
 
}
110,13 → 110,13
fo.setPixelSize(9);
qp->setFont(fo);
static FPointArray gly;
int len = (*m_Item->doc()->AllFonts)[par->fontInUse]->outline(par->characters[cc]).size();
gly.resize(len);
gly.putPoints(0, len, (*m_Item->doc()->AllFonts)[par->fontInUse]->outline(par->characters[cc]) );
ScFace face = (*m_Item->doc()->AllFonts)[par->fontInUse];
uint gl = face.char2CMap(par->characters[cc]);
gly = face.glyphOutline(gl);
if (gly.size() > 4)
{
gly.map(chma);
double ww = sz.width() - (*m_Item->doc()->AllFonts)[par->fontInUse]->charWidth(par->characters[cc])*16;
double ww = sz.width() - face.glyphWidth(gl)*16;
p->translate(ww / 2, 1);
p->setBrush(black);
p->setFillMode(1);
164,7 → 164,7
if ((e->button() == RightButton) && ((r*16+c) < maxCount))
{
watchTimer->stop();
int bh = 48 + qRound(-(*m_Item->doc()->AllFonts)[font]->descent() * 48) + 3;
int bh = 48 + qRound(-(*m_Item->doc()->AllFonts)[font].descent() * 48) + 3;
QPixmap pixm(bh,bh);
ScPainter *p = new ScPainter(&pixm, bh, bh);
p->clear();
171,8 → 171,10
pixm.fill(white);
QWMatrix chma;
chma.scale(4.8, 4.8);
FPointArray gly = (*m_Item->doc()->AllFonts)[font]->outline(par->characters[r*16+c]).copy();
double ww = bh - (*m_Item->doc()->AllFonts)[font]->charWidth(par->characters[r*16+c])*48;
ScFace face = (*m_Item->doc()->AllFonts)[font];
uint gl = face.char2CMap(par->characters[r*16+c]);
FPointArray gly = face.glyphOutline(gl);
double ww = bh - face.glyphWidth(gl, 48);
if (gly.size() > 4)
{
gly.map(chma);
244,7 → 246,7
 
CharSelect::CharSelect( QWidget* parent, PageItem *item) : QDialog( parent, "CharSelect", true, 0 )
{
fontInUse = item->doc()->currentStyle.charStyle().font()->scName();
fontInUse = item->doc()->currentStyle.charStyle().font().scName();
needReturn = false;
installEventFilter(this);
run(parent, item);
372,10 → 374,9
 
void CharSelect::scanFont()
{
FT_Face face;
FT_ULong charcode;
FT_UInt gindex;
gindex = 0;
QString gname;
allClasses.clear();
charactersFull.clear();
charactersLatin1.clear();
405,14 → 406,14
charactersArabicPresentationFormsA.clear();
charactersArabicPresentationFormsB.clear();
charactersHebrew.clear();
face = (*m_Item->doc()->AllFonts)[fontInUse]->ftFace();
if (!face) {
return;
}
setBestEncoding(face);
charcode = FT_Get_First_Char(face, &gindex );
while (gindex != 0)
QMap<QChar, std::pair<uint, QString> > glyphs;
(*m_Item->doc()->AllFonts)[fontInUse].glyphNames(glyphs);
for (QMap<QChar, std::pair<uint, QString> >::iterator it=glyphs.begin();
it != glyphs.end(); ++it)
{
charcode = it.key().unicode();
gindex = it.data().first;
gname = it.data().second;
charactersFull.append(charcode);
if ((charcode >= 0x0020 ) && (charcode <= 0x007F))
charactersLatin1.append(charcode);
468,7 → 469,6
charactersArabicPresentationFormsB.append(charcode);
else if ((charcode >= 0xFFF0 ) && (charcode <= 0xFFFF))
charactersSpecial.append(charcode);
charcode = FT_Get_Next_Char(face, charcode, &gindex );
}
allClasses.append(charactersFull);
allClasses.append(charactersLatin1);
676,17 → 676,10
 
void CharSelect::generatePreview(int charClass)
{
FT_Face face;
zTabelle->maxCount = 0;
characters.clear();
zTabelle->setNumRows( 0 );
characters = allClasses[charClass];
face = (*m_Item->doc()->AllFonts)[fontInUse]->ftFace();
if (!face) {
maxCount = 0;
return;
}
setBestEncoding(face);
maxCount = characters.count();
zTabelle->maxCount = maxCount;
int ab = maxCount / 16;
708,17 → 701,16
zTabelle->maxCount = 0;
QString oldFont = fontInUse;
fontInUse = fontSelector->text(font);
(*m_Item->doc()->AllFonts)[fontInUse]->increaseUsage();
if ((*m_Item->doc()->AllFonts)[oldFont])
(*m_Item->doc()->AllFonts)[oldFont]->decreaseUsage();
(*m_Item->doc()->AllFonts)[fontInUse].increaseUsage();
(*m_Item->doc()->AllFonts)[oldFont].decreaseUsage();
delEdit();
setCaption( tr( "Select Character:" )+" "+fontInUse );
ScCore->primaryMainWindow()->SetNewFont(fontInUse);
if (m_Item->doc()->currentStyle.charStyle().font()->scName() != fontInUse)
if (m_Item->doc()->currentStyle.charStyle().font().scName() != fontInUse)
{
disconnect(fontSelector, SIGNAL(activated(int)), this, SLOT(newFont(int)));
fontSelector->RebuildList(m_Item->doc());
fontInUse = m_Item->doc()->currentStyle.charStyle().font()->scName();
fontInUse = m_Item->doc()->currentStyle.charStyle().font().scName();
setCaption( tr( "Select Character:" )+" "+fontInUse );
fontSelector->setCurrentText(fontInUse);
connect(fontSelector, SIGNAL(activated(int)), this, SLOT(newFont(int)));
/branches/Version13x/Scribus/scribus/gtaction.h
34,7 → 34,7
#include <qstring.h>
class PageItem;
class PrefsManager;
class Foi;
class ScFace;
#include "scribusapi.h"
#include "gtfont.h"
#include "gtframestyle.h"
67,7 → 67,7
int findParagraphStyle(const QString& name);
int findParagraphStyle(gtParagraphStyle* pstyle);
int applyParagraphStyle(gtParagraphStyle* pstyle);
Foi* validateFont(gtFont* font);
ScFace validateFont(gtFont* font);
QString findFontName(gtFont* font);
void updateParagraphStyle(int pstyleIndex, gtParagraphStyle* pstyle);
QString parseColor(const QString &s);
/branches/Version13x/Scribus/scribus/loadsaveplugin.cpp
202,7 → 202,7
m_AvailableFonts=targetAvailableFonts;
}
 
void LoadSavePlugin::getReplacedFontData(bool & /*getNewReplacement*/, QMap<QString,QString> &/*getReplacedFonts*/, QPtrList<Foi> &/*getDummyFois*/)
void LoadSavePlugin::getReplacedFontData(bool & /*getNewReplacement*/, QMap<QString,QString> &/*getReplacedFonts*/, QValueList<ScFace> &/*getDummyScFaces*/)
{
}
 
211,7 → 211,7
return false;
}
 
bool LoadSavePlugin::readStyles(const QString& /*fileName*/, ScribusDoc* /*doc*/, QValueList<ParagraphStyle> &/*docParagraphStyles*/)
bool LoadSavePlugin::readStyles(const QString& /*fileName*/, ScribusDoc* /*doc*/, StyleSet<ParagraphStyle> &/*docParagraphStyles*/)
{
return false;
}
247,10 → 247,10
plug->setupTargets(targetDoc, targetView, targetMW, targetMWPRogressBar, targetAvailableFonts);
}
 
void FileFormat::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois) const
void FileFormat::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces) const
{
if (plug)
plug->getReplacedFontData(getNewReplacement, getReplacedFonts, getDummyFois);
plug->getReplacedFontData(getNewReplacement, getReplacedFonts, getDummyScFaces);
}
 
bool FileFormat::loadPage(const QString & fileName, int pageNumber, bool Mpage, QString renamedPageName) const
258,7 → 258,7
return (plug && load) ? plug->loadPage(fileName, pageNumber, Mpage, renamedPageName) : false;
}
 
bool FileFormat::readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles) const
bool FileFormat::readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles) const
{
return (plug && load) ? plug->readStyles(fileName, doc, docParagraphStyles) : false;
}
/branches/Version13x/Scribus/scribus/editformats.cpp
205,7 → 205,9
connect(DeleteB, SIGNAL(clicked()), this, SLOT(deleteFormat()));
connect(ListBox1, SIGNAL(highlighted(QListBoxItem*)), this, SLOT(selFormat(QListBoxItem*)));
connect(ListBox1, SIGNAL(selected(QListBoxItem*)), this, SLOT(selEditFormat(QListBoxItem*)));
TempVorl = doc->docParagraphStyles;
TempVorl.clear();
for (uint i = 0; i < doc->docParagraphStyles.count(); ++i)
TempVorl.append(doc->docParagraphStyles[i]); // copy
UpdateFList();
}
 
/branches/Version13x/Scribus/scribus/pageitem_pathtext.h
43,7 → 43,6
class ScribusDoc;
class UndoManager;
class UndoState;
class Foi;
struct CopyPasteBuffer;
 
class SCRIBUS_API PageItem_PathText : public PageItem
/branches/Version13x/Scribus/scribus/scribusXml.h
25,6 → 25,7
#include "scfonts.h"
#include "scribusstructs.h"
#include "selection.h"
#include "styles/styleset.h"
 
class PrefsManager;
class ScribusView;
51,13 → 52,13
bool ReadElemHeader(QString file, bool isFile, double *x, double *y, double *w, double *h);
bool ReadElem(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, ScribusView *view);
ColorList Farben;
QValueList<ParagraphStyle> docParagraphStyles;
StyleSet<ParagraphStyle> docParagraphStyles;
QValueList<Linked> LFrames;
QStringList MNames;
QMap<QString,QString> DoFonts;
QMap<QString,QString> ReplacedFonts;
QMap<uint,QString> DoVorl;
QPtrList<Foi> dummyFois;
QValueList<ScFace> dummyScFaces;
uint VorlC;
bool newReplacement;
64,7 → 65,7
protected:
PrefsManager* prefsManager;
void GetStyle(QDomElement *pg, ParagraphStyle *vg, QValueList<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl);
void GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl);
QString AskForFont(SCFonts &avail, QString fStr, ScribusDoc *doc);
};
 
/branches/Version13x/Scribus/scribus/sampleitem.cpp
301,7 → 301,7
// after sample creating
bool previouslyUsedFont = false;
 
if (tmpStyle.charStyle().font() == &Foi::NONE)
if (tmpStyle.charStyle().font().isNone())
return QPixmap();
 
UndoManager::instance()->setUndoEnabled(false); // disable undo
319,11 → 319,11
m_Doc->view()->setScale(1.0);
}
 
if (m_Doc->UsedFonts.contains(tmpStyle.charStyle().font()->scName()))
if (m_Doc->UsedFonts.contains(tmpStyle.charStyle().font().scName()))
previouslyUsedFont = true;
 
m_Doc->AddFont(tmpStyle.charStyle().font()->scName(), qRound(m_Doc->toolSettings.defSize / 10.0));
m_Doc->docParagraphStyles.append(tmpStyle);
m_Doc->AddFont(tmpStyle.charStyle().font().scName(), qRound(m_Doc->toolSettings.defSize / 10.0));
m_Doc->docParagraphStyles.create(tmpStyle);
int tmpIndex = m_Doc->docParagraphStyles.count() - 1;
 
previewItem->FrameType = PageItem::TextFrame;
345,11 → 345,11
 
// cleanups and resets
if (!previouslyUsedFont)
m_Doc->UsedFonts.remove(tmpStyle.charStyle().font()->scName());
m_Doc->UsedFonts.remove(tmpStyle.charStyle().font().scName());
if (m_Doc->view() != NULL)
m_Doc->view()->setScale(sca);
m_Doc->appMode = userAppMode;
m_Doc->docParagraphStyles.remove(m_Doc->docParagraphStyles.fromLast());
m_Doc->docParagraphStyles.remove(tmpIndex);
UndoManager::instance()->setUndoEnabled(true);
return pm;
}
/branches/Version13x/Scribus/scribus/fileloader.h
14,6 → 14,7
 
#include "scribusapi.h"
#include "scribusstructs.h"
#include "styles/styleset.h"
 
class QDomElement;
class QProgressBar;
34,7 → 35,7
bool LoadPage(ScribusDoc* currDoc, int PageToLoad, bool Mpage, QString renamedPageName=QString::null);
bool LoadFile(ScribusDoc* currDoc);
bool SaveFile(const QString& fileName, ScribusDoc *doc, QProgressBar *dia2);
bool ReadStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles);
bool ReadStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles);
bool ReadPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames);
bool ReadColors(const QString& fileName, ColorList & colors);
bool ReadLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty);
54,7 → 55,7
QMap<QString,QString> ReplacedFonts;
QMap<uint,QString> DoVorl;
uint VorlC;
QPtrList<Foi> dummyFois;
QValueList<ScFace> dummyScFaces;
 
static const QString getLoadFilterString();
private:
/branches/Version13x/Scribus/scribus/scfonts.cpp
30,8 → 30,10
 
#include <cstdlib>
#include "scfonts.h"
#include "scfonts_ttf.h"
#include "scfontmetrics.h"
#include "fonts/ftface.h"
#include "fonts/scface_ps.h"
#include "fonts/scface_ttf.h"
#include "fonts/scfontmetrics.h"
 
#include "prefsmanager.h"
#include "prefsfile.h"
48,464 → 50,20
#include <fontconfig/fontconfig.h>
#endif
 
#include "scpaths.h"
#include "util.h"
 
#include FT_TRUETYPE_TAGS_H
#include FT_TRUETYPE_TABLES_H
 
// static:
FT_Library Foi::library = NULL;
 
const Foi Foi::NONE;
#include "scpaths.h"
#include "util.h"
 
/*****
ScFace lifecycle: unchecked -> loaded -> glyphs checked
| \-> broken glyphs
\-> broken
usable() == ! broken
embeddable() == glyphs_checked
canRender(unicode) -> CharMap cache? -> loadChar/Glyph -> !broken
Glyphs: width status
-1000 unkown
-2000 broken
>= 0 ok, outline valid
CharMap: unicode -> glyph index
uint[256][256]
unicode ignores: < 32, ...
unicode emulate: spaces, hyphen, ligatures?, diacritics?
*****/
 
Foi::Foi(QString fam, QString sty, QString alt, QString psname, QString path,
int face, bool embedps) : face(NULL)
{
isOTF_ = false;
Subset = false;
typeCode = Foi::UNKNOWN_TYPE;
formatCode = Foi::UNKNOWN_FORMAT;
SCName = alt;
Family = fam;
Effect = sty;
cached_RealName = psname;
fontFile = path;
faceIndex_ = face;
EmbedPS = embedps;
Alternative = "";
if (!library) {
if (FT_Init_FreeType( &library ))
qDebug(QObject::tr("Freetype2 library not available"));
}
}
 
Foi::Foi() : face(NULL)
{
isOTF_ = false;
Subset = false;
typeCode = Foi::UNKNOWN_TYPE;
formatCode = Foi::UNKNOWN_FORMAT;
SCName = "";
Family = "";
Effect = "";
cached_RealName = "";
fontFile = "(None)";
faceIndex_ = -1;
EmbedPS = false;
Alternative = "";
UseFont = false;
}
 
Foi::~Foi() {
unload();
}
 
FT_Face Foi::ftFace() const {
if (!face) {
if (FT_New_Face( library, fontFile, faceIndex_, &face )) {
const_cast<Foi*>(this)->UseFont = false;
qDebug(QObject::tr("Font %1(%2) is broken").arg(fontFile).arg(faceIndex_));
}
}
return face;
}
 
void Foi::increaseUsage() const
{
Foi* that = const_cast<Foi*>(this); //FIXME: use mutable instead
++that->usage_;
}
 
void Foi::decreaseUsage() const
{
Foi* that = const_cast<Foi*>(this); //FIXME: use mutable instead
if (usage_ == 1)
unload();
--that->usage_;
}
 
void Foi::unload() const
{
Foi* that = const_cast<Foi*>(this); //FIXME: use mutable instead
if (that->face) {
FT_Done_Face( that->face );
that->face = NULL;
}
// clear caches
that->CharWidth.clear();
that->GlyphArray.clear();
that->HasMetrics = false;
}
 
double Foi::charWidth(QChar ch) const
{
return CharWidth[ch.unicode()];
}
 
bool Foi::canRender(QChar ch) const
{
return typeCode != Foi::UNKNOWN_TYPE && CharWidth.contains(ch.unicode());
}
 
FPointArray Foi::outline(QChar ch) const
{
return GlyphArray[ch.unicode()].Outlines.copy();
}
 
FPoint Foi::origin(QChar ch) const
{
const struct GlyphR & res(GlyphArray[ch.unicode()]);
return FPoint(res.x, res.y);
}
 
/// copied from Freetype's FT_Stream_ReadAt()
FT_Error ftIOFunc( FT_Stream stream, unsigned long pos, unsigned char* buffer, unsigned long count)
{
FT_Error error = FT_Err_Ok;
FT_ULong read_bytes;
if ( pos >= stream->size )
{
qDebug( "ftIOFunc: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
pos, stream->size );
return FT_Err_Invalid_Stream_Operation;
}
if ( stream->read )
read_bytes = stream->read( stream, pos, buffer, count );
else
{
read_bytes = stream->size - pos;
if ( read_bytes > count )
read_bytes = count;
memcpy( buffer, stream->base + pos, read_bytes );
}
stream->pos = pos + read_bytes;
if ( read_bytes < count )
{
qDebug( "ftIOFunc: invalid read; expected %lu bytes, got %lu\n",
count, read_bytes );
error = FT_Err_Invalid_Stream_Operation;
}
return error;
}
 
 
 
QString Foi::RealName()
{
return cached_RealName;
}
 
bool Foi::EmbedFont(QString &str)
{
str+="Base";
return(false);
}
 
bool Foi::ReadMetrics()
{
HasMetrics=false;
for(int i=0;i<256;++i)
CharWidth[i]=0;
return(false);
}
 
bool Foi::GlNames(QMap<uint, QString> *GList)
{
return GlyNames(this, GList);
}
 
void Foi::RawData(QByteArray & bb)
{
FT_Stream fts = ftFace()->stream;
bb.resize(fts->size);
bool error = ftIOFunc(fts, 0L, reinterpret_cast<FT_Byte *>(bb.data()), fts->size);
if (error)
{
sDebug(QObject::tr("Font %1 is broken (read stream), no embedding").arg(fontFile));
bb.resize(0);
}
/*
if (showFontInformation)
{
QFile f(fontFile);
qDebug(QObject::tr("RawData for Font %1(%2): size=%3 filesize=%4").arg(fontFile).arg(faceIndex_).arg(bb.size()).arg(f.size()));
}
*/
}
 
 
 
/*
Class Foi_postscript
Subclass of Foi, for PostScript fonts that could possibly have a .afm file
associated with them for metrics information.
*/
 
class Foi_postscript : public Foi
{
public:
Foi_postscript(QString fam, QString sty, QString alt, QString psname, QString path, int face, bool embedps) :
Foi(fam,sty,alt,psname,path,face,embedps), metricsread(false)
{
HasMetrics=false;
HasKern = false;
Ascent = "0";
CapHeight = "0";
Descender = "0";
ItalicAngle = "0";
StdVW = "1";
FontBBox = "0 0 0 0";
IsFixedPitch = false;
typeCode = TYPE1;
HasMetrics=true;
}
 
virtual QString RealName()
{
return(Foi::RealName());
}
 
virtual bool ReadMetrics() // routine by Franz Schmid - modified by Alastair M. Robinson
{
if(metricsread)
return(HasMetrics);
CharWidth.clear();
GlyphArray.clear();
QString tmp, tmp2, tmp3, tmp4;
double x, y;
FPointArray outlines;
struct GlyphR GRec;
bool error;
FT_ULong charcode;
FT_UInt gindex;
isStroked_ = false;
FT_Face face = ftFace();
if (!face)
return false;
 
uniEM = static_cast<double>(face->units_per_EM);
QString afnm = fontFilePath().left(fontFilePath().length()-3);
QFile afm(afnm+"afm");
if(!(afm.exists()))
{
afm.setName(afnm+"Afm");
if(!(afm.exists()))
afm.setName(afnm+"AFM");
}
if (afm.exists())
error = FT_Attach_File(face, afm.name());
HasKern = FT_HAS_KERNING(face);
Ascent = tmp.setNum(face->ascender);
Descender = tmp.setNum(face->descender);
numDescender = face->descender / uniEM;
numAscent = face->ascender / uniEM;
underline_pos = face->underline_position / uniEM;
strikeout_pos = numAscent / 3;
strokeWidth_ = face->underline_thickness / uniEM;
CapHeight = Ascent;
ItalicAngle = "0";
StdVW = "1";
FontBBox = tmp.setNum(face->bbox.xMin)+" "+tmp2.setNum(face->bbox.yMin)+" "+tmp3.setNum(face->bbox.xMax)+" "+tmp4.setNum(face->bbox.yMax);
IsFixedPitch = face->face_flags & 4;
setBestEncoding(face);
gindex = 0;
charcode = FT_Get_First_Char( face, &gindex );
int goodGlyph = 0;
int invalidGlyph = 0;
while ( gindex != 0 )
{
error = FT_Load_Glyph( face, gindex, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
if (error)
{
++invalidGlyph;
sDebug(QObject::tr("Font %1 has broken glyph %2 (charcode %3)").arg(fontPath()).arg(gindex).arg(charcode));
charcode = FT_Get_Next_Char( face, charcode, &gindex );
continue;
}
++goodGlyph;
double ww = face->glyph->metrics.horiAdvance / uniEM;
if (face->glyph->format == FT_GLYPH_FORMAT_PLOTTER)
isStroked_ = true;
error = false;
outlines = traceChar(face, charcode, 10, &x, &y, &error);
if (!error)
{
CharWidth.insert(charcode, ww);
GRec.Outlines = outlines.copy();
GRec.x = x;
GRec.y = y;
GlyphArray.insert(charcode, GRec);
}
charcode = FT_Get_Next_Char( face, charcode, &gindex );
}
if (invalidGlyph > 0) {
UseFont = false;
sDebug(QObject::tr("Font %1 is broken and will be discarded").arg(fontPath()));
}
CharWidth[13] = 0;
CharWidth[28] = 0;
CharWidth[9] = 1;
HasMetrics=UseFont;
metricsread=UseFont;
return(HasMetrics);
}
private:
bool metricsread;
};
 
/*
Class Foi_pfb
Subclass of Foi, specifically for Adobe type 1 .pfb fonts.
Implements: RealName() and EmbedFont().
*/
 
class Foi_pfb : public Foi_postscript
{
public:
Foi_pfb(QString fam, QString sty, QString alt, QString psname, QString path, int face, bool embedps) :
Foi_postscript(fam,sty,alt,psname,path,face,embedps)
{
formatCode = PFB;
}
 
virtual bool EmbedFont(QString &str)
{
QByteArray bb;
RawData(bb);
QString tmp2 = "";
if ((bb.size() > 2) && (bb[0] == char(0x80)) && (static_cast<int>(bb[1]) == 1))
{
QString tmp3="";
QString tmp4 = "";
uint posi,cxxc=0;
for (posi = 6; posi < bb.size(); ++posi)
{
if ((bb[posi] == char(0x80)) && (posi+1 < bb.size()) && (static_cast<int>(bb[posi+1]) == 2))
break;
str += bb[posi];
}
uint ulen;
if (posi+6 < bb.size())
{
ulen = bb[posi+2] & 0xff;
ulen |= (bb[posi+3] << 8) & 0xff00;
ulen |= (bb[posi+4] << 16) & 0xff0000;
ulen |= (bb[posi+5] << 24) & 0xff000000;
posi += 6;
if (posi + ulen > bb.size())
ulen = bb.size() - posi - 1;
char linebuf[80];
cxxc=0;
for (uint j = 0; j < ulen; ++j)
{
unsigned char u=bb[posi];
linebuf[cxxc]=((u >> 4) & 15) + '0';
if(u>0x9f) linebuf[cxxc]+='a'-':';
++cxxc;
u&=15; linebuf[cxxc]=u + '0';
if(u>0x9) linebuf[cxxc]+='a'-':';
++posi;
++cxxc;
if (cxxc > 72)
{
linebuf[cxxc++]='\n';
linebuf[cxxc++]=0;
str += linebuf;
cxxc = 0;
}
}
linebuf[cxxc]=0;
str += linebuf;
str += "\n";
}
posi += 6;
for (uint j = posi; j < bb.size(); ++j)
{
if ((bb[j] == static_cast<char>(0x80)) && (j+1 < bb.size()) && (static_cast<int>(bb[j+1]) == 3))
break;
if(bb[j]=='\r')
str+="\n";
else
str += bb[j];
}
str += "\n";
cxxc = 0;
return true;
}
else
{
sDebug(QObject::tr("Font %1 cannot be read, no embedding").arg(fontPath()));
return false;
}
}
};
 
/*
Class Foi_pfa
Subclass of Foi, specifically for Adobe type 1 and type 3 .pfa fonts.
Implements: RealName() and EmbedFont().
*/
 
class Foi_pfa : public Foi_postscript
{
public:
Foi_pfa(QString fam, QString sty, QString alt, QString psname, QString path, int face, bool embedps) :
Foi_postscript(fam,sty,alt,psname,path,face,embedps)
{
formatCode = PFA;
}
virtual bool EmbedFont(QString &str)
{
QByteArray bb;
RawData(bb);
if (bb.size() > 2 && bb[0] == '%' && bb[1] == '!')
{
// this is ok since bb will not contain '\0'
str.append(bb);
return true;
}
return false;
}
};
 
 
 
/***************************************************************************/
 
SCFonts::SCFonts() : QDict<Foi>(), FontPath(true)
SCFonts::SCFonts() : QMap<QString,ScFace>(), FontPath(true)
{
insert("", new Foi());
setAutoDelete(true);
insert("", ScFace::none());
showFontInformation=false;
checkedFonts.clear();
}
518,23 → 76,22
{
fontMap.clear();
SCFontsIterator it( *this );
for ( ; it.current(); ++it)
for ( ; it.hasNext(); it.next())
{
if (it.current()->usable())
if (it.current().usable())
{
if (fontMap.contains(it.current()->family()))
if (fontMap.contains(it.current().family()))
{
QStringList effect;
if (!fontMap[it.current()->family()].contains(it.current()->style()))
if (!fontMap[it.current().family()].contains(it.current().style()))
{
fontMap[it.current()->family()].append(it.current()->style());
fontMap[it.current().family()].append(it.current().style());
}
}
else
{
QStringList effect;
effect.append(it.current()->style());
fontMap.insert(it.current()->family(), effect);
QStringList styles;
styles.append(it.current().style());
fontMap.insert(it.current().family(), styles);
}
}
}
607,7 → 164,7
{
error = AddScalableFont(pathfile, library, DocName);
}
#ifdef FT_MACINTOSH
#ifdef Q_OS_MAC
else if (ext.isEmpty() && DocName.isEmpty())
{
error = AddScalableFont(pathfile, library, DocName);
638,7 → 195,7
/**
* tests magic words to determine the fontformat and preliminary fonttype
*/
void getFontFormat(FT_Face face, Foi::FontFormat & fmt, Foi::FontType & type)
void getFontFormat(FT_Face face, ScFace::FontFormat & fmt, ScFace::FontType & type)
{
static const char* T42_HEAD = "%!PS-TrueTypeFont";
static const char* T1_HEAD = "%!FontType1";
651,20 → 208,20
const FT_Stream fts = face->stream;
char buf[128];
fmt = Foi::UNKNOWN_FORMAT;
type = Foi::UNKNOWN_TYPE;
fmt = ScFace::UNKNOWN_FORMAT;
type = ScFace::UNKNOWN_TYPE;
if (ftIOFunc(fts, 0L, reinterpret_cast<FT_Byte *>(buf), 128) == FONT_NO_ERROR)
{
if(strncmp(buf,T42_HEAD,strlen(T42_HEAD)) == 0)
{
fmt = Foi::TYPE42;
type = Foi::TTF;
fmt = ScFace::TYPE42;
type = ScFace::TTF;
}
else if(strncmp(buf,T1_HEAD,strlen(T1_HEAD)) == 0 ||
strncmp(buf,T1_ADOBE_HEAD,strlen(T1_ADOBE_HEAD)) == 0)
{
fmt = Foi::PFA;
type = Foi::TYPE1;
fmt = ScFace::PFA;
type = ScFace::TYPE1;
}
else if(strncmp(buf,PSFONT_ADOBE2_HEAD,strlen(PSFONT_ADOBE2_HEAD)) == 0 ||
strncmp(buf,PSFONT_ADOBE21_HEAD,strlen(PSFONT_ADOBE21_HEAD)) == 0 ||
671,34 → 228,34
strncmp(buf,PSFONT_ADOBE3_HEAD,strlen(PSFONT_ADOBE3_HEAD)) ==0)
{
// Type2(CFF), Type0(Composite/CID), Type 3, Type 14 etc would end here
fmt = Foi::PFA;
type = Foi::UNKNOWN_TYPE;
fmt = ScFace::PFA;
type = ScFace::UNKNOWN_TYPE;
}
else if(buf[0] == '\200' && buf[1] == '\1')
{
fmt = Foi::PFB;
type = Foi::TYPE1;
fmt = ScFace::PFB;
type = ScFace::TYPE1;
}
else if(buf[0] == '\0' && buf[1] == '\1'
&& buf[2] == '\0' && buf[3] == '\0')
{
fmt = Foi::SFNT;
type = Foi::TTF;
fmt = ScFace::SFNT;
type = ScFace::TTF;
}
else if(strncmp(buf,"true",4) == 0)
{
fmt = Foi::SFNT;
type = Foi::TTF;
fmt = ScFace::SFNT;
type = ScFace::TTF;
}
else if(strncmp(buf,"ttcf",4) == 0)
{
fmt = Foi::TTCF;
type = Foi::OTF;
fmt = ScFace::TTCF;
type = ScFace::OTF;
}
else if(strncmp(buf,"OTTO",4) == 0)
{
fmt = Foi::SFNT;
type = Foi::OTF;
fmt = ScFace::SFNT;
type = ScFace::OTF;
}
// missing: raw CFF
}
708,7 → 265,7
* Checks face, which must be sfnt based, for the subtype.
* Possible values: TTF, CFF, OTF
*/
void getSFontType(FT_Face face, Foi::FontType & type)
void getSFontType(FT_Face face, ScFace::FontType & type)
{
if (FT_IS_SFNT(face))
{
718,9 → 275,9
bool hasCFF = ! FT_Load_Sfnt_Table(face, TTAG_CFF, 0, NULL, &ret);
hasCFF &= ret > 0;
if (hasGlyph)
type = Foi::TTF;
type = ScFace::TTF;
else if (hasCFF)
type = Foi::OTF;
type = ScFace::OTF;
// TODO: CID or no
}
}
732,8 → 289,8
bool Subset = false;
char *buf[50];
QString glyName = "";
Foi::FontFormat format;
Foi::FontType type;
ScFace::FontFormat format;
ScFace::FontType type;
FT_Face face = NULL;
struct testCache foCache;
QFileInfo fic(filename);
745,7 → 302,7
firstRun = true;
ScCore->setSplashStatus( QObject::tr("Creating Font Cache") );
}
bool error = FT_New_Face( library, filename, 0, &face );
bool error = FT_New_Face( library, QFile::encodeName(filename), 0, &face );
if (error)
{
if (face != NULL)
756,7 → 313,7
return true;
}
getFontFormat(face, format, type);
if (format == Foi::UNKNOWN_FORMAT)
if (format == ScFace::UNKNOWN_FORMAT)
{
if (showFontInformation)
sDebug(QObject::tr("Failed to load font %1 - font type unknown").arg(filename));
873,10 → 430,11
qpsName = QString(psName);
else
qpsName = ts;
Foi *t = find(ts);
if (t)
ScFace t;
if (contains(ts))
{
if (t->RealName() != qpsName)
t = (*this)[ts];
if (t.psName() != qpsName)
{
alt = " ("+qpsName+")";
ts += alt;
883,53 → 441,50
sty += alt;
}
}
t = find(ts);
if (!t)
t = (*this)[ts];
if (t.isNone())
{
switch (format)
{
case Foi::PFA:
t = new Foi_pfa(fam, sty, ts, qpsName, filename, faceindex, true);
t->subset(Subset);
case ScFace::PFA:
t = ScFace(new ScFace_pfa(fam, sty, "", ts, qpsName, filename, faceindex));
t.subset(Subset);
break;
case Foi::PFB:
t = new Foi_pfb(fam, sty, ts, qpsName, filename, faceindex, true);
t->subset(Subset);
case ScFace::PFB:
t = ScFace(new ScFace_pfb(fam, sty, "", ts, qpsName, filename, faceindex));
t.subset(Subset);
break;
case Foi::SFNT:
t = new Foi_ttf(fam, sty, ts, qpsName, filename, faceindex, true);
getSFontType(face, t->typeCode);
if (t->typeCode == Foi::OTF)
case ScFace::SFNT:
t = ScFace(new ScFace_ttf(fam, sty, "", ts, qpsName, filename, faceindex));
getSFontType(face, t.m->typeCode);
if (t.type() == ScFace::OTF)
{
t->isOTF_ = true;
t->subset(true);
t.subset(true);
}
else
t->subset(Subset);
t.subset(Subset);
break;
case Foi::TTCF:
t = new Foi_ttf(fam, sty, ts, qpsName, filename, faceindex, true);
t->formatCode = Foi::TTCF;
t->typeCode = Foi::TTF;
//getSFontType(face, t->typeCode);
if (t->typeCode == Foi::OTF)
case ScFace::TTCF:
t = ScFace(new ScFace_ttf(fam, sty, "", ts, qpsName, filename, faceindex));
t.m->formatCode = ScFace::TTCF;
t.m->typeCode = ScFace::TTF;
//getSFontType(face, t.m->typeCode);
if (t.type() == ScFace::OTF)
{
t->isOTF_ = true;
t->subset(true);
t.subset(true);
}
else
t->subset(Subset);
t.subset(Subset);
break;
case Foi::TYPE42:
t = new Foi_ttf(fam, sty, ts, qpsName, filename, faceindex, true);
getSFontType(face, t->typeCode);
if (t->typeCode == Foi::OTF)
case ScFace::TYPE42:
t = ScFace(new ScFace_ttf(fam, sty, "", ts, qpsName, filename, faceindex));
getSFontType(face, t.m->typeCode);
if (t.type() == ScFace::OTF)
{
t->isOTF_ = true;
t->subset(true);
t.subset(true);
}
else
t->subset(Subset);
t.subset(Subset);
break;
default:
/* catching any types not handled above to silence compiler */
936,15 → 491,12
break;
}
insert(ts,t);
t->HasNames = HasNames;
t->embedPs(true);
t->useFont(true);
t->CharWidth[13] = 0;
t->CharWidth[28] = 0;
t->CharWidth[9] = 1;
t->PrivateFont = DocName;
t.m->hasNames = HasNames;
t.embedPs(true);
t.usable(true);
t.m->forDocument = DocName;
//setBestEncoding(face); //AV
switch (face->charmap? face->charmap->encoding : -1)
/* switch (face->charmap? face->charmap->encoding : -1)
{
case FT_ENCODING_ADOBE_STANDARD:
t->FontEnc = QString("StandardEncoding");
964,8 → 516,8
default:
t->FontEnc = QString();
}
if (showFontInformation)
sDebug(QObject::tr("Font %1 loaded from %2(%3)").arg(t->RealName()).arg(filename).arg(faceindex+1));
*/ if (showFontInformation)
sDebug(QObject::tr("Font %1 loaded from %2(%3)").arg(t.psName()).arg(filename).arg(faceindex+1));
 
/*
//debug
981,7 → 533,7
else
{
if (showFontInformation)
sDebug(QObject::tr("Font %1(%2) is duplicate of %3").arg(filename).arg(faceindex+1).arg(t->fontPath()));
sDebug(QObject::tr("Font %1(%2) is duplicate of %3").arg(filename).arg(faceindex+1).arg(t.fontPath()));
// this is needed since eg. AppleSymbols will happily return a face for *any* face_index
if (faceindex > 0) {
break;
990,7 → 542,7
FT_Done_Face(face);
face=NULL;
++faceindex;
error = FT_New_Face( library, filename, faceindex, &face );
error = FT_New_Face( library, QFile::encodeName(filename), faceindex, &face );
} //while
if (face != 0)
1047,8 → 599,7
FT_Done_FreeType( library );
}
 
#else
#if !defined(QT_MAC) && !defined(_WIN32)
#elif defined(QT_WS_X11)
 
void SCFonts::AddXFontPath()
{
1114,7 → 665,6
}
}
#endif
#endif
 
/* Add an extra path to our font search path,
* allowing a user to have extra fonts installed
/branches/Version13x/Scribus/scribus/story.cpp
200,7 → 200,7
void SEditor::imEndEvent(QIMEvent *e)
{
QString uc = e->text();
if ((!uc.isEmpty()) && ((*doc->AllFonts)[CurrFont]->canRender(uc[0])))
if ((!uc.isEmpty()) && ((*doc->AllFonts)[CurrFont].canRender(uc[0])))
{
insChars(e->text());
QTextEdit::imEndEvent(e);
445,7 → 445,7
case Key_End:
break;
default:
if ((!k->text().isEmpty()) && ((*doc->AllFonts)[CurrFont]->canRender(uc[0])))
if ((!k->text().isEmpty()) && ((*doc->AllFonts)[CurrFont].canRender(uc[0])))
{
insChars(k->text());
QTextEdit::keyPressEvent(k);
722,7 → 722,7
newStyle.setUnderlineWidth(CurrTextUnderWidth);
newStyle.setStrikethruOffset(CurrTextStrikePos);
newStyle.setStrikethruWidth(CurrTextStrikeWidth);
if (doc->docParagraphStyles[ParagStyles[p-1]].charStyle().font() != &Foi::NONE)
if (!doc->docParagraphStyles[ParagStyles[p-1]].charStyle().font().isNone())
{
newStyle.setFont(doc->docParagraphStyles[ParagStyles[p-1]].charStyle().font());
newStyle.setFontSize(doc->docParagraphStyles[ParagStyles[p-1]].charStyle().fontSize());
2692,7 → 2692,7
Editor->CurrTextStroke = curstyle.strokeColor();
Editor->CurrTextStrokeSh = curstyle.strokeShade();
Editor->prevFont = Editor->CurrFont;
Editor->CurrFont = curstyle.font()->scName();
Editor->CurrFont = curstyle.font().scName();
Editor->CurrFontSize = curstyle.fontSize();
Editor->CurrentStyle = curstyle.effects();
Editor->currentParaStyle = findParagraphStyle(currItem->doc(), currItem->itemText.defaultStyle());
2769,7 → 2769,7
if (Editor->currentParaStyle > 4)
{
Editor->prevFont = Editor->CurrFont;
Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font()->scName();
Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().scName();
Editor->CurrFontSize = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().fontSize();
Editor->CurrentStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().effects();
Editor->CurrTextFill = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().fillColor();
2805,7 → 2805,7
Editor->CurrTextStroke = hg->charStyle.strokeColor();
Editor->CurrTextStrokeSh = hg->charStyle.strokeShade();
Editor->prevFont = Editor->CurrFont;
Editor->CurrFont = hg->charStyle.font()->scName();
Editor->CurrFont = hg->charStyle.font().scName();
Editor->CurrFontSize = hg->charStyle.fontSize();
Editor->CurrentStyle = hg->charStyle.effects() & static_cast<StyleFlag>(1919);
Editor->CurrTextKern = hg->charStyle.tracking();
3286,7 → 3286,7
{
if (Editor->currentParaStyle > 4)
{
if (currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font() != &Foi::NONE)
if (!currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().isNone())
{
chars->at(s)->charStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle();
}
3308,10 → 3308,10
{
if (Editor->currentParaStyle > 4)
{
if (currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font() != &Foi::NONE)
if (!currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().isNone())
{
Editor->prevFont = Editor->CurrFont;
Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font()->scName();
Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().scName();
Editor->CurrFontSize = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().fontSize();
Editor->CurrentStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().effects();
Editor->CurrTextFill = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().fillColor();
3334,7 → 3334,7
Editor->CurrTextStroke = currItem->itemText.defaultStyle().charStyle().strokeColor();
Editor->CurrTextStrokeSh = currItem->itemText.defaultStyle().charStyle().strokeShade();
Editor->prevFont = Editor->CurrFont;
Editor->CurrFont = currItem->itemText.defaultStyle().charStyle().font()->scName();
Editor->CurrFont = currItem->itemText.defaultStyle().charStyle().font().scName();
Editor->CurrFontSize = currItem->itemText.defaultStyle().charStyle().fontSize();
Editor->CurrentStyle = currItem->itemText.defaultStyle().charStyle().effects();
Editor->CurrTextKern = currItem->itemText.defaultStyle().charStyle().tracking();
3403,7 → 3403,7
{
if (Editor->currentParaStyle > 4)
{
if (currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font() != &Foi::NONE)
if (!currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().isNone())
{
chars->at(s)->charStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle();
}
3428,10 → 3428,10
{
if (Editor->currentParaStyle > 4)
{
if (currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font() != &Foi::NONE)
if (!currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().isNone())
{
Editor->prevFont = Editor->CurrFont;
Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font()->scName();
Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().scName();
Editor->CurrFontSize = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().fontSize();
Editor->CurrentStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().effects();
Editor->CurrTextFill = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().fillColor();
3455,7 → 3455,7
Editor->CurrTextStroke = currStyle.strokeColor();
Editor->CurrTextStrokeSh = currStyle.strokeShade();
Editor->prevFont = Editor->CurrFont;
Editor->CurrFont = currStyle.font()->scName();
Editor->CurrFont = currStyle.font().scName();
Editor->CurrFontSize = currStyle.fontSize();
Editor->CurrentStyle = currStyle.effects();
Editor->CurrTextKern = currStyle.tracking();
/branches/Version13x/Scribus/scribus/pageitem.h
46,7 → 46,6
class ScribusDoc;
class UndoManager;
class UndoState;
class Foi;
 
class PageItem_ImageFrame;
class PageItem_Line;
179,33 → 178,6
public:
PageItem(ScribusDoc *pa, ItemType newType, double x, double y, double w, double h, double w2, QString fill, QString outline);
~PageItem() {};
struct ZZ {
double xco;
double yco;
double wide;
double kern;
int Siz;
int realSiz;
int Style;
int scale;
int scalev;
int shade;
int shade2;
int shadowX;
int shadowY;
int outline;
int base;
int underpos;
int underwidth;
int strikepos;
int strikewidth;
bool Sele;
QString Zeich;
QString Farb;
QString Farb2;
Foi* ZFo;
PageItem* embedded;
};
/**
* @brief Clear the contents of a frame.
* WARNING: Currently *they* do not check if the user wants this.
256,7 → 228,7
void DrawObj_PolyLine(ScPainter *p);
void DrawObj_PathText(ScPainter *p, double sc);
public:
void DrawObj_Embedded(ScPainter *p, QRect e, struct ZZ *hl);
void DrawObj_Embedded(ScPainter *p, QRect e, const CharStyle& style, PageItem* cembedded);
void SetFrameShape(int count, double *vals);
void SetRectFrame();
void SetOvalFrame();
305,9 → 277,9
/// returns the style at the current charpos
const CharStyle& currentCharStyle() const;
// deprecated:
double SetZeichAttr(const CharStyle& hl, int *chs, QString *chx);
double layoutGlyphs(const CharStyle& style, const QString chars, GlyphLayout& layout);
void SetFarbe(QColor *tmp, QString farbe, int shad);
void DrawZeichenS(ScPainter *p, struct ZZ *hl);
void drawGlyphs(ScPainter *p, const CharStyle& style, GlyphLayout& glyphs );
void DrawPolyL(QPainter *p, QPointArray pts);
QString ExpandToken(uint base);
/branches/Version13x/Scribus/scribus/scribusdoc.h
50,8 → 50,8
#include "pageitem_line.h"
#include "pageitem_textframe.h"
#include "pagestructs.h"
#include "styles/styleset.h"
 
 
#ifdef HAVE_CMS
#include CMS_INC
#endif
786,7 → 786,8
PageItem *DraggedElem;
PageItem *ElemToLink;
QValueList<uint> DragElements;
QValueList<ParagraphStyle> docParagraphStyles;
StyleSet<ParagraphStyle> docParagraphStyles;
StyleSet<CharStyle> docCharStyles;
QValueList<Layer> Layers;
bool marginColored;
int GroupCounter;
/branches/Version13x/Scribus/scribus/pdflib.h
58,15 → 58,8
bool doExport(const QString& fn, const QString& nam, int Components,
const std::vector<int> & pageNs, const QMap<int,QPixmap> & thumbs);
 
// used by ScFonts
struct GlNamInd
{
uint Code;
QString Name;
};
 
private:
typedef QMap<uint, GlNamInd> GListeInd;
typedef QMap<QChar, std::pair<uint, QString> > GListe;
 
bool PDF_Begin_Doc(const QString& fn, SCFonts &AllFonts, QMap<QString, QMap<uint, FPointArray> > DocFonts, BookMView* vi);
void PDF_Begin_Page(const Page* pag, QPixmap pm = 0);
119,7 → 112,7
 
int bytesWritten() { return Spool.at(); }
 
QMap<QString, GListeInd> GlyphsIdxOfFont;
QMap<QString, GListe> GlyphsIdxOfFont;
QString Inhalt;
ScribusDoc & doc;
const Page * ActPageP;
/branches/Version13x/Scribus/scribus/actionmanager.cpp
1085,8 → 1085,8
charCode==28 ||
charCode==29 ||
charCode==30 ||
((*mainWindow->doc->AllFonts)[fontName]!=0 &&
(*mainWindow->doc->AllFonts)[fontName]->canRender(charCode)) )
((*mainWindow->doc->AllFonts)[fontName].usable() &&
(*mainWindow->doc->AllFonts)[fontName].canRender(charCode)) )
(*actionMap)[*it]->setEnabled(true);
else
(*actionMap)[*it]->setEnabled(false);
/branches/Version13x/Scribus/scribus/sampleitem.h
61,6 → 61,7
void setLineSpa(double lineSpa);
void setTextAlignment(int textAlignment);
void setIndent(double indent);
void setRightMargin(double indent);
void setFirst(double first);
void setGapBefore(double gapBefore);
void setGapAfter(double gapAfter);
/branches/Version13x/Scribus/scribus/pageitem_textframe.h
43,7 → 43,6
class ScribusDoc;
class UndoManager;
class UndoState;
class Foi;
struct CopyPasteBuffer;
 
#include "text/nlsconfig.h"
54,6 → 53,19
#include "sctextstruct.h"
class ScText;
class ScStyleRun;
#else
struct LineSpec
{
double x;
double y;
double width;
double ascent;
double descent;
 
int firstItem;
int lastItem;
double naturalWidth;
};
#endif
 
class SCRIBUS_API PageItem_TextFrame : public PageItem
99,6 → 111,7
ScScriptItem *item, uint itemIndex);
#endif
QVector<LineSpec> lines;
bool unicodeTextEditMode;
int unicodeInputCount;
QString unicodeInputString;
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
57,11 → 57,11
{
for (int b = 0; b < it->itemText.length(); b++)
if (it->itemText.selected(b))
return PyString_FromString(it->itemText.charStyle(b).font()->scName().utf8());
return PyString_FromString(it->itemText.charStyle(b).font().scName().utf8());
return NULL;
}
else
return PyString_FromString(it->currentCharStyle().font()->scName().utf8());
return PyString_FromString(it->currentCharStyle().font().scName().utf8());
}
 
PyObject *scribus_gettextsize(PyObject* /* self */, PyObject* args)
351,7 → 351,7
PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot set font on a non-text frame.","python error"));
return NULL;
}
if (PrefsManager::instance()->appPrefs.AvailFonts.find(QString::fromUtf8(Font)))
if (PrefsManager::instance()->appPrefs.AvailFonts.contains(QString::fromUtf8(Font)))
{
int Apm = ScCore->primaryMainWindow()->doc->appMode;
ScCore->primaryMainWindow()->doc->m_Selection->clear();
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
11,7 → 11,7
#include "qpixmap.h"
 
#include "scribuscore.h"
#include "scfontmetrics.h"
#include "fonts/scfontmetrics.h"
#include "prefsmanager.h"
 
PyObject *scribus_setredraw(PyObject* /* self */, PyObject* args)
30,17 → 30,17
{
int cc2 = 0;
SCFontsIterator it2(PrefsManager::instance()->appPrefs.AvailFonts);
for ( ; it2.current() ; ++it2)
for ( ; it2.hasNext() ; it2.next())
{
if (it2.current()->usable())
if (it2.current().usable())
cc2++;
}
PyObject *l = PyList_New(cc2);
SCFontsIterator it(PrefsManager::instance()->appPrefs.AvailFonts);
int cc = 0;
for ( ; it.current() ; ++it)
for ( ; it.hasNext() ; it.next())
{
if (it.current()->usable())
if (it.current().usable())
{
PyList_SetItem(l, cc, PyString_FromString(it.currentKey().utf8()));
cc++;
55,15 → 55,15
SCFontsIterator it(PrefsManager::instance()->appPrefs.AvailFonts);
int cc = 0;
PyObject *row;
for ( ; it.current() ; ++it)
for ( ; it.hasNext() ; it.next())
{
row = Py_BuildValue((char*)"(sssiis)",
it.currentKey().utf8().data(),
it.current()->family().utf8().data(),
it.current()->RealName().utf8().data(),
it.current()->subset(),
it.current()->embedPs(),
it.current()->fontFilePath().utf8().data()
it.current().family().utf8().data(),
it.current().psName().utf8().data(),
it.current().subset(),
it.current().embedPs(),
it.current().fontFilePath().utf8().data()
);
PyList_SetItem(l, cc, row);
cc++;
90,7 → 90,7
if (!PyArg_ParseTupleAndKeywords(args, kw, "esesesi|es", kwargs,
"utf-8", &Name, "utf-8", &FileName, "utf-8", &Sample, &Size, "ascii", &format))
return NULL;
if (!PrefsManager::instance()->appPrefs.AvailFonts.find(QString::fromUtf8(Name)))
if (!PrefsManager::instance()->appPrefs.AvailFonts.contains(QString::fromUtf8(Name)))
{
PyErr_SetString(NotFoundError, QObject::tr("Font not found.","python error"));
return NULL;
/branches/Version13x/Scribus/scribus/plugins/gettext/textfilter/tffilter.cpp
475,7 → 475,7
void tfFilter::getParagraphStyles()
{
thirdCombo->insertItem("");
for (uint i = 5; i < ScCore->primaryMainWindow()->doc->docParagraphStyles.size(); ++i)
for (uint i = 5; i < ScCore->primaryMainWindow()->doc->docParagraphStyles.count(); ++i)
{
thirdCombo->insertItem(ScCore->primaryMainWindow()->doc->docParagraphStyles[i].name());
}
/branches/Version13x/Scribus/scribus/plugins/svgimplugin/svgplugin.cpp
29,7 → 29,6
#include "menumanager.h"
#include "prefsmanager.h"
#include "pageitem.h"
#include "scfontmetrics.h"
#include "scraction.h"
#include "scribuscore.h"
#include "scribusdoc.h"
37,6 → 36,7
#include "undomanager.h"
#include "loadsaveplugin.h"
#include "util.h"
#include "fonts/scfontmetrics.h"
 
using namespace std;
 
1521,10 → 1521,10
obj->Family = m_Doc->toolSettings.defFont; // family;
bool found = false;
SCFontsIterator it(PrefsManager::instance()->appPrefs.AvailFonts);
for ( ; it.current(); ++it)
for ( ; it.hasNext(); it.next())
{
QString fam;
QString fn = it.current()->scName();
QString fn = it.current().scName();
int pos=fn.find(" ");
fam = fn.left(pos);
if (fam == family)
1855,7 → 1855,7
int pos = ite->itemText.length();
ite->itemText.insertChars(pos, ch);
ite->itemText.applyCharStyle(pos, 1, nstyle);
tempW += RealCWidth(m_Doc, nstyle.font(), ch, nstyle.fontSize())+1;
tempW += nstyle.font().realCharWidth(ch[0], nstyle.fontSize())+1;
if (ch == SpecialChars::PARSEP)
{
ite->setWidthHeight(QMAX(ite->width(), tempW), ite->height() + lineSpacing+desc);
1950,7 → 1950,7
int pos = ite->itemText.length();
ite->itemText.insertChars(pos, ch);
ite->itemText.applyCharStyle(pos, 1, nstyle);
ite->setWidth(ite->width() + RealCWidth(m_Doc, nstyle.font(), ch, nstyle.fontSize())+1);
ite->setWidth(ite->width() + nstyle.font().realCharWidth(ch[0], nstyle.fontSize())+1);
ite->setHeight(gc->FontSize / 10.0 + 2 +desc+2);
}
ite->SetRectFrame();
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
237,11 → 237,11
}
 
 
void Scribus12Format::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois)
void Scribus12Format::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces)
{
getNewReplacement=newReplacement;
getReplacedFonts=ReplacedFonts;
getDummyFois=dummyFois;
getDummyScFaces=dummyScFaces;
}
 
bool Scribus12Format::loadFile(const QString & fileName, const FileFormat & /* fmt */, int /* flags */, int /* index */)
253,7 → 253,7
}
ReplacedFonts.clear();
newReplacement = false;
dummyFois.clear();
dummyScFaces.clear();
//start old ReadDoc
//Scribus 1.2 docs, see fileloader.cpp for 1.3 docs
342,7 → 342,7
DoFonts.clear();
m_Doc->toolSettings.defSize=qRound(dc.attribute("DSIZE").toDouble() * 10);
Defont=dc.attribute("DFONT");
if ((!m_AvailableFonts->find(Defont)) || (!(*m_AvailableFonts)[Defont]->usable()))
if ((!m_AvailableFonts->contains(Defont)) || (!(*m_AvailableFonts)[Defont].usable()))
{
ReplacedFonts.insert(Defont, prefsManager->appPrefs.toolSettings.defFont);
Defont = prefsManager->appPrefs.toolSettings.defFont;
442,9 → 442,9
vg.setGapBefore(pg.attribute("VOR", "0").toDouble());
vg.setGapAfter(pg.attribute("NACH", "0").toDouble());
tmpf = pg.attribute("FONT", m_Doc->toolSettings.defFont);
if ((!m_AvailableFonts->find(tmpf)) || (!(*m_AvailableFonts)[tmpf]->usable()))
if ((!m_AvailableFonts->contains(tmpf)) || (!(*m_AvailableFonts)[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
502,7 → 502,7
}
else
vg.tabValues().clear();
m_Doc->docParagraphStyles.append(vg);
m_Doc->docParagraphStyles.append(new ParagraphStyle(vg));
}
if(pg.tagName()=="JAVA")
m_Doc->JavaScripts[pg.attribute("NAME")] = pg.attribute("SCRIPT");
637,9 → 637,9
OB.startArrowIndex = 0;
OB.endArrowIndex = 0;
tmpf = obj.attribute("IFONT", m_Doc->toolSettings.defFont);
if ((!m_AvailableFonts->find(tmpf)) || (!(*m_AvailableFonts)[tmpf]->usable()))
if ((!m_AvailableFonts->contains(tmpf)) || (!(*m_AvailableFonts)[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
934,27 → 934,27
tmp2.replace(QRegExp("\t"), QChar(4));
tmpf = it->attribute("CFONT", doc->toolSettings.defFont);
bool unknown = false;
Foi* dummy = NULL;
ScFace dummy = ScFace::none();
PrefsManager* prefsManager=PrefsManager::instance();
if ((!prefsManager->appPrefs.AvailFonts.find(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf]->usable()))
if ((!prefsManager->appPrefs.AvailFonts.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf].usable()))
{
bool isThere = false;
for (uint dl = 0; dl < dummyFois.count(); ++dl)
for (uint dl = 0; dl < dummyScFaces.count(); ++dl)
{
if (dummyFois.at(dl)->scName() == tmpf)
if ((*dummyScFaces.at(dl)).scName() == tmpf)
{
isThere = true;
dummy = dummyFois.at(dl);
dummy = *dummyScFaces.at(dl);
break;
}
}
if (!isThere)
{
dummy = new Foi(tmpf, "", tmpf, "", "", 1, false);
dummyFois.append(dummy);
dummy = ScFace(); // FIXME
dummyScFaces.append(dummy);
}
unknown = true;
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
1466,7 → 1466,7
return false;
}
 
void Scribus12Format::GetStyle(QDomElement *pg, ParagraphStyle *vg, QValueList<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl)
void Scribus12Format::GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl)
{
bool fou;
QString tmpf, tmf, tmV;
1592,7 → 1592,7
}
if (!fou)
{
docParagraphStyles.append(*vg);
docParagraphStyles.append(vg);
if (fl)
{
DoVorl[VorlC] = tmV.setNum(docParagraphStyles.count()-1);
1606,9 → 1606,9
PrefsManager *prefsManager=PrefsManager::instance();
// QFont fo;
QString tmpf = fStr;
if ((!avail.find(tmpf)) || (!avail[tmpf]->usable()))
if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
qApp->setOverrideCursor(QCursor(arrowCursor), true);
MissingFont *dia = new MissingFont(0, tmpf, doc);
1632,7 → 1632,7
return tmpf;
}
 
bool Scribus12Format::readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles)
bool Scribus12Format::readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles)
{
ParagraphStyle vg;
QDomDocument docu("scridoc");
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.h
11,10 → 11,10
#include "loadsaveplugin.h"
#include "scfonts.h"
#include "scribusstructs.h"
#include "styles/styleset.h"
 
#include <qdom.h>
#include <qmap.h>
#include <qptrlist.h>
#include <qstring.h>
#include <qvaluelist.h>
 
40,20 → 40,20
 
// Special features - .sla page extraction support
virtual bool loadPage(const QString & fileName, int pageNumber, bool Mpage, QString renamedPageName=QString::null);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles);
virtual bool readLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty);
virtual bool readColors(const QString& fileName, ColorList & colors);
virtual bool readPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames);
virtual void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois);
virtual void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces);
 
private:
void registerFormats();
//Scribus Doc vars, not plugin vars
void GetItemText(QDomElement *it, ScribusDoc *doc, bool VorLFound, bool impo, PageItem* obj = 0);
void GetStyle(QDomElement *pg, ParagraphStyle *vg, QValueList<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl);
void GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl);
QString readSLA(const QString & fileName);
QString AskForFont(SCFonts &avail, QString fStr, ScribusDoc *doc);
QPtrList<Foi> dummyFois;
QValueList<ScFace> dummyScFaces;
bool newReplacement;
QMap<QString,QString> ReplacedFonts;
QMap<QString,QString> DoFonts;
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
214,11 → 214,11
return docText;
}
 
void Scribus13Format::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois)
void Scribus13Format::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces)
{
getNewReplacement=newReplacement;
getReplacedFonts=ReplacedFonts;
getDummyFois=dummyFois;
getDummyScFaces=dummyScFaces;
}
 
bool Scribus13Format::loadFile(const QString & fileName, const FileFormat & /* fmt */, int /* flags */, int /* index */)
230,7 → 230,7
}
ReplacedFonts.clear();
newReplacement = false;
dummyFois.clear();
dummyScFaces.clear();
ParagraphStyle vg;
struct Layer la;
struct ScribusDoc::BookMa bok;
307,7 → 307,7
m_Doc->setUnitIndex(dc.attribute("UNITS", "0").toInt());
m_Doc->toolSettings.defSize=qRound(dc.attribute("DSIZE").toDouble() * 10);
Defont=dc.attribute("DFONT");
if ((!m_AvailableFonts->find(Defont)) || (!(*m_AvailableFonts)[Defont]->usable()))
if ((!m_AvailableFonts->contains(Defont)) || (!(*m_AvailableFonts)[Defont].usable()))
{
ReplacedFonts.insert(Defont, prefsManager->appPrefs.toolSettings.defFont);
Defont = prefsManager->appPrefs.toolSettings.defFont;
559,7 → 559,7
if(pg.tagName()=="STYLE")
{
readParagraphStyle(vg, pg, *m_AvailableFonts, m_Doc);
m_Doc->docParagraphStyles.append(vg);
m_Doc->docParagraphStyles.append(new ParagraphStyle(vg));
}
if(pg.tagName()=="JAVA")
m_Doc->JavaScripts[pg.attribute("NAME")] = pg.attribute("SCRIPT");
951,9 → 951,9
Neu->OnMasterPage = "";
m_Doc->GroupCounter = docGc;
tmpf = pg.attribute("IFONT", m_Doc->toolSettings.defFont);
if ((!m_AvailableFonts->find(tmpf)) || (!(*m_AvailableFonts)[tmpf]->usable()))
if ((!m_AvailableFonts->contains(tmpf)) || (!(*m_AvailableFonts)[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
1422,7 → 1422,7
fo.setAttribute("FIRST",m_Doc->docParagraphStyles[ff].firstIndent());
fo.setAttribute("VOR",m_Doc->docParagraphStyles[ff].gapBefore());
fo.setAttribute("NACH",m_Doc->docParagraphStyles[ff].gapAfter());
fo.setAttribute("FONT",m_Doc->docParagraphStyles[ff].charStyle().font()->scName());
fo.setAttribute("FONT",m_Doc->docParagraphStyles[ff].charStyle().font().scName());
fo.setAttribute("FONTSIZE",m_Doc->docParagraphStyles[ff].charStyle().fontSize() / 10.0);
fo.setAttribute("DROP", static_cast<int>(m_Doc->docParagraphStyles[ff].hasDropCap()));
fo.setAttribute("DROPLIN", m_Doc->docParagraphStyles[ff].dropCapLines());
1730,7 → 1730,7
 
void Scribus13Format::GetItemText(QDomElement *it, ScribusDoc *doc, PageItem* obj, LastStyles* last, bool impo, bool VorLFound)
{
Foi* dummy = NULL;
ScFace dummy = ScFace::none();
bool unknown = false;
QString tmp2, tmpf;
tmp2 = it->attribute("CH");
1739,25 → 1739,25
tmp2.replace(QRegExp("\t"), QChar(9));
tmpf = it->attribute("CFONT", doc->toolSettings.defFont);
PrefsManager* prefsManager=PrefsManager::instance();
if ((!prefsManager->appPrefs.AvailFonts.find(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf]->usable()))
if ((!prefsManager->appPrefs.AvailFonts.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf].usable()))
{
bool isThere = false;
for (uint dl = 0; dl < dummyFois.count(); ++dl)
for (uint dl = 0; dl < dummyScFaces.count(); ++dl)
{
if (dummyFois.at(dl)->scName() == tmpf)
if ((*dummyScFaces.at(dl)).scName() == tmpf)
{
isThere = true;
dummy = dummyFois.at(dl);
dummy = *dummyScFaces.at(dl);
break;
}
}
if (!isThere)
{
dummy = new Foi(tmpf, "", tmpf, "", "", 1, false);
dummyFois.append(dummy);
// dummy = ScFace(tmpf, "", tmpf, "", "", 1, false);
dummyScFaces.append(dummy);
}
unknown = true;
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
1896,9 → 1896,9
vg.setGapAfter(pg.attribute("NACH", "0").toDouble());
PrefsManager * prefsManager = PrefsManager::instance();
QString tmpf = pg.attribute("FONT", doc->toolSettings.defFont);
if ((!avail.find(tmpf)) || (!avail[tmpf]->usable()))
if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
2725,9 → 2725,9
Neu->OnMasterPage = "";
m_Doc->GroupCounter = docGc;
tmpf = pg.attribute("IFONT", m_Doc->toolSettings.defFont);
if ((!m_AvailableFonts->find(tmpf)) || (!(*m_AvailableFonts)[tmpf]->usable()))
if ((!m_AvailableFonts->contains(tmpf)) || (!(*m_AvailableFonts)[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
2898,7 → 2898,7
return true;
}
 
void Scribus13Format::GetStyle(QDomElement *pg, ParagraphStyle *vg, QValueList<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl)
void Scribus13Format::GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl)
{
bool fou;
QString tmpf, tmf, tmV;
2945,7 → 2945,7
}
if (!fou)
{
docParagraphStyles.append(*vg);
docParagraphStyles.append(vg);
if (fl)
{
DoVorl[VorlC] = tmV.setNum(docParagraphStyles.count()-1);
2959,9 → 2959,9
PrefsManager *prefsManager=PrefsManager::instance();
// QFont fo;
QString tmpf = fStr;
if ((!avail.find(tmpf)) || (!avail[tmpf]->usable()))
if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
qApp->setOverrideCursor(QCursor(arrowCursor), true);
MissingFont *dia = new MissingFont(0, tmpf, doc);
2985,7 → 2985,7
return tmpf;
}
 
bool Scribus13Format::readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles)
bool Scribus13Format::readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles)
{
ParagraphStyle vg;
QDomDocument docu("scridoc");
3313,7 → 3313,7
QChar ch = item->itemText.text(k);
QDomElement it=docu->createElement("ITEXT");
ts = style1.fontSize() / 10.0;
tf = style1.font()->scName();
tf = style1.font().scName();
tc = style1.fillColor();
te = style1.tracking();
tsh = style1.fillShade();
3378,7 → 3378,7
const CharStyle& style2(item->itemText.charStyle(k));
ch = item->itemText.text(k);
ts2 = style2.fontSize() / 10.0;
tf2 = style2.font()->scName();
tf2 = style2.font().scName();
tc2 = style2.fillColor();
te2 = style2.tracking();
tsh2 = style2.fillShade();
3439,7 → 3439,7
const CharStyle& style3(item->itemText.charStyle(k));
ch = item->itemText.text(k);
ts2 = style3.fontSize() / 10.0;
tf2 = style3.font()->scName();
tf2 = style3.font().scName();
tc2 = style3.fillColor();
te2 = style3.tracking();
tsh2 = style3.fillShade();
3580,7 → 3580,7
ob->setAttribute("FLIPPEDV", item->imageFlippedV());
/* ob->setAttribute("BBOXX",item->BBoxX);
ob->setAttribute("BBOXH",item->BBoxH); */
ob->setAttribute("IFONT",item->itemText.defaultStyle().charStyle().font()->scName());
ob->setAttribute("IFONT",item->itemText.defaultStyle().charStyle().font().scName());
ob->setAttribute("ISIZE",item->itemText.defaultStyle().charStyle().fontSize() / 10.0 );
ob->setAttribute("SCALETYPE", item->ScaleType ? 1 : 0);
ob->setAttribute("RATIO", item->AspectRatio ? 1 : 0);
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.h
11,10 → 11,10
#include "loadsaveplugin.h"
#include "scfonts.h"
#include "scribusstructs.h"
#include "styles/styleset.h"
 
#include <qdom.h>
#include <qmap.h>
#include <qptrlist.h>
#include <qstring.h>
#include <qvaluelist.h>
 
39,11 → 39,11
 
// Special features - .sla page extraction support
virtual bool loadPage(const QString & fileName, int pageNumber, bool Mpage, QString renamedPageName=QString::null);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles);
virtual bool readLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty);
virtual bool readColors(const QString& fileName, ColorList & colors);
virtual bool readPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames);
virtual void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois);
virtual void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces);
 
private:
void registerFormats();
51,7 → 51,7
void GetItemText(QDomElement *it, ScribusDoc *doc, PageItem* obj, LastStyles* last, bool impo=false, bool VorLFound=false);
void readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *doc);
PageItem* PasteItem(QDomElement *obj, ScribusDoc *doc);
void GetStyle(QDomElement *pg, ParagraphStyle *vg, QValueList<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl);
void GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl);
QString readSLA(const QString & fileName);
QString AskForFont(SCFonts &avail, QString fStr, ScribusDoc *doc);
void WritePages(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, bool master);
58,7 → 58,7
void WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master);
void SetItemProps(QDomElement *ob, PageItem* item, bool newFormat);
QValueList<int> LFrames;
QPtrList<Foi> dummyFois;
QValueList<ScFace> dummyScFaces;
bool newReplacement;
QMap<QString,QString> ReplacedFonts;
QMap<uint,QString> DoVorl;
/branches/Version13x/Scribus/scribus/plugins/fileloader/oodraw/oodrawimp.cpp
39,7 → 39,6
#include "undomanager.h"
#include "pluginmanager.h"
#include "util.h"
#include "scfontmetrics.h"
#include "stylestack.h"
#include "scraction.h"
#include "menumanager.h"
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
11,10 → 11,10
#include "loadsaveplugin.h"
#include "scfonts.h"
#include "scribusstructs.h"
#include "styles/styleset.h"
 
#include <qdom.h>
#include <qmap.h>
#include <qptrlist.h>
#include <qstring.h>
#include <qvaluelist.h>
 
39,11 → 39,11
 
// Special features - .sla page extraction support
virtual bool loadPage(const QString & fileName, int pageNumber, bool Mpage, QString renamedPageName=QString::null);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles);
virtual bool readLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty);
virtual bool readColors(const QString& fileName, ColorList & colors);
virtual bool readPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames);
virtual void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois);
virtual void getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces);
 
private:
void registerFormats();
51,7 → 51,7
void GetItemText(QDomElement *it, ScribusDoc *doc, PageItem* obj, LastStyles* last, bool impo=false, bool VorLFound=false);
void readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *doc);
PageItem* PasteItem(QDomElement *obj, ScribusDoc *doc);
void GetStyle(QDomElement *pg, ParagraphStyle *vg, QValueList<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl);
void GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl);
QString readSLA(const QString & fileName);
QString AskForFont(SCFonts &avail, QString fStr, ScribusDoc *doc);
void WritePages(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, bool master);
58,7 → 58,7
void WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master);
void SetItemProps(QDomElement *ob, PageItem* item, bool newFormat);
QValueList<int> LFrames;
QPtrList<Foi> dummyFois;
QValueList<ScFace> dummyScFaces;
bool newReplacement;
QMap<QString,QString> ReplacedFonts;
QMap<uint,QString> DoVorl;
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
214,11 → 214,11
return docText;
}
 
void Scribus134Format::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QPtrList<Foi> &getDummyFois)
void Scribus134Format::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces)
{
getNewReplacement=newReplacement;
getReplacedFonts=ReplacedFonts;
getDummyFois=dummyFois;
getDummyScFaces=dummyScFaces;
}
 
bool Scribus134Format::loadFile(const QString & fileName, const FileFormat & /* fmt */, int /* flags */, int /* index */)
230,7 → 230,7
}
ReplacedFonts.clear();
newReplacement = false;
dummyFois.clear();
dummyScFaces.clear();
ParagraphStyle vg;
struct Layer la;
struct ScribusDoc::BookMa bok;
307,7 → 307,7
m_Doc->setUnitIndex(dc.attribute("UNITS", "0").toInt());
m_Doc->toolSettings.defSize=qRound(dc.attribute("DSIZE").toDouble() * 10);
Defont=dc.attribute("DFONT");
if ((!m_AvailableFonts->find(Defont)) || (!(*m_AvailableFonts)[Defont]->usable()))
if ((!m_AvailableFonts->contains(Defont)) || (!(*m_AvailableFonts)[Defont].usable()))
{
ReplacedFonts.insert(Defont, prefsManager->appPrefs.toolSettings.defFont);
Defont = prefsManager->appPrefs.toolSettings.defFont;
559,7 → 559,7
if(pg.tagName()=="STYLE")
{
readParagraphStyle(vg, pg, *m_AvailableFonts, m_Doc);
m_Doc->docParagraphStyles.append(vg);
m_Doc->docParagraphStyles.append(new ParagraphStyle(vg));
}
if(pg.tagName()=="JAVA")
m_Doc->JavaScripts[pg.attribute("NAME")] = pg.attribute("SCRIPT");
951,9 → 951,9
Neu->OnMasterPage = "";
m_Doc->GroupCounter = docGc;
tmpf = pg.attribute("IFONT", m_Doc->toolSettings.defFont);
if ((!m_AvailableFonts->find(tmpf)) || (!(*m_AvailableFonts)[tmpf]->usable()))
if ((!m_AvailableFonts->contains(tmpf)) || (!(*m_AvailableFonts)[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
1422,7 → 1422,7
fo.setAttribute("FIRST",m_Doc->docParagraphStyles[ff].firstIndent());
fo.setAttribute("VOR",m_Doc->docParagraphStyles[ff].gapBefore());
fo.setAttribute("NACH",m_Doc->docParagraphStyles[ff].gapAfter());
fo.setAttribute("FONT",m_Doc->docParagraphStyles[ff].charStyle().font()->scName());
fo.setAttribute("FONT",m_Doc->docParagraphStyles[ff].charStyle().font().scName());
fo.setAttribute("FONTSIZE",m_Doc->docParagraphStyles[ff].charStyle().fontSize() / 10.0);
fo.setAttribute("DROP", static_cast<int>(m_Doc->docParagraphStyles[ff].hasDropCap()));
fo.setAttribute("DROPLIN", m_Doc->docParagraphStyles[ff].dropCapLines());
1730,7 → 1730,7
 
void Scribus134Format::GetItemText(QDomElement *it, ScribusDoc *doc, PageItem* obj, LastStyles* last, bool impo, bool VorLFound)
{
Foi* dummy = NULL;
ScFace dummy = ScFace::none();
bool unknown = false;
QString tmp2, tmpf;
tmp2 = it->attribute("CH");
1739,25 → 1739,25
tmp2.replace(QRegExp("\t"), QChar(9));
tmpf = it->attribute("CFONT", doc->toolSettings.defFont);
PrefsManager* prefsManager=PrefsManager::instance();
if ((!prefsManager->appPrefs.AvailFonts.find(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf]->usable()))
if ((!prefsManager->appPrefs.AvailFonts.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf].usable()))
{
bool isThere = false;
for (uint dl = 0; dl < dummyFois.count(); ++dl)
for (uint dl = 0; dl < dummyScFaces.count(); ++dl)
{
if (dummyFois.at(dl)->scName() == tmpf)
if ((*dummyScFaces.at(dl)).scName() == tmpf)
{
isThere = true;
dummy = dummyFois.at(dl);
dummy = *dummyScFaces.at(dl);
break;
}
}
if (!isThere)
{
dummy = new Foi(tmpf, "", tmpf, "", "", 1, false);
dummyFois.append(dummy);
// dummy = ScFace(tmpf, "", tmpf, "", "", 1, false);
dummyScFaces.append(dummy);
}
unknown = true;
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
1857,7 → 1857,7
last->StyleStart = pos;
}
if (ch == SpecialChars::PARSEP) {
const ParagraphStyle& pstyle(doc->docParagraphStyles[QMAX(0,last->ParaStyle)]);
const ParagraphStyle& pstyle( doc->docParagraphStyles[QMAX(0,last->ParaStyle)]);
qDebug(QString("par style134 at %1: %2/%3 (%4)").arg(pos).arg(pstyle.name()).arg(pstyle.parent()? pstyle.parent()->name():"").arg(last->ParaStyle));
obj->itemText.applyStyle(pos, pstyle);
obj->itemText.applyStyle(pos, doc->docParagraphStyles[QMAX(0,last->ParaStyle)]);
1884,9 → 1884,9
vg.setGapAfter(pg.attribute("NACH", "0").toDouble());
PrefsManager * prefsManager = PrefsManager::instance();
QString tmpf = pg.attribute("FONT", doc->toolSettings.defFont);
if ((!avail.find(tmpf)) || (!avail[tmpf]->usable()))
if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
2712,9 → 2712,9
Neu->OnMasterPage = "";
m_Doc->GroupCounter = docGc;
tmpf = pg.attribute("IFONT", m_Doc->toolSettings.defFont);
if ((!m_AvailableFonts->find(tmpf)) || (!(*m_AvailableFonts)[tmpf]->usable()))
if ((!m_AvailableFonts->contains(tmpf)) || (!(*m_AvailableFonts)[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
2887,7 → 2887,7
return true;
}
 
void Scribus134Format::GetStyle(QDomElement *pg, ParagraphStyle *vg, QValueList<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl)
void Scribus134Format::GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl)
{
bool fou;
QString tmpf, tmf, tmV;
2934,7 → 2934,7
}
if (!fou)
{
docParagraphStyles.append(*vg);
docParagraphStyles.append(vg);
if (fl)
{
DoVorl[VorlC] = tmV.setNum(docParagraphStyles.count()-1);
2948,9 → 2948,9
PrefsManager *prefsManager=PrefsManager::instance();
// QFont fo;
QString tmpf = fStr;
if ((!avail.find(tmpf)) || (!avail[tmpf]->usable()))
if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
qApp->setOverrideCursor(QCursor(arrowCursor), true);
MissingFont *dia = new MissingFont(0, tmpf, doc);
2974,7 → 2974,7
return tmpf;
}
 
bool Scribus134Format::readStyles(const QString& fileName, ScribusDoc* doc, QValueList<ParagraphStyle> &docParagraphStyles)
bool Scribus134Format::readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles)
{
ParagraphStyle vg;
QDomDocument docu("scridoc");
3302,7 → 3302,7
QChar ch = item->itemText.text(k);
QDomElement it=docu->createElement("ITEXT");
ts = style1.fontSize() / 10.0;
tf = style1.font()->scName();
tf = style1.font().scName();
tc = style1.fillColor();
te = style1.tracking();
tsh = style1.fillShade();
3367,7 → 3367,7
const CharStyle& style2(item->itemText.charStyle(k));
ch = item->itemText.text(k);
ts2 = style2.fontSize() / 10.0;
tf2 = style2.font()->scName();
tf2 = style2.font().scName();
tc2 = style2.fillColor();
te2 = style2.tracking();
tsh2 = style2.fillShade();
3428,7 → 3428,7
const CharStyle& style3(item->itemText.charStyle(k));
ch = item->itemText.text(k);
ts2 = style3.fontSize() / 10.0;
tf2 = style3.font()->scName();
tf2 = style3.font().scName();
tc2 = style3.fillColor();
te2 = style3.tracking();
tsh2 = style3.fillShade();
3569,7 → 3569,7
ob->setAttribute("FLIPPEDV", item->imageFlippedV());
/* ob->setAttribute("BBOXX",item->BBoxX);
ob->setAttribute("BBOXH",item->BBoxH); */
ob->setAttribute("IFONT",item->itemText.defaultStyle().charStyle().font()->scName());
ob->setAttribute("IFONT",item->itemText.defaultStyle().charStyle().font().scName());
ob->setAttribute("ISIZE",item->itemText.defaultStyle().charStyle().fontSize() / 10.0 );
ob->setAttribute("SCALETYPE", item->ScaleType ? 1 : 0);
ob->setAttribute("RATIO", item->AspectRatio ? 1 : 0);
/branches/Version13x/Scribus/scribus/plugins/fontpreview/fontpreview.cpp
21,7 → 21,6
#include "prefsfile.h"
#include "commonstrings.h"
#include "prefsmanager.h"
#include "scfontmetrics.h"
#include "selection.h"
#include "sampleitem.h"
 
73,7 → 72,7
{
Q_ASSERT(m_Doc!=0);
if (m_Doc->m_Selection->count() != 0)
item = fontList->findItem(m_Doc->currentStyle.charStyle().font()->scName(), 0);
item = fontList->findItem(m_Doc->currentStyle.charStyle().font().scName(), 0);
else
item = fontList->findItem(PrefsManager::instance()->appPrefs.toolSettings.defFont, 0);
}
161,47 → 160,47
re.setWildcard(true);
 
for (SCFontsIterator fontIter(PrefsManager::instance()->appPrefs.AvailFonts);
fontIter.current(); ++fontIter)
fontIter.hasNext(); fontIter.next())
{
if (searchStr.length()!=0 & !re.exactMatch(fontIter.current()->scName()))
if (searchStr.length()!=0 & !re.exactMatch(fontIter.current().scName()))
continue;
 
if (fontIter.current()->usable())
if (fontIter.current().usable())
{
QListViewItem *row = new QListViewItem(fontList);
Foi::FontType type = fontIter.current()->type();
ScFace::FontType type = fontIter.current().type();
 
row->setText(0, fontIter.current()->scName());
row->setText(0, fontIter.current().scName());
// searching
Q_ASSERT(m_Doc!=0);
// quick hack before #4036 gets fixed - PV
if (m_Doc){
if (m_Doc->UsedFonts.contains(fontIter.current()->scName()))
if (m_Doc->UsedFonts.contains(fontIter.current().scName()))
row->setPixmap(1, okIcon);
}
 
if (type == Foi::OTF)
if (type == ScFace::OTF)
{
row->setPixmap(2, otfFont);
row->setText(2, "OpenType");
}
else
if (fontIter.current()->subset())
if (fontIter.current().subset())
row->setPixmap(3, okIcon);
 
if (type == Foi::TYPE1) // type1
if (type == ScFace::TYPE1) // type1
{
row->setPixmap(2, psFont);
row->setText(2, "Type1");
}
 
if (type == Foi::TTF)
if (type == ScFace::TTF)
{
row->setPixmap(2, ttfFont);
row->setText(2, "TrueType");
}
 
QFileInfo fi(fontIter.current()->fontFilePath());
QFileInfo fi(fontIter.current().fontFilePath());
fi.absFilePath().contains(QDir::homeDirPath()) ?
row->setText(4, tr("User", "font preview")):
row->setText(4, tr("System", "font preview"));
/branches/Version13x/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
743,12 → 743,12
if ((hl->strokeColor() != CommonStrings::None) && (chst & 4))
{
tp->setAttribute("stroke", SetFarbe(hl->strokeColor(), hl->strokeShade()));
tp->setAttribute("stroke-width", FToStr((*m_Doc->AllFonts)[hl->font()->scName()]->strokeWidth() * (hl->fontSize() / 10.0))+"pt");
tp->setAttribute("stroke-width", FToStr(hl->font().strokeWidth(hl->fontSize() / 10.0))+"pt");
}
else
tp->setAttribute("stroke", "none");
tp->setAttribute("font-size", (hl->fontSize() / 10.0));
tp->setAttribute("font-family", (*m_Doc->AllFonts)[hl->font()->scName()]->family());
tp->setAttribute("font-family", hl->font().family());
if (chst != 0)
{
if (chst & 64)
/branches/Version13x/Scribus/scribus/plugins/psimport/importps.cpp
28,7 → 28,6
 
#include "multiprogressdialog.h"
#include "scpaths.h"
#include "scfontmetrics.h"
#include "selection.h"
#include "prefsmanager.h"
#include "undomanager.h"
/branches/Version13x/Scribus/scribus/fontprefs.cpp
193,7 → 193,7
QString tmp;
UsedFonts.clear();
SCFontsIterator it(PrefsManager::instance()->appPrefs.AvailFonts);
for ( ; it.current() ; ++it)
for ( ; it.hasNext() ; it.next())
{
if (fontFlags[it.currentKey()].FlagUse)
UsedFonts.append(it.currentKey());
336,36 → 336,36
fontFlags.clear();
fontList->clear();
SCFontsIterator it(*availFonts);
for ( ; it.current(); ++it)
for ( ; it.hasNext(); it.next())
{
if (!it.current()->usable())
if (!it.current().usable())
continue;
fontSet foS;
QListViewItem *row = new QListViewItem(fontList);
row->setText(0, it.currentKey());
 
foS.FlagUse = it.current()->usable();
foS.FlagUse = it.current().usable();
row->setPixmap(1, foS.FlagUse ? checkOn : checkOff);
if (foS.FlagUse)
UsedFonts.append(it.currentKey());
 
foS.FlagPS = it.current()->embedPs();
foS.FlagPS = it.current().embedPs();
row->setPixmap(2, foS.FlagPS ? checkOn : checkOff);
 
foS.FlagSub = it.current()->subset();
foS.FlagSub = it.current().subset();
row->setPixmap(3, foS.FlagSub ? checkOn : checkOff);
 
Foi::FontType type = it.current()->type();
foS.FlagOTF = (type == Foi::OTF) ? true : false;
if (type == Foi::TYPE1)
ScFace::FontType type = it.current().type();
foS.FlagOTF = (type == ScFace::OTF) ? true : false;
if (type == ScFace::TYPE1)
row->setPixmap(0, psFont);
if (type == Foi::TTF)
if (type == ScFace::TTF)
row->setPixmap(0, ttfFont);
if (type == Foi::OTF)
if (type == ScFace::OTF)
row->setPixmap(0, otfFont);
 
foS.FlagNames = it.current()->hasNames();
row->setText(4, it.current()->fontPath());
foS.FlagNames = it.current().hasNames();
row->setText(4, it.current().fontPath());
fontFlags.insert(it.currentKey(), foS);
}
fontList->sort();
/branches/Version13x/Scribus/scribus/scpreview.cpp
112,9 → 112,9
if(pg.tagName()=="FONT")
{
tmpf = GetAttr(&pg, "NAME");
if ((!prefsManager->appPrefs.AvailFonts.find(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf]->usable()))
if ((!prefsManager->appPrefs.AvailFonts.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]]->usable()))
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
ScCore->showSplash(false);
MissingFont *dia = new MissingFont(0, tmpf, 0);
129,11 → 129,11
}
if (!DoFonts.contains(tmpf))
{
FT_Face face;
error = FT_New_Face( library, prefsManager->appPrefs.AvailFonts[tmpf]->fontFilePath(), prefsManager->appPrefs.AvailFonts[tmpf]->faceIndex(), &face );
if (error)
// FT_Face face;
// error = FT_New_Face( library, prefsManager->appPrefs.AvailFonts[tmpf].fontFilePath(), prefsManager->appPrefs.AvailFonts[tmpf].faceIndex(), &face );
if ( prefsManager->appPrefs.AvailFonts[tmpf].usable() )
tmpf = prefsManager->appPrefs.toolSettings.defFont;
if (prefsManager->appPrefs.AvailFonts[tmpf]->ReadMetrics()) {
/* if (prefsManager->appPrefs.AvailFonts[tmpf]->ReadMetrics()) {
//already done in ScFonts::addScalaableFont():
// prefsManager->appPrefs.AvailFonts[tmpf]->CharWidth[13] = 0;
}
140,10 → 140,11
else
{
tmpf = prefsManager->appPrefs.toolSettings.defFont;
prefsManager->appPrefs.AvailFonts[tmpf]->ReadMetrics();
// prefsManager->appPrefs.AvailFonts[tmpf]->ReadMetrics();
//already done in ScFonts::addScalaableFont():
// prefsManager->appPrefs.AvailFonts[tmpf]->CharWidth[13] = 0;
}
*/
}
// fo = prefsManager->appPrefs.AvailFonts[tmpf]->Font;
// fo.setPointSize(12);
623,7 → 624,7
pS->setPen(tmpfa, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
mode += 1;
}
DrawZeichenS(pS, hl->glyph.xoffset, hl->glyph.yoffset, chstr, hl->font()->scName(), OB.Reverse, hl->effects(), mode, chs);
DrawZeichenS(pS, hl->glyph.xoffset, hl->glyph.yoffset, chstr, hl->font().scName(), OB.Reverse, hl->effects(), mode, chs);
}
pS->restore();
}
821,7 → 822,7
pS->setPen(tmpfa);
}
chs = hl->fontSize();
asce = prefsManager->appPrefs.AvailFonts[hl->font()->scName()]->ascent() * (hl->fontSize() / 10.0);
asce = hl->font().ascent(hl->fontSize() / 10.0);
int chst = hl->effects() & 127;
if (chst != 0)
{
844,7 → 845,7
}
}
}
wide = prefsManager->appPrefs.AvailFonts[hl->font()->scName()]->charWidth(chstr[0])*(chs / 10.0);
wide = hl->font().charWidth(chstr[0], chs / 10.0);
if ((CurX+(wide+chs * hl->tracking() / 10000.0)/2) >= wid)
{
if (zae < cl.size()-1)
874,7 → 875,7
pS->save();
pS->translate(cl.point(zae).x(), cl.point(zae).y());
pS->rotate(rota);
DrawZeichenS(pS, CurX+chs * hl->tracking() / 10000.0, CurY+OB.BaseOffs, chstr, hl->font()->scName(), OB.Reverse, hl->effects(), 2, chs);
DrawZeichenS(pS, CurX+chs * hl->tracking() / 10000.0, CurY+OB.BaseOffs, chstr, hl->font().scName(), OB.Reverse, hl->effects(), 2, chs);
pS->restore();
CurX += wide+chs * hl->tracking() / 10000.0;
}
938,12 → 939,13
double wide;
double csi = static_cast<double>(Siz) / 100.0;
uint chr = ccx[0].unicode();
if (prefsManager->appPrefs.AvailFonts[ZFo]->canRender(ccx[0]))
if (prefsManager->appPrefs.AvailFonts[ZFo].canRender(ccx[0]))
{
wide = prefsManager->appPrefs.AvailFonts[ZFo]->charWidth(ccx[0])*(Siz / 10.0);
wide = prefsManager->appPrefs.AvailFonts[ZFo].charWidth(ccx[0])*(Siz / 10.0);
QWMatrix chma;
chma.scale(csi, csi);
FPointArray gly = prefsManager->appPrefs.AvailFonts[ZFo]->outline(ccx[0]);
uint gl = prefsManager->appPrefs.AvailFonts[ZFo].char2CMap(ccx[0]);
FPointArray gly = prefsManager->appPrefs.AvailFonts[ZFo].glyphOutline(gl);
if (gly.size() < 4)
return;
gly.map(chma);
966,19 → 968,19
p->fillPath();
if ((Style & 4) && ((mod % 2) != 0))
{
p->setLineWidth(prefsManager->appPrefs.AvailFonts[ZFo]->strokeWidth() * Siz / 20);
p->setLineWidth(prefsManager->appPrefs.AvailFonts[ZFo].strokeWidth() * Siz / 20);
p->strokePath();
}
if (Style & 16)
{
double st = prefsManager->appPrefs.AvailFonts[ZFo]->strikeoutPos() * (Siz / 10.0);
p->setLineWidth(QMAX(prefsManager->appPrefs.AvailFonts[ZFo]->strokeWidth() * (Siz / 10.0), 1));
double st = prefsManager->appPrefs.AvailFonts[ZFo].strikeoutPos() * (Siz / 10.0);
p->setLineWidth(QMAX(prefsManager->appPrefs.AvailFonts[ZFo].strokeWidth() * (Siz / 10.0), 1));
p->drawLine(FPoint(xco, yco-st), FPoint(xco+wide, yco-st));
}
if (Style & 8)
{
double st = prefsManager->appPrefs.AvailFonts[ZFo]->underlinePos() * (Siz / 10.0);
p->setLineWidth(QMAX(prefsManager->appPrefs.AvailFonts[ZFo]->strokeWidth() * (Siz / 10.0), 1));
double st = prefsManager->appPrefs.AvailFonts[ZFo].underlinePos() * (Siz / 10.0);
p->setLineWidth(QMAX(prefsManager->appPrefs.AvailFonts[ZFo].strokeWidth() * (Siz / 10.0), 1));
p->drawLine(FPoint(xco, yco-st), FPoint(xco+wide, yco-st));
}
}
/branches/Version13x/Scribus/scribus/pslib.cpp
127,14 → 127,14
for (it = DocFonts.begin(); it != DocFonts.end(); ++it)
{
/* Subset all TTF Fonts until the bug in the TTF-Embedding Code is fixed */
Foi::FontType type = AllFonts[it.key()]->type();
ScFace::FontType type = AllFonts[it.key()].type();
 
if ((type == Foi::TTF) || (AllFonts[it.key()]->isOTF()) || (AllFonts[it.key()]->subset()))
if ((type == ScFace::TTF) || (AllFonts[it.key()].isOTF()) || (AllFonts[it.key()].subset()))
{
QMap<uint, FPointArray>& RealGlyphs(it.data());
FontDesc += "/"+AllFonts[it.key()]->RealName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+
FontDesc += "/"+AllFonts[it.key()].psName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+
" "+IToStr(RealGlyphs.count()+1)+" dict def\n";
FontDesc += AllFonts[it.key()]->RealName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+" begin\n";
FontDesc += AllFonts[it.key()].psName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+" begin\n";
QMap<uint,FPointArray>::Iterator ig;
for (ig = RealGlyphs.begin(); ig != RealGlyphs.end(); ++ig)
{
172,18 → 172,18
else
{
UsedFonts.insert(it.key(), "/Fo"+IToStr(a));
Fonts += "/Fo"+IToStr(a)+" /"+AllFonts[it.key()]->RealName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+" findfont definefont pop\n";
if (AllFonts[it.key()]->embedPs())
Fonts += "/Fo"+IToStr(a)+" /"+AllFonts[it.key()].psName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+" findfont definefont pop\n";
if (AllFonts[it.key()].embedPs())
{
QString tmp;
if(AllFonts[it.key()]->EmbedFont(tmp))
if(AllFonts[it.key()].EmbedFont(tmp))
{
FontDesc += "%%BeginFont: " + AllFonts[it.key()]->RealName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ) + "\n";
FontDesc += "%%BeginFont: " + AllFonts[it.key()].psName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ) + "\n";
FontDesc += tmp + "\n%%EndFont\n";
}
}
GListe gl;
AllFonts[it.key()]->GlNames(&gl);
AllFonts[it.key()].glyphNames(gl);
GlyphsOfFont.insert(it.key(), gl);
a++;
}
745,7 → 745,7
{
QString Name;
uint cc = ch[0].unicode();
Name = GlyphsOfFont[font].contains(cc) ? GlyphsOfFont[font][cc] : QString(".notdef");
Name = GlyphsOfFont[font].contains(cc) ? GlyphsOfFont[font][cc].second : QString(".notdef");
if (spot)
PutSeite("/"+Name+" "+ToStr(x)+" "+ToStr(y)+" shgsp\n");
else
1956,11 → 1956,11
PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
}
/* Subset all TTF Fonts until the bug in the TTF-Embedding Code is fixed */
Foi::FontType type = hl->font()->type();
if ((type == Foi::TTF) || (hl->font()->isOTF()) || (hl->font()->subset()))
ScFace::FontType type = hl->font().type();
if ((type == ScFace::TTF) || (hl->font().isOTF()) || (hl->font().subset()))
{
uint chr = chstr[0].unicode();
if ((hl->font()->canRender(chstr[0])) && (chr != 32))
if ((hl->font().canRender(chstr[0])) && (chr != 32))
{
PS_save();
if (hl->fillColor() != CommonStrings::None)
1979,7 → 1979,7
PutSeite(ToStr(hl->fillShade() / 100.0)+" "+spotMap[hl->fillColor()]);
else
PutSeite(FillColor + " cmyk");
PS_showSub(chr, hl->font()->RealName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ), tsz / 10.0, false);
PS_showSub(chr, hl->font().psName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ), tsz / 10.0, false);
if ((hl->strokeColor() != CommonStrings::None) && ((tsz * hl->outlineWidth() / 10000.0) != 0))
{
PS_save();
1990,7 → 1990,7
PutSeite(ToStr(hl->strokeShade() / 100.0)+" "+spotMap[hl->strokeColor()]);
else
PutSeite(StrokeColor + " cmyk");
PS_showSub(chr, hl->font()->RealName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ), tsz / 10.0, true);
PS_showSub(chr, hl->font().psName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ), tsz / 10.0, true);
PS_restore();
}
}
1999,7 → 1999,7
}
else
{
PS_selectfont(hl->font()->scName(), tsz / 10.0);
PS_selectfont(hl->font().scName(), tsz / 10.0);
PS_save();
PutSeite("["+ToStr(1) + " " + ToStr(0) + " " + ToStr(0) + " " + ToStr(-1) + " " + ToStr(-hl->PRot) + " " + ToStr(0) + "]\n");
PutSeite("["+ToStr(hl->PtransX) + " " + ToStr(-hl->PtransY) + " " + ToStr(-hl->PtransY) + " " + ToStr(-hl->PtransX) + " " + ToStr(hl->glyph.xoffset) + " " + ToStr(-hl->glyph.yoffset) + "]\n");
2009,13 → 2009,14
if ((colorsToUse[hl->fillColor()].isSpotColor()) && (!DoSep))
{
PutSeite(ToStr(hl->fillShade() / 100.0)+" "+spotMap[hl->fillColor()]);
PS_show_xyG(hl->font()->scName(), chstr, 0, 0, true);
PS_show_xyG(hl->font().scName(), chstr, 0, 0, true);
}
else
PS_show_xyG(hl->font()->scName(), chstr, 0, 0, false);
PS_show_xyG(hl->font().scName(), chstr, 0, 0, false);
if ((hl->strokeColor() != CommonStrings::None) && ((tsz * hl->outlineWidth() / 10000.0) != 0))
{
FPointArray gly = hl->font()->outline(chstr[0]);
uint gl = hl->font().char2CMap(chstr[0]);
FPointArray gly = hl->font().glyphOutline(gl);
QWMatrix chma;
chma.scale(tsz / 100.0, tsz / 100.0);
gly.map(chma);
2308,7 → 2309,7
if ((!tTabValues[tabCc].tabFillChar.isNull()) && (tabCc < tTabValues.count()))
{
ScText hl2;
double wt = Cwidth(Doc, hl->font(), QString(tTabValues[tabCc].tabFillChar), hl->fontSize());
double wt = hl->font().charWidth(tTabValues[tabCc].tabFillChar, hl->fontSize());
int coun = static_cast<int>((hl->glyph.xoffset - tabDist) / wt);
double sPos = hl->glyph.xoffset - (hl->glyph.xoffset - tabDist) + 1;
hl2.ch = QString(tTabValues[tabCc].tabFillChar);
2359,7 → 2360,7
setTextCh(Doc, ite, gcr, a, d, &hl2, pstyle, pg, sep, farb, ic, master);
}
setTextCh(Doc, ite, gcr, a, d, hl, pstyle, pg, sep, farb, ic, master);
tabDist = hl->glyph.xoffset + Cwidth(Doc, hl->font(), hl->ch, hl->fontSize()) * (hl->scaleH() / 1000.0);
tabDist = hl->glyph.xoffset + hl->font().charWidth(hl->ch[0], hl->fontSize()) * (hl->scaleH() / 1000.0);
}
#endif
}
2377,15 → 2378,15
if (hl->effects() & 2048)
{
if (pstyle.useBaselineGrid())
tsz = qRound(10 * ((Doc->typographicSettings.valueBaseGrid * (pstyle.dropCapLines()-1)+(hl->font()->ascent() * (pstyle.charStyle().fontSize() / 10.0))) / (RealCHeight(Doc, hl->font(), chstr, 10))));
tsz = qRound(10 * ((Doc->typographicSettings.valueBaseGrid * (pstyle.dropCapLines()-1)+(hl->font().ascent(pstyle.charStyle().fontSize() / 10.0))) / (hl->font().realCharHeight(chstr[0], 10))));
else
{
if (pstyle.lineSpacingMode() == ParagraphStyle::FixedLineSpacing)
tsz = qRound(10 * ((pstyle.lineSpacing() * (pstyle.dropCapLines()-1)+(hl->font()->ascent() * (pstyle.charStyle().fontSize() / 10.0))) / (RealCHeight(Doc, hl->font(), chstr, 10))));
tsz = qRound(10 * ((pstyle.lineSpacing() * (pstyle.dropCapLines()-1)+(hl->font().ascent(pstyle.charStyle().fontSize() / 10.0))) / (hl->font().realCharHeight(chstr[0], 10))));
else
{
double currasce = RealFHeight(Doc, hl->font(), pstyle.charStyle().fontSize());
tsz = qRound(10 * ((currasce * (pstyle.dropCapLines()-1)+(hl->font()->ascent() * (pstyle.charStyle().fontSize() / 10.0))) / RealCHeight(Doc, hl->font(), chstr, 10)));
double currasce = hl->font().height(pstyle.charStyle().fontSize());
tsz = qRound(10 * ((currasce * (pstyle.dropCapLines()-1)+(hl->font().ascent(pstyle.charStyle().fontSize() / 10.0))) / hl->font().realCharHeight(chstr[0], 10)));
}
}
}
2483,11 → 2484,11
if (hl->effects() & 2)
tsz = hl->fontSize() * Doc->typographicSettings.scalingSuperScript / 100;
/* Subset all TTF Fonts until the bug in the TTF-Embedding Code is fixed */
Foi::FontType ftype = hl->font()->type();
if ((ftype == Foi::TTF) || (hl->font()->isOTF()) || (hl->font()->subset()))
ScFace::FontType ftype = hl->font().type();
if ((ftype == ScFace::TTF) || (hl->font().isOTF()) || (hl->font().subset()))
{
uint chr = chstr[0].unicode();
if ((hl->font()->canRender(chstr[0])) && (chr != 32))
if ((hl->font().canRender(chstr[0])) && (chr != 32))
{
PS_save();
if (ite->reversed())
2501,10 → 2502,10
ctx = " ";
if (ctx == QChar(0xA0))
ctx = " ";
wideR = -Cwidth(Doc, hl->font(), chstr, tsz, ctx) * (hl->scaleH() / 1000.0);
wideR = - hl->font().charWidth(chstr[0], tsz, ctx[0]) * (hl->scaleH() / 1000.0);
}
else
wideR = -Cwidth(Doc, hl->font(), chstr, tsz) * (hl->scaleH() / 1000.0);
wideR = - hl->font().charWidth(chstr[0], tsz) * (hl->scaleH() / 1000.0);
PS_translate(wideR, 0);
}
else
2526,7 → 2527,7
PutSeite(ToStr(hl->fillShade() / 100.0)+" "+spotMap[hl->fillColor()]);
else
PutSeite(FillColor + " cmyk");
PS_showSub(chr, hl->font()->RealName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ), tsz / 10.0, false);
PS_showSub(chr, hl->font().psName().simplifyWhiteSpace().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ), tsz / 10.0, false);
}
PS_restore();
}
2533,27 → 2534,29
}
else
{
PS_selectfont(hl->font()->scName(), tsz / 10.0);
PS_selectfont(hl->font().scName(), tsz / 10.0);
PS_save();
PS_translate(hl->glyph.xoffset, -hl->glyph.yoffset);
if (ite->reversed())
{
int chs = hl->fontSize();
ite->SetZeichAttr(*hl, &chs, &chstr);
GlyphLayout dummy;
ite->layoutGlyphs(*hl, chstr, dummy);
// chs = ??? FIXME
PS_scale(-1, 1);
if (ite->frameDisplays(d+1))
{
QString ctx = ite->itemText.text(d+1, 1);
if (ctx == QChar(29))
if (ctx[0] == QChar(29))
ctx = " ";
if (ctx == QChar(0xA0))
if (ctx[0] == QChar(0xA0))
ctx = " ";
wideR = -Cwidth(Doc, hl->font(), chstr, chs, ctx) * (hl->scaleH() / 1000.0);
wideR = - hl->font().charWidth(chstr[0], chs, ctx[0]) * (hl->scaleH() / 1000.0);
PS_translate(wideR, 0);
}
else
{
wideR = -Cwidth(Doc, hl->font(), chstr, chs) * (hl->scaleH() / 1000.0);
wideR = -hl->font().charWidth(chstr[0], chs) * (hl->scaleH() / 1000.0);
PS_translate(wideR, 0);
}
}
2570,18 → 2573,19
if ((colorsToUse[hl->fillColor()].isSpotColor()) && (!DoSep))
{
PutSeite(ToStr(hl->fillShade() / 100.0)+" "+spotMap[hl->fillColor()]);
PS_show_xyG(hl->font()->scName(), chstr, 0, 0, true);
PS_show_xyG(hl->font().scName(), chstr, 0, 0, true);
}
else
PS_show_xyG(hl->font()->scName(), chstr, 0, 0, false);
PS_show_xyG(hl->font().scName(), chstr, 0, 0, false);
}
PS_restore();
}
if ((hl->effects() & 4) && (chstr != QChar(13)))
{
if (hl->font()->canRender(chstr[0]))
if (hl->font().canRender(chstr[0]))
{
FPointArray gly = hl->font()->outline(chstr[0]);
uint gl = hl->font().char2CMap(chstr[0]);
FPointArray gly = hl->font().glyphOutline(gl);
QWMatrix chma, chma2, chma3;
chma.scale(tsz / 100.0, tsz / 100.0);
chma2.scale(hl->scaleH() / 1000.0, hl->scaleV() / 1000.0);
2615,7 → 2619,7
}
if ((hl->effects() & 16) && (chstr != QChar(13)))
{
double Ulen = Cwidth(Doc, hl->font(), chstr, hl->fontSize()) * (hl->scaleH() / 1000.0);
double Ulen = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->scaleH() / 1000.0);
double Upos, lw, kern;
if (hl->effects() & 16384)
kern = 0;
2624,18 → 2628,18
if ((hl->strikethruOffset() != -1) || (hl->strikethruWidth() != -1))
{
if (hl->strikethruOffset() != -1)
Upos = (hl->strikethruOffset() / 1000.0) * (hl->font()->ascent() * (hl->fontSize() / 10.0));
Upos = (hl->strikethruOffset() / 1000.0) * (hl->font().ascent(hl->fontSize() / 10.0));
else
Upos = hl->font()->strikeoutPos() * (hl->fontSize() / 10.0);
Upos = hl->font().strikeoutPos(hl->fontSize() / 10.0);
if (hl->strikethruWidth() != -1)
lw = (hl->strikethruWidth() / 1000.0) * (hl->fontSize() / 10.0);
else
lw = QMAX(hl->font()->strokeWidth() * (hl->fontSize() / 10.0), 1);
lw = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
else
{
Upos = hl->font()->strikeoutPos() * (hl->fontSize() / 10.0);
lw = QMAX(hl->font()->strokeWidth() * (hl->fontSize() / 10.0), 1);
Upos = hl->font().strikeoutPos(hl->fontSize() / 10.0);
lw = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
if (hl->baselineOffset() != 0)
Upos += (hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0);
2653,7 → 2657,7
}
if (((hl->effects() & 8) && (chstr != QChar(13))) || ((hl->effects() & 512) && (!chstr[0].isSpace())))
{
double Ulen = Cwidth(Doc, hl->font(), chstr, hl->fontSize()) * (hl->scaleH() / 1000.0);
double Ulen = hl->font().charWidth(chstr[0], hl->fontSize()) * (hl->scaleH() / 1000.0);
double Upos, lw, kern;
if (hl->effects() & 16384)
kern = 0;
2662,18 → 2666,18
if ((hl->underlineOffset() != -1) || (hl->underlineWidth() != -1))
{
if (hl->underlineOffset() != -1)
Upos = (hl->underlineOffset() / 1000.0) * (hl->font()->descent() * (hl->fontSize() / 10.0));
Upos = (hl->underlineOffset() / 1000.0) * (hl->font().descent(hl->fontSize() / 10.0));
else
Upos = hl->font()->underlinePos() * (hl->fontSize() / 10.0);
Upos = hl->font().underlinePos(hl->fontSize() / 10.0);
if (hl->underlineWidth() != -1)
lw = (hl->underlineWidth() / 1000.0) * (hl->fontSize() / 10.0);
else
lw = QMAX(hl->font()->strokeWidth() * (hl->fontSize() / 10.0), 1);
lw = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
else
{
Upos = hl->font()->underlinePos() * (hl->fontSize() / 10.0);
lw = QMAX(hl->font()->strokeWidth() * (hl->fontSize() / 10.0), 1);
Upos = hl->font().underlinePos(hl->fontSize() / 10.0);
lw = QMAX(hl->font().strokeWidth(hl->fontSize() / 10.0), 1);
}
if (hl->baselineOffset() != 0)
Upos += (hl->fontSize() / 10.0) * (hl->baselineOffset() / 1000.0);
2692,12 → 2696,15
if (hl->effects() & 8192)
{
int chs = hl->fontSize();
ite->SetZeichAttr(*hl, &chs, &chstr);
double wide = Cwidth(Doc, hl->font(), chstr, chs) * (hl->scaleH() / 1000.0);
GlyphLayout dummy;
ite->layoutGlyphs(*hl, chstr, dummy);
// chs = ???
double wide = hl->font().charWidth(chstr[0], chs) * (hl->scaleH() / 1000.0);
chstr = "-";
if (hl->font()->canRender(chstr[0]))
if (hl->font().canRender(chstr[0]))
{
FPointArray gly = hl->font()->outline(chstr[0]);
uint gl = hl->font().char2CMap(chstr[0]);
FPointArray gly = hl->font().glyphOutline(gl);
QWMatrix chma;
chma.scale(tsz / 100.0, tsz / 100.0);
gly.map(chma);
/branches/Version13x/Scribus/scribus/CMakeLists.txt
16,6 → 16,7
ADD_SUBDIRECTORY(swatches)
ADD_SUBDIRECTORY(templates)
ADD_SUBDIRECTORY(text)
ADD_SUBDIRECTORY(fonts)
ADD_SUBDIRECTORY(desaxe)
 
 
360,8 → 361,6
sccombobox.cpp
scinputdialog.cpp
scfonts.cpp
scfonts_ttf.cpp
scfontmetrics.cpp
scimage.cpp
scimagestructs.cpp
scimgdataloader.cpp
452,6 → 451,7
LINK_DIRECTORIES(
desaxe
text
fonts
pixbuf
)
 
462,6 → 462,7
SET(SCRIBUS_LIBART_LIB "scribus_libart_lib")
SET(SCRIBUS_PIXBUF_LIB "scribus_pixbuf_lib")
SET(SCRIBUS_TEXT_LIB "scribus_text_lib")
SET(SCRIBUS_FONTS_LIB "scribus_fonts_lib")
SET(SCRIBUS_DESAXE_LIB "scribus_desaxe_lib")
 
INCLUDE_DIRECTORIES(
468,6 → 469,7
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/text"
"${CMAKE_CURRENT_SOURCE_DIR}/fonts"
"${CMAKE_CURRENT_SOURCE_DIR}/desaxe"
)
 
478,6 → 480,7
${SCRIBUS_SOURCES}
${SCRIBUS_UI_CPP}
${SCRIBUS_TEXT_SOURCES}
${SCRIBUS_FONTS_SOURCES}
${SCRIBUS_DESAXE_SOURCES}
)
 
484,6 → 487,7
TARGET_LINK_LIBRARIES(${EXE_NAME}
${SCRIBUS_DESAXE_LIB}
${SCRIBUS_TEXT_LIB}
${SCRIBUS_FONTS_LIB}
${SCRIBUS_PIXBUF_LIB}
)
 
/branches/Version13x/Scribus/scribus/pageitem_polygon.h
42,7 → 42,6
class ScribusDoc;
class UndoManager;
class UndoState;
class Foi;
struct CopyPasteBuffer;
 
class SCRIBUS_API PageItem_Polygon : public PageItem
/branches/Version13x/Scribus/scribus/smtextstyles.cpp
140,7 → 140,7
/******************************************************************************/
/******************************************************************************/
 
SMParagraphStyle::SMParagraphStyle() : StyleItem(), pwidget_(0)
SMParagraphStyle::SMParagraphStyle() : StyleItem(), pwidget_(0), doc_(NULL)
{
 
}
166,7 → 166,7
{
Q_ASSERT(doc);
doc_ = doc;
tmpPStyles_ = doc_->docParagraphStyles;
// tmpPStyles_ = doc_->docParagraphStyles;
}
 
QValueList<StyleName> SMParagraphStyle::styles()
173,12 → 173,12
{
QValueList<StyleName> tmpList;
 
if (tmpPStyles_.count() < 6)
if (!doc_ || doc_->docParagraphStyles.count() < 6)
return tmpList;
 
for (uint x = 5; x < tmpPStyles_.count(); ++x)
tmpList << StyleName(tmpPStyles_[x].name(),
tmpPStyles_[x].parent() ? tmpPStyles_[x].parent()->name() : QString::null);
for (uint x = 5; x < doc_->docParagraphStyles.count(); ++x)
tmpList << StyleName(doc_->docParagraphStyles[x].name(),
doc_->docParagraphStyles[x].parent() ? doc_->docParagraphStyles[x].parent()->name() : QString::null);
 
return tmpList;
}