UNPKG

@wordpress/block-editor

Version:
45 lines (43 loc) 941 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatFontStyle = formatFontStyle; var _i18n = require("@wordpress/i18n"); /** * WordPress dependencies */ /** * Formats font styles to human readable names. * * @param {string} fontStyle font style string * @return {Object} new object with formatted font style */ function formatFontStyle(fontStyle) { if (!fontStyle) { return {}; } if (typeof fontStyle === 'object') { return fontStyle; } let name; switch (fontStyle) { case 'normal': name = (0, _i18n._x)('Regular', 'font style'); break; case 'italic': name = (0, _i18n._x)('Italic', 'font style'); break; case 'oblique': name = (0, _i18n._x)('Oblique', 'font style'); break; default: name = fontStyle; break; } return { name, value: fontStyle }; } //# sourceMappingURL=format-font-style.js.map