473,738 Members | 3,636 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fractions Simply Won't Display Properly

I've been searching in vain for a way to present typographically
correct fractions (not resorting to <sup> and <sub> tags) but have been
frustrated by the fact that the glyphs for one-half, one-eighth,
three-quarters, etc. do not display in the correct typeface (or even
consistently the same typeface) and seem totally resistant to attempt
to fix this through CSS:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Language" content="en">
<table>
<tr valign="top"><t d>&#x00bc;</td></tr>
<tr valign="top"><t d>&#x00bd;</td></tr>
<tr valign="top"><t d>&#x00be;</td></tr>
<tr valign="top"><t d>⅓</td></tr>
<tr valign="top"><t d>⅔</td></tr>
<tr valign="top"><t d>⅕</td></tr>
<tr valign="top"><t d>⅖</td></tr>
<tr valign="top"><t d>⅗</td></tr>
<tr valign="top"><t d>⅘</td></tr>
<tr valign="top"><t d>⅙</td></tr>
<tr valign="top"><t d>⅚</td></tr>
<tr valign="top"><t d>⅛</td></tr>
<tr valign="top"><t d>⅜</td></tr>
<tr valign="top"><t d>⅝</td></tr>
</table>
</body>
</html>

Any thoughts of a solution (other than using inlines like 1/2, 3/4,
etc. or other hacks)?

Jul 24 '05 #1
33 6626
se*******@gwi.n et wrote:
I've been searching in vain for a way to present typographically
correct fractions (not resorting to <sup> and <sub> tags) but have been
frustrated by the fact that the glyphs for one-half, one-eighth,
three-quarters, etc. do not display in the correct typeface (or even
consistently the same typeface) and seem totally resistant to attempt
to fix this through CSS:


CSS won't add glyphs to a font that doesn't have them.
Jul 24 '05 #2
On Wed, 29 Jun 2005, se*******@gwi.n et wrote:
I've been searching in vain for a way to present typographically
correct fractions (not resorting to <sup> and <sub> tags) but have been
frustrated by the fact that the glyphs for one-half, one-eighth,
three-quarters, etc. do not display in the correct typeface
Well, as was mentioned in the responses to your same question on
comp.fonts, where it was suggested that you might raise the question
in this hierarchy: that's really a question about the browser, not so
much about the HTML. As far as HTML is concerned, your &#number;
references, such as ⅓ onwards, *are* the correct way to
represent the fraction characters. Each browser will do its best (for
some value of "best") to display them.
(or even consistently the same typeface)
Again, that's a browser question, really, as well as being indirectly
a question about the available fonts. As I said, some of those
fractions are in MS's WGL4 (and thus are likely to be present in their
supplied fonts), whereas others aren't (and thus might need a
specialist font to get them).

Ideally, browsers are supposed to work their way through
cosmetically-similar fonts when the selected font doesn't have the
desired character. But, in the end, it's better to display the
desired character (no matter how bad the style match) than to display
nothing at all. So if you're short on available fonts, this is what
you're going to get. That's a browser fact (which you could discuss
on the relevant browsers group if you think it's of sufficient
interest), but from the authoring point of view, I say that what
you're doing is entirely correct (even if you're disappointed in the
results).
and seem totally resistant to attempt to fix this through CSS:


As author in a web situation, you really can't expect to "fix" this
sort of thing through CSS[1]. As author you have no idea what fonts
and repertoires the user may have available. Note that CSS allows you
to *name* fonts, but knowing the name of the font *in no way* tells
you for sure what repertoire of characters that font may contain.

As reader, your best bet is to disable any font suggestions from the
author, and fix your browser to use the best font that you can get.

If you want better results on your *own* browser, you'd need to
explain more (on the appropriate browsers group) about what you've got
already, i.e which OS you're using, which browsers you're testing,
which fonts you configured to be your default, and so on.

But your readers will be getting whatever they're getting - unless you
manage to encourage them to install some better fonts, etc.

hope this helps
[1] there have been proposals for downloadable fonts in CSS, but they
aren't in widespread practical use on the web.
Jul 24 '05 #3
> CSS won't add glyphs to a font that doesn't have them.

This I know. What I meant by "fixing" via CSS is in the case where the
font does in fact "have" the particular glyph but doesn't display it in
the correct typeface, I've tried to specify a font like Arial Unicode
MS and it still doesn't render properly. Plus, I'm trying not to count
on someone having a font installed other than the standard half-dozen
or so (Arial, Georgia, Times, Helvetica, et al.)

Jul 24 '05 #4
se*******@gwi.n et wrote:

I've been searching in vain for a way to present typographically
correct fractions (not resorting to <sup> and <sub> tags) but have been
frustrated by the fact that the glyphs for one-half, one-eighth,
three-quarters, etc. do not display in the correct typeface (or even
consistently the same typeface) and seem totally resistant to attempt
to fix this through CSS:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Language" content="en">
<table>
<tr valign="top"><t d>&#x00bc;</td></tr>
<tr valign="top"><t d>&#x00bd;</td></tr>
<tr valign="top"><t d>&#x00be;</td></tr>
<tr valign="top"><t d>⅓</td></tr>
<tr valign="top"><t d>⅔</td></tr>
<tr valign="top"><t d>⅕</td></tr>
<tr valign="top"><t d>⅖</td></tr>
<tr valign="top"><t d>⅗</td></tr>
<tr valign="top"><t d>⅘</td></tr>
<tr valign="top"><t d>⅙</td></tr>
<tr valign="top"><t d>⅚</td></tr>
<tr valign="top"><t d>⅛</td></tr>
<tr valign="top"><t d>⅜</td></tr>
<tr valign="top"><t d>⅝</td></tr>
</table>
</body>
</html>

Any thoughts of a solution (other than using inlines like 1/2, 3/4,
etc. or other hacks)?


First of all, I hope you have a </head> and <body> between the last
<meta> and the <table>.

For fractions that have entity references in the HTML 4.01
specification, use them in place of the numeric character
references:
&frac14; for 1/4
&frac12; for 1/2
&frac34; for 3/4
If the glyphs exist in the viewer's display font, this will work.

For other fractions (and for the above three, if you choose),
create a style that displays the inlines with a smaller font
relative to the current font-size and slightly elevated. For
example:
.fract { font-size: 80%; vertical-align: 20% }
Then use
<p>1 = <span class=fract>1/3</span> + <span class=fract>2/3</span>
This will work even if the viewer does not have fractional glyphs.

Actually, I would probably use <font> in place of <span> because
the effect is supposed to change the size font. I know <font> is
deprecated, but its use here would be mnemonic when I manually edit
an HTML file.

--

David E. Ross
<URL:http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <URL:http://www.mozilla.org/>.
Jul 24 '05 #5
> CSS won't add glyphs to a font that doesn't have them.

Obviously not. What I meant by this is that I thought CSS might be able
to force a group of fraction glyphs to all display in the same font.
Try styling the table I provided using CSS and you'll see what I mean.

Apparently, the problem arises from the fact that the glyphs for
one-half, one-quarter, and three-quarters reside in the Latin-1
Supplement Block and the others are in the Number Forms block, and
those two blocks are (maddeningly enough) not presented in the same
shape or typeface.

Jul 24 '05 #6
> CSS won't add glyphs to a font that doesn't have them.

Of course not. What I meant was that CSS cannot override the fact that
the glyphs for one-half, one-quarter, and three-quarters (from the
Latin-1 block) display in one typeface and the others (from the Number
Forms block) in another typeface.

Jul 24 '05 #7
Sorry for the essentially duplicate posts. I was foolishly using Google
Groups and got frustrated when my replies weren't showing up. Apologies.
Jul 24 '05 #8

"Alan J. Flavell" <fl*****@ph.gla .ac.uk> wrote in message
news:Pi******** *************** *******@ppepc56 .ph.gla.ac.uk.. .
On Wed, 29 Jun 2005, se*******@gwi.n et wrote:
I've been searching in vain for a way to present typographically
correct fractions (not resorting to <sup> and <sub> tags) but have been
frustrated by the fact that the glyphs for one-half, one-eighth,
three-quarters, etc. do not display in the correct typeface
Well, as was mentioned in the responses to your same question on
comp.fonts, where it was suggested that you might raise the question
in this hierarchy: that's really a question about the browser, not so
much about the HTML. As far as HTML is concerned, your &#number;
references, such as ⅓ onwards, *are* the correct way to
represent the fraction characters. Each browser will do its best (for
some value of "best") to display them.


I understand. I'm still not happy with the visual results, though.
(or even consistently the same typeface)


Again, that's a browser question, really, as well as being indirectly
a question about the available fonts. As I said, some of those
fractions are in MS's WGL4 (and thus are likely to be present in their
supplied fonts), whereas others aren't (and thus might need a
specialist font to get them).


I don't know of a way to "get" a specialist font for a public website. I'm
stuck, like most web designers, with either specifying the same crummy group
of fonts (Arial, Times, Verdana, et al.). If I were to specify a font I was
sure "had" all of the necessary glyphs, there's a good chance a visitor to
my website will not have that font installed on his/her client machine.
Hence my dilemma.
But, in the end, it's better to display the
desired character (no matter how bad the style match) than to display
nothing at all.
I see what you mean, but that kind of cold comfort for my situation.
So if you're short on available fonts, this is what
you're going to get. That's a browser fact (which you could discuss
on the relevant browsers group if you think it's of sufficient
interest), but from the authoring point of view, I say that what
you're doing is entirely correct (even if you're disappointed in the
results).
In other words, I'm screwed.
[1] there have been proposals for downloadable fonts in CSS, but they
aren't in widespread practical use on the web.


This I would like to see!!!! :-) :-) :-) If they could make the presentation
of fonts dependent on the server rather than the client, that would solve a
lot of problems from my perspective. Why should the web continue to be
typographically inferior to print?
Jul 24 '05 #9
On Wed, 29 Jun 2005, Sam Elowitch wrote:
I understand. I'm still not happy with the visual results, though.
This is what I'm getting at: if you're not happy with the visual
results on *your* browser, then tune *your* browser (e.g get some
better fonts, and tell the browser to use them).

But if you're not happy with the visual results that your *users*
might be getting, then your only recourse is to encourage them to do
the same. There's nothing that you, as an HTML author, can do in
practice to force their browser to do something that it's currently
not doing - either because it's not capable of it, or because it's
not currently configured to do it.

Your HTML is correct, there's no real argument about that.
I don't know of a way to "get" a specialist font for a public website.
It's not going to happen. Good fonts cost money, and rightly so.
I'm stuck, like most web designers, with either specifying the same
crummy group of fonts (Arial, Times, Verdana, et al.).
As I've said: if the reader has a better font, they may well get
improved results by disabling the author's choice of font, and
imposing their own instead.
If I were to specify a font I was sure "had" all of the necessary
glyphs, there's a good chance a visitor to my website will not have
that font installed on his/her client machine. Hence my dilemma.
It's the way things are on the web, indeed.
In other words, I'm screwed.
If you were hoping to persuade your readers to display something of
which their own browsers aren't capable or aren't configured to do,
then yes, I suppose you are. But in web terms, that's considered to
be their choice, really.
Why should the web continue to be typographically inferior to print?


It isn't, inherently. If you used the same fonts for printing that
your browser is using for the web, I reckon you'd get the same printed
results. And how many print documents do you know which can be
processed in all the interesting ways that web documents can be
handled? Visual browsing is only one possibility, even if it's the
one of specific interest to you at this point.

What's going wrong here seems to be that you don't accept the division
of responsibility between HTML (marking-up content), CSS (to propose a
presentation), and the browser (to render the content as best it can,
with or without use of those CSS proposals from the author). Your
complaint seems to me to lie exactly with the browsers that you're
using (and the fonts that are available to them, and the settings
you've chosen or at least accepted, and so on).

that's the best I can summarise it, anyway.
Jul 24 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9248
by: karp | last post by:
Lets say I have the following class in order to add two fractions, class Fraction{ public: Fractions::Fraction(int numer = 0, int denom = 1) { valeurNumerateur = numer; valeurDenominateur = denom; }
0
1428
by: Mori | last post by:
Hi, How do I hold fractions in a string so I can display them and print them out? Say I want to display "2½" (that's 2 and a half if this doesn't display either), but it displays "2?½" (that's 2 follow by uppercase A with a squiggle on top, thenfollowed by a half). It's not just halfs I want to display either, it's eighths and three
2
7049
by: Mori | last post by:
Hi, Can someone supply a code example of displaying a string with a fractional part, say 5 and 7 16ths. I cannot find an example of how to use the Encoding object (if that is what you use). thanks, Mori
2
1638
by: Just Me | last post by:
I need a numerical updown control that displays fractions. If the increment is 1/16 it would display 1/16, 1/32, 3/16, 1/4... I thought I might inherit from a NumericalUpDown control and place a label on top of the display and put the text in that. Sounds kind of kluged. Anyone have a better approach?
15
14620
by: farah727rash | last post by:
Hi everyone, I have this problem and I don't know what's wrong with my program. I am trying to enter my two variables height and weight as fraction numbers. I declared them as float and also as double, but the program aborts when I input a fraction instead of decimal/integer number. Could someone tell me where the problem is, and what I need to do to correct my code? Thanks a lot in advance, Farah. #include <iostream> using namespace...
4
3379
by: Bob | last post by:
Hi All, Was wondering if in C# there is an elegant way of displaying and or calculating fractions. The case: we have an app that measures/slices dices etc and all our internal measures and counters are in metric measures ... (its a manufacturing tool) For display purposes this is fine for Australia/Europe/Asia .. however the US company likes to see the measures in feet/inches .. no real problem here.
1
1634
by: Semajthewise | last post by:
Here it is cleaned up a little more. Here's what this code does. It will take 2 fractions and add, subtract, multiply, or divide them. The user enters the fractions to be calculated into two textboxes. These can be entered as a whole number and a proper fraction, whole number and an improper fraction, just a proper/inproper fraction, or just a whole number. Form build Requirements: using Microsoft Visual Studio.NET 2003 single form...
5
5622
by: gubbachchi | last post by:
Hi all, How to convert the fractions into decimals and vice versa in php. I have a form, where the user will enter fractions in the text boxes such as "1 1/2", "1 1/4" and so on. I need to store all these values in mysql database after converting it into decimal value, and again fetch the value from database and re-convert it into fractions and display it to the user in a different php page. So what is best solution for this. Can anyone...
0
1243
by: Paddy | last post by:
(From: http://paddy3118.blogspot.com/2008/09/python-fractions-issue.html) There seems to be a problem/difference in calculating with the new fractions module when comparing Python 26rc2 and 30rc1 I was reading the paper "Interval Arithmetic: Python Implementation and Applications" and thought to try the first example function f(x,y), which needs more precision than Python floating point provides (on my Windows PC), to calculate a...
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.