Last Comment Bug 407439 - (asana-math) Support for Asana Math font in MathML
(asana-math)
: Support for Asana Math font in MathML
Status: RESOLVED FIXED
: dev-doc-complete, helpwanted, user-doc-needed
Product: Core
Classification: Components
Component: MathML (show other bugs)
: Trunk
: x86 Linux
: -- enhancement with 3 votes (vote)
: mozilla7
Assigned To: Frédéric Wang (:fredw)
:
Mentors:
Depends on: mathvariant 289938 333126 400938 407059 584332
Blocks: 947654
  Show dependency treegraph
 
Reported: 2007-12-07 15:36 PST by Karl Tomlinson (ni?:karlt)
Modified: 2014-01-19 06:15 PST (History)
10 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Support for non-BMP stretchy operators (16.01 KB, patch)
2010-06-29 14:26 PDT, Frédéric Wang (:fredw)
no flags Details | Diff | Review
Support for Asana Math (16.24 KB, patch)
2010-06-29 14:27 PDT, Frédéric Wang (:fredw)
no flags Details | Diff | Review
Add Asana in preferences (4.22 KB, patch)
2010-06-29 14:28 PDT, Frédéric Wang (:fredw)
no flags Details | Diff | Review
Support for non-BMP stretchy operators (V2) (16.00 KB, patch)
2010-08-12 13:17 PDT, Frédéric Wang (:fredw)
no flags Details | Diff | Review
Support for non-BMP stretchy operators (V3) (16.14 KB, patch)
2011-05-16 02:55 PDT, Frédéric Wang (:fredw)
karlt: review+
Details | Diff | Review
Support for Asana Math (V2) (16.20 KB, patch)
2011-05-16 02:55 PDT, Frédéric Wang (:fredw)
karlt: review+
Details | Diff | Review
Add Asana in preferences (V2) (4.19 KB, patch)
2011-05-16 02:56 PDT, Frédéric Wang (:fredw)
karlt: review+
Details | Diff | Review
support drawing non-BMP characters for stretchy operators (V4) (16.08 KB, patch)
2011-05-17 00:30 PDT, Frédéric Wang (:fredw)
no flags Details | Diff | Review
testcase (6.62 KB, application/xhtml+xml)
2011-05-17 00:31 PDT, Frédéric Wang (:fredw)
no flags Details
Add Asana in preferences (V3) (4.23 KB, patch)
2011-06-14 13:15 PDT, Frédéric Wang (:fredw)
no flags Details | Diff | Review

Description Karl Tomlinson (ni?:karlt) 2007-12-07 15:36:10 PST
Asana Math is available under the LaTeX Project Public License and "includes
almost all mathematical Unicode symbols".

http://tug.ctan.org/pkg/asana-math

Currently there is a more recent version here:

http://openfontlibrary.org/media/files/asyropoulos/213

It also includes variants sizes and parts for large character construction
similar to Cambria Math and include a MATH OpenType table.

A notable advantage over Cambria Math (as well as the licence) as that Asana
Math provides Unicode Mappings for these variants and parts in the
Supplementary Private Use Area-B (plane 16).  This means that we can use a
mathfontAsanaMath.properties file to specify the glyphs (characters), but we
need to add support to nsMathMLChar for non-BMP code points.  The appropriate
characters for the properties file can be obtained by viewing the MATH table
variant and construction entries in fontforge and finding the PUA code points
for those glyph ids.

Bug 289938 needs to be fixed for Unicode Plane 1 characters.

This font has no italic nor bold style for alphanumeric characters in plane 0
as they exist at their unique code points in plane 1.  To ensure that
<mi>a</mi> is displayed as italic we either need to complete the mathvariant
translation to plane 1 (bug 114365) or we need to ensure that synthetic italic
and bold are functional (e.g. bug 333126).

I've marked severity as enhancement, but it would be nice to get this into 1.9 as we no longer support the TeX Computer Modern fonts, and this font could be a good replacement.
Comment 1 Karl Tomlinson (ni?:karlt) 2007-12-12 11:55:34 PST
I hear from the author that the font has been released under the Open Font
License, not the LaTeX Project Public License.
Comment 2 Frédéric Wang (:fredw) 2010-06-29 14:26:54 PDT
Created attachment 454965 [details] [diff] [review]
Support for non-BMP stretchy operators
Comment 3 Frédéric Wang (:fredw) 2010-06-29 14:27:41 PDT
Created attachment 454966 [details] [diff] [review]
Support for Asana Math
Comment 4 Frédéric Wang (:fredw) 2010-06-29 14:28:21 PDT
Created attachment 454969 [details] [diff] [review]
Add Asana in preferences
Comment 5 Frédéric Wang (:fredw) 2010-08-12 13:17:12 PDT
Created attachment 465351 [details] [diff] [review]
Support for non-BMP stretchy operators (V2)
Comment 6 Frédéric Wang (:fredw) 2011-05-16 02:55:02 PDT
Created attachment 532584 [details] [diff] [review]
Support for non-BMP stretchy operators (V3)
Comment 7 Frédéric Wang (:fredw) 2011-05-16 02:55:57 PDT
Created attachment 532585 [details] [diff] [review]
Support for Asana Math (V2)
Comment 8 Frédéric Wang (:fredw) 2011-05-16 02:56:54 PDT
Created attachment 532586 [details] [diff] [review]
Add Asana in preferences (V2)
Comment 9 Karl Tomlinson (ni?:karlt) 2011-05-16 17:39:56 PDT
Comment on attachment 532584 [details] [diff] [review]
Support for non-BMP stretchy operators (V3)

Who's crazy idea was UTF-16?

>+      // Read the next word, if we have a non-BMP character.

No comma here.

>+      if (i < length &&
>+          PRUnichar(0xD800) <= code && code <= PRUnichar(0xDBFF)) {

Use NS_IS_HIGH_SURROGATE.

>-  return (ch.code == PRUnichar(0xFFFD)) ? kNullGlyph : ch;
>+  return (ch.code[0] == PRUnichar(0xFFFD) &&
>+          ch.Length() == 1) ? kNullGlyph : ch;

There's no need to check ch.Length() here, right,
because ch.code[0] will always be a high surrogate if Length() == 2?
Comment 10 Karl Tomlinson (ni?:karlt) 2011-05-16 17:46:40 PDT
Perhaps it would be more correct to use the comment
"support drawing non-BMP characters for stretchy operators".
(Stretchy operators still need to be in the BMP.)
Comment 11 Frédéric Wang (:fredw) 2011-05-17 00:29:54 PDT
Thanks for your review, Karl. I'll attach a new version addressing your comments.
I don't really expect you to check in detail mathfontAsanaMath.properties, but
I'll also provide a dynamic testcase if you want to try the patches. I you test
with STIX and Asana, you can see (at least for the integrals) that we may have
different fonts used. I don't know if it is really a problem, since in general
largeops in a document have the same size and thus use the same font.
Comment 12 Frédéric Wang (:fredw) 2011-05-17 00:30:51 PDT
Created attachment 532887 [details] [diff] [review]
support drawing non-BMP characters for stretchy operators (V4)
Comment 13 Frédéric Wang (:fredw) 2011-05-17 00:31:33 PDT
Created attachment 532888 [details]
testcase
Comment 14 Karl Tomlinson (ni?:karlt) 2011-06-13 23:25:27 PDT
Comment on attachment 532585 [details] [diff] [review]
Support for Asana Math (V2)

It looks like U+20D0/U+20D1/U+10ff1a could be used to make long harpoons
U+21BC etc, but those glyphs are designed for accents and so I expect they
would be a little smaller.
Comment 15 Karl Tomlinson (ni?:karlt) 2011-06-13 23:33:19 PDT
Comment on attachment 532586 [details] [diff] [review]
Add Asana in preferences (V2)

> pref("font.mathfont-family", "STIXNonUnicode, STIXSizeOneSym, STIXSize1, STIXGeneral, Standard Symbols L, DejaVu Sans, Cambria Math");
>+pref("font.mathfont-family", "STIXNonUnicode, STIXSizeOneSym, STIXSize1, STIXGeneral, Asana Math, Standard Symbols L, DejaVu Sans, Cambria Math");

Just update this to remove the old line.

(In reply to comment #11)
> [If] you test
> with STIX and Asana, you can see (at least for the integrals) that we may
> have different fonts used.

Nice testcase, thanks.  I see what you mean.  Now that we have your scaling of operators to provide precision in sizing, I expect we can loosen our tolerance for finding a matching font.  No need to do that before landing this, but I expect that would also help with the parentheses and braces from STIX fonts where we currently flick between choosing variants and building from parts.
Comment 16 Frédéric Wang (:fredw) 2011-06-14 13:13:48 PDT
(In reply to comment #14)
> Comment on attachment 532585 [details] [diff] [review] [review]
> Support for Asana Math (V2)
> 
> It looks like U+20D0/U+20D1/U+10ff1a could be used to make long harpoons
> U+21BC etc, but those glyphs are designed for accents and so I expect they
> would be a little smaller.

I didn't try that, I've just copied what was indicated in the MATH table and commented the entries that are not in the MathML operator dictionary.
Comment 17 Frédéric Wang (:fredw) 2011-06-14 13:15:02 PDT
Created attachment 539300 [details] [diff] [review]
Add Asana in preferences (V3)
Comment 19 :Ehsan Akhgari (out sick) 2011-06-22 11:36:48 PDT
Landed on inbound.
Comment 21 Frédéric Wang (:fredw) 2011-07-01 14:21:21 PDT
We need to update the documentation:

https://developer.mozilla.org/en/Firefox_7_for_developers
https://developer.mozilla.org/en/Mozilla_MathML_Project/Fonts
Comment 22 Florian Scholz [:fscholz] (MDN) 2011-07-23 08:10:50 PDT
Updated docs mentioned in comment 21. 
I don't think we need more developer doc updates, but feel free to add missing bits. Marking as dev-doc-complete.

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