Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > accessibility: possible to determine browser-chosen point size of a relative font-size?

Reply
Thread Tools

accessibility: possible to determine browser-chosen point size of a relative font-size?

 
 
Timo
Guest
Posts: n/a
 
      06-14-2004
All my font-sizes are set as relative sizes in CSS (large, medium, small,
x-small, etc). Let's say something is set in CSS to be xx-large, but a
visually impaired user wants it displayed even bigger. Can a script
determine an element's absolute size, *as it is being rendered by the
browser*, and then increment the element's font-size in absolute terms?
Thanks!
Timo




 
Reply With Quote
 
 
 
 
Vincent van Beveren
Guest
Posts: n/a
 
      06-14-2004
Well, I have this script that makes a line span the screen size. You can
ofcourse always do something like document.body.style.fontSize='5cm';
This would make characters about 5 centimeters high.

<html>
<head>
<script language="JavaScript">
<!--

function calibrate() {
obj = document.getElementById('sizetest');
grow(0, obj.offsetHeight);
}


function grow(size, rowHeight) {
size+=10;
document.body.style.fontSize = size+'px';
window.setTimeout(
"growTest("+size+","+rowHeight+");",10);
}

function shrink(size, rowHeight) {
size-=1;
document.body.style.fontSize = size+'px';
window.setTimeout(
"shrinkTest("+size+","+rowHeight+");",10);
}

function shrinkTest(size, rowHeight) {
obj = document.getElementById('sizetest');
if (obj.offsetHeight>(rowHeight/2)) {
shrink(size, obj.offsetHeight);
}
}

function growTest(size, rowHeight) {
obj = document.getElementById('sizetest');
if (obj.offsetHeight>(rowHeight*2)) {
shrink(size, obj.offsetHeight);
} else {
grow(size, obj.offsetHeight);
}
}


<!-- -->
</script>

</head>


<body onLoad="calibrate();">

<SPAN id="sizetest">This should span a whole line</SPAN>

</body>
</html>


Timo wrote:
> All my font-sizes are set as relative sizes in CSS (large, medium, small,
> x-small, etc). Let's say something is set in CSS to be xx-large, but a
> visually impaired user wants it displayed even bigger. Can a script
> determine an element's absolute size, *as it is being rendered by the
> browser*, and then increment the element's font-size in absolute terms?
> Thanks!
> Timo
>
>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
dynamically determine the largest possible font size ara.t.howard@gmail.com Javascript 1 02-06-2007 09:36 AM
Can we determine stack size & Heap size at runtime ? sunny C Programming 5 08-17-2006 12:17 AM
Scenario 5: IS-IS routing on Frame Relay Multi-point and Point-to-Point David Sudjiman Cisco 0 06-08-2006 09:11 AM
Dynamic Size for Text Box - Expanding more than the relative size Madhanmohan S ASP .Net 5 09-03-2004 06:28 AM



Advertisments