The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> font list, want last font to be italic
deleyd
post Oct 11 2007, 01:37 AM
Post #1





Group: Members
Posts: 2
Joined: 16-September 07
Member No.: 3,824



How do I specify, I have a list of fonts, the first few fonts are normal, but if the user has none of them, I want the last font to be italic?

<span style="font-family: &Quot;Courier New&Quot;,&Quot;Times New Roman&Quot;;">some text</span>

So in this contrived bad example, if the user has Courier New, use that, else use Times New Roman.

But what if I want Courier New to be normal, and if the user doesn't have Courier New, then I want to use Times New Roman Italic? I tried just specifying "Times New Roman Italic", but the computer just thought I was an idiot and denied my request for italics.

So far I only know to use <I>...</I> to get italic always. Haven't figured out how to throw in a font-style for the last font only.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Oct 11 2007, 03:33 AM
Post #2


Programming Fanatic
********

Group: Members
Posts: 5,146
Joined: 23-August 06
From: Europe
Member No.: 9



Normally, one puts a prioritized list of similar font-families in the CSS font(-family) property, ending wth a generic-family of the same kind. You list a monospace (Courier New), followed by a serif font (Times New Roman).

You could use "cursive" as generic-family at the end, but then a corresponding font, like eg Zapf Chancery, would be used. AFAIK, you can't point to glyphs within a specific font-face. A font list is only a suggestion.

Italics can be specified in CSS using font-style:, which can have the values: normal | italic | oblique | inherit.

You might want to use the <em> tag to put emphasis, which is typically rendered as italic text. See the HTML Reference on EM.
You also might want to read the W3C CSS 2.1 on Fonts.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Oct 11 2007, 04:40 AM
Post #3


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



QUOTE(deleyd @ Oct 11 2007, 03:37 PM) *

How do I specify, I have a list of fonts, the first few fonts are normal, but if the user has none of them, I want the last font to be italic?

<span style="font-family: &Quot;Courier New&Quot;,&Quot;Times New Roman&Quot;;">some text</span>

So in this contrived bad example, if the user has Courier New, use that, else use Times New Roman.

But what if I want Courier New to be normal, and if the user doesn't have Courier New, then I want to use Times New Roman Italic? I tried just specifying "Times New Roman Italic", but the computer just thought I was an idiot and denied my request for italics.

So far I only know to use <I>...</I> to get italic always. Haven't figured out how to throw in a font-style for the last font only.


Basically I think the answer is "You can't". Obviously the sensible way to implement layout and styling properly is for the browser to send a "Resource" header, telling the server what is available - "narrow screen", "low-res", "low-bandwidth", "following list of fonts" etc etc. Then the server can do "ifs" to generate the output most appropriate for a particular case. But CSS isn't like this at all - you just send a bunch of "suggestions", and an unspecified implementation of a half-baked standard generates what it guesses you might have meant. (CSS advocates seem to be proud of this induced disconnect.)

The server basically can't know where particular fonts are available and do something different, except by human-engineering kludges. You put notes in your text saying things like "If you see the same character in these two boxes..." and show an image of what the character should look like, and also send the character so the user can see if it's the same. If you want to talk about fonts, you will have to send samples as images.

HTH




User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 06:06 PM