src/gui/text/qfontengine_qpf.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 37 758a864f9613
--- a/src/gui/text/qfontengine_qpf.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/gui/text/qfontengine_qpf.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -920,8 +920,18 @@
 
     if (!renderingFontEngine)
         return;
-
-    QImage img = renderingFontEngine->alphaMapForGlyph(glyph).convertToFormat(QImage::Format_Indexed8);
+    QImage img = renderingFontEngine->alphaMapForGlyph(glyph);
+    if (img.format() != QImage::Format_Indexed8) {
+        bool mono = img.depth() == 1;
+        img = img.convertToFormat(QImage::Format_Indexed8);
+        if (mono) {
+            //### we know that 1 is opaque and 0 is transparent
+            uchar *byte = img.bits();
+            int count = img.byteCount();
+            while (count--)
+                *byte++ *= 0xff;
+        }
+    }
     glyph_metrics_t metrics = renderingFontEngine->boundingBox(glyph);
     renderingFontEngine->removeGlyphFromCache(glyph);