Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 8600249 Details for
Bug 947654
[patch]
Use font.*.x-math font preferences for MathML
bug-947654.patch (text/plain), 11.91 KB, created by
Frédéric Wang (:fredw)
(
hide
)
Description:
Use font.*.x-math font preferences for MathML
Filename:
MIME Type:
Creator:
Frédéric Wang (:fredw)
Size:
11.91 KB
patch
obsolete
># HG changeset patch ># Parent 7723b15ea695e321e6acda04beef9bc98728dd13 ># User Frédéric Wang <fred.wang@free.fr> >Bug 1156463 - Use font.*.x-math font preferences for MathML. r=karl > >diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h >--- a/dom/base/nsGkAtomList.h >+++ b/dom/base/nsGkAtomList.h >@@ -2115,16 +2115,19 @@ GK_ATOM(x_symbol, "x-symbol") > // additional languages that have special case transformations > GK_ATOM(az, "az") > GK_ATOM(ba, "ba") > GK_ATOM(crh, "crh") > GK_ATOM(el, "el") > GK_ATOM(ga, "ga") > GK_ATOM(nl, "nl") > >+// mathematical language, used for MathML >+GK_ATOM(x_math, "x-math") >+ > // Names for editor transactions > GK_ATOM(TypingTxnName, "Typing") > GK_ATOM(IMETxnName, "IME") > GK_ATOM(DeleteTxnName, "Deleting") > > // IPC stuff > GK_ATOM(Remote, "remote") > GK_ATOM(RemoteId, "_remote_id") >diff --git a/intl/locale/langGroups.properties b/intl/locale/langGroups.properties >--- a/intl/locale/langGroups.properties >+++ b/intl/locale/langGroups.properties >@@ -218,8 +218,9 @@ x-geor=x-geor > # lang in (X)HTML/XML documents, which they shouldn't. (see bug 256257) > #x-beng=x-beng > #x-cans=x-cans > #x-ethi=x-ethi > #x-guru=x-guru > #x-gujr=x-gujr > #x-khmr=x-khmr > #x-mlym=x-mlym >+x-math=x-math >diff --git a/layout/mathml/mathml.css b/layout/mathml/mathml.css >--- a/layout/mathml/mathml.css >+++ b/layout/mathml/mathml.css >@@ -6,28 +6,26 @@ > /**************************************************************************/ > /* namespace for MathML elements */ > /**************************************************************************/ > > @namespace url(http://www.w3.org/1998/Math/MathML); > > /**************************************************************************/ > /* <math> - outermost math element */ >-/* Put Cambria before Cambria Math as Cambria Math has neither bold nor */ >-/* italic. */ > /**************************************************************************/ > > math { > writing-mode: horizontal-tb !important; > direction: ltr; > unicode-bidi: embed; > display: inline; > font-size: inherit; > font-style: normal; >- font-family: MathJax_Main, STIXGeneral, Cambria, Cambria Math, XITS, Latin Modern Math, DejaVu Serif, DejaVu Sans, Times, Lucida Sans Unicode, OpenSymbol, Standard Symbols L, serif; >+ font-family: serif; > text-rendering: optimizeLegibility; > -moz-float-edge: margin-box; > -moz-math-display: inline; > } > math[mode="display"], math[display="block"] { > display: block; > text-align: -moz-center; > -moz-math-display: block; >diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp >--- a/layout/mathml/nsMathMLChar.cpp >+++ b/layout/mathml/nsMathMLChar.cpp >@@ -1656,17 +1656,17 @@ nsMathMLChar::StretchInternal(nsPresCont > if (!done) { // normal case > // Use the css font-family but add preferred fallback fonts. > font = mStyleContext->StyleFont()->mFont; > NormalizeDefaultFont(font, aFontSizeInflation); > > // really shouldn't be doing things this way but for now > // insert fallbacks into the list > nsAutoTArray<nsString, 10> mathFallbacks; >- gfxFontUtils::GetPrefsFontList("font.mathfont-family", mathFallbacks); >+ gfxFontUtils::GetPrefsFontList("font.name.serif.x-math", mathFallbacks); > InsertMathFallbacks(font.fontlist, mathFallbacks); > > > #ifdef NOISY_SEARCH > nsAutoString fontlistStr; > font.fontlist.ToString(fontlistStr, false, true); > printf("Searching in "%s" for a glyph of appropriate size for: 0x%04X:%c\n", > NS_ConvertUTF16toUTF8(fontlistStr).get(), mData[0], mData[0]&0x00FF); >diff --git a/layout/reftests/mathml/default-font-ref.html b/layout/reftests/mathml/default-font-ref.html >new file mode 100644 >--- /dev/null >+++ b/layout/reftests/mathml/default-font-ref.html >@@ -0,0 +1,13 @@ >+<html> >+ <head> >+ <title>default font</title> >+ <meta charset="utf-8"/> >+ </head> >+ <body style="font: 20px monospace;"> >+ >+ <math style="font-family: sans-serif; font-size: 40px;"> >+ <mtext>x-math language</mtext> >+ </math> >+ >+ </body> >+</html> >diff --git a/layout/reftests/mathml/default-font.html b/layout/reftests/mathml/default-font.html >new file mode 100644 >--- /dev/null >+++ b/layout/reftests/mathml/default-font.html >@@ -0,0 +1,13 @@ >+<html> >+ <head> >+ <title>default font</title> >+ <meta charset="utf-8"/> >+ </head> >+ <body style="font: 20px monospace;"> >+ >+ <math> >+ <mtext>x-math language</mtext> >+ </math> >+ >+ </body> >+</html> >diff --git a/layout/reftests/mathml/reftest.list b/layout/reftests/mathml/reftest.list >--- a/layout/reftests/mathml/reftest.list >+++ b/layout/reftests/mathml/reftest.list >@@ -357,8 +357,9 @@ random-if(winWidget&&!/^Windows\x20NT\x2 > == mfrac-C-4.html mfrac-C-4-ref.html > fuzzy-if(OSX,1,100) == mfrac-D-1.html mfrac-D-1-ref.html > random-if(winWidget&&!/^Windows\x20NT\x205\.1/.test(http.oscpu)) == mfrac-D-2.html mfrac-D-2-ref.html > == mfrac-D-3.html mfrac-D-3-ref.html > == mfrac-D-4.html mfrac-D-4-ref.html > == mfrac-E-1.html mfrac-E-1-ref.html > test-pref(dom.webcomponents.enabled,true) == shadow-dom-1.html shadow-dom-1-ref.html > pref(font.size.inflation.emPerLine,25) == font-inflation-1.html font-inflation-1-ref.html >+test-pref(font.minimum-size.x-math,40) test-pref(font.name.serif.x-math,"sans-serif") == default-font.html default-font-ref.html >diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp >--- a/layout/style/nsHTMLStyleSheet.cpp >+++ b/layout/style/nsHTMLStyleSheet.cpp >@@ -301,16 +301,23 @@ nsHTMLStyleSheet::RulesMatching(ElementR > > // http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#language > // says that the xml:lang attribute overrides HTML's lang attribute, > // so we need to do this after WalkContentStyleRules. > nsString lang; > if (aData->mElement->GetAttr(kNameSpaceID_XML, nsGkAtoms::lang, lang)) { > ruleWalker->Forward(LangRuleFor(lang)); > } >+ >+ // Set the language to "x-math" on the <math> element, so that appropriate >+ // font settings are used for MathML. >+ if (aData->mElement->IsMathMLElement(nsGkAtoms::math)) { >+ nsGkAtoms::x_math->ToString(lang); >+ ruleWalker->Forward(LangRuleFor(lang)); >+ } > } > > // Test if style is dependent on content state > /* virtual */ nsRestyleHint > nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData) > { > if (aData->mElement->IsHTMLElement(nsGkAtoms::a) && > nsCSSRuleProcessor::IsLink(aData->mElement) && >diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js >--- a/modules/libpref/init/all.js >+++ b/modules/libpref/init/all.js >@@ -1810,17 +1810,19 @@ pref("intl.hyphenation-alias.bs-*", "sh" > > // Norwegian has two forms, Bokmål and Nynorsk, with "no" as a macrolanguage encompassing both. > // For "no", we'll alias to "nb" (Bokmål) as that is the more widely used written form. > pref("intl.hyphenation-alias.no", "nb"); > pref("intl.hyphenation-alias.no-*", "nb"); > pref("intl.hyphenation-alias.nb-*", "nb"); > pref("intl.hyphenation-alias.nn-*", "nn"); > >-pref("font.mathfont-family", "Latin Modern Math, XITS Math, STIX Math, Cambria Math, Asana Math, TeX Gyre Bonum Math, TeX Gyre Pagella Math, TeX Gyre Termes Math, Neo Euler, Lucida Bright Math, MathJax_Main, STIXNonUnicode, STIXSizeOneSym, STIXGeneral, Standard Symbols L, DejaVu Sans"); >+pref("font.name.serif.x-math", "Latin Modern Math, XITS Math, STIX Math, Asana Math, TeX Gyre Bonum Math, TeX Gyre Pagella Math, TeX Gyre Termes Math, Neo Euler, Lucida Bright Math, MathJax_Main, STIXNonUnicode, STIXSizeOneSym, STIXGeneral, Standard Symbols L, DejaVu Serif"); >+pref("font.name.sans-serif.x-math", "DejaVu Sans, sans-serif"); >+pref("font.name.monospace.x-math", "monospace"); > > // Some CJK fonts have bad underline offset, their CJK character glyphs are overlapped (or adjoined) to its underline. > // These fonts are ignored the underline offset, instead of it, the underline is lowered to bottom of its em descent. > pref("font.blacklist.underline_offset", "FangSong,Gulim,GulimChe,MingLiU,MingLiU-ExtB,MingLiU_HKSCS,MingLiU-HKSCS-ExtB,MS Gothic,MS Mincho,MS PGothic,MS PMincho,MS UI Gothic,PMingLiU,PMingLiU-ExtB,SimHei,SimSun,SimSun-ExtB,Hei,Kai,Apple LiGothic,Apple LiSung,Osaka"); > > #ifdef MOZ_B2G > // Whitelist of fonts that ship with B2G that do not include space lookups in > // default features. This allows us to skip analyzing the GSUB/GPOS tables >@@ -2595,16 +2597,23 @@ pref("font.minimum-size.zh-HK", 0); > pref("font.size.variable.zh-HK", 16); > pref("font.size.fixed.zh-HK", 16); > > pref("font.default.zh-TW", "sans-serif"); > pref("font.minimum-size.zh-TW", 0); > pref("font.size.variable.zh-TW", 16); > pref("font.size.fixed.zh-TW", 16); > >+// mathml.css sets font-size to "inherit" and font-family to "serif" so only >+// font.name.*.x-math and font.minimum-size.x-math are really relevant. >+pref("font.default.x-math", "serif"); >+pref("font.minimum-size.x-math", 0); >+pref("font.size.variable.x-math", 16); >+pref("font.size.fixed.x-math", 13); >+ > /* > * A value greater than zero enables font size inflation for > * pan-and-zoom UIs, so that the fonts in a block are at least the size > * that, if a block's width is scaled to match the device's width, the > * fonts in the block are big enough that at most the pref value ems of > * text fit in *the width of the device*. > * > * When both this pref and the next are set, the larger inflation is >@@ -2918,17 +2927,20 @@ pref("font.name.monospace.x-tibt", "Tibe > pref("font.name-list.serif.x-tibt", "Tibetan Machine Uni, Jomolhari, Microsoft Himalaya"); > pref("font.name-list.sans-serif.x-tibt", "Tibetan Machine Uni, Jomolhari, Microsoft Himalaya"); > pref("font.name-list.monospace.x-tibt", "Tibetan Machine Uni, Jomolhari, Microsoft Himalaya"); > > pref("font.minimum-size.th", 10); > > pref("font.default.x-devanagari", "sans-serif"); > // We have special support for Monotype Symbol on Windows. >-pref("font.mathfont-family", "MathJax_Main, STIXNonUnicode, STIXSizeOneSym, STIXGeneral, Asana Math, Symbol, DejaVu Sans, Cambria Math"); >+// Cambria is put before Cambria Math, to workaround bug 598900. >+pref("font.name.serif.x-math", "Cambria, Cambria Math, MathJax_Main, STIXNonUnicode, STIXSizeOneSym, STIXGeneral, Asana Math, Symbol, DejaVu Serif"); >+pref("font.name.sans-serif.x-math", "DejaVu Sans, sans-serif"); >+pref("font.name.monospace.x-math", "monospace"); > > // cleartype settings - false implies default system settings > > // use cleartype rendering for downloadable fonts (win xp only) > pref("gfx.font_rendering.cleartype.use_for_downloadable_fonts", true); > > // use cleartype rendering for all fonts always (win xp only) > pref("gfx.font_rendering.cleartype.always_use_for_content", false); >@@ -3317,17 +3329,19 @@ pref("font.name-list.monospace.zh-HK", " > > // XP_MACOSX changes to default font sizes > pref("font.minimum-size.th", 10); > pref("font.size.variable.zh-CN", 15); > pref("font.size.variable.zh-HK", 15); > pref("font.size.variable.zh-TW", 15); > > // Apple's Symbol is Unicode so use it >-pref("font.mathfont-family", "Latin Modern Math, XITS Math, STIX Math, Cambria Math, Asana Math, TeX Gyre Bonum Math, TeX Gyre Pagella Math, TeX Gyre Termes Math, Neo Euler, Lucida Bright Math, MathJax_Main, STIXNonUnicode, STIXSizeOneSym, STIXGeneral, Symbol, DejaVu Sans"); >+pref("font.name.serif.x-math", "Latin Modern Math, XITS Math, STIX Math, Asana Math, TeX Gyre Bonum Math, TeX Gyre Pagella Math, TeX Gyre Termes Math, Neo Euler, Lucida Bright Math, MathJax_Main, STIXNonUnicode, STIXSizeOneSym, STIXGeneral, Symbol, DejaVu Serif"); >+pref("font.name.sans-serif.x-math", "DejaVu Sans, sans-serif"); >+pref("font.name.monospace.x-math", "monospace"); > > // individual font faces to be treated as independent families > // names are Postscript names of each face > pref("font.single-face-list", "Osaka-Mono"); > > // optimization hint for fonts with localized names to be read in at startup, otherwise read in at lookup miss > // names are canonical family names (typically English names) > pref("font.preload-names-list", "Hiragino Kaku Gothic ProN,Hiragino Mincho ProN,STSong");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
|
Review
Attachments on
bug 947654
:
8362151
|
8362153
|
8362155
|
8408287
|
8408288
|
8408289
|
8408290
|
8410268
|
8411783
|
8411784
|
8434220
|
8598124
|
8598125
|
8598126
|
8599982
|
8600249
|
8602977
|
8603694
|
8609372
|
8609743
|
8610048