https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 292f3687ff5172f5bf246347bc271510fc19ca5a authored by Emilio Cobos Álvarez on 11 April 2018, 18:35:20 UTC
Remove usage of setTimeout to appease lint.
Tip revision: 292f368
fonts-kern-01-t-manual.svg
<svg version="1.1" baseProfile="tiny" id="svg-root"
  width="100%" height="100%" viewBox="0 0 480 360"
  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <!--======================================================================-->
  <!--=  SVG 1.1 2nd Edition Test Case                                     =-->
  <!--======================================================================-->
  <!--=  Copyright 2009 World Wide Web Consortium, (Massachusetts          =-->
  <!--=  Institute of Technology, European Research Consortium for         =-->
  <!--=  Informatics and Mathematics (ERCIM), Keio University).            =-->
  <!--=  All Rights Reserved.                                              =-->
  <!--=  See http://www.w3.org/Consortium/Legal/.                          =-->
  <!--======================================================================-->
  <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/"
    template-version="1.4" reviewer="CN" author="VH" status="accepted"
    version="$Revision: 1.7 $" testname="$RCSfile: fonts-kern-01-t.svg,v $">
    <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/fonts.html#KernElements">
      <p>
        This test validates handling of the hkern element.
      </p>
      <p>
        In all instances, a text element matching a font with hkern
        is displayed along with reference markers showing the expected
        glyph positioning.
      </p>
      <p>
        The 'fontA' cell shows the string "12" with "fontA" for which there
        in a kerning pair defined with u1="1" and u2="2".
      </p>
      <p>
        The 'fontB' cell shows the string "12" with "fontB" for which there
        in a kerning pair defined with g1="gl_1" and g2="gl_2",
        where "gl_1" has unicode="1" and "gl_2" has unicode="2".
      </p>
      <p>
        The 'fontC' cell shows the string "1234" with "fontC" were the same kerning pair
        uses u1/u2 to match "12" and g1/g2 to match "34".
      </p>
      <p>
        The 'fontD' cell shows the string "1234" with "fontD" were the same kerning pair
        uses u1/u2 to match "12" and "34" (u1/u2 are lists of character vales).
      </p>
      <p>
        The 'fontE' cell shows the string "1234" with "fontE" were the same kerning pair
        uses g1/g2 to match "12" and "34" (g1/g2 are lists of names).
      </p>
      <p>
        The 'fontF' cell shows the string "1234" with "fontF" were the same kerning pair
        uses u1/u2 to match "12" and "34" (u1/u2 are unicode ranges).
      </p>
      <p>
        The 'fontG' cell shows the string "12" with "fontG" were for which there
        is a kerning pair with u1 matching "1" and g2 matching "gl_2".
      </p>
    </d:testDescription>
    <d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
      <p>Run the test. No interaction required.</p>
    </d:operatorScript>
    <d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
      <p>
        The test is passed if for each of the seven subtests there is a series of black squares whose lower-left corner aligns with the centre of the corresponding small, red square as shown in the reference graphic.
      </p>
    </d:passCriteria>
  </d:SVGTestCase>
  <title id="test-title">$RCSfile: fonts-kern-01-t.svg,v $</title>
  <defs>
    <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F">
      <font-face-src>
        <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
      </font-face-src>
    </font-face>
  </defs>
  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
    <defs>
      <g id="marker">
        <!-- <rect x="0" y="-10" width="10" height="10" /> -->
        <line y2="-12" stroke="red" stroke-width="1"/>
        <line x2="12" stroke="red" stroke-width="1"/>
        <rect x="-2" y="-2" width="4" height="4" fill="red"/>
      </g>
      <g id="sampleBkg">
        <rect width="200" height="20" fill="#eeeeee"/>
        <rect y="20" width="200" height="30" fill="#cccccc"/>
        <rect width="200" height="50" fill="none" stroke="black"/>
      </g>
    </defs>
    <defs>

    <font horiz-adv-x="224">
<font-face font-family="fontG" units-per-em="1000" ascent="917" descent="-250"/>
        <missing-glyph horiz-adv-x="800" d="M 0 0 L 750 0 L 750 1000 L 0 1000 Z"/>
        <glyph unicode="1" glyph-name="gl_1" horiz-adv-x="250" d="M 0 0 L 250 0 L 250 250 L 0 250 Z"/>
        <glyph unicode="2" glyph-name="gl_2" horiz-adv-x="1500" d="M 0 0 L 500 0 L 500 500 L 0 500 Z"/>
        <hkern u1="1" g2="gl_2" k="-1000"/>
    </font>

    <font horiz-adv-x="224">
<font-face font-family="fontF" units-per-em="1000" ascent="917" descent="-250"/>
        <missing-glyph horiz-adv-x="800" d="M 0 0 L 750 0 L 750 1000 L 0 1000 Z"/>
        <glyph unicode="1" glyph-name="gl_1" horiz-adv-x="250" d="M 0 0 L 250 0 L 250 250 L 0 250 Z"/>
        <glyph unicode="2" glyph-name="gl_2" horiz-adv-x="1500" d="M 0 0 L 500 0 L 500 500 L 0 500 Z"/>
        <glyph unicode="3" glyph-name="gl_3" horiz-adv-x="750" d="M 0 0 L 750 0 L 750 750 L 0 750 Z"/>
        <glyph unicode="4" glyph-name="gl_4" horiz-adv-x="1000" d="M 0 0 L 1000 0 L 1000 1000 L 0 1000 Z"/>
        <!-- u1 covers '0' to '9' and ':' ';' '<' '=' '>' '?' -->
        <!-- u2 covers '1' '2' '3' and '4'                    -->
        <!-- So, this is a match for '12', '23' and '34'      -->
        <hkern u1="U+003?" u2="U+0031-0034" k="-1500"/>
    </font>

    <font horiz-adv-x="224">
<font-face font-family="fontE" units-per-em="1000" ascent="917" descent="-250"/>
        <missing-glyph horiz-adv-x="800" d="M 0 0 L 750 0 L 750 1000 L 0 1000 Z"/>
        <glyph unicode="1" glyph-name="gl_1" horiz-adv-x="250" d="M 0 0 L 250 0 L 250 250 L 0 250 Z"/>
        <glyph unicode="2" glyph-name="gl_2" horiz-adv-x="1500" d="M 0 0 L 500 0 L 500 500 L 0 500 Z"/>
        <glyph unicode="3" glyph-name="gl_3" horiz-adv-x="750" d="M 0 0 L 750 0 L 750 750 L 0 750 Z"/>
        <glyph unicode="4" glyph-name="gl_4" horiz-adv-x="1000" d="M 0 0 L 1000 0 L 1000 1000 L 0 1000 Z"/>
        <hkern g1="gl_1,gl_3" g2="gl_2,gl_4" k="-1500"/>
    </font>

    <font horiz-adv-x="224">
<font-face font-family="fontD" units-per-em="1000" ascent="917" descent="-250"/>
        <missing-glyph horiz-adv-x="800" d="M 0 0 L 750 0 L 750 1000 L 0 1000 Z"/>
        <glyph unicode="1" glyph-name="gl_1" horiz-adv-x="250" d="M 0 0 L 250 0 L 250 250 L 0 250 Z"/>
        <glyph unicode="2" glyph-name="gl_2" horiz-adv-x="1500" d="M 0 0 L 500 0 L 500 500 L 0 500 Z"/>
        <glyph unicode="3" glyph-name="gl_3" horiz-adv-x="750" d="M 0 0 L 750 0 L 750 750 L 0 750 Z"/>
        <glyph unicode="4" glyph-name="gl_4" horiz-adv-x="1000" d="M 0 0 L 1000 0 L 1000 1000 L 0 1000 Z"/>
        <hkern u1="1,3" u2="2,4" k="-1500"/>
    </font>

    <font horiz-adv-x="224">
<font-face font-family="fontC" units-per-em="1000" ascent="917" descent="-250"/>
        <missing-glyph horiz-adv-x="800" d="M 0 0 L 750 0 L 750 1000 L 0 1000 Z"/>
        <glyph unicode="1" glyph-name="gl_1" horiz-adv-x="250" d="M 0 0 L 250 0 L 250 250 L 0 250 Z"/>
        <glyph unicode="2" glyph-name="gl_2" horiz-adv-x="1500" d="M 0 0 L 500 0 L 500 500 L 0 500 Z"/>
        <glyph unicode="3" glyph-name="gl_3" horiz-adv-x="750" d="M 0 0 L 750 0 L 750 750 L 0 750 Z"/>
        <glyph unicode="4" glyph-name="gl_4" horiz-adv-x="1000" d="M 0 0 L 1000 0 L 1000 1000 L 0 1000 Z"/>

        <hkern u1="1" u2="2" g1="gl_3" g2="gl_4" k="-1500"/>
    </font>

    <font horiz-adv-x="224">
<font-face font-family="fontB" units-per-em="1000" ascent="917" descent="-250"/>
        <missing-glyph horiz-adv-x="800" d="M 0 0 L 750 0 L 750 1000 L 0 1000 Z"/>
        <glyph unicode="1" glyph-name="gl_1" horiz-adv-x="250" d="M 0 0 L 250 0 L 250 250 L 0 250 Z"/>
        <glyph unicode="2" glyph-name="gl_2" horiz-adv-x="500" d="M 0 0 L 500 0 L 500 500 L 0 500 Z"/>
        <hkern g1="gl_1" g2="gl_2" k="-2000"/>
    </font>

    <font horiz-adv-x="224">
<font-face font-family="fontA" units-per-em="1000" ascent="917" descent="-250"/>
        <missing-glyph horiz-adv-x="800" d="M 0 0 L 750 0 L 750 1000 L 0 1000 Z"/>
        <glyph unicode="1" glyph-name="gl_1" horiz-adv-x="250" d="M 0 0 L 250 0 L 250 250 L 0 250 Z"/>
        <glyph unicode="2" glyph-name="gl_2" horiz-adv-x="500" d="M 0 0 L 500 0 L 500 500 L 0 500 Z"/>
        <hkern u1="1" u2="2" k="-1000"/>
    </font>

    </defs>
    <text x="240" y="30" font-size="20" text-anchor="middle">&lt;hkern&gt;</text>
    <g id="legend" transform="translate(30, 60)">
      <g>
        <g>
          <rect x="-20" width="20" height="50" fill="none" stroke="black"/>
          <text transform="translate(-5, 25) rotate(-90)" text-anchor="middle">font A</text>
        </g>
        <use xlink:href="#sampleBkg"/>
        <text x="5" y="15" font-size="12">u1="1" u2="2"</text>
        <g transform="translate(5, 45) scale(2)" font-size="10">
          <!-- Advance for '1': 0 -->
          <use xlink:href="#marker" fill="#8888ff"/>

          <!-- Advance for '2' : '1'.advance + kerning             -->
          <!--                 : ((250 - (-1000))/1000)*10         -->
          <!--                 : 12.5                              -->
          <use xlink:href="#marker" x="12.5" fill="#8888ff"/>
          <text font-family="fontA" font-size="10">12</text>
        </g>
      </g>

      <g transform="translate(0, 55)">
        <g>
          <rect x="-20" width="20" height="50" fill="none" stroke="black"/>
          <text transform="translate(-5, 25) rotate(-90)" text-anchor="middle">font B</text>
        </g>
        <use xlink:href="#sampleBkg"/>
        <text x="5" y="15" font-size="12">g1="gl_1" g2="gl_2"</text>
        <g transform="translate(5, 45) scale(2)">
          <use xlink:href="#marker" fill="#8888ff"/>
          <use xlink:href="#marker" x="22.5" fill="#8888ff"/>
          <text font-family="fontB" font-size="10">12</text>
        </g>
      </g>

      <g transform="translate(0, 110)">
        <g>
          <rect x="-20" width="20" height="50" fill="none" stroke="black"/>
          <text transform="translate(-5, 25) rotate(-90)" text-anchor="middle">font C</text>
        </g>
        <use xlink:href="#sampleBkg"/>
        <text x="5" y="15" font-size="12">u1="1" u2="2" g1="gl_3" g2="gl_4"</text>
        <g transform="translate(5, 45) scale(2)">
          <use xlink:href="#marker" fill="#8888ff"/>
          <!-- ((1.adv + '12'.k)/unitsPerEm)*fontSize -->
          <use xlink:href="#marker" x="17.5" fill="#8888ff"/>
          <use xlink:href="#marker" x="32.5" fill="#8888ff"/>
          <!-- ((3.adv + '34'.k)/unitsPerEm)*fontSize -->
          <use xlink:href="#marker" x="55" fill="#8888ff"/>
          <text font-family="fontC" font-size="10">1234</text>
        </g>
      </g>

      <g transform="translate(0, 165)">
        <g>
          <rect x="-20" width="20" height="50" fill="none" stroke="black"/>
          <text transform="translate(-5, 25) rotate(-90)" text-anchor="middle">font D</text>
        </g>
        <use xlink:href="#sampleBkg"/>
        <text x="5" y="15" font-size="12">u1="1,3" u2="2,4"</text>
        <g transform="translate(5, 45) scale(2)">
          <use xlink:href="#marker" fill="#8888ff"/>
          <use xlink:href="#marker" x="17.5" fill="#8888ff"/>
          <use xlink:href="#marker" x="32.5" fill="#8888ff"/>
          <use xlink:href="#marker" x="55" fill="#8888ff"/>
          <text font-family="fontD" font-size="10">1234</text>
        </g>
      </g>

      <g transform="translate(240, 0)">
        <g>
          <rect x="-20" width="20" height="50" fill="none" stroke="black"/>
          <text transform="translate(-5, 25) rotate(-90)" text-anchor="middle">font E</text>
        </g>
        <use xlink:href="#sampleBkg"/>
        <text x="5" y="15" font-size="12">g1="gl_1,gl_3" g2="gl_2,gl_4"</text>
        <g transform="translate(5, 45) scale(2)">
          <use xlink:href="#marker" fill="#8888ff"/>
          <use xlink:href="#marker" x="17.5" fill="#8888ff"/>
          <use xlink:href="#marker" x="32.5" fill="#8888ff"/>
          <use xlink:href="#marker" x="55" fill="#8888ff"/>
          <text font-family="fontE" font-size="10">1234</text>
        </g>
      </g>

      <g transform="translate(240, 55)">
        <g>
          <rect x="-20" width="20" height="50" fill="none" stroke="black"/>
          <text transform="translate(-5, 25) rotate(-90)" text-anchor="middle">font F</text>
        </g>
        <use xlink:href="#sampleBkg"/>
        <text x="5" y="15" font-size="12">u1="U+003?" u2="U+0031-34"</text>
        <g transform="translate(5, 45) scale(2)">
          <use xlink:href="#marker" fill="#8888ff"/>
          <!-- '2' -->
          <use xlink:href="#marker" x="17.5" fill="#8888ff"/>
          <!-- '3' -->
          <use xlink:href="#marker" x="47.5" fill="#8888ff"/>
          <!-- '4' -->
          <use xlink:href="#marker" x="70" fill="#8888ff"/>
          <text font-family="fontF" font-size="10">1234</text>
        </g>
      </g>

      <g transform="translate(240, 110)">
        <g>
          <rect x="-20" width="20" height="50" fill="none" stroke="black"/>
          <text transform="translate(-5, 25) rotate(-90)" text-anchor="middle">font G</text>
        </g>
        <use xlink:href="#sampleBkg"/>
        <text x="5" y="15" font-size="12">u1="1" g2="gl_2"</text>
        <g transform="translate(5, 45) scale(2)">
          <!-- Advance for '1': 0 -->
          <use xlink:href="#marker" fill="#8888ff"/>

          <!-- Advance for '2' : '1'.advance + kerning             -->
          <!--                 : ((250 - (-1000))/1000)*10         -->
          <!--                 : 12.5                              -->
          <use xlink:href="#marker" x="12.5" fill="#8888ff"/>
          <text font-family="fontG" font-size="10">12</text>
        </g>
      </g>
    </g>
    <g id="testContent" transform="translate(320, 100)" font-size="10">
    </g>
  </g>
  <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
    <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.7 $</text>
  </g>
  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
  <!-- comment out this watermark once the test is approved -->
  <!--<g id="draft-watermark">
    <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
    <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
      text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
  </g>-->
</svg>
back to top