[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WebDrawingArea - Paint.Text function missing


Le 28/08/2025 à 20:41, Bruce Steers a écrit :

Re-submitted anyway.
https://gitlab.com/gambas/gambas/-/merge_requests/400 <https:// gitlab.com/gambas/gambas/-/merge_requests/400>

It adds Paint.Font, Paint.FillText and Paint.StrokeText to the mix.

Paint font is a css string https://www.w3schools.com/cssref/ pr_font_font.php <https://www.w3schools.com/cssref/pr_font_font.php> that's what the canvas wants, wasn't sure how to make it WebFont or if Benoit would think it should be or not.

Because Canvas has it's own fillText and strokeText functions i emulated them instead of using a method that would then use Paint.Stroke or Paint.Fill after.

Respects
BruceS


Hi,

'Paint.DrawText()' and 'Paint.Font' were implemented in 'gb.web.gui' since the last commit.

There is now a Font class, but only for Paint.

The WebControl has its own custom string 'Font' property, that is not compatible. I will see if I can make WebControl understand this new Font class.

I kept 'Paint.StrokeText()' and 'Paint.FillText()', but I'm not sure that I won't remove them, because they are canvas specific.

By the way, canvas font support is really cumbersome, so you can't do all what you can do with the GUI toolkits.

For example, I had to implement multiline text drawing with custom javascript, because the canvas text routines are only single line!

And there is no support for text decoration (underline, strikeout...) apparently.

Anyway, enjoy it!

--
Benoît Minisini.


Follow-Ups:
Re: WebDrawingArea - Paint.Text function missingLinus <olivier.cruilles@xxxxxxxx>
Re: WebDrawingArea - Paint.Text function missingBruce Steers <bsteers4@xxxxxxxxx>
References:
WebDrawingArea - Paint.Text function missingLinus <olivier.cruilles@xxxxxxxx>
Re: WebDrawingArea - Paint.Text function missingBruce Steers <bsteers4@xxxxxxxxx>
Re: WebDrawingArea - Paint.Text function missingBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: WebDrawingArea - Paint.Text function missingBruce Steers <bsteers4@xxxxxxxxx>
Re: WebDrawingArea - Paint.Text function missingBruce Steers <bsteers4@xxxxxxxxx>