Closed Bug 407439 (asana-math) Opened 12 years ago Closed 9 years ago

Support for Asana Math font in MathML

Categories

(Core :: MathML, enhancement)

x86
Linux
enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla7

People

(Reporter: karlt, Assigned: fredw)

References

Details

(Keywords: dev-doc-complete, helpwanted, user-doc-needed)

Attachments

(4 files, 6 obsolete files)

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.
I hear from the author that the font has been released under the Open Font
License, not the LaTeX Project Public License.
Summary: Support for Asana Math fonts in MathML → Support for Asana Math font in MathML
Keywords: helpwanted
Attached patch Support for Asana Math (obsolete) — Splinter Review
Attached patch Add Asana in preferences (obsolete) — Splinter Review
Depends on: 584332
Assignee: nobody → fred.wang
Status: NEW → ASSIGNED
Attachment #454965 - Attachment is obsolete: true
Attachment #465351 - Attachment is obsolete: true
Attachment #532584 - Flags: review?(karlt)
Attachment #454966 - Attachment is obsolete: true
Attachment #532585 - Flags: review?(karlt)
Attached patch Add Asana in preferences (V2) (obsolete) — Splinter Review
Whiteboard: [needs attachment 469857]
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?
Attachment #532584 - Flags: review?(karlt) → review+
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.)
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.
Attached file testcase
Attachment #454969 - Attachment is obsolete: true
Attachment #532586 - Flags: review?(karlt)
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.
Attachment #532585 - Flags: review?(karlt) → review+
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.
Attachment #532586 - Flags: review?(karlt) → review+
(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.
Attachment #532586 - Attachment is obsolete: true
Keywords: checkin-needed
Landed on inbound.
Keywords: checkin-needed
Whiteboard: [needs attachment 469857]
http://hg.mozilla.org/mozilla-central/rev/8ffbdfc7c721
http://hg.mozilla.org/mozilla-central/rev/936c8f2e7085
http://hg.mozilla.org/mozilla-central/rev/40fac958d3c0
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
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.
Alias: asana-math
Blocks: 947654
You need to log in before you can comment on or make changes to this bug.