Skip to content

Commit a97372b

Browse files
authored
Reference even more baseline concepts in CSS Inline Layout
See w3c/csswg-drafts#5312. And also #5429 for where all of this started. This should help #6731 quite a bit too.
1 parent 6e6e538 commit a97372b

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

images/baselines.png

-212 Bytes
Loading

source

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3875,6 +3875,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
38753875
  • alphabetic baseline
  • 38763876
  • ascent metric
  • 38773877
  • descent metric
  • 3878+
  • em-over baseline
  • 3879+
  • em-under baseline
  • 38783880
  • hanging baseline
  • 38793881
  • ideographic-under baseline
  • 38803882
    @@ -66561,19 +66563,19 @@ worker.postMessage(offscreenCanvas, [offscreenCanvas]);
    6656166563
    attribute's allowed keywords correspond to alignment points in the
    6656266564
    font:

    6656366565

    66564-

    The <span class=top of the em square is roughly at the top of the glyphs in a font, the hanging baseline is where some glyphs like आ are anchored, the middle is half-way between the top of the em square and the bottom of the em square, the alphabetic baseline is where characters like Á, ÿ, f, and Ω are anchored, the ideographic-under baseline is where glyphs like 私 and 達 are anchored, and the bottom of the em square is roughly at the bottom of the glyphs in a font. The top and bottom of the bounding box can be far from these baselines, due to glyphs extending far outside the em square.">

    66566+

    The <span class=em-over baseline is roughly at the top of the glyphs in a font, the hanging baseline is where some glyphs like आ are anchored, the middle is half-way between the em-over and em-under baselines, the alphabetic baseline is where characters like Á, ÿ, f, and Ω are anchored, the ideographic-under baseline is where glyphs like 私 and 達 are anchored, and the em-under baseline is roughly at the bottom of the glyphs in a font. The top and bottom of the bounding box can be far from these baselines, due to glyphs extending far outside em-over and em-under baselines.">

    6656566567

    6656666568

    The keywords map to these alignment points as follows:

    6656766569

    6656866570
    6656966571
    top
    66570-
    The top of the em square
    66572+
    The em-over baseline
    6657166573

    6657266574
    hanging
    6657366575
    The hanging baseline
    6657466576

    6657566577
    middle
    66576-
    The middle of the em square
    66578+
    Halfway between the em-over baseline and the em-under baseline
    6657766579

    6657866580
    alphabetic
    6657966581
    The alphabetic baseline
    @@ -66582,7 +66584,7 @@ worker.postMessage(offscreenCanvas, [offscreenCanvas]);
    6658266584
    The ideographic-under baseline
    6658366585

    6658466586
    bottom
    66585-
    The bottom of the em square
    66587+
    The em-under baseline
    6658666588
    6658766589

    6658866590

    The direction attribute's allowed keywords are

    @@ -68985,19 +68987,20 @@ try {
    6898568987
    emHeightAscent attribute
    6898668988

    6898768989

    The distance from the horizontal line indicated by the

    68988-
    data-x="dom-context-2d-textBaseline">textBaseline attribute to the highest top of the em
    68989-
    squares in the inline box, in CSS pixels; positive numbers
    68990-
    indicating that the given baseline is below the top of that em square (so this value will usually
    68991-
    be positive). Zero if the given baseline is the top of that em square; half the font size if the
    68992-
    given baseline is the middle of that em square.

    68990+
    data-x="dom-context-2d-textBaseline">textBaseline attribute to the em-over
    68991+
    baseline in the inline box, in CSS pixels;
    68992+
    positive numbers indicating that the given baseline is below the em-over baseline
    68993+
    (so this value will usually be positive). Zero if the given baseline is the em-over
    68994+
    baseline; half the font size if the given baseline is halfway between the em-over
    68995+
    baseline and the em-under baseline.

    6899368996

    6899468997
    emHeightDescent attribute
    6899568998

    6899668999

    The distance from the horizontal line indicated by the

    68997-
    data-x="dom-context-2d-textBaseline">textBaseline attribute to the lowest bottom of the em
    68998-
    squares in the inline box, in CSS pixels; positive numbers
    68999-
    indicating that the given baseline is above the bottom of that em square. (Zero if the given baseline
    69000-
    is the bottom of that em square.)

    69000+
    data-x="dom-context-2d-textBaseline">textBaseline attribute to the em-under
    69001+
    baseline in the inline box, in CSS pixels;
    69002+
    positive numbers indicating that the given baseline is above the em-under baseline.
    69003+
    (Zero if the given baseline is the em-under baseline.)

    6900169004

    6900269005
    hangingBaseline attribute
    6900369006

    @@ -69027,9 +69030,9 @@ try {
    6902769030

    6902869031

    Glyphs rendered using fillText() and

    6902969032
    strokeText() can spill out of the box given by the
    69030-
    font size (the em square size) and the width returned by
    69031-
    data-x="dom-context-2d-measureText">measureText() (the text width). Authors are encouraged
    69032-
    to use the bounding box values described above if this is an issue.

    69033+
    font size and the width returned by data-x="dom-context-2d-measureText">measureText()
    69034+
    (the text width). Authors are encouraged to use the bounding box values described above if this is
    69035+
    an issue.

    6903369036

    6903469037

    A future version of the 2D context API might provide a way to render fragments of

    6903569038
    documents, rendered using CSS, straight to the canvas. This would be provided in preference to a

    0 commit comments

    Comments
     (0)