WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 18617
[CAIRO] SVG/Canvas fonts miss gradients/pattern support
https://bugs.webkit.org/show_bug.cgi?id=18617
Summary
[CAIRO] SVG/Canvas fonts miss gradients/pattern support
Dirk Schulze
Reported
2008-04-19 00:50:01 PDT
The problem: The color of a Text in SVG is always black. It's related to WebCore/platform/graphics/cairo/FontCairo.cpp. cairo_set_source_rgba(cr, red, green, blue, alpha); overwrites the color-set of SVG. But without the line, fonts in HTML get invisible. There should be something like: if (!svg) {}
Attachments
dosplay of SVG-Text
(4.73 KB, patch)
2008-04-24 23:16 PDT
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Display SVG-text
(3.22 KB, patch)
2008-04-25 03:30 PDT
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Display SVG-text
(7.05 KB, patch)
2008-04-25 12:14 PDT
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Display texts in SVG and HTML
(6.15 KB, patch)
2008-04-25 13:43 PDT
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Painting of texts in SVG and HTML
(8.56 KB, patch)
2008-04-26 04:29 PDT
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Painting of texts in SVG and HTML
(8.53 KB, patch)
2008-04-26 22:58 PDT
,
Dirk Schulze
alp
: review-
Details
Formatted Diff
Diff
Fonts with Pattern/Gradient
(7.89 KB, patch)
2008-11-18 08:41 PST
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Fonts with Pattern/Gradient
(
deleted
)
2008-11-18 08:47 PST
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
Fonts with Pattern/Gradient
(5.13 KB, patch)
2009-02-26 23:58 PST
,
Dirk Schulze
oliver
: review+
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Dirk Schulze
Comment 1
2008-04-20 12:15:14 PDT
It's a little bit more problematic. If you comment the line out (...source_rgb()) the text is rendered fine (gradients and colors). But if the text has a stroke. The complete text is filled with the settings of the stroke. Cg gives a setTextDrawingMode(cTextStroke) or setTextDrawingMode(cTextFill) in SVGPaintServer... back to GraphicsContext. Perhaps cairo should do the same?
Dirk Schulze
Comment 2
2008-04-24 23:16:33 PDT
Created
attachment 20811
[details]
dosplay of SVG-Text In Cairo SVG-text works with this changes. But texts on normal webpages are broken. Perhaps HTML-texts should do the same like SVG-texts. To hard-code the font-color isn't a good idea.
Dirk Schulze
Comment 3
2008-04-25 03:30:16 PDT
Created
attachment 20815
[details]
Display SVG-text SVG-Text is now displayed right and the most HTML-pages work now too. Some texts still don't get there color (like text in buttons or textfields). They are white. Stroke of HTML-text doesn't work like they should.
Dirk Schulze
Comment 4
2008-04-25 12:14:47 PDT
Created
attachment 20821
[details]
Display SVG-text The patch of above is the wrong file. Now the right one.
Dirk Schulze
Comment 5
2008-04-25 13:43:59 PDT
Created
attachment 20823
[details]
Display texts in SVG and HTML This patch fixes the problem with displaying texts in SVG and HTML. I had to use a workaround to get a full support. I had to hard-code the fill-rule for SVG's to CAIRO_FILL_RULE_EVEN_ODD to differentiate between HTML- and SVG-texts. For HTML-text the font-color has to be hard-coded at present. If you don't do it (e.g. use of setPlatformFillColor(), see attachment above) not all HTML-objects are displayed right. HTML makes only use of CAIRO_FILL_RULE_WINDING. I couldn't find any optical differences in SVG between the two fill-rules. This patch fixes bug-report: 18663, 15619 too.
Dirk Schulze
Comment 6
2008-04-26 04:29:52 PDT
Created
attachment 20830
[details]
Painting of texts in SVG and HTML Same changes like above: SVG- and HTML-text are displayed well now, with a workaround. Added support for text-stroke (SVG needs it). Plus text-shadow on stroked Texts in HTML/CSS.
Dirk Schulze
Comment 7
2008-04-26 22:58:19 PDT
Created
attachment 20845
[details]
Painting of texts in SVG and HTML The workaround only affects texts in SVG now. More information look 2 comments above. This patch fixes bug-report: 18663, 15619 too.
Alp Toker
Comment 8
2008-04-28 13:22:34 PDT
Comment on
attachment 20845
[details]
Painting of texts in SVG and HTML I appreciate the push to get SVG fixed but we can't really take a patch that misuses fill rule as a flag to denote text drawing. We'll need to figure out how to do this properly -- we might need to fix the GraphicsContext abstraction if it's too closely tied to the assumption that the platform graphics library has separate brushes for text and graphics.
Dirk Schulze
Comment 9
2008-04-28 22:23:01 PDT
It should be possible to add displaysSVGtext() and setDiaplaysSVGtext() to GraphicsContext. You could differentiate between HTML- and SVG-text again but it would be a hack to. Another idea was to use setPlatformFillColor(); and setPlatformStrokeColor();(Isn't used yet). But if you try to give the fillColor to 'cairo_t* cr = m_data->cr;' with cairo_set_source_rgba(), not every text in HTML is affected by it (strange). And there will be problems to include text-stroke of CSS into Cairo since the complete text uses the fillColor or the strokeColor (depending which Color was set at last).
Dirk Schulze
Comment 10
2008-11-12 23:36:56 PST
***
Bug 15619
has been marked as a duplicate of this bug. ***
Dirk Schulze
Comment 11
2008-11-12 23:44:11 PST
Solid colors will be fixed with
https://bugs.webkit.org/show_bug.cgi?id=20699
(third part). I can't run LayoutTests, so I can't land it yet. To fix patterns and gradients they have to be platformindependent first:
https://bugs.webkit.org/show_bug.cgi?id=21205
https://bugs.webkit.org/show_bug.cgi?id=20543
Dirk Schulze
Comment 12
2008-11-18 08:41:09 PST
Created
attachment 25237
[details]
Fonts with Pattern/Gradient Moved the fill and stroke code out of fillPath() and strokePath() to common methods for paths and texts.
Dirk Schulze
Comment 13
2008-11-18 08:47:09 PST
Created
attachment 25238
[details]
Fonts with Pattern/Gradient The same idea as the previous patch, but add own methods for text fill/stroke. The other patch could be a bit slower on filling paths (but not noticeable). I would prefer the previous patch.
Dirk Schulze
Comment 14
2009-02-26 23:58:54 PST
Created
attachment 28065
[details]
Fonts with Pattern/Gradient Make use of the new calls fillGradient/strokeGradient and fillPattern/strokePattern in GraphicsContext to support patterns and gradient on Fonts in Cairo. I also added support for globalAlpha on Fonts for Cairo.
Dirk Schulze
Comment 15
2009-02-27 00:01:50 PST
I forgot to mension that I commented the clipToImageBuffer on CanvasRenderingContext2D::drawTextInternal. Just CG needs this hack for filling and stroking texts with gradients. All other platforms have their own way to do it.
Oliver Hunt
Comment 16
2009-02-27 00:15:51 PST
Comment on
attachment 28065
[details]
Fonts with Pattern/Gradient r=me, the CG specific path makes me sad, oh well.
Dirk Schulze
Comment 17
2009-02-27 00:21:23 PST
landed in
r41279
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug