Closed Bug 354785 Opened 18 years ago Closed 18 years ago

Consolidate the handling of &minus

Categories

(Core :: MathML, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: rbs, Assigned: rbs)

Details

Attachments

(1 file, 1 obsolete file)

Three closely related issues that I would like to address in this bug:

1- It may happen that <mo>-</mo> and <mo>&minus;</mo> are handled with different fonts, because, ironically, "-" is internally substituted to a &minus; and receives a special treatment, while a starting &minus; is left to its own devices, so to speak. It should go through the same codepath of a substituted &minus;

2- The pref for changing the fonts associated to individual characters is, e.g.,
pref("font.mathfont-family.\\u2264.base", "CMSY10")

However, users tend to use
pref("font.mathfont-family.\u2264.base", "CMSY10")

By convention, any \uNNNN is actually converted to a Unicode point by JavaScript. But clueless users (who are not savvy of JavaScript) are left baffled as to why their pref setting isn't working. I think I will just make both settings to work internally.

(It should be recalled that the same setting in the mathfont.properties file is:
font.mathfont-family.\u2264.base     = CMSY10
but here the key is treated as ascii, and so \u2264 really means \u2264, ascii character by ascii character.)

3. It was brought to my attention (bug 120198 comment 102) that the default setting for &minus; may be better off extended, using perhaps:
font.mathfont-family.\u2212.base    = Symbol, Courier New, Courier, Times
Attached patch patch (obsolete) — Splinter Review
Per comment 0:
- changes in nsMathMLmoFrame.cpp implement point 1.
- changes in nsMathMChar.cpp implement point 2.
- changes in mathfont.properties implement point 3.
(I am not adding Courier because it is a bitmap font. I am not adding Times because the minus of Times is far from elegant and is not worth listed as a recommended choice. If we get there, let others glyph compete to be picked too.)
Attachment #240832 - Flags: superreview?(roc)
Attachment #240832 - Flags: review?(roc)
+  PRInt32 ucharOffset = (*(aKey + 21) == '\\') ? 23 : 21;

Avoid this magic '21'/'23' ... e.g. declare 

static const char kMathFontPrefix = "font.mathfont-family.";
somewhere, then you can write sizeof(kMathFontPrefix) instead of 21, and sizeof(kMathFontPrefix)+2 instead of 23

+  PRInt32 length = nsCAutoString(aKey + ucharOffset).FindChar('.');

nsDependentCString here

+  alternateKey.Assign("font.mathfont-family.");

alternateKey.AssignLiteral(kMathFontPrefix);

+    uchar = nsCAutoString(aKey + ucharOffset, length).ToInteger(&error, 16);

nsDependentCString

+    alternateKey.AppendLiteral(".base");
...
+    alternateKey.AppendLiteral(".variants");
...
+    alternateKey.AppendLiteral(".parts");

These could all be just alternateKey.AppendASCII(extension) at the end.
Attached patch updated patchSplinter Review
Updated the patch to incorporate the review commments.

I also added Times in the default list of &minus; I visually checked the graphical character-map of Times, and it showed that its has a specific &minus; glyph (not to be confused with the hyphen-minus) that is pretty good after all.
Attachment #240880 - Flags: superreview?(roc)
Attachment #240880 - Flags: review?(roc)
Attachment #240832 - Attachment is obsolete: true
Attachment #240832 - Flags: superreview?(roc)
Attachment #240832 - Flags: review?(roc)
Attachment #240880 - Flags: superreview?(roc)
Attachment #240880 - Flags: superreview+
Attachment #240880 - Flags: review?(roc)
Attachment #240880 - Flags: review+
Checked in.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: