summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp8
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp9
-rw-r--r--src/gui/styles/qs60style.cpp38
-rw-r--r--src/gui/text/qfontengine_s60.cpp68
-rw-r--r--src/gui/text/qfontengine_s60_p.h13
5 files changed, 85 insertions, 51 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 793bcde..e5ab300 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -101,11 +101,7 @@ QCoeFepInputContext::~QCoeFepInputContext()
void QCoeFepInputContext::reset()
{
- commitTemporaryPreeditString();
-
- CCoeFep* fep = CCoeEnv::Static()->Fep();
- if (fep)
- fep->CancelTransaction();
+ commitCurrentString(false);
}
void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType)
@@ -290,7 +286,6 @@ void QCoeFepInputContext::commitTemporaryPreeditString()
return;
commitCurrentString(false);
- m_hasTempPreeditString = false;
}
void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event)
@@ -765,6 +760,7 @@ void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian)
m_preeditString.clear();
sendEvent(event);
+ m_hasTempPreeditString = false;
m_longPress = 0;
if (!triggeredBySymbian) {
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 3f2322e..bc56ed0 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3081,6 +3081,8 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti)
QVarLengthArray<glyph_t> glyphs;
QTransform matrix = s->matrix;
matrix.translate(p.x(), p.y());
+ if (matrix.type() == QTransform::TxScale)
+ fe->setFontScale(matrix.m11());
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
const QFixed aliasDelta = QFixed::fromReal(aliasedCoordinateDelta);
@@ -3097,6 +3099,9 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti)
alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight);
}
+ if (matrix.type() == QTransform::TxScale)
+ fe->setFontScale(1.0);
+
return;
}
#endif // Q_OS_SYMBIAN && QT_NO_FREETYPE
@@ -3269,7 +3274,9 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
}
#elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_WS_WIN || Q_WS_MAC
- if (s->matrix.type() <= QTransform::TxTranslate) {
+ if (s->matrix.type() <= QTransform::TxTranslate
+ || (s->matrix.type() == QTransform::TxScale
+ && (qFuzzyCompare(s->matrix.m11(), s->matrix.m22())))) {
drawGlyphsS60(p, ti);
return;
}
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 9b99161..fc435e8 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -92,10 +92,10 @@ static const qreal goldenRatio = 1.618;
const layoutHeader QS60StylePrivate::m_layoutHeaders[] = {
// *** generated layout data ***
-{240,320,1,15,"QVGA Landscape"},
-{320,240,1,15,"QVGA Portrait"},
-{360,640,1,15,"NHD Landscape"},
-{640,360,1,15,"NHD Portrait"},
+{240,320,1,16,"QVGA Landscape"},
+{320,240,1,16,"QVGA Portrait"},
+{360,640,1,16,"NHD Landscape"},
+{640,360,1,16,"NHD Portrait"},
{352,800,1,12,"E90 Landscape"}
// *** End of generated data ***
};
@@ -104,10 +104,10 @@ const int QS60StylePrivate::m_numberOfLayouts =
const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = {
// *** generated pixel metrics ***
-{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1},
-{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1},
-{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
-{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
+{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1},
+{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1},
+{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
+{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}
// *** End of generated data ***
};
@@ -2400,21 +2400,13 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
break;
#ifndef QT_NO_COMBOBOX
case CT_ComboBox:
- if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
- const int frameWidth = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0;
- const int textMargins = 2*(pixelMetric(PM_FocusFrameHMargin) + 1);
- const int smallestExtraWidth = 23;
- // QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins...
- const int extra =
- qMax(smallestExtraWidth, 2*textMargins + pixelMetric(PM_ScrollBarExtent, opt, widget));
- sz = QSize(sz.width() + frameWidth + extra, sz.height() + frameWidth);
- int maxScreenWidth = QApplication::desktop()->availableGeometry().size().width();
- if (sz.width() > maxScreenWidth) {
- maxScreenWidth = maxScreenWidth - (extra + frameWidth);
- sz.setWidth(maxScreenWidth);
- }
- }
- break;
+ // Fixing Ui design issues with too wide QComboBoxes and greedy SizeHints
+ // Make sure, that the combobox says within the screen.
+ const QSize desktopContentSize = QApplication::desktop()->availableGeometry().size()
+ -QSize(pixelMetric(PM_LayoutLeftMargin) + pixelMetric(PM_LayoutRightMargin), 0);
+ sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget).
+ boundedTo(desktopContentSize);
+ break;
#endif
default:
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index 4625667..9dd4af7 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -129,26 +129,62 @@ static inline unsigned int getChar(const QChar *str, int &i, const int len)
return uc;
}
+CFont *QFontEngineS60::fontWithSize(qreal size) const
+{
+ CFont *result = 0;
+ TFontSpec fontSpec(qt_QString2TPtrC(QFontEngine::fontDef.family), TInt(size));
+ fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
+ fontSpec.iFontStyle.SetPosture(QFontEngine::fontDef.style == QFont::StyleNormal?EPostureUpright:EPostureItalic);
+ fontSpec.iFontStyle.SetStrokeWeight(QFontEngine::fontDef.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal);
+ const TInt errorCode = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(result, fontSpec);
+ Q_ASSERT(result && (errorCode == 0));
+ return result;
+}
+
+void QFontEngineS60::setFontScale(qreal scale)
+{
+ if (qFuzzyCompare(scale, qreal(1))) {
+ if (!m_originalFont)
+ m_originalFont = fontWithSize(m_originalFontSizeInPixels);
+ m_activeFont = m_originalFont;
+ } else {
+ const qreal scaledFontSizeInPixels = m_originalFontSizeInPixels * scale;
+ if (!m_scaledFont ||
+ (TInt(scaledFontSizeInPixels) != TInt(m_scaledFontSizeInPixels))) {
+ releaseFont(m_scaledFont);
+ m_scaledFontSizeInPixels = scaledFontSizeInPixels;
+ m_scaledFont = fontWithSize(m_scaledFontSizeInPixels);
+ }
+ m_activeFont = m_scaledFont;
+ }
+}
+
+void QFontEngineS60::releaseFont(CFont *&font)
+{
+ if (font) {
+ S60->screenDevice()->ReleaseFont(font);
+ font = 0;
+ }
+}
+
QFontEngineS60::QFontEngineS60(const QFontDef &request, const QFontEngineS60Extensions *extensions)
: m_extensions(extensions)
+ , m_originalFont(0)
+ , m_originalFontSizeInPixels((request.pixelSize >= 0)?
+ request.pixelSize:pointsToPixels(request.pointSize))
+ , m_scaledFont(0)
+ , m_scaledFontSizeInPixels(0)
+ , m_activeFont(0)
{
QFontEngine::fontDef = request;
- m_fontSizeInPixels = (request.pixelSize >= 0)?
- request.pixelSize:pointsToPixels(request.pointSize);
-
- TFontSpec fontSpec(qt_QString2TPtrC(request.family), m_fontSizeInPixels);
- fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
- fontSpec.iFontStyle.SetPosture(request.style == QFont::StyleNormal?EPostureUpright:EPostureItalic);
- fontSpec.iFontStyle.SetStrokeWeight(request.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal);
- const TInt errorCode = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(m_font, fontSpec);
- Q_ASSERT(errorCode == 0);
-
+ setFontScale(1.0);
cache_cost = sizeof(QFontEngineS60);
}
QFontEngineS60::~QFontEngineS60()
{
- S60->screenDevice()->ReleaseFont(m_font);
+ releaseFont(m_originalFont);
+ releaseFont(m_scaledFont);
}
bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
@@ -251,12 +287,12 @@ glyph_metrics_t QFontEngineS60::boundingBox(glyph_t glyph)
QFixed QFontEngineS60::ascent() const
{
- return m_font->FontMaxAscent();
+ return m_originalFont->FontMaxAscent();
}
QFixed QFontEngineS60::descent() const
{
- return m_font->FontMaxDescent();
+ return m_originalFont->FontMaxDescent();
}
QFixed QFontEngineS60::leading() const
@@ -266,7 +302,7 @@ QFixed QFontEngineS60::leading() const
qreal QFontEngineS60::maxCharWidth() const
{
- return m_font->MaxCharWidthInPixels();
+ return m_originalFont->MaxCharWidthInPixels();
}
const char *QFontEngineS60::name() const
@@ -302,11 +338,11 @@ void QFontEngineS60::getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metri
const TUint specialCode = (TUint)glyph | 0x80000000;
const CFont::TCharacterDataAvailability availability =
- m_font->GetCharacterData(specialCode, metrics, bitmap, bitmapSize);
+ m_activeFont->GetCharacterData(specialCode, metrics, bitmap, bitmapSize);
const glyph_t fallbackGlyph = '?';
if (availability != CFont::EAllCharacterData) {
const CFont::TCharacterDataAvailability fallbackAvailability =
- m_font->GetCharacterData(fallbackGlyph, metrics, bitmap, bitmapSize);
+ m_activeFont->GetCharacterData(fallbackGlyph, metrics, bitmap, bitmapSize);
Q_ASSERT(fallbackAvailability == CFont::EAllCharacterData);
}
}
diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h
index ff819e2..78f8a9a 100644
--- a/src/gui/text/qfontengine_s60_p.h
+++ b/src/gui/text/qfontengine_s60_p.h
@@ -58,9 +58,6 @@
#include "qsize.h"
#include <OPENFONT.H>
-class CFbsBitmap;
-class CFbsBitmapDevice;
-class CFbsBitGc;
class CFont;
QT_BEGIN_NAMESPACE
@@ -120,15 +117,21 @@ public:
Type type() const;
void getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metrics, const TUint8*& bitmap, TSize& bitmapSize) const;
+ void setFontScale(qreal scale);
private:
friend class QFontPrivate;
QFixed glyphAdvance(HB_Glyph glyph) const;
+ CFont *fontWithSize(qreal size) const;
+ static void releaseFont(CFont *&font);
- CFont* m_font;
const QFontEngineS60Extensions *m_extensions;
- qreal m_fontSizeInPixels;
+ CFont* m_originalFont;
+ const qreal m_originalFontSizeInPixels;
+ CFont* m_scaledFont;
+ qreal m_scaledFontSizeInPixels;
+ CFont* m_activeFont;
};
class QFontEngineMultiS60 : public QFontEngineMulti