font-size-adjust - SVG: Scalable Vector Graphics 编辑

« SVG Attribute reference home

The font-size-adjust attribute allows authors to specify an aspect value for an element that will preserve the x-height of the first choice font in a substitute font.

Note: As a presentation attribute, font-size-adjust can be used as a CSS property. See the css font-size-adjust property for more information.

As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan>

html, body, svg {
  height: 100%;
}
<svg width="600" height="80" viewBox="0 0 500 80"
    xmlns="http://www.w3.org/2000/svg">
  <text y="20" font-family="Times, serif" font-size="10px">
    This text uses the Times font (10px), which is hard to read in small sizes.
  </text>
  <text y="40" font-family="Verdana, sans-serif" font-size="10px">
    This text uses the Verdana font (10px), which has relatively large lowercase letters.
  </text>
  <text y="60" font-family="Times, serif" font-size="10px" font-size-adjust="0.58">
    This is the 10px Times, but now adjusted to the same aspect ratio as the Verdana.
  </text>
</svg>

Usage notes

Default valuenone
Valuenone | <number>
AnimatableYes
none
Choose the size of the font based only on the font-size property.
<number>

Choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size.

The number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. This means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust.

0 yields text of zero height (hidden text).

Specifications

SpecificationStatusComment
CSS Fonts Module Level 3
The definition of 'font-size-adjust' in that specification.
RecommendationNo change
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'font-size-adjust' in that specification.
RecommendationInitial definition

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:135 次

字数:4946

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文