Changeset 199869 in webkit


Ignore:
Timestamp:
Apr 21, 2016 10:56:39 PM (8 years ago)
Author:
fred.wang@free.fr
Message:

More improvements and explanations regarding resetting CSS properties on the <math> element
https://bugs.webkit.org/show_bug.cgi?id=156840

Patch by Frederic Wang <fwang@igalia.com> on 2016-04-21
Reviewed by Darin Adler.

We some follow-up improvements regarding CSS rules on the <math> element, after bug 133603:

  • We fix indenting to use 4 spaces.
  • We explain why we set -webkit-line-box-contain and add references to related bugs.
  • We explain why we reset some CSS spacing rules.
  • We explain why the direction is set to ltr.
  • We explain why font-family is set to a list of known math fonts and add reference to the wiki.
  • We mention the need to customize math fonts to get consistent style and add references to a bug report and to the wiki.
  • We described each of the math font listed and add some justification about their orders.
  • We better explain the section about fonts that do not satisfy the requirements for good mathematical rendering, reformulate why we still need them for iOS/Mac and we add some references to a bug report and to the wiki. Some fonts that not pre-installed were removed in r199773.
  • We add a FIXME comments for potential changes of CSS properties on the <math> tag.

We make the following changes to the lists of font-family:

  • We move "TeX Gyre Termes Math" into the Times group.
  • We move "Asana Math" into the Palatino group.
  • We remove iOS conditionals on "Symbol" and "Times New Roman".

No new tests, only order of math fonts that are not used by test framework is changed.

  • css/mathml.css:

(math): We merge the two math selectors, reorder some font-families, remove iOS ifdef and
add more description.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r199862 r199869  
     12016-04-21  Frederic Wang  <fwang@igalia.com>
     2
     3        More improvements and explanations regarding resetting CSS properties on the <math> element
     4        https://bugs.webkit.org/show_bug.cgi?id=156840
     5
     6        Reviewed by Darin Adler.
     7
     8        We some follow-up improvements regarding CSS rules on the <math> element, after bug 133603:
     9        - We fix indenting to use 4 spaces.
     10        - We explain why we set -webkit-line-box-contain and add references to related bugs.
     11        - We explain why we reset some CSS spacing rules.
     12        - We explain why the direction is set to ltr.
     13        - We explain why font-family is set to a list of known math fonts and add reference
     14          to the wiki.
     15        - We mention the need to customize math fonts to get consistent style and add references to
     16          a bug report and to the wiki.
     17        - We described each of the math font listed and add some justification about their orders.
     18        - We better explain the section about fonts that do not satisfy the requirements for good
     19          mathematical rendering, reformulate why we still need them for iOS/Mac and we add some
     20          references to a bug report and to the wiki. Some fonts that not pre-installed were removed
     21          in r199773.
     22        - We add a FIXME comments for potential changes of CSS properties on the <math> tag.
     23
     24        We make the following changes to the lists of font-family:
     25        - We move "TeX Gyre Termes Math" into the Times group.
     26        - We move "Asana Math" into the Palatino group.
     27        - We remove iOS conditionals on "Symbol" and "Times New Roman".
     28
     29        No new tests, only order of math fonts that are not used by test framework is changed.
     30
     31        * css/mathml.css:
     32        (math): We merge the two math selectors, reorder some font-families, remove iOS ifdef and
     33        add more description.
     34
    1352016-04-21  Dean Jackson  <dino@apple.com>
    236
  • trunk/Source/WebCore/css/mathml.css

    r199773 r199869  
    22
    33math {
     4    /*
     5    We use the exact bounding boxes of glyphs to avoid excessive gaps in mathematical formulas.
     6    FIXME: Should we replace this with a more general handling of ink/logical ascent/descent?
     7    See http://webkit.org/b/130326, http://webkit.org/b/156841 and
     8    http://www.mathml-association.org/MathMLinHTML5/S3.html#SS1.SSS1
     9    */
    410    -webkit-line-box-contain: glyphs replaced;
     11
     12    /*
     13    Inheriting the following properties can cause excessive spacing of mathematical formulas so we
     14    just reset them to their default values.
     15    */
    516    text-indent: 0;
    617    line-height: normal;
    718    word-spacing: normal;
    819    letter-spacing: normal;
     20
     21    /*
     22    In some countries and languages, text is written from right-to-left while mathematical formulas
     23    are written from left-to-write. Hence it is wrong to inherit the direction and we reset that
     24    property to left-to-write. Per the MathML specification, authors should explicitly use the "dir"
     25    attribute on the <math> element if they want to force the overall direction of the mathematical
     26    formulas.
     27    */
    928    direction: ltr;
     29
     30    /* Fonts with appropriate Unicode coverage and OpenType features are required for good math
     31    rendering. These requirements as well as the up-to-date list of known math fonts to fulfill
     32    these requirements are listed on http://trac.webkit.org/wiki/MathML/Fonts.
     33    Inheriting the font-family is likely to make MathML use text fonts that are not designed for
     34    math layout and thus would cause very poor mathematical rendering. Consequently, the default
     35    font-family on the <math> tag is set to a list of recommended math fonts.
     36    For best rendering, authors and readers are encouraged to use text and math fonts with consistent
     37    style (appearance, size...), see http://trac.webkit.org/wiki/MathML/Fonts#CustomizingMathFont
     38    FIXME: Should we make math font properties configurable (http://webkit.org/b/156843)?
     39    */
     40    font-family:
     41       /*
     42       This font has Computer Modern style and is provided with most TeX & Linux distributions.
     43       We put it as the default because its style is familiar to TeX, Wikipedia and math people.
     44       */
     45       "Latin Modern Math",
     46
     47       /*
     48       The following fonts have Times style and are provided with most TeX & Linux distributions.
     49       We put XITS & STIX as a second option because they have very good unicode coverage.
     50       XITS is a fork of STIX with bug fixes and more Arabic/RTL features so we put it first.
     51       */
     52       "XITS Math",
     53       "STIX Math",
     54       "Libertinus Math",
     55       "TeX Gyre Termes Math",
     56
     57       /*
     58       These fonts respectively have style compatible with Bookman Old and Century Schoolbook.
     59       They are provided with most TeX & Linux distributions.
     60       */
     61       "TeX Gyre Bonum Math",
     62       "TeX Gyre Schola",
     63
     64       /*
     65       The following fonts have Palatino style and are provided with most TeX & Linux distributions.
     66       Asana Math has some rendering issues (e.g. missing italic correction) so we put it after.
     67       */
     68       "TeX Gyre Pagella Math",
     69       "Asana Math",
     70
     71       /*
     72       The following fonts are proprietary and have not much been tested so we put them at the end.
     73       Cambria Math it is pre-installed on Windows 7 and higher.
     74       */
     75       "Cambria Math",
     76       "Lucida Bright Math",
     77       "Minion Math",
     78
     79       /*
     80       The following fonts do not satisfy the requirements for good mathematical rendering.
     81       These are pre-installed on Mac and iOS so we list them to provide minimal unicode-based
     82       mathematical rendering. For more explanation of fallback mechanisms and missing features see
     83       http://trac.webkit.org/wiki/MathML/Fonts#ObsoleteFontsandFallbackMechanisms.
     84       STIX fonts have best unicode coverage so we put them first. */
     85       STIXGeneral,
     86       STIXSizeOneSym,
     87       Symbol,
     88       "Times New Roman",
     89
     90       /* Mathematical fonts generally use "serif" style. Hence we append the generic "serif" family
     91       as a fallback in order to increase our chance to find a mathematical font. */
     92       serif;
     93
     94    /* FIXME: Should we reset more CSS properties (http://webkit.org/b/156839)? */
    1095}
    1196mtext {
    1297    line-height: 1.0;
    13 }
    14 
    15 /* Fonts with appropriate Unicode coverage and OpenType features are required for good math rendering.
    16    Consequently the default font-family on the <math> tag is not inherited but set to a list of known math fonts.
    17    See http://trac.webkit.org/wiki/MathML/Fonts.
    18    FIXME: OS X and iOS do not have such fonts pre-installed (bugs 17021145, 16841023 and 16843041 from Apple bug tracker).
    19    Hence we also append some system fonts to provide minimal Unicode coverage and limited operator stretching.
    20 */
    21 math {
    22     font-family: "Latin Modern Math",
    23                  "XITS Math",
    24                  "STIX Math",
    25                  "Libertinus Math",
    26                  "TeX Gyre Bonum Math",
    27                  "TeX Gyre Pagella Math",
    28                  "TeX Gyre Schola",
    29                  "TeX Gyre Termes Math",
    30                  "Cambria Math",
    31                  "Asana Math",
    32                  "Lucida Bright Math",
    33                  "Minion Math",
    34                  STIXGeneral,
    35                  STIXSizeOneSym,
    36 #if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
    37                  Symbol,
    38                  "Times New Roman",
    39 #endif
    40                  serif;
    4198}
    4299
Note: See TracChangeset for help on using the changeset viewer.