Jump to content

Multi Size For Multi Font Family


khadem1386

Recommended Posts

You could use JavaScript to check which font the text has been rendered in and switch the font size accordingly e.g.(Set the font family on the body element)var x = document.getElementsByTagName('body');if (x.style.fontFamily = 'Mitra') { x.style.fontSize = '14px'} else { x.fontSize = '12px'}However, it is quite unlikely that a user will have Mitra installed on their system.Another alternative is to use the @font-face css rule.Font squirrel has a bunch of free fonts you can pick from and also provides a kit that contains the different font formats you will need to serve each user agent correctly. It even includes the CSS. It's not yet a perfect solution and you might not find Mitra for free, but it is worth a look.There is most likely a way of changing the font sizes using a server side script language such as PHP which is more robust than JAvaScrip that could be disabled.

Link to comment
Share on other sites

Actually, Javascript cannot know which font is being used on the text.The style.fontFamily property would be empty unless something was put into the style attribute of the element. Besides, it would only show exactly what had been put in the element.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...