Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #25981
| From | Chris Winter <thepoet@a-za-z0-9.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Capturing 'new line' info from div |
| References | <sv6j4a1bb9p53to2ak8v0ccsrf0v0clbpn@4ax.com> |
| Message-ID | <hFq2w.477328$u11.100889@fx12.fr7> (permalink) |
| Organization | http://www.NewsDemon.com |
| Date | 2014-10-24 13:23 +0200 |
Am 24.10.2014 02:36, schrieb Ed Jay:
[...]
> I want to place the contents of each div onto a canvas
> ("save_canvas"), at the same location as the original text,
> which locations are stored in two arrays (x_pos_array and
> y_pos_array), and with the same line breaks as in the created divs.
[...]
>
> This works, with the exception that none of the line breaks,
> whether word wrapped or manually entered, are effected on the
> canvas. The text flows to the right, out of the canvas. [...]
fillText ignores line wrapping. You'll probably have to roll
your own solution that splits the text appropriately and calls
fillText for each line. Be wary of solutions out there in
the web, as they often use unreliable shortcuts to "calculate"
line heights. If you're making a one-platform, one-font solution,
you can probably survive with hard-coding line offsets. Otherwise
you'll have to decide which downsides of the approaches you can
live with.
-Chris
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Capturing 'new line' info from div Ed Jay <edMbj@aes-intl.com> - 2014-10-23 17:36 -0700
Re: Capturing 'new line' info from div Chris Winter <thepoet@a-za-z0-9.de> - 2014-10-24 13:23 +0200
Re: Capturing 'new line' info from div Ed Jay <edMbj@aes-intl.com> - 2014-10-24 08:31 -0700
csiph-web