Bug 24243 - [Qt] gradients and patterns for FontQt
Summary: [Qt] gradients and patterns for FontQt
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-27 12:04 PST by Dirk Schulze
Modified: 2009-02-27 12:35 PST (History)
0 users

See Also:


Attachments
patterns and gradients for Qt (2.89 KB, patch)
2009-02-27 12:05 PST, Dirk Schulze
zack: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Schulze 2009-02-27 12:04:05 PST
We need support for gradients and patterns on FontQt
Comment 1 Dirk Schulze 2009-02-27 12:05:27 PST
Created attachment 28095 [details]
patterns and gradients for Qt

This adds the support.
Comment 2 Zack Rusin 2009-02-27 12:27:29 PST
Comment on attachment 28095 [details]
patterns and gradients for Qt

> +    if (ctx->textDrawingMode() & cTextStroke) {
> +        if (ctx->strokeGradient()) {
> +            QBrush brush(*ctx->strokeGradient()->platformGradient());
> +            brush.setMatrix(ctx->strokeGradient()->gradientSpaceTransform());
> +            p->setPen(QPen(brush, 0));
> +        } else if (ctx->strokePattern()) {
> +            TransformationMatrix affine;
> +            p->setPen(QPen(QBrush(ctx->strokePattern()->createPlatformPattern(affine)), 0));
> +        } else
> +            p->setPen(QColor(ctx->strokeColor()));
> +    }
>  
>      QString string = qstring(run);

I think it's good enough to go in, but the above section has to be prefixed with "FIXME: stroking is currently not working or such". Basically the issue is that Qt doesn't support stroking of text per se. So what needs to be done is that it has to be emulated with a path as in:
if (ctx->textDrawingMode() & cTextStroke) {
  QPainterPath path;
  path.addText(0, 0, currentFont, text);
  ...
  p->strokePath(path, theCorretPen);
}
Basically stroke the path constructed from the given text string.
Comment 3 Dirk Schulze 2009-02-27 12:35:59 PST
landed in r41294.