CSSFontFeatureValuesRule: thuộc tính swash

Khả dụng hạn chế

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Thuộc tính chỉ đọc swash của giao diện CSSFontFeatureValuesRule chứa một đối tượng CSSFontFeatureValuesMap đại diện cho tên do nhà phát triển cung cấpchỉ mục tính năng cho một font biến đổi hỗ trợ swash().

Giá trị

Một đối tượng CSSFontFeatureValuesMap.

Mặc dù bản thân thuộc tính swash là chỉ đọc theo nghĩa bạn không thể thay thế đối tượng CSSFontFeatureValuesMap, bạn vẫn có thể gán trực tiếp cho thuộc tính swash. Bạn cũng có thể sửa đổi các giá trị của swash bằng cách sử dụng các phương thức phiên bản của CSSFontFeatureValuesMap.

Ví dụ

Sử dụng cơ bản

CSS

css
@font-feature-values "MonteCarlo" {
  @swash {
    my-swashes: 1; /* Custom name for a particular set of swash alternate glyphs */
  }
}

JavaScript

js
// look for the first stylesheet and the first cssRule in that sheet
const myRule = document.styleSheets[0].cssRules[0];
// check
if (myRule instanceof CSSFontFeatureValuesRule && myRule.swash.size) {
  // do something with the swash
}

Thông số kỹ thuật

Thông số kỹ thuật
CSS Fonts Module Level 4
# dom-cssfontfeaturevaluesrule-swash

Tương thích trình duyệt

Xem thêm