...

View Full Version : Pre-scale a CSS font?



Krupski
11-01-2011, 03:39 AM
Hi all,

I am using CSS "webfonts" (embedded fonts) like this:



@font-face {
font-family:'css-mono';
src: url('./fonts/UbuntuMono.eot'); /* MSIE */
src: local('☺'), url('./fonts/UbuntuMono.ttf') format('truetype');
font-weight:normal;
font-style:normal;
}
Then of course I use "font-family:css-mono" to style the page font.

What I would like to do is BIAS certain fonts so that their base size is larger. I am trying to do something like this:



@font-face {
font-family: 'css-mono';
src: url('./fonts/UbuntuMono.eot'); /* MSIE */
src: local('☺'), url('./fonts/UbuntuMono.ttf') format('truetype');
font-weight: normal;
font-style: normal;
font-size-adjust: 125%;
}
See in red? So when I use a standard "font-size:1.0em"; the font actually shows up 125 percent larger than the base size.

Is there any way to do this?

Thanks!

-- Roger

Arbitrator
11-01-2011, 09:15 AM
See in red? So when I use a standard "font-size:1.0em"; the font actually shows up 125 percent larger than the base size.

Is there any way to do this?Assuming that, by "base size," you mean the user's default font size:


html { font-family: "css-mono", monospace; font-size: 1.25em; }
some_element { font-size: 1rem; }

"rem" is short for "root em." rem units are relative to the font size specified on the document's root element (which is html in HTML/XHTML).

The compatibility table located at http://caniuse.com/#search=rem indicates that every browser's current release supports this unit except Opera (11.5). Apparently, Opera 12 (which is currently available as an alpha prerelease) also supports the unit.

If you're trying to adjust the font size relative to other fonts, you might want to try the procedure shown in Example IV at http://dev.w3.org/csswg/css3-fonts/#font-size-adjust-prop.

Krupski
11-01-2011, 03:25 PM
Assuming that, by "base size," you mean the user's default font size:.....

AWESOME! Works like a charm. THANK YOU! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum