Bug 29092

Summary: Fix glyphs rendering for cairo-qpainter-surface
Product: cairo Reporter: Oleg Romashin <romaxa>
Component: qt backendAssignee: Oleg Romashin <romaxa>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: dilfridge, freedesktop
Version: 1.9.13   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch to commit
Remove hidden qt_draw_glyphs usage until qt provide public version
Here is fix for Qt4.8.0 API
Modification of Oleg's patch, with more #ifdef's

Description Oleg Romashin 2010-07-15 21:11:33 UTC
Created attachment 37099 [details] [review]
Patch to commit

Idea is to drop X11 fallback surface from qt cairo backend, and use default glyphs rendering fallback or new Qt 4.7 draw_glyphs api (not yet official)
Comment 2 Chris Wilson 2010-07-16 01:51:11 UTC
ommit 6b92d5a0f9fce28f99b07177454da00f984fdb43
Author: Oleg Romashin <romaxa@gmail.com>
Date:   Fri Jul 16 09:47:23 2010 +0100

    qt: Use native glyph rendering.
    
    Remove the hack of using the xlib surface to do glyph rendering and use
    the new interface introduced with Qt4.7, or else fallback to image
    rendering with freetype.
    
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
    [2 files changed, 35 insertions(+), 140 deletions(-) \o/]
Comment 3 Behdad Esfahbod 2010-07-19 16:50:27 UTC
The patch looks good, except that it's wrong.

You MUST use the freetype face, not just take family name from it and let Qt choose whatever face it wants.  The FT_Face may be coming from a font not even installed on the system.

Can you point me to the QFont API?  I can see if there's a way to use it correctly.
Comment 4 Oleg Romashin 2010-07-19 21:21:15 UTC
I know existing implementation is not perfect, and Qt API is not yet part of stable API.

But the only way to make it stable and design it properly is start to use it, and get feedback,  comments.

> 
> Can you point me to the QFont API?

http://doc.qt.nokia.com/4.6/qfont.html

>  I can see if there's a way to use it
> correctly.

see this 
http://bugreports.qt.nokia.com/browse/QTBUG-8463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

for reference.
Comment 5 Behdad Esfahbod 2010-07-19 22:23:33 UTC
(In reply to comment #4)
> I know existing implementation is not perfect, and Qt API is not yet part of
> stable API.
> 
> But the only way to make it stable and design it properly is start to use it,
> and get feedback,  comments.

It's not that it's not perfect.  It's wrong by design.  Completely against cairo's fidelity standards.

Please add an API that takes a FT_Face.

> > Can you point me to the QFont API?
> 
> http://doc.qt.nokia.com/4.6/qfont.html
> 
> >  I can see if there's a way to use it
> > correctly.
> 
> see this 
> http://bugreports.qt.nokia.com/browse/QTBUG-8463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> 
> for reference.
Comment 6 Oleg Romashin 2010-07-19 23:10:21 UTC
> Please add an API that takes a FT_Face.

this is exactly point of the bug:
http://bugreports.qt.nokia.com/browse/QTBUG-8463?focusedCommentId=112703&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_112703
Comment 7 Oleg Romashin 2010-07-19 23:19:15 UTC
New qt API needed, something like:
QFont & QFont::createQFontFromExternal(QFontEngine::Type aType, void
*aNativeEnginePointer);

Probably I need to create some simple patch which make FT implementation for this API.
Comment 8 Oleg Romashin 2010-09-05 08:48:29 UTC
Created attachment 38454 [details] [review]
Remove hidden qt_draw_glyphs usage until qt provide public version

I think we should remove hidden API usage for now, and use unsupported cairo fallback.
Comment 9 Manuel Nickschas 2011-08-15 03:33:06 UTC
OK folks, this hidden/private API has been removed from the Qt 4.8 branch, which means apps linking against libcairo.so now fail:

libcairo.so: undefined reference to `qt_draw_glyphs(QPainter*, unsigned int const*, QPointF const*, int)'

If you don't like to make a lot of users quite unhappy when Qt 4.8 final gets released in a couple months, you should either apply that patch to cairo or convince the Qt guys to add the hidden call back - I'm told the method is still around as QPainterPrivate::drawGlyphs, but no longer exposed.
Comment 10 Oleg Romashin 2011-08-20 15:14:24 UTC
Created attachment 50411 [details] [review]
Here is fix for Qt4.8.0 API
Comment 11 Andreas K. Hüttel 2011-12-23 09:12:50 UTC
Created attachment 54751 [details] [review]
Modification of Oleg's patch, with more #ifdef's

(In reply to comment #10)
> Created attachment 50411 [details] [review] [review]
> Here is fix for Qt4.8.0 API

I modified your patch a bit so the resulting code still builds with Qt 4.7 ...
Comment 12 GitLab Migration User 2018-08-25 13:31:33 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/48.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.