Closed Bug 854339 Opened 11 years ago Closed 11 years ago

Stretching the "equal sign"

Categories

(Core :: MathML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: fredw, Assigned: fredw)

References

()

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 2 obsolete files)

Attached file testcase (obsolete) —
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.
I have read the above description, and I am interested in working on it.
(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
(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>
Hi, I am still working ..I will need if any help is required
Rushikesh, could you confirm that you're still working on this?
Flags: needinfo?(rushikesh90)
Yes..but I am still finding it hard to get to the root of problem.. can you give me some hint?
Flags: needinfo?(rushikesh90)
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.
Depends on: 687807
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: rushikesh90 → fred.wang
Status: NEW → ASSIGNED
Flags: needinfo?(rushikesh90)
Keywords: helpwanted
Whiteboard: [mentor=fredw][good first bug]
Attached patch Patch (obsolete) — Splinter Review
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
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+
Attached patch Patch V2Splinter Review
Yes, that seems to work too.
Attachment #756457 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/6a7dd82b2762
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: