home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 September / Chip_2003-09_cd1.bin / zkuste / macos / Files / wamcom.sit / wamcom-131-macos9-20030721 / res / mathml.css < prev    next >
Cascading Style Sheet File  |  2003-06-30  |  12KB  |  437 lines

  1. /*
  2.  * The contents of this file are subject to the Mozilla Public
  3.  * License Version 1.1 (the "License"); you may not use this file
  4.  * except in compliance with the License. You may obtain a copy of
  5.  * the License at http://www.mozilla.org/MPL/
  6.  *
  7.  * Software distributed under the License is distributed on an "AS
  8.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9.  * implied. See the License for the specific language governing
  10.  * rights and limitations under the License.
  11.  *
  12.  * The Original Code is Mozilla MathML Project.
  13.  *
  14.  * The Initial Developer of the Original Code is The University Of
  15.  * Queensland.  Portions created by The University Of Queensland are
  16.  * Copyright (C) 1999 The University Of Queensland.  All Rights Reserved.
  17.  *
  18.  * Contributor(s):
  19.  *   Roger B. Sidje <rbs@maths.uq.edu.au>
  20.  */
  21.  
  22.  
  23. /**************************************************************************/
  24. /* namespace for MathML elements                                          */
  25. /**************************************************************************/
  26.  
  27. @namespace url(http://www.w3.org/1998/Math/MathML);
  28.  
  29.  
  30. /**************************************************************************/
  31. /* <math> - outermost math element                                        */
  32. /**************************************************************************/
  33.  
  34. math {
  35.   display: inline;
  36.   font-size: inherit;
  37.   font-style: normal;
  38.   font-family: CMSY10, Symbol, Times, Lucida Sans Unicode, MT Extra, Math1, Math2, Math3, Math4, Math5, serif;
  39. }
  40. math[mode="inline"], math[display="inline"] {
  41.   display: inline;
  42. }
  43. math[mode="display"], math[display="block"] {
  44.   display: block;
  45.   text-align: -moz-center;
  46. }
  47. :-moz-math-inline {
  48.   display: inline;
  49. }
  50.  
  51. /**************************************************************************/
  52. /* style switching during frame construction 
  53.    these rules need to be here so that the other rules listed with
  54.    fontstyle, mathsize, etc, can override them
  55. /**************************************************************************/
  56.  
  57. /* change of style depending on the context of <mi> */
  58. [-moz-math-font-style="italic"] {
  59.   font-style: italic; /* if the textual content consists of a single character */
  60. }
  61. [-moz-math-font-style="normal"] {
  62.   font-style: normal; /* if the textual content consists of multiple characters */
  63. }
  64. /* change of size induced by changing the scriptlevel */
  65. [-moz-math-font-size="+1"] {
  66.   font-size: 71%;
  67. }
  68. [-moz-math-font-size="+2"] {
  69.   font-size: 50%;
  70. }
  71. [-moz-math-font-size="+3"] {
  72.   font-size: 36%;
  73. }
  74. [-moz-math-font-size="+4"] {
  75.   font-size: 25%;
  76. }
  77. [-moz-math-font-size="+5"] {
  78.   font-size: 18%;
  79. }
  80. [-moz-math-font-size="scriptminsize"] {
  81.   font-size: 8pt;
  82. }
  83. [-moz-math-font-size="-1"] {
  84.   font-size: 141%;
  85. }
  86. [-moz-math-font-size="-2"] {
  87.   font-size: 200%;
  88. }
  89. [-moz-math-font-size="-3"] {
  90.   font-size: 283%;
  91. }
  92. [-moz-math-font-size="-4"] {
  93.   font-size: 400%;
  94. }
  95. [-moz-math-font-size="-5"] {
  96.   font-size: 566%;
  97. }
  98.  
  99. /**************************************************************************/
  100. /* attributes common to all tags                                          */
  101. /**************************************************************************/
  102.  
  103. /* deprecated attributes from MathML 1.0 */
  104.  
  105. /* fontstyle */
  106. [fontstyle="normal"] {
  107.   font-style: normal;
  108. }
  109. [fontstyle="italic"] {
  110.   font-style: italic;
  111. }
  112. /* fontweight */
  113. [fontweight="normal"] {
  114.   font-weight: normal;
  115. }
  116. [fontweight="bold"] {
  117.   font-weight: bold;
  118. }
  119. /* fontsize */
  120. [fontsize="xx-small"] {
  121.   font-size: xx-small;
  122. }
  123. [fontsize="x-small"] {
  124.   font-size: x-small;
  125. }
  126. [fontsize="small"] {
  127.   font-size: small;
  128. }
  129. [fontsize="smaller"] {
  130.   font-size: smaller;
  131. }
  132. [fontsize="medium"] {
  133.   font-size: medium;
  134. }
  135. [fontsize="large"] {
  136.   font-size: large;
  137. }
  138. [fontsize="larger"] {
  139.   font-size: larger;
  140. }
  141. [fontsize="x-large"] {
  142.   font-size: x-large;
  143. }
  144. [fontsize="xx-large"] {
  145.   font-size: xx-large;
  146. }
  147.  
  148. /* attributes from MathML 2.0 */
  149.  
  150. /* These ones are handled in the back-end:
  151.    mathcolor (replaces 'color'):
  152.      #rgb | #rrggbb | html-color-name
  153.    mathbackground (replaces 'background'):
  154.      #rgb | #rrggbb | html-color-name
  155. */
  156. /* mathsize (replaces 'fontsize'):
  157.      small, big, number v-unit (a numeric value is handled in the back-end) */
  158. [mathsize="small"] {
  159.   font-size: small;
  160. }
  161. [mathsize="big"] {
  162.   font-size: large;
  163. }
  164. /* mathvariant (replaces 'fontstyle' & 'fontweight' & 'fontslant'; it
  165.    requires using the 'font' shorthand so as to reset everything first):
  166.      normal | bold | italic | bold-italic | double-struck | bold-fraktur | script |
  167.      bold-script | fraktur | sans-serif | bold-sans-serif | sans-serif-italic |
  168.      sans-serif-bold-italic | monospace
  169.  
  170.    Note1: These are handled with additional back-end code:
  171.           double-struck, script, fraktur, bold-fraktur, bold-script
  172.  
  173.    Note2: the 'font' shorthand must specify at least two properties, size & family
  174.    font: [ <font-style> || <font-variant> || <font-weight> ]? 
  175.          <font-size> [ / <line-height> ]?
  176.          <font-family>
  177.  
  178.    XXX bugs 46622 & 114365: need -moz-math-serif, etc, to only lookup math fonts
  179. */
  180. [mathvariant] { /* shared and same as [mathvariant="normal"] */
  181.   font: medium serif;
  182.   font-size: inherit;
  183.   font-size-adjust: inherit;
  184.   font-stretch: inherit;
  185. }
  186. [mathvariant="bold-fraktur"], 
  187. [mathvariant="bold-script"] {
  188.   font-weight: bold;
  189. }
  190. [mathvariant="bold"] {
  191.   font-weight: bold;
  192. }
  193. [mathvariant="italic"] { 
  194.   font-style: italic;
  195. }
  196. [mathvariant="bold-italic"] {
  197.   font-weight: bold;
  198.   font-style: italic;
  199. }
  200. [mathvariant="sans-serif"] {
  201.   font-family: sans-serif;
  202. }
  203. [mathvariant="bold-sans-serif"] {
  204.   font-weight: bold;
  205.   font-family: sans-serif;
  206. }
  207. [mathvariant="sans-serif-italic"] {
  208.   font-family: sans-serif;
  209.   font-style: italic;
  210. }
  211. [mathvariant="sans-serif-bold-italic"] {
  212.   font-family: sans-serif;
  213.   font-weight: bold;
  214.   font-style: italic;
  215. }
  216. [mathvariant="monospace"] {
  217.   font-family: monospace;
  218. }
  219.  
  220. /**************************************************************************/
  221. /* tags with generated content                                            */
  222. /**************************************************************************/
  223.  
  224. ms {
  225.   display: inline;
  226. }
  227. ms:before {
  228.   content: open-quote;
  229. }
  230. ms:after {
  231.   content: close-quote;
  232. }
  233.  
  234. merror {
  235.   display: block;
  236.   font-family: sans-serif;
  237.   font-weight: bold;
  238.   white-space: pre;
  239.   margin: 1em;
  240.   padding: 1em;
  241.   border-width: thin;
  242.   border-style: inset;
  243.   border-color: red;
  244.   font-size: 14pt;
  245.   background-color: lightyellow;
  246. }
  247.  
  248. /**************************************************************************/
  249. /* mtable and its related tags                                            */
  250. /**************************************************************************/
  251.  
  252. mtable {
  253.   display: table;
  254.   border-collapse: separate;
  255.   border-spacing: 0;
  256. }
  257. mtable[frame="none"] {
  258.   border: none;
  259. }
  260. mtable[frame="solid"] {
  261.   border: solid thin;
  262. }
  263. mtable[frame="dashed"] {
  264.   border: dashed thin;
  265. }
  266.  
  267. mtr {
  268.   display: table-row;
  269. }
  270.  
  271. mtd {
  272.   display: table-cell;
  273.   vertical-align: baseline;
  274.   text-align: -moz-center;
  275.   white-space: nowrap;
  276. }
  277.  
  278.  
  279. /***********************/
  280. /* -- mtd: columnalign */
  281.  
  282. mtd[columnalign="left"] {
  283.   text-align: left;
  284. }
  285. mtd[columnalign="right"] {
  286.   text-align: right;
  287. }
  288. mtd[columnalign="center"] {
  289.   text-align: -moz-center;
  290. }
  291.  
  292. /********************/
  293. /* -- mtd: rowalign */
  294.  
  295. mtd[rowalign="top"] {
  296.   vertical-align: top;
  297. }
  298. mtd[rowalign="bottom"] {
  299.   vertical-align: bottom;
  300. }
  301. mtd[rowalign="center"] {
  302.   vertical-align: middle;
  303. }
  304. mtd[rowalign="baseline"] {
  305.   vertical-align: baseline;
  306. }
  307. /* -- not yet supported --
  308. mtd[rowalign="axis"] {
  309.   vertical-align: mathline;
  310. }
  311. */
  312.  
  313. /**********************************************************************/
  314. /* rules to achieve the default spacing between cells. The back-end code
  315.    will set the internal attributes depending on the cell's position.
  316.    These rules are hard-coded, the comments indicate what would be
  317.    desirable if the style data could be changed on the fly to pick
  318.    the values that users may set with the attributes of <mtable> */
  319. mtd {
  320.   padding-right: 0.4em;  /* half of columnspacing[colindex] */
  321.   padding-left: 0.4em;   /* half of columnspacing[colindex-1] */
  322.   padding-bottom: 0.5ex; /* half of rowspacing[rowindex] */
  323.   padding-top: 0.5ex;    /* half of rowspacing[rowindex-1] */
  324. }
  325. /* turn off the spacing at the periphery of boundary cells */
  326. mtd[-moz-math-firstrow="true"] {
  327.   padding-top: 0ex;
  328. }
  329. mtd[-moz-math-lastrow="true"] {
  330.   padding-bottom: 0ex;
  331. }
  332. mtd[-moz-math-firstcolumn="true"] {
  333.   padding-left: 0em;
  334. }
  335. mtd[-moz-math-lastcolumn="true"] {
  336.   padding-right: 0em;
  337. }
  338. /* re-instate the spacing if the table has a surrounding frame */
  339. mtable[frame="solid"] > mtr > mtd[-moz-math-firstrow="true"],
  340. mtable[frame="dashed"] > mtr > mtd[-moz-math-firstrow="true"] {
  341.   padding-top: 0.5ex; /* framespacing.top */
  342. }
  343. mtable[frame="solid"] > mtr > mtd[-moz-math-lastrow="true"],
  344. mtable[frame="dashed"] > mtr > mtd[-moz-math-lastrow="true"] {
  345.   padding-bottom: 0.5ex; /* framespacing.bottom */
  346. }
  347. mtable[frame="solid"] > mtr > mtd[-moz-math-firstcolumn="true"],
  348. mtable[frame="dashed"] > mtr > mtd[-moz-math-firstcolumn="true"] {
  349.   padding-left: 0.4em; /* framespacing.left */
  350. }
  351. mtable[frame="solid"] > mtr > mtd[-moz-math-lastcolumn="true"],
  352. mtable[frame="dashed"] > mtr > mtd[-moz-math-lastcolumn="true"] {
  353.   padding-right: 0.4em; /* framespacing.right */
  354. }
  355.  
  356. /**********************************************************************/
  357. /* internal settings to support 'rowlines' and 'columnlines'. To
  358.    achieve the recommended behavior, the back-end code will avoid setting
  359.    unsuitable rules on the cells on the first row and the first column.
  360.    In general, however, authors can use the 'border' property of CSS to
  361.    achieve varying effects down to the level of the table cell. */
  362. mtd[-moz-math-rowline="none"] {
  363.   border-top: none;
  364. }
  365. mtd[-moz-math-rowline="solid"] {
  366.   border-top: solid thin;
  367. }
  368. mtd[-moz-math-rowline="dashed"] {
  369.   border-top: dashed thin;
  370. }
  371. mtd[-moz-math-columnline="none"] {
  372.   border-left: none;
  373. }
  374. mtd[-moz-math-columnline="solid"] {
  375.   border-left: solid thin;
  376. }
  377. mtd[-moz-math-columnline="dashed"] {
  378.   border-left: dashed thin;
  379. }
  380.  
  381.  
  382. /**************************************************************************/
  383. /* Style used for stretchy symbols *must* be normal to avoid misaligments */
  384. /* By leaving the font-family empty, the MathML engine will use the value
  385.    provided by the mathfont-family property in the mathfont.properties file
  386.    or the value of the user's pref("font.mathfont-family", "...").
  387.  
  388.    Authors can make elements on a document to be stretched with different
  389.    fonts, e.g.,
  390.  
  391.    To request the use of TeX fonts, you can add a <style>...</style> with:
  392.    <mo myfonts="tex">...</mo> with the associated CSS declaration
  393.    mo[myfonts="tex"]:-moz-math-font-style-stretchy {
  394.      font-family: CMSY10, CMEX10;
  395.    }
  396.  
  397.    To request the use of Mathematica fonts, you can add a <style>...</style> with:
  398.    <mo myfonts="mathematica">...</mo> with the associated CSS declaration
  399.    mo[myfonts="mathematica"]:-moz-math-font-style-stretchy {
  400.      font-family: Math1, Math2, Math4;
  401.    }
  402.  
  403.    Of course, if you just want all of the stretchy characters in your
  404.    document to be stretched with your preferred list, you can just do:
  405.    :-moz-math-font-style-stretchy {
  406.      font-family: [your-particular-list]
  407.    }
  408.  
  409.    Note that like other fonts in the document, users can override this by
  410.    clicking the pref to override document fonts.
  411. /**************************************************************************/
  412.  
  413. :-moz-math-font-style-stretchy {
  414.   font-style: normal;
  415.   font-family: serif;
  416. /*  background-color: #3C6; */
  417. }
  418. :-moz-math-font-style-anonymous {
  419. }
  420.  
  421. /**********************************************************************/
  422. /* Hide embedded semantic MathML content (as opposed to presentational
  423.    content, which we render). Ideally, here is the behavior that we want:
  424.  
  425.    if there is an annotation-xml[encoding="MathML-Presentation"]
  426.      render that annotation, and ignore the first child of the
  427.      <semantics> element and all other annotations, 
  428.    else
  429.      render the first child of <semantics> and ignore all annotations
  430.  
  431.    But this cannot be expressed with CSS. As a stop-gap, just render
  432.    the first child to cater for most of the common cases - bug 154931.
  433. */
  434. semantics > :not(:first-child) {
  435.   display: none;
  436. }
  437.