r13917 by jghali - fix hang in PageItem::layout() caused by improper access to font data : ensure font is loaded before trying to access font metrics
scribus-commit
scribus-commit at lists.scribus.net
Wed Aug 26 05:57:55 CEST 2009
Revision: 13917
Author: jghali
Date: 2009-08-25T20:40:56.668777Z
Commit message: fix hang in PageItem::layout() caused by improper access to font data : ensure font is loaded before trying to access font metrics
Changeset:
M /trunk/Scribus/scribus/fonts/scface.cpp
M /trunk/Scribus/scribus/fonts/scface.h
Diffs:
Index: scribus/fonts/scface.cpp
===================================================================
--- scribus/fonts/scface.cpp (revision 13916)
+++ scribus/fonts/scface.cpp (revision 13917)
@@ -196,7 +196,77 @@
return NONE;
}
+qreal ScFace::ascent(qreal sz) const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->ascent(sz);
+}
+qreal ScFace::descent(qreal sz) const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->descent(sz);
+}
+qreal ScFace::xHeight(qreal sz) const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->xHeight(sz);
+}
+
+qreal ScFace::capHeight(qreal sz) const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->capHeight(sz);
+}
+
+qreal ScFace::height(qreal sz) const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->height(sz);
+}
+
+qreal ScFace::strikeoutPos(qreal sz) const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->strikeoutPos(sz);
+}
+
+qreal ScFace::underlinePos(qreal sz) const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->underlinePos(sz);
+}
+
+qreal ScFace::strokeWidth(qreal sz) const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->strokeWidth(sz);
+}
+
+qreal ScFace::maxAdvanceWidth(qreal sz) const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->maxAdvanceWidth(sz);
+}
+
void ScFace::increaseUsage() const
{
m->usage++;
Index: scribus/fonts/scface.h
===================================================================
--- scribus/fonts/scface.h (revision 13916)
+++ scribus/fonts/scface.h (revision 13917)
@@ -301,20 +301,20 @@
QString variant() const { return m->variant; }
// font metrics
- qreal ascent(qreal sz=1.0) const { return m->ascent(sz); }
QString ascentAsString() const { return m->ascentAsString() ; }
QString descentAsString() const { return m->descentAsString() ; }
QString capHeightAsString() const { return m->capHeightAsString() ; }
QString FontBBoxAsString() const { return m->FontBBoxAsString() ; }
QString ItalicAngleAsString() const { return m->ItalicAngleAsString() ; }
- qreal descent(qreal sz=1.0) const { return m->descent(sz); }
- qreal xHeight(qreal sz=1.0) const { return m->xHeight(sz); }
- qreal capHeight(qreal sz=1.0) const { return m->capHeight(sz); }
- qreal height(qreal sz=1.0) const { return m->height(sz); }
- qreal strikeoutPos(qreal sz=1.0) const { return m->strikeoutPos(sz); }
- qreal underlinePos(qreal sz=1.0) const { return m->underlinePos(sz); }
- qreal strokeWidth(qreal sz=1.0) const { return m->strokeWidth(sz); }
- qreal maxAdvanceWidth(qreal sz=1.0) const { return m->maxAdvanceWidth(sz); }
+ qreal ascent(qreal sz=1.0) const;
+ qreal descent(qreal sz=1.0) const;
+ qreal xHeight(qreal sz=1.0) const;
+ qreal capHeight(qreal sz=1.0) const;
+ qreal height(qreal sz=1.0) const;
+ qreal strikeoutPos(qreal sz=1.0) const;
+ qreal underlinePos(qreal sz=1.0) const;
+ qreal strokeWidth(qreal sz=1.0) const;
+ qreal maxAdvanceWidth(qreal sz=1.0) const;
/// deprecated
QString stemV(qreal sz=1.0) const { return fontDictionary(sz)["/StemV"]; }
More information about the scribus-commit
mailing list