Last Comment Bug 854339 - Stretching the "equal sign"
: Stretching the "equal sign"
Status: RESOLVED FIXED
: dev-doc-complete
Product: Core
Classification: Components
Component: MathML (show other bugs)
: Trunk
: All All
: -- normal with 1 vote (vote)
: mozilla24
Assigned To: Frédéric Wang (:fredw)
:
Mentors:
http://lists.w3.org/Archives/Public/w...
Depends on: 687807
Blocks: mathml-in-mathjax
  Show dependency treegraph
 
Reported: 2013-03-25 03:16 PDT by Frédéric Wang (:fredw)
Modified: 2013-09-30 08:23 PDT (History)
3 users (show)
ryanvm: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
testcase (1.77 KB, text/html)
2013-03-25 03:16 PDT, Frédéric Wang (:fredw)
no flags Details
Patch (6.49 KB, patch)
2013-05-31 02:22 PDT, Frédéric Wang (:fredw)
karlt: review+
Details | Diff | Splinter Review
Patch V2 (6.49 KB, patch)
2013-06-03 22:56 PDT, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review

Description Frédéric Wang (:fredw) 2013-03-25 03:16:37 PDT
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 rushikesh 2013-03-25 03:35:12 PDT
I have read the above description, and I am interested in working on it.
Comment 2 Frédéric Wang (:fredw) 2013-03-25 03:42:27 PDT
(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.
Comment 3 Frédéric Wang (:fredw) 2013-03-25 03:43:49 PDT
And of course, you'll also need
https://developer.mozilla.org/en-US/docs/Mozilla_MathML_Project/Fonts
Comment 4 Frédéric Wang (:fredw) 2013-04-06 08:51:33 PDT
(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 rushikesh 2013-04-06 11:31:26 PDT
Hi, I am still working ..I will need if any help is required
Comment 6 Josh Matthews [:jdm] 2013-04-24 12:14:04 PDT
Rushikesh, could you confirm that you're still working on this?
Comment 7 rushikesh 2013-04-24 23:30:47 PDT
Yes..but I am still finding it hard to get to the root of problem.. can you give me some hint?
Comment 8 Frédéric Wang (:fredw) 2013-04-25 02:30:12 PDT
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.
Comment 9 Frédéric Wang (:fredw) 2013-05-23 05:32:20 PDT
Rushikesh, have you been able to build the source code since the last time? Have you tried asking help on #introduction?
Comment 10 Frédéric Wang (:fredw) 2013-05-31 02:22:47 PDT
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.
Comment 11 Karl Tomlinson (:karlt) 2013-06-03 18:28:48 PDT
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.
Comment 12 Frédéric Wang (:fredw) 2013-06-03 22:56:23 PDT
Created attachment 757813 [details] [diff] [review]
Patch V2

Yes, that seems to work too.
Comment 13 Ryan VanderMeulen [:RyanVM] 2013-06-04 05:27:39 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/6a7dd82b2762
Comment 14 Ryan VanderMeulen [:RyanVM] 2013-06-04 12:05:51 PDT
https://hg.mozilla.org/mozilla-central/rev/6a7dd82b2762
Comment 15 Florian Scholz [:fscholz] (MDN) 2013-09-30 08:23:23 PDT
A note has been added to: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/24#MathML

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