Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31721

Context2D's font set to a default-constructed QFont when invalid font assigned

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.2.0
    • 5.1.0 Beta 1
    • None
    • 2d065ddb53a31c1b717c88902bcdf4f6b24f320f

    Description

      import QtQuick 2.0
      
      Item {
          width: 500
          height: 400
      
          Canvas {
              anchors.fill: parent
              anchors.margins: 100
      
              onPaint: {
                  var ctx = getContext("2d");
                  ctx.reset();
                  ctx.fillStyle = "#FF0000";
                  ctx.fillText(ctx.font, 0, 10);
      
                  ctx.font = "ffffff";
                  ctx.fillText(ctx.font, 0, 20);
              }
          }
      }
      

      Output:

      sans-serif,-1,10,5,50,0,0,0,0,0
      ffffff,9,-1,5,50,0,0,0,0,0

      As mentioned in the comments of the function, qt_font_from_string() needs to be rewritten: http://qt.gitorious.org/qt/qtdeclarative/blobs/stable/src/quick/items/context2d/qquickcontext2d.cpp#line195

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mitch_curtis Mitch Curtis
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes