r17777 by jghali - #11094: Excessive line spacing in exported pdf form fields

scribus-commit scribus-commit at lists.scribus.net
Wed Sep 26 19:18:10 UTC 2012


Author: jghali
Date: Wed Sep 26 19:18:09 2012
New Revision: 17777

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17777
Log:
#11094: Excessive line spacing in exported pdf form fields

Modified:
    branches/Version14x/Scribus/scribus/fonts/ftface.cpp
    branches/Version14x/Scribus/scribus/fonts/ftface.h
    branches/Version14x/Scribus/scribus/fonts/scface.cpp
    branches/Version14x/Scribus/scribus/fonts/scface.h
    branches/Version14x/Scribus/scribus/fonts/scface_ttf.cpp
    branches/Version14x/Scribus/scribus/pdflib_core.cpp

Modified: branches/Version14x/Scribus/scribus/fonts/ftface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17777&path=/branches/Version14x/Scribus/scribus/fonts/ftface.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/fonts/ftface.cpp (original)
+++ branches/Version14x/Scribus/scribus/fonts/ftface.cpp Wed Sep 26 19:18:09 2012
@@ -111,11 +111,14 @@
 	m_strikeoutPos = m_ascent / 3;
 	m_strokeWidth = m_face->underline_thickness / m_uniEM;
 	const_cast<FtFace*>(this)->isFixedPitch = m_face->face_flags & 4;
-	Ascent = QString::number(m_face->ascender);
-	CapHeight = QString::number(m_face->height);
-	Descender = QString::number(m_face->descender);
-	FontBBox = QString::number(m_face->bbox.xMin)+" "+QString::number(m_face->bbox.yMin)+" "+QString::number(m_face->bbox.xMax)+" "+QString::number(m_face->bbox.yMax);
-	ItalicAngle = "0";
+	m_pdfAscent    = QString::number(m_face->ascender / m_uniEM * 1000);
+	m_pdfCapHeight = QString::number(m_face->height / m_uniEM * 1000);
+	m_pdfDescender = QString::number(m_face->descender / m_uniEM * 1000);
+	m_pdfFontBBox  = QString::number(m_face->bbox.xMin / m_uniEM * 1000) + " " + 
+	            QString::number(m_face->bbox.yMin / m_uniEM * 1000) + " " +
+	            QString::number(m_face->bbox.xMax / m_uniEM * 1000) + " " + 
+	            QString::number(m_face->bbox.yMax / m_uniEM * 1000);
+	m_italicAngle  = "0";
 
 //FIXME:	FT_Set_Charmap(m_face, m_face->charmaps[m_encoding]);
 	setBestEncoding(m_face);

Modified: branches/Version14x/Scribus/scribus/fonts/ftface.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17777&path=/branches/Version14x/Scribus/scribus/fonts/ftface.h
==============================================================================
--- branches/Version14x/Scribus/scribus/fonts/ftface.h (original)
+++ branches/Version14x/Scribus/scribus/fonts/ftface.h Wed Sep 26 19:18:09 2012
@@ -70,11 +70,11 @@
 	qreal underlinePos(qreal sz=1.0)    const { return m_underlinePos * sz; }
 	qreal strokeWidth(qreal /*sz*/)     const { return m_strokeWidth; }
 	qreal maxAdvanceWidth(qreal sz=1.0) const { return m_maxAdvanceWidth * sz; }
-	QString ascentAsString()    const { return Ascent; }
-	QString descentAsString()    const { return Descender; }
-	QString capHeightAsString()    const { return CapHeight; }
-	QString FontBBoxAsString()    const { return FontBBox; }
-	QString ItalicAngleAsString()    const { return ItalicAngle; }
+	QString pdfAscentAsString()      const { return m_pdfAscent; }
+	QString pdfDescentAsString()     const { return m_pdfDescender; }
+	QString pdfCapHeightAsString()   const { return m_pdfCapHeight; }
+	QString pdfFontBBoxAsString()    const { return m_pdfFontBBox; }
+	QString ItalicAngleAsString()    const { return m_italicAngle; }
 	
 	
 //FIXME	QMap<QString,QString> fontDictionary(qreal sz=1.0)      const;
@@ -95,13 +95,13 @@
 	
 	static FT_Library library;
 
-	mutable QString Ascent;
-	mutable QString CapHeight;
-	mutable QString Descender;
-	mutable QString ItalicAngle;
+	mutable QString m_pdfAscent;
+	mutable QString m_pdfCapHeight;
+	mutable QString m_pdfDescender;
+	mutable QString m_italicAngle;
+	mutable QString m_pdfFontBBox;
 	mutable QString StdVW;
 	QString FontEnc;
-	mutable QString FontBBox;
 
 	mutable int m_encoding;
 	

Modified: branches/Version14x/Scribus/scribus/fonts/scface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17777&path=/branches/Version14x/Scribus/scribus/fonts/scface.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/fonts/scface.cpp (original)
+++ branches/Version14x/Scribus/scribus/fonts/scface.cpp Wed Sep 26 19:18:09 2012
@@ -208,35 +208,35 @@
 	return NONE; 
 }
 
-QString ScFace::ascentAsString() const
-{
-	if (m->status == ScFace::UNKNOWN) {
-		m->load();
-	}
-	return m->ascentAsString();
-}
-
-QString ScFace::descentAsString() const
-{
-	if (m->status == ScFace::UNKNOWN) {
-		m->load();
-	}
-	return m->descentAsString();
-}
-QString ScFace::capHeightAsString() const
-{
-	if (m->status == ScFace::UNKNOWN) {
-		m->load();
-	}
-	return m->capHeightAsString();
-}
-
-QString ScFace::fontBBoxAsString() const
-{
-	if (m->status == ScFace::UNKNOWN) {
-		m->load();
-	}
-	return m->FontBBoxAsString();
+QString ScFace::pdfAscentAsString() const
+{
+	if (m->status == ScFace::UNKNOWN) {
+		m->load();
+	}
+	return m->pdfAscentAsString();
+}
+
+QString ScFace::pdfDescentAsString() const
+{
+	if (m->status == ScFace::UNKNOWN) {
+		m->load();
+	}
+	return m->pdfDescentAsString();
+}
+QString ScFace::pdfCapHeightAsString() const
+{
+	if (m->status == ScFace::UNKNOWN) {
+		m->load();
+	}
+	return m->pdfCapHeightAsString();
+}
+
+QString ScFace::pdfFontBBoxAsString() const
+{
+	if (m->status == ScFace::UNKNOWN) {
+		m->load();
+	}
+	return m->pdfFontBBoxAsString();
 }
 
 QString ScFace::italicAngleAsString() const

Modified: branches/Version14x/Scribus/scribus/fonts/scface.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17777&path=/branches/Version14x/Scribus/scribus/fonts/scface.h
==============================================================================
--- branches/Version14x/Scribus/scribus/fonts/scface.h (original)
+++ branches/Version14x/Scribus/scribus/fonts/scface.h Wed Sep 26 19:18:09 2012
@@ -161,12 +161,12 @@
 
 		// dummy implementations
 		virtual qreal ascent(qreal sz)           const { return sz; }
-		virtual QString ascentAsString()    const { return "0" ; }
-		virtual QString descentAsString()    const { return "0"; }
-		virtual QString capHeightAsString()    const { return "0"; }
-		virtual QString FontBBoxAsString()    const { return "0 0 0 0"; }
+		virtual QString pdfAscentAsString()      const { return "0" ; }
+		virtual QString pdfDescentAsString()     const { return "0"; }
+		virtual QString pdfCapHeightAsString()   const { return "0"; }
+		virtual QString pdfFontBBoxAsString()    const { return "0 0 0 0"; }
 		virtual QString ItalicAngleAsString()    const { return "0"; }
-		virtual qreal descent(qreal /*sz*/)          const { return 0.0; }
+		virtual qreal descent(qreal /*sz*/)      const { return 0.0; }
 		virtual qreal xHeight(qreal sz)          const { return sz; }
 		virtual qreal capHeight(qreal sz)        const { return sz; }
 		virtual qreal height(qreal sz)           const { return sz; }
@@ -308,11 +308,11 @@
 	QString variant()  const { return m->variant; }
 	
 	// font metrics
-	QString ascentAsString()      const;
-	QString descentAsString()     const;
-	QString capHeightAsString()   const;
-	QString fontBBoxAsString()    const;
-	QString italicAngleAsString() const;
+	QString pdfAscentAsString()      const;
+	QString pdfDescentAsString()     const;
+	QString pdfCapHeightAsString()   const;
+	QString pdfFontBBoxAsString()    const;
+	QString italicAngleAsString()    const;
 	qreal ascent(qreal sz=1.0)          const;
 	qreal descent(qreal sz=1.0)         const;
 	qreal xHeight(qreal sz=1.0)         const;

Modified: branches/Version14x/Scribus/scribus/fonts/scface_ttf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17777&path=/branches/Version14x/Scribus/scribus/fonts/scface_ttf.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/fonts/scface_ttf.cpp (original)
+++ branches/Version14x/Scribus/scribus/fonts/scface_ttf.cpp Wed Sep 26 19:18:09 2012
@@ -603,7 +603,7 @@
 	str+="/FontName /" + psName + " 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+="/FontBBox ["+m_pdfFontBBox+"] def\n";
 	str+="/FontType 42 def\n";
 	str+="/FontInfo 8 dict dup begin\n";
 	str+="/FamilyName (" + psName + ") def\n";

Modified: branches/Version14x/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17777&path=/branches/Version14x/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/pdflib_core.cpp (original)
+++ branches/Version14x/Scribus/scribus/pdflib_core.cpp Wed Sep 26 19:18:09 2012
@@ -1368,8 +1368,8 @@
 			StartObj(fontDescriptor);
 			// TODO: think about QByteArray ScFace::getFontDescriptor() -- AV
 			PutDoc("<<\n/Type /FontDescriptor\n");
-			PutDoc("/FontName /"+face.psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+"\n");
-			PutDoc("/FontBBox [ "+face.fontBBoxAsString()+" ]\n");
+			PutDoc("/FontName /"  + face.psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" ) + "\n");
+			PutDoc("/FontBBox [ " + face.pdfFontBBoxAsString()+" ]\n");
 			PutDoc("/Flags ");
 			//FIXME: isItalic() should be queried from ScFace, not from Qt -- AV
 			//QFontInfo fo = QFontInfo(it.data());
@@ -1382,15 +1382,10 @@
 //			pfl = pfl ^ 4;
 			pfl = pfl ^ 32;
 			PutDoc(QString::number(pfl)+"\n");
-			PutDoc("/Ascent "+face.ascentAsString()+"\n");
-			PutDoc("/Descent "+face.descentAsString()+"\n");
-			PutDoc("/CapHeight "+face.capHeightAsString()+"\n");
-			PutDoc("/ItalicAngle "+face.italicAngleAsString()+"\n");
-//			PutDoc("/Ascent "+QString::number(static_cast<int>(face.ascent()))+"\n");
-//			PutDoc("/Descent "+QString::number(static_cast<int>(face.descent()))+"\n");
-//			PutDoc("/CapHeight "+QString::number(static_cast<int>(face.capHeight()))+"\n");
-//			PutDoc("/ItalicAngle "+face.italicAngle()+"\n");
-//			PutDoc("/StemV "+ face.stemV() + "\n");
+			PutDoc("/Ascent "      + face.pdfAscentAsString()+"\n");
+			PutDoc("/Descent "     + face.pdfDescentAsString()+"\n");
+			PutDoc("/CapHeight "   + face.pdfCapHeightAsString()+"\n");
+			PutDoc("/ItalicAngle " + face.italicAngleAsString()+"\n");
 			PutDoc("/StemV 1\n");
 			if ((fformat == ScFace::SFNT || fformat == ScFace::TTCF) && (Options.EmbedList.contains(it.key())))
 				PutDoc("/FontFile2 "+QString::number(embeddedFontObject)+" 0 R\n");




More information about the scribus-commit mailing list