CSS 中的字体样式:斜体与斜体

发布于 2024-08-10 00:49:48 字数 228 浏览 3 评论 0原文

这两者之间有什么区别:

font-style:italic
font-style:oblique

我尝试使用 W3Schools 编辑器 但无法区分。

我缺少什么?

What is the difference between these two:

font-style:italic
font-style:oblique

I tried using the W3Schools editor but was unable to tell the difference.

What am I missing?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

桜花祭 2024-08-17 00:49:48

从最纯粹的(字体设计师)意义上来说,倾斜字体是一种倾斜一定度数(通常为 8-12 度)的罗马字体。斜体是由字体设计师用不同的方式绘制的特定字符(特别是小写 a)创建的,以创建更具书法性和倾斜的版本。

一些字体铸造厂任意创建了斜体,这些斜体不一定得到设计师本人的批准......有些字体本来就不应该是斜体或斜体......但人们还是这么做了。正如您可能知道的,某些操作系统会在单击“斜体”图标时倾斜字体并动态创建斜体。不是一个令人愉快的景象。

最好仅当您确定字体是用斜体设计的时才指定斜体。

In the purest (type designer) sense, an oblique is a roman font that has been skewed a certain number of degrees (8-12 degrees, usually). An italic is created by the type designer with specific characters (notably lowercase a) drawn differently to create a more calligraphic, as well as slanted version.

Some type foundries have arbitrarily created obliques that aren't necessarily approved by the designers themselves... some fonts were meant not to be italicized or obliqued... but people did anyway. And as you may know, some operating systems will, upon clicking the 'italic' icon, skew the font and create an oblique on the fly. Not a pleasant sight.

It's best to specify an italic only when you're sure that font has been designed with one.

怕倦 2024-08-17 00:49:48

一般来说,斜体是字体的特殊版本,而斜体版本只是稍微倾斜的常规版本。因此,两者都是倾斜的并且与常规字体相关,但是斜体将具有专门为其制作的特殊字母形式。

大多数字体都有斜体或斜体版本;我从未见过两者兼而有之的人。 (如果你有斜体版本,为什么还要费心使用斜体版本呢?)

Generally, an italic is a special version of the font, whereas an oblique version is just the regular version inclined a bit. So both are slanted and related to the regular font, but an italic will have special letterforms made especially for it.

Most fonts have either an italic or an oblique version; I've never seen one that has both. (If you have an italic version, why bother with an oblique version?)

耀眼的星火 2024-08-17 00:49:48

斜体斜体一样,在将斜体仿斜体进行比较时,可以看到同样的差异。

只要 正常 字体使用 font-style: italic; 倾斜,您就会看到假斜体,而真正的斜体字体则设计为倾斜的。

输入图像描述这里

两个 ll 的底部清楚地显示了差异。

查看示例

As with italic and oblique, the same difference is visible when comparing italic with faux italic.

You will see faux-italics wherever a normal font is skewed with font-style: italic; whereas a true italic font is designed to be slanted.

enter image description here

The bottom of the two ll​s shows the difference clearly.

See Example

初心 2024-08-17 00:49:48

斜体(或倾斜、倾斜)是一种稍微向右倾斜的字体形式,使用方式与斜体相同。然而,与斜体不同的是,它不使用不同的字形形状;它使用与罗马字体相同的字形,但变形了。

进一步阅读:
css 字体样式 oblique 与 italic

Oblique type (or slanted, sloped) is a form of type that slants slightly to the right, used in the same manner as italic type. Unlike italic type, however, it does not use different glyph shapes; it uses the same glyphs as roman type, except distorted.

Futher Reading:
css font style oblique vs italic

吃颗糖壮壮胆 2024-08-17 00:49:48

根据 mozilla 开发者 CSS 教程

  • 斜体:将文本设置为使用字体的斜体版本(如果可用);如果不可用,它将用斜体模拟斜体。
  • oblique:设置文本使用斜体字体的模拟版本,通过倾斜正常版本创建。

  • 从这里,我们推断出如果字体的斜体版本不可用斜体倾斜的行为方式相同。由于 W3Schools 代码片段没有指定任何特定的 font-family,我相信使用了默认字体;可能没有斜体版本的默认字体。

    但是如何使字体的斜体版本可用?

    这意味着我们至少有相同字体的两个版本,一个“常规”版本和一个斜体版本。这些可以在

    到目前为止,我找到了两种链接字体文件的方法

  • 字体文件的绝对 URL:(代码片段来自 tympanus.net

    <前><代码>`@font-face {
    字体系列:'Open Sans';
    字体样式:正常;
    字体粗细:400;
    src: local('Open Sans'), local('OpenSans'),
    网址(http://themes.googleusercontent.com/static/fonts/opensans/v8/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff)格式('woff');
    }

    @font-face {
    字体系列:'Open Sans';
    字体样式:斜体;
    字体粗细:400;
    src: local('Open Sans Italic'), local('OpenSans-Italic'),
    网址
    (http://themes.googleusercontent.com/static/fonts/opensans/v8/
    xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff)
    格式('woff');
    }`

    请注意,在这两种情况下,我们都有 font-family: 'Open Sans',它基本上定义了相同的字体;但在第一种情况下,我们有 font-style: normal;,而在第二种情况下,我们有 font-style: italic;。另请注意,URL 指向不同的文件。 现在,回到 w3schools 代码片段,这就是浏览器如何区分 font-style: normalfont-style: italic < /p>

  • 使用字体文件的相对路径:(代码片段来自 metaltoad.com)

    <块引用>

    您可以为每种字体使用相同的字体系列名称,并定义匹配的样式,而不是为每种字体定义单独的字体系列值,如下所示:

    <前><代码>`@font-face {
    字体系列:'Ubuntu';
    src: url('Ubuntu-R-webfont.eot');
    字体粗细:正常;
    字体样式:正常;
    }
    @font-face {
    字体系列:'Ubuntu';
    src: url('Ubuntu-I-webfont.eot');
    字体粗细:正常;
    字体样式:斜体;
    }`

    在这种情况下,.eot 文件必须与 html 页面存储在同一文件夹中。再次注意,font-family 是相同的,font-style 不同,而且 url 也不同:Ubuntu-R -webfont 与 Ubuntu-I-webfont。

    字体斜体版本的示例:

    ctan.org :这是如何提供不同的示例同一字体的不同样式/粗细的文件。粗体或斜体都不是当场计算的,它们是从特定文件中检索的。

  • According to mozilla developer CSS tutorial :

  • italic: Sets the text to use the italic version of the font if available; if not available, it will simulate italics with oblique instead.
  • oblique: Sets the text to use a simulated version of an italic font, created by slanting the normal version.

  • From here, we deduce that if an italic version of the font is not available, both italic and oblique behave the same way. Since the W3Schools code snippet does not specify any particular font-family, I believe a default font is used; a default font which probably does not have an italic version.

    But how to make an italic version of the font available?

    This means that we have at least two versions of the same font, a "regular" one, and an italic one. These can be specified in the <style> section with the @font-face rule. Please read briefly : developer.mozilla, w3schools, tympanus.net. As you can see, the font is loaded as a file, which can have the following extensions: eot, otf, woff, truetype.

    So far, i found two ways of linking the font file

  • absolute URL of the font file: (code snippet from tympanus.net)

    `@font-face {
     font-family: 'Open Sans';
     font-style: normal;
     font-weight: 400;
     src: local('Open Sans'), local('OpenSans'), 
     url (http://themes.googleusercontent.com/static/fonts/opensans/v8/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) format('woff');
    }
    
     @font-face {
     font-family: 'Open Sans';
     font-style: italic;
     font-weight: 400;
     src: local('Open Sans Italic'), local('OpenSans-Italic'), 
     url 
     (http://themes.googleusercontent.com/static/fonts/opensans/v8/
     xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff)
     format('woff');
     }`
    

    Please notice that in both cases we have font-family: 'Open Sans', which basically defines the same font; but in the first case we have font-style: normal;, while in the second case we have font-style: italic;. Also note that the URLs point to different files. Now, going back to the w3schools code snippet, that's how the browser can distinguish between font-style: normal and font-style: italic

  • using the relative path to the font file : (code snippet from metaltoad.com)

    Instead of defining separate font-family values for each font, You can use same font-family name for each font, and define the matching styles, like so:

    `@font-face {
    font-family: 'Ubuntu';
    src: url('Ubuntu-R-webfont.eot');
    font-weight: normal;
    font-style: normal;
    }
    @font-face {
    font-family: 'Ubuntu';
    src: url('Ubuntu-I-webfont.eot');
    font-weight: normal;
    font-style: italic;
    }`
    

    In this case, the .eot files must be stored in the same folder as the html page. Again, notice that the font-family is the same, the font-style is different, and also the urls are different: Ubuntu-R-webfont vs Ubuntu-I-webfont.

    Example of an italic version of the font:

    ctan.org :this is an example of how there are provided different files for different styles/weights of the same font. Neither bold or italic are computed on the spot, they are retrieved from their specific file.

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