Bug 407439 (asana-math)

Support for Asana Math font in MathML

RESOLVED FIXED in mozilla7

Status

()

Core
MathML
--
enhancement
RESOLVED FIXED
10 years ago
4 years ago

People

(Reporter: karlt, Assigned: fredw)

Tracking

({dev-doc-complete, helpwanted, user-doc-needed})

Trunk
mozilla7
x86
Linux
dev-doc-complete, helpwanted, user-doc-needed
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(4 attachments, 6 obsolete attachments)

(Reporter)

Description

10 years ago
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.
(Reporter)

Comment 1

10 years ago
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
(Assignee)

Updated

7 years ago
Keywords: helpwanted
(Assignee)

Comment 2

7 years ago
Created attachment 454965 [details] [diff] [review]
Support for non-BMP stretchy operators
(Assignee)

Comment 3

7 years ago
Created attachment 454966 [details] [diff] [review]
Support for Asana Math
(Assignee)

Comment 4

7 years ago
Created attachment 454969 [details] [diff] [review]
Add Asana in preferences
(Assignee)

Updated

7 years ago
Depends on: 584332
(Assignee)

Comment 5

7 years ago
Created attachment 465351 [details] [diff] [review]
Support for non-BMP stretchy operators (V2)
Assignee: nobody → fred.wang
Status: NEW → ASSIGNED
(Assignee)

Updated

7 years ago
Attachment #454965 - Attachment is obsolete: true
(Assignee)

Comment 6

6 years ago
Created attachment 532584 [details] [diff] [review]
Support for non-BMP stretchy operators (V3)
Attachment #465351 - Attachment is obsolete: true
Attachment #532584 - Flags: review?(karlt)
(Assignee)

Comment 7

6 years ago
Created attachment 532585 [details] [diff] [review]
Support for Asana Math (V2)
Attachment #454966 - Attachment is obsolete: true
Attachment #532585 - Flags: review?(karlt)
(Assignee)

Comment 8

6 years ago
Created attachment 532586 [details] [diff] [review]
Add Asana in preferences (V2)
(Assignee)

Updated

6 years ago
Whiteboard: [needs attachment 469857]
(Reporter)

Comment 9

6 years ago
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+
(Reporter)

Comment 10

6 years ago
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.)
(Assignee)

Comment 11

6 years ago
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.
(Assignee)

Comment 12

6 years ago
Created attachment 532887 [details] [diff] [review]
support drawing non-BMP characters for stretchy operators (V4)
Attachment #532584 - Attachment is obsolete: true
(Assignee)

Comment 13

6 years ago
Created attachment 532888 [details]
testcase
(Assignee)

Updated

6 years ago
Attachment #454969 - Attachment is obsolete: true
(Assignee)

Updated

6 years ago
Attachment #532586 - Flags: review?(karlt)
(Reporter)

Comment 14

6 years ago
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+
(Reporter)

Comment 15

6 years ago
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+
(Assignee)

Comment 16

6 years ago
(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.
(Assignee)

Comment 17

6 years ago
Created attachment 539300 [details] [diff] [review]
Add Asana in preferences (V3)
Attachment #532586 - Attachment is obsolete: true
(Assignee)

Updated

6 years ago
Keywords: checkin-needed
(Reporter)

Comment 18

6 years ago
The order of patches for checkin is:
attachment 469857 [details] [diff] [review] (bug 584332)
attachment 532887 [details] [diff] [review]
attachment 532585 [details] [diff] [review]
attachment 539300 [details] [diff] [review]
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
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
(Assignee)

Comment 21

6 years ago
We need to update the documentation:

https://developer.mozilla.org/en/Firefox_7_for_developers
https://developer.mozilla.org/en/Mozilla_MathML_Project/Fonts
Keywords: dev-doc-needed, user-doc-needed
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.
Keywords: dev-doc-needed → dev-doc-complete
(Assignee)

Updated

5 years ago
Alias: asana-math
(Assignee)

Updated

4 years ago
Blocks: 947654
You need to log in before you can comment on or make changes to this bug.