font_feature_settings for text

d48d5335dceddd6c123c932722033f2b28d3b51d
This commit is contained in:
4eb0da
2024-05-24 13:06:46 +03:00
parent 11d9a31f3a
commit a4aa3790a7
12 changed files with 30 additions and 147 deletions
+4
View File
@@ -14322,6 +14322,10 @@
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/empty/firefoxMobile/empty.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/empty/firefoxMobile/empty.png",
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/fixed-size-with-paddings/chromeMobile/fixed-size-with-paddings.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/fixed-size-with-paddings/chromeMobile/fixed-size-with-paddings.png",
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/fixed-size-with-paddings/firefoxMobile/fixed-size-with-paddings.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/fixed-size-with-paddings/firefoxMobile/fixed-size-with-paddings.png",
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/font_feature_ranges/chromeMobile/font_feature_ranges.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/font_feature_ranges/chromeMobile/font_feature_ranges.png",
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/font_feature_ranges/firefoxMobile/font_feature_ranges.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/font_feature_ranges/firefoxMobile/font_feature_ranges.png",
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/font_features/chromeMobile/font_features.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/font_features/chromeMobile/font_features.png",
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/font_features/firefoxMobile/font_features.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/font_features/firefoxMobile/font_features.png",
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/gradient-background/chromeMobile/gradient-background.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/gradient-background/chromeMobile/gradient-background.png",
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/gradient-background/firefoxMobile/gradient-background.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/gradient-background/firefoxMobile/gradient-background.png",
"client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/gradient-color-text/chromeMobile/gradient-color-text.png":"divkit/public/client/web/divkit/tests/hermione/screens/crossplatform/components/div-text/gradient-color-text/chromeMobile/gradient-color-text.png",
@@ -95,7 +95,8 @@
underline: componentContext.json.underline,
strike: componentContext.json.strike,
line_height: componentContext.json.line_height,
text_shadow: componentContext.json.text_shadow
text_shadow: componentContext.json.text_shadow,
font_feature_settings: componentContext.json.font_feature_settings
});
$: jsonTextSize = componentContext.getDerivedFromVars(componentContext.json.font_size);
$: jsonLineHeight = componentContext.getDerivedFromVars(componentContext.json.line_height);
@@ -140,7 +140,8 @@
* 2) There should not be a border-radius on line breaks, but there should be a border
*/
'box-shadow': border ? `inset 0 0 0 ${pxToEm(border.width)} ${border.color}` : undefined,
'border-radius': borderRadius ? pxToEm(borderRadius) : undefined
'border-radius': borderRadius ? pxToEm(borderRadius) : undefined,
'font-feature-settings': textStyles.font_feature_settings || undefined,
};
</script>
+13 -141
View File
@@ -6,147 +6,19 @@ import Lottie from 'lottie-web/build/player/lottie';
import { initComponents } from './devCustomComponents';
const json = {
"templates": {
"tutorialCard": {
"type": "container",
"border": {
"corner_radius": 16,
"stroke": {
"color": "#aaaaaa",
"width": 1
}
},
"items": [
{
"type": "text",
"font_size": 21,
"font_weight": "bold",
"margins": {
"bottom": 8
},
"$text": "title"
},
{
"type": "text",
"font_size": 16,
"margins": {
"bottom": 4
},
"$text": "body"
},
{
"type": "container",
"$items": "links"
}
],
"margins": {
"bottom": 6
},
"orientation": "vertical",
"paddings": {
"top": 12,
"bottom": 12,
"left": 12,
"right": 12
}
},
"link": {
"type": "text",
"action": {
"$url": "link",
"$log_id": "log"
},
"font_size": 14,
"margins": {
"bottom": 2
},
"text_color": "#0000ff",
"underline": "single",
"$text": "link_text"
}
},
"card": {
"log_id": "div2_sample_card",
"states": [
{
"state_id": 0,
"div": {
"type": "container",
"items": [
{
"type": "tutorialCard",
"title": "@{getHours(parseUnixTimeAsLocal(1715855877))}",
"body": "Server side driven ui Яндекса\nПолезные ссылки:",
"links": [
{
"type": "link",
"link_text": "Официальная документация",
"link": "https://doc.yandex-team.ru/divkit/overview/",
"log": "docs"
},
{
"type": "link",
"link_text": "Примеры карточек",
"link": "https://a.yandex-team.ru/arcadia/divkit/public/test_data/samples",
"log": "samples"
},
{
"type": "link",
"link_text": "Клуб в Этушке",
"link": "https://clubs.at.yandex-team.ru/divkit/",
"log": "atushka"
},
{
"type": "link",
"link_text": "Канал в Мессенджере",
"link": "https://q.yandex-team.ru/#/join/b7263a0a-c2ef-4c02-9669-e8a1f4cf3762",
"log": "slack"
}
]
},
{
"type": "tutorialCard",
"title": "Горячие клавиши редактора",
"body": "ctrl+space - вызвать автодополнение\nctrl+f2 - заменить всё\nctrl+shift+i - отформатировать json\nctrl+shift+a закомментировать блок\nСхолпнуть json-блоки можно с помощью стрелочек, что появляются при наведении на блок с номерами строк слева\nf1 - вызвать меню со всеми доступными командами и горячими клавишами",
"links": [
{
"type": "separator",
"delimiter_style": {
"color": "#00000000"
}
}
]
},
{
"type": "tutorialCard",
"title": "Интерактивная верстка на ваших устройствах",
"body": "Для того, чтобы посмотреть вашу верстку на android:\n1) Скачайте demo apk по ссылке ниже\n2) Установите apk на устройство и перейдите во вкладку \"Div2\"\n3) Нажмите на share на этой страничке и отсканируйте QR-код, нажав соответствующую кнопку в приложении, либо вставьте урл из поля \"Link to json\"\n4) Для каждого подключенного устройства в редакторе появится вкладка с тем, что отображается сейчас на экране",
"links": [
{
"type": "link",
"link_text": "Android демо-приложение",
"link": "https://beta.m.soft.yandex.ru/description?app=divkit&platform_shortcut=android&branch=unknown",
"log": "android"
},
{
"type": "link",
"link_text": "iOS демо-приложение",
"link": "https://teamcity.yandex-team.ru/buildConfiguration/MobileNew_Monorepo_DivKit_iOS_trunk?branch=&mode=builds",
"log": "ios"
}
]
}
],
"margins": {
"top": 8,
"bottom": 8,
"left": 8,
"right": 8
}
}
}
]
}
"templates": {},
"card": {
"log_id": "snapshot_test_card",
"states": [
{
"state_id": 0,
"div": {
"type": "text",
"text": "Hello world"
}
}
]
}
};
window.root = new Root({
+1
View File
@@ -18,6 +18,7 @@ export interface TextStyles {
font_size?: number;
font_family?: string;
// font_size_unit
font_feature_settings?: string;
letter_spacing?: number;
font_weight?: FontWeight;
text_color?: string;
+4 -2
View File
@@ -46,7 +46,8 @@
"type": "string",
"$description": "translations.json#/div_font_feature_settings",
"platforms": [
"android"
"android",
"web"
]
},
"letter_spacing": {
@@ -256,7 +257,8 @@
"type": "string",
"$description": "translations.json#/div_font_feature_settings",
"platforms": [
"android"
"android",
"web"
]
},
"line_height": {
@@ -1,7 +1,8 @@
{
"description": "Text with font features",
"platforms": [
"android"
"android",
"web"
],
"templates": {
"text_template": {
@@ -1,7 +1,8 @@
{
"description": "Text with font features",
"platforms": [
"android"
"android",
"web"
],
"templates": {
"text_template": {