跳转到主要内容

文本视图

TouchGFX Designer中的文本视图用于配置项目中的文本、译文和字体排印。 该视图包含两个选项卡:文本字体排印

文本

文本选项卡提供所有文本元素的总览。 文本元素可以有自动生成的ID自定义的ID

文本视图

自动生成的ID

带有自动生成ID的文本(也称为一次性使用文本)只能使用一次,也不能同时由多个控件或操作使用。 他们当用于控件或操作时,会自动添加,当删除控件或操作时,也会自动删除。

最初创建自动生成的文本时,会将其添加到名为“未分类”的文本组中。 如果此组不存在,将创建该组。

自动生成的ID可以轻松重新命名,以便在任意数量的控件和操作上使用该文本。

文本视图中自动生成的文本

自定义的ID

具有已自定义ID的文本(也称为资源)可以在TouchGFX 设计器中任意数量的控件和操作上重复使用。 To add a new text with a defined ID, click the button labeled 'Add new text' in the Texts tab or rename a text with an auto-generated ID. 通过在网格或树形视图中选中并单击右键打开快捷菜单或使用键盘快捷键,可在“文本”选项卡中删除具有自定义ID的一个或多个文本。

文本选项卡功能

Use the search bar to locate a specific text element or translation. 文本列中所有可用输入将被搜索。

Tree view

The Texts tab contain a tree giving an overview of groups and text elements.

Groups

Every group in the tree, that contains one or more texts can be collapsed by pressing the chevron next to the group's name. 在树形视图中拖动文本或右键单击网格中的文本,可将文本添加到组中。 要添加新组,只需单击树形视图中的添加按钮。

文本组

标题上下文菜单

Right click the header in grid to see the header context menu. 在这里,您可以隐藏、编辑、删除和显示列(并非所有选项都适用于所有列)。

标题上下文菜单

Grid context menu

Right click a text in grid to see the context menu. 在这里,您可以删除、复制、粘贴或移动文本到另一个组。

文本上下文菜单

译文

Typography

Specifies which typography the text and all its translations should use. 可以在字体排印标签中添加和配置字体排印。

Alignment

Specifies the horizontal alignment the text and all its translations should use as default. 可选值为“左”、“右”和“中心”对齐。

译文细节

所有翻译均可覆盖默认对齐方式。 要显示此控件,请双击翻译项。 如下图所示,通过行内对齐选择器可以轻松设置特定于翻译项的对齐方式。

如何设置译文特定的对齐方式

添加语言

要添加新的语言,只需按标题菜单中的添加按钮。 就会显示下图中的弹窗,您可以在弹窗中配置语言名称,以及是否使用来自其他语言的译文。

“添加新语言”弹窗

字体排印

在“字体排印”选项卡上,可以看到工程中所有字体的总览,如下图所示。

字体排印视图

Typography ID

The name of the typography.

Language Settings

Contains the language settings of the typography. 默认适用于所有未指定的语言。 要指定特定语言的设置,请单击“添加”按钮,并从菜单中选择所需的语言。

向字体排印添加语言设置

使用右键点击所需的语言设置选项卡,可删除语言设置。

删除字体排印的语言设置

Font

The name of the font to use for the given typography.
You can choose between all installed fonts in Windows, or add your own fonts in the assets/fonts folder. 当将字体文件添到该文件夹中后,TouchGFX Designer需要重新启动以载入该字体。

Type

The type of format to store the font in:

  • Bitmap - the default format where every glyph used in the font is stored as a bitmap.
  • Vector - if vector font functionality is enabled, choose this option to store the font as vector data.
Further reading
To read more about how to potentially save space in a TouchGFX application by using the vector font format, visit the Vector Fonts article.

Size

The font size of the typography.

Bpp

Bits per pixel. 每个像素用来代表字体的位数。 规定值为1、2、4和8。

Direction

Specifies which text direction the text should use. 可能的值为LTR(从左至右)和RTL(从右至左),默认值为LTR。 RTL选项主要用于阿拉伯语、希伯来语或其他从右向左书写的语言。

Fallback Character

If TouchGFX needs to render a character, but the glyph is unavailable, the character specified in this column is used. 可以是一个单字符,一个unicode 码(用10进制或16进制表示,如0xABCD),特殊键码'skip'或空格。

Wildcard Characters

Characters that should be available to display in the TouchGFX application. 推荐在使用虚拟文本时使用。 虚拟文本不仅会生成所有字形,还会生成实际字符串(如“0123456789-”)。 将“0123456789-”放在此列中会生成字形,而不是字符串。

Widget Wildcard Characters

These are characters which some widgets that require a wildcard will add. 例如,数字时钟控件会将“0123456789 :APM”添加到该字段中。 此字段为只读。

Wildcard Ranges

This is similar to Wildcard Characters, but ranges can easily be specified, e.g. "0-9,A-F" will be the same as putting "0123456789ABCDEF" in the Wildcard Characters column. 范围也可以以数字指定, 例如“0-9”也可指定为“48-57”或“0x30-0x39”。 请注意,不要输入引号。

Ellipsis Character

This character is used to truncate long text in text areas.

添加字体排印

要添加新的字体排印,只需在树形视图中按添加按钮。 包含默认设置的新字体排印将被添加到列表底部。

添加字体排印

删除字体排印

在树形视图中使用右键点击所需的字体排印,打开快捷菜单或使用键盘快捷键,即可删除字体排印。

删除字体排印