Last Comment Bug 162405 - Add support for font-style: -moz-blackboard | -moz-calligraphic | -moz-fraktur
: Add support for font-style: -moz-blackboard | -moz-calligraphic | -moz-fraktur
Status: RESOLVED WONTFIX
WG (py8ieh:add these to CSS3)
: css-moz, qawanted
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: All All
: -- normal with 1 vote (vote)
: ---
Assigned To: rbs
:
: Jet Villegas (:jet)
Mentors:
Depends on:
Blocks: mathvariant 413115
  Show dependency treegraph
 
Reported: 2002-08-12 18:44 PDT by rbs
Modified: 2011-12-03 07:29 PST (History)
15 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch to add the new -moz values to the font-style (2.46 KB, patch)
2002-08-13 01:41 PDT, rbs
no flags Details | Diff | Splinter Review
additional patch to add CSS rules with the new values in mathml.css (1.06 KB, patch)
2002-08-13 02:07 PDT, rbs
no flags Details | Diff | Splinter Review
updated patch with the rename (3.50 KB, patch)
2002-08-15 22:22 PDT, rbs
no flags Details | Diff | Splinter Review

Description rbs 2002-08-12 18:44:22 PDT
In order to support special characters such as blackboard characters (a.k.a
double-struck characters), MathML 2.0 has introduced a mathavariant attribute so
<mi mathvariant="double-struck">R</mi> means renders 'IR' (i.e., double-struck R).

See, e.g.,
http://www.w3.org/Math/testsuite/testsuite/Presentation/TokenElements/mi/miequivalents11.xml
http://www.w3.org/Math/testsuite/testsuite/Presentation/TokenElements/mi/mimathvariant13.xml
http://www.w3.org/Math/testsuite/testsuite/Presentation/TokenElements/mi/mimathvariant14.xml

To support this, I have been thinking of adding recognition of new -moz values
for |font-variant|:
  font-variant: -moz-script | -moz-fraktur | -moz-double-struck
  (currently |font-variant| only supports |small-caps|).

With the proposed extension, the text transformer in nsTextFrame could query the
font.variant flag and do the necessary genuflections.

Bug 114365 comment 2 describes the full scope of the issues needed to support
this mathvariant attribute. This bug is a sub-task in the chain. I might take
the bug later.
Comment 1 David Baron :dbaron: ⌚️UTC-10 2002-08-12 18:52:38 PDT
Should this be font-variant or font-style?
Comment 2 rbs 2002-08-12 19:19:23 PDT
If there are still available bits in nsFont::style, it might well be a 
font-style thing.
Comment 3 rbs 2002-08-13 01:41:43 PDT
Created attachment 95079 [details] [diff] [review]
patch to add the new -moz values to the font-style
Comment 4 rbs 2002-08-13 02:07:31 PDT
Created attachment 95081 [details] [diff] [review]
additional patch to add CSS rules with the new values in mathml.css

I might also have to update nsFontMetricsWin.cpp because it erroneosuly treats
mFont.style as a bitfield:

  logFont->lfItalic = (mFont.style & (NS_FONT_STYLE_ITALIC |
    NS_FONT_STYLE_OBLIQUE))
    ? TRUE : FALSE;   // XXX need better oblique support

It should be using an equality test (other platforms use an equality test).
Comment 5 rbs 2002-08-14 14:22:07 PDT
I am leaning toward s/-moz-script/-moz-calligraphic/g, what do you think? 
-moz-script seems prone to confusion in a browser context. With that, the rules 
will read:

[mathvariant="script"] {
  font-style: -moz-calligraphic;
}
[mathvariant="bold-script"] {
  font-style: -moz-calligraphic;
  font-weight: bold;
}
Comment 6 Boris Zbarsky [:bz] (still a bit busy) 2002-08-14 14:44:10 PDT
I think I prefer -moz-calligraphic, since that is closer to what the font
variant is called in AMS LaTeX.  ;)  For that matter, we could use
-moz-blackboard-bold as well, if we want.... 
Comment 7 rbs 2002-08-15 22:22:37 PDT
Created attachment 95524 [details] [diff] [review]
updated patch with the rename
Comment 8 rbs 2002-08-15 22:25:47 PDT
Taking, and updating the title to reflect the new state of the matter.
Comment 9 Hixie (not reading bugmail) 2002-08-16 20:13:38 PDT
r=hixie on the patch; can we see where these new styles are going to be used?

What happens if I say:

   p { font-style: -moz-blackboard; }

   <p>Hello World</p>

...? Will it get drawn in a special font style?
Comment 10 rbs 2002-08-19 16:38:53 PDT
It will be drawn with double-struck letters as seen here:
http://www.mozilla.org/projects/mathml/fonts/encoding/math5.gif
The plan is to tweak the text transformer so that it remaps each ASCII character
to a private encoding before passing it to GFX. Hence the fix won't have to
suffer from the zillion versions of GFX this time.

Not sure how this fits with CSS3. While Mozilla can get this with the math
fonts, it is going to be a lot harder for other user-agents to emulate this
since the glyphs are not found in ordinary fonts, and no OS (to my knowlegde)
distinguishes these fonts as they do for cursive, serif, sans-serif, etc.

Though these glyphs are nice-to-have, as this web page shows (c.f. comments in
the sidebar): http://www.fontmenu.com/site/calligraphy.html

Also of note: the Math WG has successfully lobbied to get _some_ of these glyphs
into Unicode, but unfortunately these are in plane-1 (that's where the question
marks in testcase miequivalents11.xml come from). So the support of mathvariant
will still resort to internal assignments to the PUA for cross-platform portability.
Comment 11 rbs 2002-08-19 16:58:07 PDT
...in a sense, it is like this 'font-effect' that seems to be there just to
guarantee that no implementation can match a spec :-)
http://www.w3.org/TR/2002/WD-css3-fonts-20020802/#font-effect
Comment 12 Boris Zbarsky [:bz] (still a bit busy) 2003-04-23 17:52:19 PDT
This totally fell off my radar.. rbs, do you need reviews on that patch or an
updated version thereof?
Comment 13 rbs 2003-04-23 18:05:57 PDT
No, I don't need a review right now. There is no update. I lost my M$ hard-disk
with all the laborious WIP that I was doing to support |mathvariant| per bug
114365. Bad sectors that prevented the M$ OS to even boot. Had to buy a new disk.
Comment 14 Anne (:annevk) 2004-09-20 08:26:18 PDT
Do we still want this? Those haven't been added in CSS3 by the way and that
module has past last call (css3-fonts).
Comment 15 Bruce Miller 2009-06-26 14:30:39 PDT
"Do we still want this?"
Yes!

At least we (I) want the mathml mathvariants script, fraktur and
double-struck to be supported, whether that be done via css or
other means.

With STIX fonts installed, the relevant plane-1 blocks seem
to work fine in firefox.
Comment 16 jfine 2010-09-02 02:40:31 PDT
Why not use Unicode.  For example

    http://en.wikipedia.org/wiki/Blackboard_bold

    \mathbb{R} 	U+211D 	ℝ 	Represents the real numbers.
Comment 17 John Daggett (:jtd) 2011-12-01 19:35:43 PST
I don't think overloading this onto font-style makes sense at all.  Either use the Unicode codepoints specifically designed for this purpose or use an OpenType feature to enable a variant via font-feature-settings.  The font-style property is used to select a face within a family, one that generally has a full set of glyphs in that style (e.g. italic) and that doesn't seem appropriate when your use case is specific variant glyphs for a subset of characters.

If you still feel this is needed, I would suggest proposing it on the www-style mailing list.
Comment 18 Frédéric Wang (:fredw) 2011-12-03 07:29:46 PST
I agree that font-style may not really be what we want for mathvariant.

Currently, it seems there is some code to remap BMP chars to style invariant chars in layout/mathml/ but I can't find where it is used. I only see a particular case (to make italic <mi> with a single character) in nsMathMLTokenFrame.

It would be simple if we could use a -moz-font-feature-settings in layout/mathml/mathml.css, but is it possible to implement mathvariant values that way? 

I think the mathvariant property should be implemented somewhere in the style system rather than in the MathML code.

Note You need to log in before you can comment on or make changes to this bug.