Text anti-aliasing on Windows



  • I want to write a book reader software, but webkit's text render is not smooth on Windows, is there some way to enable text anti-aliasing?

    Or let Qt's text render engine be the base of webkit, I think...



  • I would take a look at "QPainter":http://developer.qt.nokia.com/doc/qt-4.8/qpainter.html#rendering-quality

    "The RenderHint enum specifies flags to QPainter that may or may not be respected by any given engine. QPainter::Antialiasing indicates that the engine should antialias edges of primitives if possible, QPainter::TextAntialiasing indicates that the engine should antialias text if possiblThe RenderHint enum specifies flags to QPainter that may or may not be respected by any given engine. QPainter::Antialiasing indicates that the engine should antialias edges of primitives if possible, QPainter::TextAntialiasing indicates that the engine should antialias text if possible, and the QPainter::SmoothPixmapTransform indicates that the engine should use a smooth pixmap transformation algorithm. HighQualityAntialiasing is an OpenGL-specific rendering hint indicating that the engine should use fragment programs and offscreen rendering for antialiasing.

    The renderHints() function returns a flag that specifies the rendering hints that are set for this painter. Use the setRenderHint() function to set or clear the currently set RenderHints.e, and the QPainter::SmoothPixmapTransform indicates that the engine should use a smooth pixmap transformation algorithm. HighQualityAntialiasing is an OpenGL-specific rendering hint indicating that the engine should use fragment programs and offscreen rendering for antialiasing.

    The renderHints() function returns a flag that specifies the rendering hints that are set for this painter. Use the setRenderHint() function to set or clear the currently set RenderHints"



  • But how to enable in webview?
    [quote author="Blizzard" date="1330102466"]I would take a look at "QPainter":http://developer.qt.nokia.com/doc/qt-4.8/qpainter.html#rendering-quality

    "The RenderHint enum specifies flags to QPainter that may or may not be respected by any given engine. QPainter::Antialiasing indicates that the engine should antialias edges of primitives if possible, QPainter::TextAntialiasing indicates that the engine should antialias text if possiblThe RenderHint enum specifies flags to QPainter that may or may not be respected by any given engine. QPainter::Antialiasing indicates that the engine should antialias edges of primitives if possible, QPainter::TextAntialiasing indicates that the engine should antialias text if possible, and the QPainter::SmoothPixmapTransform indicates that the engine should use a smooth pixmap transformation algorithm. HighQualityAntialiasing is an OpenGL-specific rendering hint indicating that the engine should use fragment programs and offscreen rendering for antialiasing.

    The renderHints() function returns a flag that specifies the rendering hints that are set for this painter. Use the setRenderHint() function to set or clear the currently set RenderHints.e, and the QPainter::SmoothPixmapTransform indicates that the engine should use a smooth pixmap transformation algorithm. HighQualityAntialiasing is an OpenGL-specific rendering hint indicating that the engine should use fragment programs and offscreen rendering for antialiasing.

    The renderHints() function returns a flag that specifies the rendering hints that are set for this painter. Use the setRenderHint() function to set or clear the currently set RenderHints"[/quote]



  • @
    m_view.setRenderHints( //replace m_view with the name of your QWebView
    RenderHint.Antialiasing,
    RenderHint.HighQualityAntialiasing,
    RenderHint.SmoothPixmapTransform,
    RenderHint.TextAntialiasing,
    RenderHint.NonCosmeticDefaultPen);
    @

    I have not tested this code, apparently it works for everything except rounded corners, which may not be supported.



  • Please keep us posted with your progress


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.