W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2006

[whatwg] Canvas lack of drawString method

From: Stefan Haustein <sh@kobjects.org>
Date: Wed, 18 Oct 2006 01:01:47 +0200
Message-ID: <453560DB.3000109@kobjects.org>
Charles Iliya Krempeaux wrote:
> Hello Stefan,
>
> You'll probably need alot of info, about the font, to be able to 
> really handle fonts properly.
> It's been a while since I've really written that kind of code.
> But just consider the concept of "kerning".  Any API would need to 
> expose that kind of info too.

Hi Charles,

that's why I have included Font.stringWidth() in the list of Font
methods (and not charWidth())....

The proposed methods should be sufficient for basic needs, in particular
to cope with scaling issues and to implement a word wrap algorithm.

Best regards,
Stefan

>
> See ya
>
> On 10/17/06, *Stefan Haustein* <sh at kobjects.org 
> <mailto:sh at kobjects.org>> wrote:
>
>     Hi,
>
>     I would like to second the drawString() request.
>
>     It makes sense to have a simple API, but it should be balanced with
>     application simplicity and readability to some extent. Doing CSS black
>     magic to overlay text and a Canvas object just seems inadequate for
>     something like axis labeling.
>
>     As noted earlier by somebody else (did not find the mail...), we would
>     also need a simple Font object, but the minimum requirements seem
>     rather
>     simple:
>
>     Font Canvas.createFont (String cssFontProperties);
>     Canvas.setFont(Font font) // set current font
>     Canvas.drawString(int x, int y, String text);
>     Font Canvas.getFont() // current font
>
>     int Font.stringWidth(String s);
>     int Font.getHeight ();  // includes leading
>     int Font.getBaselinePosition();
>     int Font.getAscent();
>     int Font.getDescent();
>
>     Best regards
>     Stefan Haustein
>
>
>
>     Alfonso Baqueiro wrote:
>     > Hello Charles,
>     >
>     > 2006/10/17, Charles Iliya Krempeaux <supercanadian at gmail.com
>     <mailto:supercanadian at gmail.com>
>     > <mailto:supercanadian at gmail.com <mailto:supercanadian at gmail.com>>>:
>     >
>     >     Hello Alfonso,
>     >
>     >     On 10/17/06, *Alfonso Baqueiro* < abaqueiro at gmail.com
>     <mailto:abaqueiro at gmail.com>
>     >     <mailto:abaqueiro at gmail.com <mailto:abaqueiro at gmail.com>>>
>     wrote:
>     >
>     >         The canvas component is very promising, but the lack of
>     >         drawString method could be a great error for its
>     success, this
>     >         lack is a huge limitation, how could you resolve this
>     problem?
>     >
>     >
>     >     I believe that some people's reason for not wanting to add
>     it was
>     >     because of Accessibility concerns.
>     >
>     >     Although normal text in a webpage... or even a text image (with
>     >     the "alt" attribute filled in properly) could be "read" by a
>     >     person with disabilities, text embedded in the canvas element
>     >     could not.
>     >
>     >     Perhaps people need to think about how to add Accessibility
>     to the
>     >     canvas while allowing a "drawString" procedure.
>     >
>     >
>     > Well a drawString method in canvas can be used for drawing the axis
>     > labels or values on a dinamic javascript graphic, but is non
>     sense an
>     > aural reader read it, theres no way (yet) to read an image to a
>     > blinded people, there are cases where is imposible the
>     accessibility,
>     > is imposible for a blind to play video games, and accessibility
>     dont
>     > stop the video games creation. In the case of images or the
>     canvas the
>     > alt attribute could do the job.
>     >
>     >     See ya
>     >
>
>
>
>
> -- 
>     Charles Iliya Krempeaux, B.Sc.
>
>     charles @ reptile.ca <http://reptile.ca>
>     supercanadian @ gmail.com <http://gmail.com>
>
>     developer weblog: http://ChangeLog.ca/
> ___________________________________________________________________________
>  Make Television                                http://maketelevision.com/
>
> ___________________________________________________________________________
>  Cars, Motorcycles, Trucks, and Racing...           
> http://tirebiterz.com/ 
Received on Tuesday, 17 October 2006 16:01:47 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:48 UTC