Files
react-native-devtools-frontend/front_end/sdk/CSSFontFace.js
T
Alex Rudenko 25a810222f Warn when font-variation-settings are not used correctly
When font-variation-settings don't match the one supported by
relevant font faces, display a warning icon with warnings next
to the font-variation-settings property in the Styles panel.

Screenshot: https://i.imgur.com/JaHEvn1.png

Bug: 971878
Change-Id: I19a83bc003c282e19585edeabe0650e43bc4a36a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2292280
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-07-16 06:38:21 +00:00

30 lines
787 B
JavaScript

// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
export class CSSFontFace {
/**
* @param {!Protocol.CSS.FontFace} payload
*/
constructor(payload) {
this._fontFamily = payload.fontFamily;
this._fontVariationAxes = payload.fontVariationAxes || [];
/** @type {!Map<string, !Protocol.CSS.FontVariationAxis>} */
this._fontVariationAxesByTag = new Map();
for (const axis of this._fontVariationAxes) {
this._fontVariationAxesByTag.set(axis.tag, axis);
}
}
getFontFamily() {
return this._fontFamily;
}
/**
* @param {string} tag
*/
getVariationAxisByTag(tag) {
return this._fontVariationAxesByTag.get(tag);
}
}