Built-up (vulgar) fractions using the Unicode fraction slash (or other methods) not supported

UNCONFIRMED
Unassigned

Status

()

UNCONFIRMED
10 years ago
10 years ago

People

(Reporter: pub-mozilla, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_7; fr-fr) AppleWebKit/530.18 (KHTML, like Gecko) Version/4.0.1 Safari/530.18
Build Identifier: 

Unicode contains only a handful of precomposed vulgar fractions (viz, ½; ¼, ¾; ⅓, ⅔; ⅕, ⅖, ⅗, ⅘; ⅙, ⅚; ⅛, ⅜, ⅝, ⅞). In particular, 16hts and 32nds, which are frequently used with imperial units, are not included.

The preferred solution, as suggested in an e-mail [1] sent to the WhatWG mailing list and supported by Jonas Sickling [2], would be to let a sequence of one or more digits 0--9 followed by a fraction slash [U+2044] followed by one or more digits 0--9 be rendered as a built-up fraction. This behaviour is defined in Unicode, and Unicode Technical Report No. 20 explicitly says that this solution is appropriate for use in mark-up languages and not only in plain text.

Ideally, digits specifically designed for use in built-up fractions should be used when available in the font used. Otherwise, scaling normal digits to 60% height and 65% width, as suggested in the PostScript  
Language Cookbook, would seem to be appropriate as fall-back.

It should also be noted that MathML does not seem to support vulgar fractions at all, neither as specified nor as implemented in Firefox.

[1] <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2009-April/019340.html>
[2] <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2009-June/020120.html>

Reproducible: Always
Component: General → Layout: Text
Product: Firefox → Core
QA Contact: general → layout.fonts-and-text
Version: unspecified → Trunk
Would be great if you could link to the actual specifications for how this is supposed to work as well.
(Reporter)

Comment 2

10 years ago
The correct behaviour is specified in Unicode 5.0, Chapter 6 `Punctuation' [1], Section 6.1 `General Punctuation', heading `General Punctuation: U+2000--U+206F', subheading `Other Punctuation',  subsubheading `Fraction Slash' (p. 154):

“Fraction Slash.

“U+2044 FRACTION SLASH is used between digits to form numeric fractions, such as 2/3, 3/9, and so on. The standard form of a fraction built using the fraction slash is defined as follows: Any sequence of one or more decimal digits, followed by the fraction slash, followed by any sequence of one or more decimal digits. Such a fraction should be displayed as a unit, such as ¾ or $\frac34$ [vertical built-up fraction]. The precise choice of display can depend upon additional formatting information.

“If the displaying software is incapable of mapping the fraction to a unit, then it can also be displayed as a simple linear sequence as a fallback (for example, 3/4). If the fraction is to be separated from a previous number, then a space can be used, choosing the appropriate width (normal, thin, zero width, and so on). For example, 1 + ZERO WIDTH SPACE + 3 + FRACTION SLASH + 4 is displayed as 1¾.”

[1] <http://unicode.org/book/ch06.pdf>
This would be a nice feature, and not too hard to implement at the gfxTextRunWordCache level where all textrun processing goes through ... as long as you don't expect this to work when the fraction contains multiple font styles or direction changes. Alternatively we could implement it in Harfbuzz...

I don't think it will be high enough priority to demand attention anytime soon, though. Patches welcome.
You need to log in before you can comment on or make changes to this bug.