CSS: How could I deactivate kerning for my font?

前端 未结 5 1785
广开言路
广开言路 2021-01-03 11:51

How could I deactivate kerning for my font?

相关标签:
5条回答
  • 2021-01-03 12:16

    Try text-rendering: optimizeSpeed, this disables kerning at least on my browser.

    That is to say, "VA".width == "V".width + "A".width.

    letter-spacing does not disable kerning, "VA" is still shorter than "V" + "A".

    So, try text-rendering. Though it gets a worse text rendering, it does disable kerning.

    0 讨论(0)
  • 2021-01-03 12:21

    CSS controls kerning with the letter-spacing attribute. Try setting it to 0 to return the font to it's normal kerning.

    p { letter-spacing: 0; }
    
    0 讨论(0)
  • 2021-01-03 12:22

    Use letter-spacing property

    <style>
    .kern
    {
        letter-spacing: 10px;
    }
    .nokern
    {
        letter-spacing: 0px;
    }
    </style>
    <div id="div1" class="kern">
        test test test test
    </div>
    <div id="div2" class="nokern">
        test test test test
    </div>
    
    0 讨论(0)
  • 2021-01-03 12:28

    See the kerning concept at Wikipedia.

    Kerning is not controlled by letter-spacing, and there are no font-kerning for CSS1 or CSS2. The new specification, CSS3, has not been approved as a standard (W3C Recommendation), but there are a property proposed for font-kerning, see 2012 draft,

    http://www.w3.org/TR/css3-fonts/#font-kerning-prop

    Only specific fonts, like OpenFonts, have this property.

    Even with no kerning control, the use of a non-zero letter-spacing can change the "human kerning perception", producing a "deactivate kerning" effect. Example: enhance kerning with letter-spacing:-0.1em and lost with letter-spacing:0.5em.

    With CSS1 letter-spacing property you can lost or enhance kerning perception, and into a "letter-spaced text" you can simulate kerning:

    <div style="font-size:20pt;background-color:#bcd">
    
      VAST   <small>(normal)</small> 
      <br/>
    
      <span style="letter-spacing:-0.1em">VAST</span>  
      <small>(enhance perception)</small>
      <br/>
    
      <span style="letter-spacing:0.5em">VAST</span> 
      <small>(lost perception)</small>
      <br/>
    
      <!-- SIMULATE KERNING AT SPACED TEXT -->
      <div style="letter-spacing:6pt">
         SIMULATE: <span style="letter-spacing:4pt">VA</span>ST TEXT
      </div>
    
    </div>
    

    See the above example here.

    0 讨论(0)
  • 2021-01-03 12:32

    I don't know if this is exactly possible, but you could try to look at the letter-spacing property.

    0 讨论(0)
提交回复
热议问题