Re: getting the font size in pixels
- From: Thomas 'PointedEars' Lahn <PointedEars@xxxxxx>
- Date: Sat, 08 Sep 2007 13:50:32 +0200
Johannes Baagoe wrote:
Cartoper :
I have learned from a html newsgroup that there is no easy way to do
this in a browser
True enough, but there is an easy way to do it the other way round:
express the heights, widths, etc of all non-text elements in percentage of
the font height, IOW, in ems. (Yes, image sizes can be expressed in ems.)
They can, but they SHOULD NOT. A HTML user agent is not graphics software;
the image will lose quality considerably (to the point that it cannot be
recognized anymore) because anti-aliasing is not used.
And where did the OP state that they want to have scaled images anyway?
All I can see is that they write about font sizes that should be
proportional to the size of the viewport (although they are confusing
the display resolution with that).
Which means this cannot be done with HTML and CSS alone, because CSS has
no such measurement of length. 1em equals the height of the capital letter
`M' of the font (originating from Gutenberg's movable type printing),
called the font-size. The size of the viewport is irrelevant for that.
It also cannot be done reliably with client-side scripting of an (X)HTML
document, and should not be done here (performance, maintenance costs).
However, there are media formats where everything can be scaled
automagically: SVG and PDF (standardized), and Flash (proprietary), to name
just a few. All of the former can also be scripted with ECMAScript
implementations: SVG with ECMAScript, PDF with Adobe PDF Script (if used
with Adobe Reader), and Flash with built-in ActionScript.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
.
- Follow-Ups:
- Re: getting the font size in pixels
- From: Cartoper
- Re: getting the font size in pixels
- References:
- getting the font size in pixels
- From: Cartoper
- Re: getting the font size in pixels
- From: Johannes Baagoe
- getting the font size in pixels
- Prev by Date: Re: getting the font size in pixels
- Next by Date: Re: how will i know programatically that wmp is done playing?
- Previous by thread: Re: getting the font size in pixels
- Next by thread: Re: getting the font size in pixels
- Index(es):
Relevant Pages
|