Opened 13 years ago

Closed 13 years ago

#1437 closed enhancement (fixed)

[patch][cla] True font height metrics in pixels, scrollbar width in pixels, font resize detection

Reported by: morris Owned by: Tom Trenka
Priority: high Milestone: 0.9
Component: HTML Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

A widget that has four features:

a) Provides an event when fontsize is changed in the browser (e.g. ctrl- or ctrl+)

b) Provides true pixel metrics for font heights given in ems, %, pixels, points or fixed sizes such as large, x-large.

c) Gives true measurement of the pixel width of scroll bars.

d) Fixes IE5/IE6 problem with em and % not being same.

Attached widget works (although currently it is defined within its own namespace instead of the dojo namespace).

Attachments (1)

mojo_metrics.zip (4.1 KB) - added by morris 13 years ago.
widget js file and test

Download all attachments as: .zip

Change History (14)

Changed 13 years ago by morris

Attachment: mojo_metrics.zip added

widget js file and test

comment:1 Changed 13 years ago by dylan

Milestone: 0.4
Summary: True font height metrics in pixels, scrollbar width in pixels, font resize detection[patch][cla] True font height metrics in pixels, scrollbar width in pixels, font resize detection
Version: 0.40.3

comment:2 Changed 13 years ago by liucougar

I don't see why this should be a widget, nor a class: no need to have more than one instance of this widget per page, right?

Maybe you can consider just defining it as an object, such as dojo.html.metrics, and move the file to src/html/metrics.js

comment:3 Changed 13 years ago by liucougar

and maybe split the functions into more than one objects

comment:4 Changed 13 years ago by guest

Cougar, I just prefer dojo templates to DOM javascript code. That said, it could easily be rewritten to use a single innerHTML and just have ids on the two elements I need to reference since it is global anyway.

I dont think it is worthwhile splitting out the functionality into separate objects - too many small files just leads to overheads. The IE fix is required for the IE font metrics to work properly so although it doesnt fit in, it is in there. Morris.

comment:5 Changed 13 years ago by liucougar

I think no one would want to customize the template for this widget, so I assume using innerHTML is sufficient in an object

I agree too many small files are no good. However, we do have a build system, so in a production environment, that would not be an issue.

Anyway, I don't really care much about whether they are in one file or many.

thanks

comment:6 Changed 13 years ago by Tom Trenka

Owner: changed from bill to Tom Trenka

I'll take it, and figure out the best way to deal with it/use it.

comment:7 Changed 13 years ago by Tom Trenka

Resolution: fixed
Status: newclosed

(In [5811]) Fixes #1437.

comment:8 Changed 13 years ago by Tom Trenka

Resolution: fixed
Status: closedreopened

comment:9 Changed 13 years ago by Tom Trenka

Oops, wrong ticket number on a fix.

comment:10 Changed 13 years ago by Tom Trenka

Milestone: 0.40.5

I'm going to punt this to 0.5; not that I don't want to add it now but I want to take a very close look at it, and do it in a way that is not widgeted. Preferably adding it as measurement functions to dojo.html, and I will want to add a few other ones at the same time (such as actual font measurements, which I have sitting around).

I would try to add it but since today is the 0.4 feature freeze...I don't think I can get it in in time. Of course, if we push the freeze back a couple of days...

comment:11 Changed 13 years ago by Tom Trenka

The scrollbar measurement and the font height measurements have been merged into dojo.html as metrics functions; I will keep this ticket open for the resize event in 0.5.

comment:12 Changed 13 years ago by Tom Trenka

Component: WidgetsHTML

comment:13 Changed 13 years ago by Tom Trenka

Resolution: fixed
Status: reopenedclosed

(In [6714]) Fixes #1437, although there are issues with both Safari and Opera (as noted by Morris in the original).

Note: See TracTickets for help on using tickets.