Stretching the "equal sign"

RESOLVED FIXED in mozilla24

Status

()

Core
MathML
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: fredw, Assigned: fredw)

Tracking

(Blocks: 1 bug, {dev-doc-complete})

Trunk
mozilla24
dev-doc-complete
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

4 years ago
Created attachment 728897 [details]
testcase

Using stretchy equal sign is used to implement the AMScd extension by LaTeXML and MathJax. I attach a testcase produced by MathJax.

The idea would be to add a direction:horizontal to the equal sign here:

http://mxr.mozilla.org/mozilla-central/source/layout/mathml/mathfont.properties#114

and to add a construction for the equal sign (for example by repeating U+2550 BOX DRAWINGS DOUBLE HORIZONTAL, which is in STIX fonts) in the Unicode table:

http://mxr.mozilla.org/mozilla-central/source/layout/mathml/mathfontUnicode.properties

Here is a minimal testcase

<math>
  <mn>2</mn>
  <munder>
    <mi>BASE</mi>
    <mo stretchy="true">=</mo>
  </munder>
</math>

The "2" is to workaround bug 687807. Someone willing to work on this could also have a look at bug 687807 comment 4. Then I guess that should be enough to make the attached testcase render correctly.

Comment 1

4 years ago
I have read the above description, and I am interested in working on it.
(Assignee)

Comment 2

4 years ago
(In reply to rushikesh from comment #1)
> I have read the above description, and I am interested in working on it.

Thanks, I guess you already read

https://developer.mozilla.org/en-US/docs/Introduction

but if you need more information, do not hesitate to ask.

Regarding the syntax to use for mathfontUnicode see

http://mxr.mozilla.org/mozilla-central/source/layout/mathml/mathfont.properties#1211

Here, I think you could just do as for the double vertical line:

http://mxr.mozilla.org/mozilla-central/source/layout/mathml/mathfontUnicode.properties#27

that is only use U+2550 for both the "glue" and "size0" character.
Assignee: nobody → rushikesh90
(Assignee)

Comment 3

4 years ago
And of course, you'll also need
https://developer.mozilla.org/en-US/docs/Mozilla_MathML_Project/Fonts
(Assignee)

Comment 4

4 years ago
(In reply to Frédéric Wang (:fredw) from comment #0)
> The "2" is to workaround bug 687807. Someone willing to work on this could
> also have a look at bug 687807 comment 4. Then I guess that should be enough
> to make the attached testcase render correctly.

I've uploaded a patch on bug 687807. With that new patch, a minimal test case for the present bug becomes:

<math>
  <munder>
    <mi>BASE</mi>
    <mo stretchy="true">=</mo>
  </munder>
</math>

Comment 5

4 years ago
Hi, I am still working ..I will need if any help is required

Comment 6

4 years ago
Rushikesh, could you confirm that you're still working on this?
Flags: needinfo?(rushikesh90)

Comment 7

4 years ago
Yes..but I am still finding it hard to get to the root of problem.. can you give me some hint?
Flags: needinfo?(rushikesh90)
(Assignee)

Comment 8

4 years ago
Really the most difficult part is to understand the whole process to compile, create a patch, submit it etc:

https://developer.mozilla.org/en-US/docs/Introduction 

You will probably find someone on IRC #introduction to help you. Have you been able to build the source?

I also recommend to install the math fonts:

https://developer.mozilla.org/en-US/docs/Mozilla_MathML_Project/Fonts/Test

Then regarding the bug itself, consider

<math>
  <munder>
    <mi>AVERYLONGBASE</mi>
    <mo stretchy="true">&#x2194;</mo>
  </munder>
</math>

you should see that the arrow stretches to cover AVERYLONGBASE. The construction is described at this line:

http://mxr.mozilla.org/mozilla-central/source/layout/mathml/mathfontUnicode.properties#33

\u2194 = \u2190\uFFFD\u2192\u23AF\u2194\u27F7

where each \u**** is a Unicode code point that can be understood that way (from left to right):

1) \u2194: the character we want to stretch, "LEFT RIGHT ARROW U+2194"

2) The construction is described by various characters that we will put together to form the stretchy arrow:

\u2190: the left piece "LEFTWARDS ARROW U+2190"
\uFFFD: the middle piece. The character "REPLACEMENT CHARACTER U+FFFD" means that we don't actually use a middle piece (as opposed to e.g. horizontal braces)
\u2192: the right piece "RIGHTWARDS ARROW U+2192"
\u23AF: the glue "HORIZONTAL LINE EXTENSION U+23AF" that is we repeat several horizontal line characters between the left and right pieces.

3) Alternatively, for small sizes we can use a single character:

\u2194: the smallest size "LEFT RIGHT ARROW U+2194"
\u27F7: a larger size "LONG LEFT RIGHT ARROW U+27F7"

Now, try instead with 

<math>
  <munder>
    <mi>AVERYLONGBASE</mi>
    <mo stretchy="true">=</mo>
  </munder>
</math>

At the moment, the equal sign does not stretch and this is the bug we want to fix. You need to modify

http://mxr.mozilla.org/mozilla-central/source/layout/mathml/mathfontUnicode.properties

to add a construction for the equal sign. Since its code point is EQUALS SIGN U+003D, that would be a new line

\003D = ...

I suggest considering U+2550 BOX DRAWINGS DOUBLE HORIZONTAL ═ for the pieces.

Hope that helps.
(Assignee)

Updated

4 years ago
Depends on: 687807
(Assignee)

Comment 9

4 years ago
Rushikesh, have you been able to build the source code since the last time? Have you tried asking help on #introduction?
Flags: needinfo?(rushikesh90)
(Assignee)

Updated

4 years ago
Assignee: rushikesh90 → fred.wang
Status: NEW → ASSIGNED
Flags: needinfo?(rushikesh90)
Keywords: helpwanted
Whiteboard: [mentor=fredw][good first bug]
(Assignee)

Comment 10

4 years ago
Created attachment 756457 [details] [diff] [review]
Patch

https://tbpl.mozilla.org/?tree=Try&rev=89f9371c0b90

The test case from AMScd does not work because of other missing features / bugs with our stretchy support.
Attachment #728897 - Attachment is obsolete: true
(Assignee)

Updated

4 years ago
Attachment #756457 - Flags: review?(karlt)
Comment on attachment 756457 [details] [diff] [review]
Patch

>+\u003D = \uFFFD\uFFFD\uFFFD\u2550\u003D # = equal sign

Could we use U+003D EQUALS SIGN instead of U+2550 BOX DRAWINGS DOUBLE HORIZONTAL for the repeated glyph here?  That should stretch fine I expect?  And it would be more consistent with the unstretched glyph.
Attachment #756457 - Flags: review?(karlt) → review+
(Assignee)

Comment 12

4 years ago
Created attachment 757813 [details] [diff] [review]
Patch V2

Yes, that seems to work too.
Attachment #756457 - Attachment is obsolete: true
(Assignee)

Updated

4 years ago
Keywords: checkin-needed, dev-doc-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/6a7dd82b2762
Flags: in-testsuite+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/6a7dd82b2762
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
A note has been added to: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/24#MathML
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.