473,599 Members | 3,183 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 6606
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
9244
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
1424
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
7032
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
1627
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
14602
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
3372
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
1622
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
5614
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
1238
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
7993
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
8401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8053
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
8268
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5440
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();...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1508
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.